Index: components/guest_view/renderer/guest_view_container.h |
diff --git a/components/guest_view/renderer/guest_view_container.h b/components/guest_view/renderer/guest_view_container.h |
index 50b05cb886ab97832a4ed308c1c27c2ffff01c50..6c80f10f6898b3d94bc5fd266fe605b9c179606f 100644 |
--- a/components/guest_view/renderer/guest_view_container.h |
+++ b/components/guest_view/renderer/guest_view_container.h |
@@ -17,7 +17,6 @@ class GuestViewRequest; |
class GuestViewContainer : public content::BrowserPluginDelegate { |
public: |
explicit GuestViewContainer(content::RenderFrame* render_frame); |
- ~GuestViewContainer() override; |
static GuestViewContainer* FromID(int element_instance_id); |
@@ -33,6 +32,11 @@ class GuestViewContainer : public content::BrowserPluginDelegate { |
// container. |
bool OnMessageReceived(const IPC::Message& message); |
+ // BrowserPluginDelegate public implementation. |
+ // Note that DidDestroyElement currently destroys this container. |
+ // This won't be necessary once GuestViewContainers run w/o plugin. |
+ void DidDestroyElement() final; |
Fady Samuel
2015/06/05 22:12:46
Does this need to be public?
lazyboy
2015/06/05 22:26:15
Since Destroy() is now public, made this private.
|
+ |
// Called when the embedding RenderFrame is destroyed. |
virtual void OnRenderFrameDestroyed() {} |
@@ -43,6 +47,14 @@ class GuestViewContainer : public content::BrowserPluginDelegate { |
// Called to perform actions when a GuestViewContainer gets a geometry. |
virtual void OnReady() {} |
+ // Called to perform actions when a GuestViewContainer is about to be |
+ // destroyed. |
+ // Note that this should be called exactly once. |
+ virtual void OnDestroy() {} |
+ |
+ protected: |
+ ~GuestViewContainer() override; |
+ |
private: |
class RenderFrameLifetimeObserver; |
friend class RenderFrameLifetimeObserver; |
@@ -55,6 +67,9 @@ class GuestViewContainer : public content::BrowserPluginDelegate { |
void OnHandleCallback(const IPC::Message& message); |
+ // Destroys this GuestViewContainer after performing necessary cleanup. |
+ void Destroy(); |
+ |
// BrowserPluginDelegate implementation. |
void Ready() final; |
void SetElementInstanceID(int element_instance_id) final; |
@@ -64,6 +79,7 @@ class GuestViewContainer : public content::BrowserPluginDelegate { |
scoped_ptr<RenderFrameLifetimeObserver> render_frame_lifetime_observer_; |
bool ready_; |
+ bool in_destruction_; |
std::deque<linked_ptr<GuestViewRequest> > pending_requests_; |
linked_ptr<GuestViewRequest> pending_response_; |