| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "extensions/common/extension.h" | 10 #include "extensions/common/extension.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 protected: | 35 protected: |
| 36 base::MessageLoop& message_loop() { return message_loop_; } | 36 base::MessageLoop& message_loop() { return message_loop_; } |
| 37 | 37 |
| 38 ScriptContextSet& script_context_set() { return script_context_set_; } | 38 ScriptContextSet& script_context_set() { return script_context_set_; } |
| 39 | 39 |
| 40 v8::Local<v8::Context> v8_context() { | 40 v8::Local<v8::Context> v8_context() { |
| 41 return v8::Local<v8::Context>::New(v8::Isolate::GetCurrent(), v8_context_); | 41 return v8::Local<v8::Context>::New(v8::Isolate::GetCurrent(), v8_context_); |
| 42 } | 42 } |
| 43 | 43 |
| 44 ScriptContext* RegisterScriptContext() { | 44 ScriptContext* RegisterScriptContext() { |
| 45 // No extension group or world ID. | 45 // No world ID. |
| 46 return script_context_set_.Register( | 46 return script_context_set_.Register( |
| 47 web_frame_.frame(), | 47 web_frame_.frame(), |
| 48 v8::Local<v8::Context>::New(v8::Isolate::GetCurrent(), v8_context_), 0, | 48 v8::Local<v8::Context>::New(v8::Isolate::GetCurrent(), v8_context_), 0); |
| 49 0); | |
| 50 } | 49 } |
| 51 | 50 |
| 52 void RequestGarbageCollection() { | 51 void RequestGarbageCollection() { |
| 53 v8::Isolate::GetCurrent()->RequestGarbageCollectionForTesting( | 52 v8::Isolate::GetCurrent()->RequestGarbageCollectionForTesting( |
| 54 v8::Isolate::kFullGarbageCollection); | 53 v8::Isolate::kFullGarbageCollection); |
| 55 } | 54 } |
| 56 | 55 |
| 57 private: | 56 private: |
| 58 void SetUp() override { | 57 void SetUp() override { |
| 59 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 58 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // Trigger a GC. The callback should not be invoked because the fallback was | 150 // Trigger a GC. The callback should not be invoked because the fallback was |
| 152 // already invoked. | 151 // already invoked. |
| 153 RequestGarbageCollection(); | 152 RequestGarbageCollection(); |
| 154 base::RunLoop().RunUntilIdle(); | 153 base::RunLoop().RunUntilIdle(); |
| 155 | 154 |
| 156 EXPECT_FALSE(callback_invoked); | 155 EXPECT_FALSE(callback_invoked); |
| 157 } | 156 } |
| 158 | 157 |
| 159 } // namespace | 158 } // namespace |
| 160 } // namespace extensions | 159 } // namespace extensions |
| OLD | NEW |