OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 #include "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "chrome/browser/dom_ui/new_tab_ui.h" | 7 #include "chrome/browser/dom_ui/new_tab_ui.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // Not enough quiet time has elapsed. | 167 // Not enough quiet time has elapsed. |
168 // Some more paints must've occurred since we set the timeout. | 168 // Some more paints must've occurred since we set the timeout. |
169 // Wait some more. | 169 // Wait some more. |
170 timer_.Start(base::TimeDelta::FromMilliseconds(kTimeoutMs), this, | 170 timer_.Start(base::TimeDelta::FromMilliseconds(kTimeoutMs), this, |
171 &PaintTimer::Timeout); | 171 &PaintTimer::Timeout); |
172 } | 172 } |
173 } | 173 } |
174 | 174 |
175 private: | 175 private: |
176 // The amount of time there must be no painting for us to consider painting | 176 // The amount of time there must be no painting for us to consider painting |
177 // finished. Observed times are in the ~1200ms range. | 177 // finished. Observed times are in the ~1200ms range on Windows. |
178 static const int kTimeoutMs = 2000; | 178 static const int kTimeoutMs = 5000; |
179 // The time when we started benchmarking. | 179 // The time when we started benchmarking. |
180 base::TimeTicks start_; | 180 base::TimeTicks start_; |
181 // The last time we got a paint notification. | 181 // The last time we got a paint notification. |
182 base::TimeTicks last_paint_; | 182 base::TimeTicks last_paint_; |
183 // Scoping so we can be sure our timeouts don't outlive us. | 183 // Scoping so we can be sure our timeouts don't outlive us. |
184 base::OneShotTimer<PaintTimer> timer_; | 184 base::OneShotTimer<PaintTimer> timer_; |
185 | 185 |
186 DISALLOW_COPY_AND_ASSIGN(PaintTimer); | 186 DISALLOW_COPY_AND_ASSIGN(PaintTimer); |
187 }; | 187 }; |
188 | 188 |
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 bool NewTabUI::WebResourcesEnabled() { | 1767 bool NewTabUI::WebResourcesEnabled() { |
1768 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1768 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
1769 return !command_line->HasSwitch(switches::kDisableWebResources); | 1769 return !command_line->HasSwitch(switches::kDisableWebResources); |
1770 } | 1770 } |
1771 | 1771 |
1772 // static | 1772 // static |
1773 bool NewTabUI::FirstRunDisabled() { | 1773 bool NewTabUI::FirstRunDisabled() { |
1774 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1774 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
1775 return command_line->HasSwitch(switches::kDisableNewTabFirstRun); | 1775 return command_line->HasSwitch(switches::kDisableNewTabFirstRun); |
1776 } | 1776 } |
OLD | NEW |