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

Side by Side 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 9 years, 12 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H_ 5 #ifndef CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H_
6 #define CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H_ 6 #define CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/timer.h"
12 #include "chrome/browser/dom_ui/dom_ui.h" 13 #include "chrome/browser/dom_ui/dom_ui.h"
13 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" 14 #include "chrome/browser/dom_ui/chrome_url_data_manager.h"
14 #include "chrome/browser/sessions/tab_restore_service.h" 15 #include "chrome/browser/sessions/tab_restore_service.h"
15 #include "chrome/common/notification_observer.h" 16 #include "chrome/common/notification_observer.h"
16 #include "chrome/common/notification_registrar.h" 17 #include "chrome/common/notification_registrar.h"
17 18
18 class GURL; 19 class GURL;
19 class MessageLoop; 20 class MessageLoop;
20 class PrefService; 21 class PrefService;
21 class Profile; 22 class Profile;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 static bool first_run_; 82 static bool first_run_;
82 83
83 // Pointer back to the original profile. 84 // Pointer back to the original profile.
84 Profile* profile_; 85 Profile* profile_;
85 86
86 DISALLOW_COPY_AND_ASSIGN(NewTabHTMLSource); 87 DISALLOW_COPY_AND_ASSIGN(NewTabHTMLSource);
87 }; 88 };
88 89
89 private: 90 private:
90 FRIEND_TEST_ALL_PREFIXES(NewTabUITest, UpdateUserPrefsVersion); 91 FRIEND_TEST_ALL_PREFIXES(NewTabUITest, UpdateUserPrefsVersion);
92 class PaintTimer : public NotificationObserver {
93 public:
94 PaintTimer(RenderViewHost* render_view_host);
95
96 private:
97 void Timeout();
98 virtual void Observe(NotificationType type,
99 const NotificationSource& source,
100 const NotificationDetails& details);
101 NotificationRegistrar registrar_;
brettw 2011/01/03 19:48:30 Can you put a blank line above this?
102 // The time when we started benchmarking.
103 base::TimeTicks start_;
104 // The last time we got a paint notification.
105 base::TimeTicks last_paint_;
106 // Scoping so we can be sure our timeouts don't outlive us.
107 base::OneShotTimer<PaintTimer> timer_;
108
109 DISALLOW_COPY_AND_ASSIGN(PaintTimer);
110 };
91 111
92 virtual void Observe(NotificationType type, 112 virtual void Observe(NotificationType type,
93 const NotificationSource& source, 113 const NotificationSource& source,
94 const NotificationDetails& details); 114 const NotificationDetails& details);
95 115
96 // Reset the CSS caches. 116 // Reset the CSS caches.
97 void InitializeCSSCaches(); 117 void InitializeCSSCaches();
98 118
99 // Updates the user prefs version and calls |MigrateUserPrefs| if needed. 119 // Updates the user prefs version and calls |MigrateUserPrefs| if needed.
100 // Returns true if the version was updated. 120 // Returns true if the version was updated.
101 static bool UpdateUserPrefsVersion(PrefService* prefs); 121 static bool UpdateUserPrefsVersion(PrefService* prefs);
102 122
103 NotificationRegistrar registrar_; 123 NotificationRegistrar registrar_;
104 124
125 scoped_ptr<PaintTimer> paint_timer_;
126
105 // The preference version. This used for migrating prefs of the NTP. 127 // The preference version. This used for migrating prefs of the NTP.
106 static const int current_pref_version_ = 3; 128 static const int current_pref_version_ = 3;
107 129
108 DISALLOW_COPY_AND_ASSIGN(NewTabUI); 130 DISALLOW_COPY_AND_ASSIGN(NewTabUI);
109 }; 131 };
110 132
111 #endif // CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H_ 133 #endif // CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698