| OLD | NEW |
| 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/guest_view/extensions_guest_view_container.h" | 5 #include "extensions/renderer/guest_view/extensions_guest_view_container.h" |
| 6 | 6 |
| 7 #include "content/public/renderer/render_frame.h" | 7 #include "content/public/renderer/render_frame.h" |
| 8 #include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" | 8 #include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" |
| 9 #include "ui/gfx/geometry/size.h" | 9 #include "ui/gfx/geometry/size.h" |
| 10 | 10 |
| 11 namespace extensions { | 11 namespace extensions { |
| 12 | 12 |
| 13 ExtensionsGuestViewContainer::ExtensionsGuestViewContainer( | 13 ExtensionsGuestViewContainer::ExtensionsGuestViewContainer( |
| 14 content::RenderFrame* render_frame) | 14 content::RenderFrame* render_frame) |
| 15 : GuestViewContainer(render_frame), | 15 : GuestViewContainer(render_frame), |
| 16 destruction_isolate_(nullptr), | 16 destruction_isolate_(nullptr), |
| 17 element_resize_isolate_(nullptr), | 17 element_resize_isolate_(nullptr), |
| 18 weak_ptr_factory_(this) { | 18 weak_ptr_factory_(this) { |
| 19 } | 19 } |
| 20 | 20 |
| 21 ExtensionsGuestViewContainer::~ExtensionsGuestViewContainer() { | 21 ExtensionsGuestViewContainer::~ExtensionsGuestViewContainer() { |
| 22 } |
| 23 |
| 24 void ExtensionsGuestViewContainer::OnDestroy() { |
| 22 // Call the destruction callback, if one is registered. | 25 // Call the destruction callback, if one is registered. |
| 23 if (!destruction_callback_.IsEmpty()) { | 26 if (!destruction_callback_.IsEmpty()) { |
| 24 v8::HandleScope handle_scope(destruction_isolate_); | 27 v8::HandleScope handle_scope(destruction_isolate_); |
| 25 v8::Local<v8::Function> callback = v8::Local<v8::Function>::New( | 28 v8::Local<v8::Function> callback = v8::Local<v8::Function>::New( |
| 26 destruction_isolate_, destruction_callback_); | 29 destruction_isolate_, destruction_callback_); |
| 27 v8::Local<v8::Context> context = callback->CreationContext(); | 30 v8::Local<v8::Context> context = callback->CreationContext(); |
| 28 if (context.IsEmpty()) | 31 if (context.IsEmpty()) |
| 29 return; | 32 return; |
| 30 | 33 |
| 31 v8::Context::Scope context_scope(context); | 34 v8::Context::Scope context_scope(context); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 v8::Integer::New(element_resize_isolate_, new_size.width()), | 77 v8::Integer::New(element_resize_isolate_, new_size.width()), |
| 75 v8::Integer::New(element_resize_isolate_, new_size.height())}; | 78 v8::Integer::New(element_resize_isolate_, new_size.height())}; |
| 76 | 79 |
| 77 v8::Context::Scope context_scope(context); | 80 v8::Context::Scope context_scope(context); |
| 78 blink::WebScopedMicrotaskSuppression suppression; | 81 blink::WebScopedMicrotaskSuppression suppression; |
| 79 | 82 |
| 80 callback->Call(context->Global(), argc, argv); | 83 callback->Call(context->Global(), argc, argv); |
| 81 } | 84 } |
| 82 | 85 |
| 83 } // namespace extensions | 86 } // namespace extensions |
| OLD | NEW |