OLD | NEW |
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 private: | 90 private: |
90 FRIEND_TEST_ALL_PREFIXES(NewTabUITest, UpdateUserPrefsVersion); | 91 FRIEND_TEST_ALL_PREFIXES(NewTabUITest, UpdateUserPrefsVersion); |
91 | 92 |
92 virtual void Observe(NotificationType type, | 93 virtual void Observe(NotificationType type, |
93 const NotificationSource& source, | 94 const NotificationSource& source, |
94 const NotificationDetails& details); | 95 const NotificationDetails& details); |
95 | 96 |
96 // Reset the CSS caches. | 97 // Reset the CSS caches. |
97 void InitializeCSSCaches(); | 98 void InitializeCSSCaches(); |
98 | 99 |
| 100 void StartTimingPaint(RenderViewHost* render_view_host); |
| 101 void PaintTimeout(); |
| 102 |
99 // Updates the user prefs version and calls |MigrateUserPrefs| if needed. | 103 // Updates the user prefs version and calls |MigrateUserPrefs| if needed. |
100 // Returns true if the version was updated. | 104 // Returns true if the version was updated. |
101 static bool UpdateUserPrefsVersion(PrefService* prefs); | 105 static bool UpdateUserPrefsVersion(PrefService* prefs); |
102 | 106 |
103 NotificationRegistrar registrar_; | 107 NotificationRegistrar registrar_; |
104 | 108 |
| 109 // The time when we started benchmarking. |
| 110 base::TimeTicks start_; |
| 111 // The last time we got a paint notification. |
| 112 base::TimeTicks last_paint_; |
| 113 // Scoping so we can be sure our timeouts don't outlive us. |
| 114 base::OneShotTimer<NewTabUI> timer_; |
105 // The preference version. This used for migrating prefs of the NTP. | 115 // The preference version. This used for migrating prefs of the NTP. |
106 static const int current_pref_version_ = 3; | 116 static const int current_pref_version_ = 3; |
107 | 117 |
108 DISALLOW_COPY_AND_ASSIGN(NewTabUI); | 118 DISALLOW_COPY_AND_ASSIGN(NewTabUI); |
109 }; | 119 }; |
110 | 120 |
111 #endif // CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H_ | 121 #endif // CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H_ |
OLD | NEW |