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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 } | 361 } |
362 | 362 |
363 // Note: it's a shame we can't delay this (until, say, we knew an API would | 363 // Note: it's a shame we can't delay this (until, say, we knew an API would |
364 // actually be used), but it's needed for some of our crazier hooks, like | 364 // actually be used), but it's needed for some of our crazier hooks, like |
365 // web/guest view. | 365 // web/guest view. |
366 context->module_system()->SetGetInternalAPIHook( | 366 context->module_system()->SetGetInternalAPIHook( |
367 get_internal_api_.Get(isolate)); | 367 get_internal_api_.Get(isolate)); |
368 } | 368 } |
369 | 369 |
370 void NativeExtensionBindingsSystem::WillReleaseScriptContext( | 370 void NativeExtensionBindingsSystem::WillReleaseScriptContext( |
371 ScriptContext* context) {} | 371 ScriptContext* context) { |
| 372 v8::HandleScope handle_scope(context->isolate()); |
| 373 api_system_.WillReleaseContext(context->v8_context()); |
| 374 } |
372 | 375 |
373 void NativeExtensionBindingsSystem::UpdateBindingsForContext( | 376 void NativeExtensionBindingsSystem::UpdateBindingsForContext( |
374 ScriptContext* context) { | 377 ScriptContext* context) { |
375 v8::HandleScope handle_scope(context->isolate()); | 378 v8::HandleScope handle_scope(context->isolate()); |
376 v8::Local<v8::Context> v8_context = context->v8_context(); | 379 v8::Local<v8::Context> v8_context = context->v8_context(); |
377 v8::Local<v8::Object> chrome = GetOrCreateChrome(v8_context); | 380 v8::Local<v8::Object> chrome = GetOrCreateChrome(v8_context); |
378 if (chrome.IsEmpty()) | 381 if (chrome.IsEmpty()) |
379 return; | 382 return; |
380 | 383 |
381 BindingsSystemPerContextData* data = GetBindingsDataFromContext(v8_context); | 384 BindingsSystemPerContextData* data = GetBindingsDataFromContext(v8_context); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 | 627 |
625 void NativeExtensionBindingsSystem::OnEventListenerChanged( | 628 void NativeExtensionBindingsSystem::OnEventListenerChanged( |
626 const std::string& event_name, | 629 const std::string& event_name, |
627 binding::EventListenersChanged change, | 630 binding::EventListenersChanged change, |
628 v8::Local<v8::Context> context) { | 631 v8::Local<v8::Context> context) { |
629 send_event_listener_ipc_.Run( | 632 send_event_listener_ipc_.Run( |
630 change, ScriptContextSet::GetContextByV8Context(context), event_name); | 633 change, ScriptContextSet::GetContextByV8Context(context), event_name); |
631 } | 634 } |
632 | 635 |
633 } // namespace extensions | 636 } // namespace extensions |
OLD | NEW |