| 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 28 matching lines...) Expand all Loading... |
| 39 ScriptContextSet& script_context_set() { return script_context_set_; } | 39 ScriptContextSet& script_context_set() { return script_context_set_; } |
| 40 | 40 |
| 41 v8::Local<v8::Context> v8_context() { | 41 v8::Local<v8::Context> v8_context() { |
| 42 return v8::Local<v8::Context>::New(v8::Isolate::GetCurrent(), v8_context_); | 42 return v8::Local<v8::Context>::New(v8::Isolate::GetCurrent(), v8_context_); |
| 43 } | 43 } |
| 44 | 44 |
| 45 ScriptContext* RegisterScriptContext() { | 45 ScriptContext* RegisterScriptContext() { |
| 46 // No extension group or world ID. | 46 // No extension group or world ID. |
| 47 return script_context_set_.Register( | 47 return script_context_set_.Register( |
| 48 web_frame_.frame(), | 48 web_frame_.frame(), |
| 49 v8::Local<v8::Context>::New(v8::Isolate::GetCurrent(), v8_context_), 0, | 49 v8::Local<v8::Context>::New(v8::Isolate::GetCurrent(), v8_context_), |
| 50 0); | 50 Feature::SESSION_TYPE_UNSPECIFIED, 0, 0); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void RequestGarbageCollection() { | 53 void RequestGarbageCollection() { |
| 54 v8::Isolate::GetCurrent()->RequestGarbageCollectionForTesting( | 54 v8::Isolate::GetCurrent()->RequestGarbageCollectionForTesting( |
| 55 v8::Isolate::kFullGarbageCollection); | 55 v8::Isolate::kFullGarbageCollection); |
| 56 } | 56 } |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 void SetUp() override { | 59 void SetUp() override { |
| 60 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 60 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // Trigger a GC. The callback should not be invoked because the fallback was | 153 // Trigger a GC. The callback should not be invoked because the fallback was |
| 154 // already invoked. | 154 // already invoked. |
| 155 RequestGarbageCollection(); | 155 RequestGarbageCollection(); |
| 156 base::RunLoop().RunUntilIdle(); | 156 base::RunLoop().RunUntilIdle(); |
| 157 | 157 |
| 158 EXPECT_FALSE(callback_invoked); | 158 EXPECT_FALSE(callback_invoked); |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace | 161 } // namespace |
| 162 } // namespace extensions | 162 } // namespace extensions |
| OLD | NEW |