OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/ntp/new_tab_ui.h" | 7 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 int load_time_ms = static_cast<int>(load_time.InMilliseconds()); | 271 int load_time_ms = static_cast<int>(load_time.InMilliseconds()); |
272 NotificationService::current()->Notify( | 272 NotificationService::current()->Notify( |
273 chrome::NOTIFICATION_INITIAL_NEW_TAB_UI_LOAD, | 273 chrome::NOTIFICATION_INITIAL_NEW_TAB_UI_LOAD, |
274 Source<Profile>(GetProfile()), | 274 Source<Profile>(GetProfile()), |
275 Details<int>(&load_time_ms)); | 275 Details<int>(&load_time_ms)); |
276 UMA_HISTOGRAM_TIMES("NewTabUI load", load_time); | 276 UMA_HISTOGRAM_TIMES("NewTabUI load", load_time); |
277 } else { | 277 } else { |
278 // Not enough quiet time has elapsed. | 278 // Not enough quiet time has elapsed. |
279 // Some more paints must've occurred since we set the timeout. | 279 // Some more paints must've occurred since we set the timeout. |
280 // Wait some more. | 280 // Wait some more. |
281 timer_.Start(base::TimeDelta::FromMilliseconds(kTimeoutMs), this, | 281 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kTimeoutMs), this, |
282 &NewTabUI::PaintTimeout); | 282 &NewTabUI::PaintTimeout); |
283 } | 283 } |
284 } | 284 } |
285 | 285 |
286 void NewTabUI::StartTimingPaint(RenderViewHost* render_view_host) { | 286 void NewTabUI::StartTimingPaint(RenderViewHost* render_view_host) { |
287 start_ = base::TimeTicks::Now(); | 287 start_ = base::TimeTicks::Now(); |
288 last_paint_ = start_; | 288 last_paint_ = start_; |
289 registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, | 289 registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, |
290 Source<RenderWidgetHost>(render_view_host)); | 290 Source<RenderWidgetHost>(render_view_host)); |
291 timer_.Start(base::TimeDelta::FromMilliseconds(kTimeoutMs), this, | 291 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kTimeoutMs), this, |
292 &NewTabUI::PaintTimeout); | 292 &NewTabUI::PaintTimeout); |
293 | 293 |
294 } | 294 } |
295 void NewTabUI::RenderViewCreated(RenderViewHost* render_view_host) { | 295 void NewTabUI::RenderViewCreated(RenderViewHost* render_view_host) { |
296 StartTimingPaint(render_view_host); | 296 StartTimingPaint(render_view_host); |
297 } | 297 } |
298 | 298 |
299 void NewTabUI::RenderViewReused(RenderViewHost* render_view_host) { | 299 void NewTabUI::RenderViewReused(RenderViewHost* render_view_host) { |
300 StartTimingPaint(render_view_host); | 300 StartTimingPaint(render_view_host); |
301 } | 301 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 SendResponse(request_id, html_bytes); | 464 SendResponse(request_id, html_bytes); |
465 } | 465 } |
466 | 466 |
467 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { | 467 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { |
468 return "text/html"; | 468 return "text/html"; |
469 } | 469 } |
470 | 470 |
471 bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() const { | 471 bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() const { |
472 return false; | 472 return false; |
473 } | 473 } |
OLD | NEW |