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

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 72203003: Introduce RenderProcessHostObserver, use it in its first client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed Created 7 years, 1 month 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: content/browser/renderer_host/render_process_host_impl.cc
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 7abfcf9a5858bbc62f45e27e712e0614cb274c96..4b1e0b58ff09cbd64ec56a63ec3e2f84be86eb1c 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -117,6 +117,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_process_host_factory.h"
+#include "content/public/browser/render_process_host_observer.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_iterator.h"
#include "content/public/browser/resource_context.h"
@@ -772,6 +773,15 @@ void RenderProcessHostImpl::RemoveRoute(int32 routing_id) {
Cleanup();
}
+void RenderProcessHostImpl::AddObserver(RenderProcessHostObserver* observer) {
+ observers_.AddObserver(observer);
+}
+
+void RenderProcessHostImpl::RemoveObserver(
+ RenderProcessHostObserver* observer) {
+ observers_.RemoveObserver(observer);
+}
+
bool RenderProcessHostImpl::WaitForBackingStoreMsg(
int render_widget_id,
const base::TimeDelta& max_delay,
@@ -1361,6 +1371,9 @@ void RenderProcessHostImpl::Cleanup() {
// When no other owners of this object, we can delete ourselves
if (listeners_.IsEmpty()) {
DCHECK_EQ(0, pending_views_);
+ FOR_EACH_OBSERVER(RenderProcessHostObserver,
+ observers_,
+ RenderProcessHostDestroyed(this));
NotificationService::current()->Notify(
NOTIFICATION_RENDERER_PROCESS_TERMINATED,
Source<RenderProcessHost>(this),

Powered by Google App Engine
This is Rietveld 408576698