| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/shell/test_runner/gc_controller.h" | 5 #include "content/shell/test_runner/gc_controller.h" |
| 6 | 6 |
| 7 #include "gin/arguments.h" | 7 #include "gin/arguments.h" |
| 8 #include "gin/handle.h" | 8 #include "gin/handle.h" |
| 9 #include "gin/object_template_builder.h" | 9 #include "gin/object_template_builder.h" |
| 10 #include "third_party/WebKit/public/web/WebFrame.h" | |
| 11 #include "third_party/WebKit/public/web/WebKit.h" | 10 #include "third_party/WebKit/public/web/WebKit.h" |
| 11 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 12 #include "v8/include/v8.h" | 12 #include "v8/include/v8.h" |
| 13 | 13 |
| 14 namespace test_runner { | 14 namespace test_runner { |
| 15 | 15 |
| 16 gin::WrapperInfo GCController::kWrapperInfo = {gin::kEmbedderNativeGin}; | 16 gin::WrapperInfo GCController::kWrapperInfo = {gin::kEmbedderNativeGin}; |
| 17 | 17 |
| 18 // static | 18 // static |
| 19 void GCController::Install(blink::WebFrame* frame) { | 19 void GCController::Install(blink::WebLocalFrame* frame) { |
| 20 v8::Isolate* isolate = blink::MainThreadIsolate(); | 20 v8::Isolate* isolate = blink::MainThreadIsolate(); |
| 21 v8::HandleScope handle_scope(isolate); | 21 v8::HandleScope handle_scope(isolate); |
| 22 v8::Local<v8::Context> context = frame->MainWorldScriptContext(); | 22 v8::Local<v8::Context> context = frame->MainWorldScriptContext(); |
| 23 if (context.IsEmpty()) | 23 if (context.IsEmpty()) |
| 24 return; | 24 return; |
| 25 | 25 |
| 26 v8::Context::Scope context_scope(context); | 26 v8::Context::Scope context_scope(context); |
| 27 | 27 |
| 28 gin::Handle<GCController> controller = | 28 gin::Handle<GCController> controller = |
| 29 gin::CreateHandle(isolate, new GCController()); | 29 gin::CreateHandle(isolate, new GCController()); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 v8::Isolate::kFullGarbageCollection); | 63 v8::Isolate::kFullGarbageCollection); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 void GCController::MinorCollect(const gin::Arguments& args) { | 67 void GCController::MinorCollect(const gin::Arguments& args) { |
| 68 args.isolate()->RequestGarbageCollectionForTesting( | 68 args.isolate()->RequestGarbageCollectionForTesting( |
| 69 v8::Isolate::kMinorGarbageCollection); | 69 v8::Isolate::kMinorGarbageCollection); |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace test_runner | 72 } // namespace test_runner |
| OLD | NEW |