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

Unified Diff: chrome/browser/dom_ui/new_tab_ui.h

Issue 6010004: Refactor RenderWidgetHost::set_paint_observer() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comments Created 10 years 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: chrome/browser/dom_ui/new_tab_ui.h
diff --git a/chrome/browser/dom_ui/new_tab_ui.h b/chrome/browser/dom_ui/new_tab_ui.h
index 40add0320fe99614b6610a80a76ebbe995c4217a..55275428baf0f03b5b39dbd7e3056d95124a4a31 100644
--- a/chrome/browser/dom_ui/new_tab_ui.h
+++ b/chrome/browser/dom_ui/new_tab_ui.h
@@ -9,6 +9,7 @@
#include <string>
#include "base/gtest_prod_util.h"
+#include "base/timer.h"
#include "chrome/browser/dom_ui/dom_ui.h"
#include "chrome/browser/dom_ui/chrome_url_data_manager.h"
#include "chrome/browser/sessions/tab_restore_service.h"
@@ -88,6 +89,25 @@ class NewTabUI : public DOMUI,
private:
FRIEND_TEST_ALL_PREFIXES(NewTabUITest, UpdateUserPrefsVersion);
+ class PaintTimer : public NotificationObserver {
+ public:
+ PaintTimer(RenderViewHost* render_view_host);
+
+ private:
+ void Timeout();
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+ NotificationRegistrar registrar_;
brettw 2011/01/03 19:48:30 Can you put a blank line above this?
+ // The time when we started benchmarking.
+ base::TimeTicks start_;
+ // The last time we got a paint notification.
+ base::TimeTicks last_paint_;
+ // Scoping so we can be sure our timeouts don't outlive us.
+ base::OneShotTimer<PaintTimer> timer_;
+
+ DISALLOW_COPY_AND_ASSIGN(PaintTimer);
+ };
virtual void Observe(NotificationType type,
const NotificationSource& source,
@@ -102,6 +122,8 @@ class NewTabUI : public DOMUI,
NotificationRegistrar registrar_;
+ scoped_ptr<PaintTimer> paint_timer_;
+
// The preference version. This used for migrating prefs of the NTP.
static const int current_pref_version_ = 3;

Powered by Google App Engine
This is Rietveld 408576698