Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(657)

Unified Diff: components/guest_view/renderer/guest_view_container.h

Issue 1162053003: Move BrowserPluginDelegate's lifetime mgmt out of content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make dtor protected Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_;

Powered by Google App Engine
This is Rietveld 408576698