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

Unified Diff: content/browser/loader/render_view_host_tracker.h

Issue 12600018: ResourceScheduler should use renderer notifications instead of MRUCache to track renderers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reverse destruction order Created 7 years, 9 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
« no previous file with comments | « no previous file | content/browser/loader/render_view_host_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/render_view_host_tracker.h
diff --git a/content/browser/loader/render_view_host_tracker.h b/content/browser/loader/render_view_host_tracker.h
new file mode 100644
index 0000000000000000000000000000000000000000..bab36ded5c9fa07fc97770fc7c0f3b9f0302fbc1
--- /dev/null
+++ b/content/browser/loader/render_view_host_tracker.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_LOADER_RENDER_VIEW_HOST_TRACKER_H_
+#define CONTENT_BROWSER_LOADER_RENDER_VIEW_HOST_TRACKER_H_
+
+#include <set>
+
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+#include "content/public/browser/render_view_host_observer.h"
+
+namespace content {
+
+// The ResourceDispatcherHost needs to know when renderers are created and
+// destroyed. That happens on the UI thread, but the ResourceDispatcherHost
+// operates on the IO thread. RenderViewHostTracker listens for renderer
+// notifications on the UI thread, then bounces them over to the IO thread so
+// the ResourceDispatcherHost can be notified.
+class CONTENT_EXPORT RenderViewHostTracker : public NotificationObserver {
+ public:
+ RenderViewHostTracker();
+ virtual ~RenderViewHostTracker();
+
+ private:
+ class Observer : public RenderViewHostObserver {
+ public:
+ Observer(RenderViewHost* rvh,
+ RenderViewHostTracker* tracker);
+ virtual ~Observer();
+
+ private:
+ // RenderViewHostObserver interface:
+ virtual void RenderViewHostDestroyed(RenderViewHost* rvh) OVERRIDE;
+
+ RenderViewHostTracker* tracker_;
+ };
+
+ friend class Observer;
+ typedef std::set<Observer*> ObserverSet;
+
+ // NotificationObserver interface:
+ virtual void Observe(int type,
+ const NotificationSource& source,
+ const NotificationDetails& details) OVERRIDE;
+
+ void RemoveObserver(Observer* observer);
+
+ content::NotificationRegistrar registrar_;
+ ObserverSet observers_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_LOADER_RENDER_VIEW_HOST_TRACKER_H_
« no previous file with comments | « no previous file | content/browser/loader/render_view_host_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698