Split out the extensions gin::Runner implementation into a separate class.
The gin::Runner should be destroyed when the JS context is so that its
weak pointers are invalidated and any outstanding callbacks that
interact with the JS context can detect its destruction. Currently,
ScriptContext implements gin::Runner but is not immediately destroyed
when the JS context is. This CL moves this gin::Runner implementation
into a separate class which is destroyed when the ScriptContext is
invalidated.
Review URL: https://codereview.chromium.org/831423005
Cr-Commit-Position: refs/heads/master@{#311358}
diff --git a/extensions/renderer/module_system_test.cc b/extensions/renderer/module_system_test.cc
index fb197fc..b9d4a4d 100644
--- a/extensions/renderer/module_system_test.cc
+++ b/extensions/renderer/module_system_test.cc
@@ -156,7 +156,7 @@
}
ModuleSystemTestEnvironment::~ModuleSystemTestEnvironment() {
- if (context_)
+ if (context_->is_valid())
context_->v8_context()->Exit();
}
@@ -197,7 +197,7 @@
void ModuleSystemTestEnvironment::ShutdownModuleSystem() {
context_->v8_context()->Exit();
- context_.reset();
+ context_->Invalidate();
}
v8::Handle<v8::Object> ModuleSystemTestEnvironment::CreateGlobal(