summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui/new_tab_ui.cc
diff options
context:
space:
mode:
authordeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-13 12:41:14 +0000
committerdeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-13 12:41:14 +0000
commit08e26077e930d99b2e692f0e3d35ecd66f4511d9 (patch)
tree92f045e3f838ae817a7b30731e22d1bf611287f0 /chrome/browser/dom_ui/new_tab_ui.cc
parent82bf9d4dd4815aafc67c2dc9f5e825f5246d9f6c (diff)
downloadchromium_src-08e26077e930d99b2e692f0e3d35ecd66f4511d9.zip
chromium_src-08e26077e930d99b2e692f0e3d35ecd66f4511d9.tar.gz
chromium_src-08e26077e930d99b2e692f0e3d35ecd66f4511d9.tar.bz2
Remove a static initializer while reducing a bit of casting.
Review URL: http://codereview.chromium.org/17628 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7925 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui/new_tab_ui.cc')
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc
index 3bcf866b..d47bdaa 100644
--- a/chrome/browser/dom_ui/new_tab_ui.cc
+++ b/chrome/browser/dom_ui/new_tab_ui.cc
@@ -72,8 +72,7 @@ class PaintTimer : public RenderWidgetHost::PaintObserver {
start_ = TimeTicks::Now();
last_paint_ = start_;
MessageLoop::current()->PostDelayedTask(FROM_HERE,
- method_factory_.NewRunnableMethod(&PaintTimer::Timeout),
- static_cast<int>(kTimeout.InMilliseconds()));
+ method_factory_.NewRunnableMethod(&PaintTimer::Timeout), kTimeoutMs);
}
// A callback that is invoked whenever our RenderWidgetHost paints.
@@ -85,7 +84,7 @@ class PaintTimer : public RenderWidgetHost::PaintObserver {
// message, we say we're done painting; otherwise, we keep waiting.
void Timeout() {
TimeTicks now = TimeTicks::Now();
- if ((now - last_paint_) >= kTimeout) {
+ if ((now - last_paint_) >= TimeDelta::FromMilliseconds(kTimeoutMs)) {
// Painting has quieted down. Log this as the full time to run.
TimeDelta load_time = last_paint_ - start_;
int load_time_ms = static_cast<int>(load_time.InMilliseconds());
@@ -99,15 +98,14 @@ class PaintTimer : public RenderWidgetHost::PaintObserver {
// Some more paints must've occurred since we set the timeout.
// Wait some more.
MessageLoop::current()->PostDelayedTask(FROM_HERE,
- method_factory_.NewRunnableMethod(&PaintTimer::Timeout),
- static_cast<int>(kTimeout.InMilliseconds()));
+ method_factory_.NewRunnableMethod(&PaintTimer::Timeout), kTimeoutMs);
}
}
private:
// The amount of time there must be no painting for us to consider painting
// finished. Observed times are in the ~1200ms range.
- static const TimeDelta kTimeout;
+ static const int kTimeoutMs = 2000;
// The time when we started benchmarking.
TimeTicks start_;
// The last time we got a paint notification.
@@ -117,7 +115,6 @@ class PaintTimer : public RenderWidgetHost::PaintObserver {
DISALLOW_EVIL_CONSTRUCTORS(PaintTimer);
};
-const TimeDelta PaintTimer::kTimeout(TimeDelta::FromMilliseconds(2000));
// Adds "url" and "title" keys on incoming dictionary, setting title
// as the url as a fallback on empty title.