Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: extensions/renderer/module_system_test.cc

Issue 1074273002: Move the event attach/detach logic on unload from event.js to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix memory leak Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "extensions/renderer/module_system_test.h" 5 #include "extensions/renderer/module_system_test.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 std::string test_js; 189 std::string test_js;
190 ASSERT_TRUE(base::ReadFileToString(test_js_file_path, &test_js)); 190 ASSERT_TRUE(base::ReadFileToString(test_js_file_path, &test_js));
191 source_map_->RegisterModule(module_name, test_js); 191 source_map_->RegisterModule(module_name, test_js);
192 } 192 }
193 193
194 void ModuleSystemTestEnvironment::ShutdownGin() { 194 void ModuleSystemTestEnvironment::ShutdownGin() {
195 context_holder_.reset(); 195 context_holder_.reset();
196 } 196 }
197 197
198 void ModuleSystemTestEnvironment::ShutdownModuleSystem() { 198 void ModuleSystemTestEnvironment::ShutdownModuleSystem() {
199 context_->module_system()->Invalidate();
199 context_->v8_context()->Exit(); 200 context_->v8_context()->Exit();
200 context_->Invalidate(); 201 context_->Invalidate();
201 } 202 }
202 203
203 v8::Handle<v8::Object> ModuleSystemTestEnvironment::CreateGlobal( 204 v8::Handle<v8::Object> ModuleSystemTestEnvironment::CreateGlobal(
204 const std::string& name) { 205 const std::string& name) {
205 v8::EscapableHandleScope handle_scope(isolate_); 206 v8::EscapableHandleScope handle_scope(isolate_);
206 v8::Local<v8::Object> object = v8::Object::New(isolate_); 207 v8::Local<v8::Object> object = v8::Object::New(isolate_);
207 isolate_->GetCurrentContext()->Global()->Set( 208 isolate_->GetCurrentContext()->Global()->Set(
208 v8::String::NewFromUtf8(isolate_, name.c_str()), object); 209 v8::String::NewFromUtf8(isolate_, name.c_str()), object);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 247
247 void ModuleSystemTest::ExpectNoAssertionsMade() { 248 void ModuleSystemTest::ExpectNoAssertionsMade() {
248 should_assertions_be_made_ = false; 249 should_assertions_be_made_ = false;
249 } 250 }
250 251
251 void ModuleSystemTest::RunResolvedPromises() { 252 void ModuleSystemTest::RunResolvedPromises() {
252 isolate_->RunMicrotasks(); 253 isolate_->RunMicrotasks();
253 } 254 }
254 255
255 } // namespace extensions 256 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698