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 "extensions/common/extension.h" | 9 #include "extensions/common/extension.h" |
10 #include "extensions/common/extension_set.h" | 10 #include "extensions/common/extension_set.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 gin_context_holder_.reset(); | 69 gin_context_holder_.reset(); |
70 v8_context_.Reset(); | 70 v8_context_.Reset(); |
71 RequestGarbageCollection(); | 71 RequestGarbageCollection(); |
72 } | 72 } |
73 | 73 |
74 base::MessageLoop message_loop_; | 74 base::MessageLoop message_loop_; |
75 ScopedWebFrame web_frame_; // (this will construct the v8::Isolate) | 75 ScopedWebFrame web_frame_; // (this will construct the v8::Isolate) |
76 ExtensionIdSet active_extensions_; | 76 ExtensionIdSet active_extensions_; |
77 ScriptContextSet script_context_set_; | 77 ScriptContextSet script_context_set_; |
78 v8::Global<v8::Context> v8_context_; | 78 v8::Global<v8::Context> v8_context_; |
79 scoped_ptr<gin::ContextHolder> gin_context_holder_; | 79 std::unique_ptr<gin::ContextHolder> gin_context_holder_; |
80 | 80 |
81 DISALLOW_COPY_AND_ASSIGN(GCCallbackTest); | 81 DISALLOW_COPY_AND_ASSIGN(GCCallbackTest); |
82 }; | 82 }; |
83 | 83 |
84 TEST_F(GCCallbackTest, GCBeforeContextInvalidated) { | 84 TEST_F(GCCallbackTest, GCBeforeContextInvalidated) { |
85 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 85 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
86 v8::HandleScope handle_scope(isolate); | 86 v8::HandleScope handle_scope(isolate); |
87 v8::Context::Scope context_scope(v8_context()); | 87 v8::Context::Scope context_scope(v8_context()); |
88 | 88 |
89 ScriptContext* script_context = RegisterScriptContext(); | 89 ScriptContext* script_context = RegisterScriptContext(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // Trigger a GC. The callback should not be invoked because the fallback was | 152 // Trigger a GC. The callback should not be invoked because the fallback was |
153 // already invoked. | 153 // already invoked. |
154 RequestGarbageCollection(); | 154 RequestGarbageCollection(); |
155 message_loop().RunUntilIdle(); | 155 message_loop().RunUntilIdle(); |
156 | 156 |
157 EXPECT_FALSE(callback_invoked); | 157 EXPECT_FALSE(callback_invoked); |
158 } | 158 } |
159 | 159 |
160 } // namespace | 160 } // namespace |
161 } // namespace extensions | 161 } // namespace extensions |
OLD | NEW |