OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/native_extension_bindings_system.h" | 5 #include "extensions/renderer/native_extension_bindings_system.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "content/public/common/content_switches.h" | 9 #include "content/public/common/content_switches.h" |
10 #include "extensions/common/constants.h" | 10 #include "extensions/common/constants.h" |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 api_system_.RegisterCustomType("storage.StorageArea", | 336 api_system_.RegisterCustomType("storage.StorageArea", |
337 base::Bind(&StorageArea::CreateStorageArea)); | 337 base::Bind(&StorageArea::CreateStorageArea)); |
338 } | 338 } |
339 | 339 |
340 NativeExtensionBindingsSystem::~NativeExtensionBindingsSystem() {} | 340 NativeExtensionBindingsSystem::~NativeExtensionBindingsSystem() {} |
341 | 341 |
342 void NativeExtensionBindingsSystem::DidCreateScriptContext( | 342 void NativeExtensionBindingsSystem::DidCreateScriptContext( |
343 ScriptContext* context) {} | 343 ScriptContext* context) {} |
344 | 344 |
345 void NativeExtensionBindingsSystem::WillReleaseScriptContext( | 345 void NativeExtensionBindingsSystem::WillReleaseScriptContext( |
346 ScriptContext* context) {} | 346 ScriptContext* context) { |
| 347 api_system_.WillReleaseContext(context->v8_context()); |
| 348 } |
347 | 349 |
348 void NativeExtensionBindingsSystem::UpdateBindingsForContext( | 350 void NativeExtensionBindingsSystem::UpdateBindingsForContext( |
349 ScriptContext* context) { | 351 ScriptContext* context) { |
350 v8::HandleScope handle_scope(context->isolate()); | 352 v8::HandleScope handle_scope(context->isolate()); |
351 v8::Local<v8::Context> v8_context = context->v8_context(); | 353 v8::Local<v8::Context> v8_context = context->v8_context(); |
352 v8::Local<v8::Object> chrome = GetOrCreateChrome(v8_context); | 354 v8::Local<v8::Object> chrome = GetOrCreateChrome(v8_context); |
353 if (chrome.IsEmpty()) | 355 if (chrome.IsEmpty()) |
354 return; | 356 return; |
355 | 357 |
356 gin::PerContextData* per_context_data = gin::PerContextData::From(v8_context); | 358 gin::PerContextData* per_context_data = gin::PerContextData::From(v8_context); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 | 631 |
630 void NativeExtensionBindingsSystem::OnEventListenerChanged( | 632 void NativeExtensionBindingsSystem::OnEventListenerChanged( |
631 const std::string& event_name, | 633 const std::string& event_name, |
632 binding::EventListenersChanged change, | 634 binding::EventListenersChanged change, |
633 v8::Local<v8::Context> context) { | 635 v8::Local<v8::Context> context) { |
634 send_event_listener_ipc_.Run( | 636 send_event_listener_ipc_.Run( |
635 change, ScriptContextSet::GetContextByV8Context(context), event_name); | 637 change, ScriptContextSet::GetContextByV8Context(context), event_name); |
636 } | 638 } |
637 | 639 |
638 } // namespace extensions | 640 } // namespace extensions |
OLD | NEW |