Commit 85cf39d4 authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[inspector] Fix memory leaks in inspector test

Bug: v8:7932
Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ia29e9e62022f0820c3a5aaf48a7724b13b61b275
Reviewed-on: https://chromium-review.googlesource.com/1143186Reviewed-by: 's avatarAleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54567}
parent 08caf18c
...@@ -107,7 +107,7 @@ class FrontendChannelImpl : public v8_inspector::V8Inspector::Channel { ...@@ -107,7 +107,7 @@ class FrontendChannelImpl : public v8_inspector::V8Inspector::Channel {
SendMessageTask(FrontendChannelImpl* channel, SendMessageTask(FrontendChannelImpl* channel,
const v8::internal::Vector<uint16_t>& message) const v8::internal::Vector<uint16_t>& message)
: channel_(channel), message_(message) {} : channel_(channel), message_(message) {}
virtual ~SendMessageTask() {} virtual ~SendMessageTask() { message_.Dispose(); }
bool is_priority_task() final { return false; } bool is_priority_task() final { return false; }
private: private:
...@@ -215,6 +215,11 @@ class ExecuteStringTask : public TaskRunner::Task { ...@@ -215,6 +215,11 @@ class ExecuteStringTask : public TaskRunner::Task {
ExecuteStringTask(const v8::internal::Vector<const char>& expression, ExecuteStringTask(const v8::internal::Vector<const char>& expression,
int context_group_id) int context_group_id)
: expression_utf8_(expression), context_group_id_(context_group_id) {} : expression_utf8_(expression), context_group_id_(context_group_id) {}
virtual ~ExecuteStringTask() {
if (expression_.start()) expression_.Dispose();
if (expression_utf8_.start()) expression_utf8_.Dispose();
}
bool is_priority_task() override { return false; } bool is_priority_task() override { return false; }
void Run(IsolateData* data) override { void Run(IsolateData* data) override {
v8::MicrotasksScope microtasks_scope(data->isolate(), v8::MicrotasksScope microtasks_scope(data->isolate(),
...@@ -391,8 +396,10 @@ class UtilsExtension : public IsolateData::SetupGlobalTask { ...@@ -391,8 +396,10 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
} }
v8::internal::Vector<const char> chars; v8::internal::Vector<const char> chars;
v8::Isolate* isolate = args.GetIsolate(); v8::Isolate* isolate = args.GetIsolate();
if (ReadFile(isolate, args[0], &chars)) if (ReadFile(isolate, args[0], &chars)) {
args.GetReturnValue().Set(ToV8String(isolate, chars.start())); args.GetReturnValue().Set(ToV8String(isolate, chars.start()));
chars.Dispose();
}
} }
static void Load(const v8::FunctionCallbackInfo<v8::Value>& args) { static void Load(const v8::FunctionCallbackInfo<v8::Value>& args) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment