ffee558e14
With this CL, {CreateDefaultPlatform} returns a unique_ptr to indicate that the caller owns the returned memory. We had several memory leaks where the memory of the DefaultPlatform did not get deallocated. In addition, the {TracingController} of the {DefaultPlatform} also gets received as a unique_ptr. Thereby we document that the {DefaultPlatform} takes ownership of the {TracingController}. Note that the memory of the {TracingController} was already owned by the {DefaultPlatform}, but it was not documented in the interface, and it was used incorrectly in tests. This CL fixes the asan issues in https://chromium-review.googlesource.com/c/v8/v8/+/753583 ([platform] Implement TaskRunners in the DefaultPlatform) R=rmcilroy@chromium.org Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng Change-Id: I0d1a6d3b22bb8289dc050b1977e4f58381cec675 Reviewed-on: https://chromium-review.googlesource.com/755033 Reviewed-by: Adam Klein <adamk@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Commit-Queue: Andreas Haas <ahaas@chromium.org> Cr-Commit-Position: refs/heads/master@{#49349}
39 lines
1.0 KiB
C++
39 lines
1.0 KiB
C++
// Copyright 2016 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef TEST_FUZZER_FUZZER_SUPPORT_H_
|
|
#define TEST_FUZZER_FUZZER_SUPPORT_H_
|
|
|
|
#include "include/libplatform/libplatform.h"
|
|
#include "include/v8.h"
|
|
|
|
namespace v8_fuzzer {
|
|
|
|
class FuzzerSupport {
|
|
public:
|
|
FuzzerSupport(int* argc, char*** argv);
|
|
~FuzzerSupport();
|
|
|
|
static FuzzerSupport* Get();
|
|
|
|
v8::Isolate* GetIsolate() const;
|
|
v8::Local<v8::Context> GetContext();
|
|
bool PumpMessageLoop(v8::platform::MessageLoopBehavior =
|
|
v8::platform::MessageLoopBehavior::kDoNotWait);
|
|
|
|
private:
|
|
// Prevent copying. Not implemented.
|
|
FuzzerSupport(const FuzzerSupport&);
|
|
FuzzerSupport& operator=(const FuzzerSupport&);
|
|
|
|
std::unique_ptr<v8::Platform> platform_;
|
|
v8::ArrayBuffer::Allocator* allocator_;
|
|
v8::Isolate* isolate_;
|
|
v8::Global<v8::Context> context_;
|
|
};
|
|
|
|
} // namespace v8_fuzzer
|
|
|
|
#endif // TEST_FUZZER_FUZZER_SUPPORT_H_
|