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..6cd1331c85d494be0a9afca14e1b15a20a454bf4 100644 |
--- a/components/guest_view/renderer/guest_view_container.h |
+++ b/components/guest_view/renderer/guest_view_container.h |
@@ -17,10 +17,12 @@ class GuestViewRequest; |
class GuestViewContainer : public content::BrowserPluginDelegate { |
public: |
explicit GuestViewContainer(content::RenderFrame* render_frame); |
- ~GuestViewContainer() override; |
static GuestViewContainer* FromID(int element_instance_id); |
+ // Destroys this GuestViewContainer after performing necessary cleanup. |
+ void Destroy() final; |
+ |
// IssueRequest queues up a |request| until the container is ready and |
// the browser process has responded to the last request if it's still |
// pending. |
@@ -43,6 +45,13 @@ 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. |
+ virtual void OnDestroy() {} |
+ |
+ protected: |
+ ~GuestViewContainer() override; |
+ |
private: |
class RenderFrameLifetimeObserver; |
friend class RenderFrameLifetimeObserver; |
@@ -58,12 +67,14 @@ class GuestViewContainer : public content::BrowserPluginDelegate { |
// BrowserPluginDelegate implementation. |
void Ready() final; |
void SetElementInstanceID(int element_instance_id) final; |
+ void WillDestroy() final; |
int element_instance_id_; |
content::RenderFrame* render_frame_; |
scoped_ptr<RenderFrameLifetimeObserver> render_frame_lifetime_observer_; |
bool ready_; |
+ bool in_destruction_; |
std::deque<linked_ptr<GuestViewRequest> > pending_requests_; |
linked_ptr<GuestViewRequest> pending_response_; |