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

Unified Diff: components/guest_view/browser/guest_view_manager.h

Issue 1232603002: This patch improves the way that GuestViewManager tracks the destruction of GuestView embedders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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/browser/guest_view_manager.h
diff --git a/components/guest_view/browser/guest_view_manager.h b/components/guest_view/browser/guest_view_manager.h
index 5364edefcb920e6047d70c503f42e75ed56552c0..0a6725355f9ec2eeb95ffa1267892b92014bafe0 100644
--- a/components/guest_view/browser/guest_view_manager.h
+++ b/components/guest_view/browser/guest_view_manager.h
@@ -132,6 +132,8 @@ class GuestViewManager : public content::BrowserPluginGuestManager,
friend class GuestViewEvent;
friend class GuestViewMessageFilter;
+ class EmbedderRenderProcessHostObserver;
+
// These methods are virtual so that they can be overriden in tests.
virtual void AddGuest(int guest_instance_id,
@@ -139,8 +141,8 @@ class GuestViewManager : public content::BrowserPluginGuestManager,
virtual void RemoveGuest(int guest_instance_id);
// This method is called when the embedder process with ID
- // |embedder_process_id| is about to be destroyed.
- virtual void EmbedderWillBeDestroyed(int embedder_process_id);
+ // |embedder_process_id| has been destroyed.
+ virtual void EmbedderProcessDestroyed(int embedder_process_id);
// Called when a GuestView has been created in JavaScript.
virtual void ViewCreated(int embedder_process_id,
@@ -151,6 +153,15 @@ class GuestViewManager : public content::BrowserPluginGuestManager,
virtual void ViewGarbageCollected(int embedder_process_id,
int view_instance_id);
+ // Calls all destruction callbacks registered for the GuestView identified by
+ // |embedder_process_id| and |view_instance_id|.
+ void CallViewDestructionCallbacks(int embedder_process_id,
+ int view_instance_id);
+
+ // Calls all destruction callbacks registered for GuestViews in the embedder
+ // with ID |embedder_process_id|.
+ void CallViewDestructionCallbacks(int embedder_process_id);
+
// Creates a guest of the provided |view_type|.
GuestViewBase* CreateGuestInternal(content::WebContents* owner_web_contents,
const std::string& view_type);
@@ -215,7 +226,8 @@ class GuestViewManager : public content::BrowserPluginGuestManager,
using GuestViewCreateFunction =
base::Callback<GuestViewBase*(content::WebContents*)>;
- using GuestViewCleanUpFunction = base::Callback<void(int, int)>;
+ using GuestViewCleanUpFunction =
+ base::Callback<void(content::BrowserContext*, int, int)>;
struct GuestViewData {
GuestViewData(const GuestViewCreateFunction& create_function,
const GuestViewCleanUpFunction& cleanup_function);
@@ -248,6 +260,9 @@ class GuestViewManager : public content::BrowserPluginGuestManager,
using CallbacksForEachEmbedderID = std::map<int, CallbacksForEachViewID> ;
CallbacksForEachEmbedderID view_destruction_callback_map_;
+ ScopedVector<EmbedderRenderProcessHostObserver>
+ embedder_render_process_host_observers_;
+
DISALLOW_COPY_AND_ASSIGN(GuestViewManager);
};

Powered by Google App Engine
This is Rietveld 408576698