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

Side by Side Diff: chrome/browser/dom_distiller/tab_utils.cc

Issue 2011213002: Record start up latency of DOM distiller viewer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | components/dom_distiller/content/browser/dom_distiller_viewer_source.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/dom_distiller/tab_utils.h" 5 #include "chrome/browser/dom_distiller/tab_utils.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" 10 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 void SelfDeletingRequestDelegate::TakeViewerHandle( 100 void SelfDeletingRequestDelegate::TakeViewerHandle(
101 std::unique_ptr<ViewerHandle> viewer_handle) { 101 std::unique_ptr<ViewerHandle> viewer_handle) {
102 viewer_handle_ = std::move(viewer_handle); 102 viewer_handle_ = std::move(viewer_handle);
103 } 103 }
104 104
105 // Start loading the viewer URL of the current page in |web_contents|. 105 // Start loading the viewer URL of the current page in |web_contents|.
106 void StartNavigationToDistillerViewer(content::WebContents* web_contents, 106 void StartNavigationToDistillerViewer(content::WebContents* web_contents,
107 const GURL& url) { 107 const GURL& url) {
108 GURL viewer_url = dom_distiller::url_utils::GetDistillerViewUrlFromUrl( 108 GURL viewer_url = dom_distiller::url_utils::GetDistillerViewUrlFromUrl(
109 dom_distiller::kDomDistillerScheme, url); 109 dom_distiller::kDomDistillerScheme, url,
110 (base::TimeTicks::Now() - base::TimeTicks()).InMilliseconds());
mdjones 2016/05/31 17:26:25 I'm not sure I understand why the subtraction is n
wychen 2016/05/31 17:59:26 TimeTicks cannot be directly converted to int. Tim
110 content::NavigationController::LoadURLParams params(viewer_url); 111 content::NavigationController::LoadURLParams params(viewer_url);
111 params.transition_type = ui::PAGE_TRANSITION_AUTO_BOOKMARK; 112 params.transition_type = ui::PAGE_TRANSITION_AUTO_BOOKMARK;
112 web_contents->GetController().LoadURLWithParams(params); 113 web_contents->GetController().LoadURLWithParams(params);
113 } 114 }
114 115
115 void MaybeStartDistillation( 116 void MaybeStartDistillation(
116 std::unique_ptr<SourcePageHandleWebContents> source_page_handle) { 117 std::unique_ptr<SourcePageHandleWebContents> source_page_handle) {
117 const GURL& last_committed_url = 118 const GURL& last_committed_url =
118 source_page_handle->web_contents()->GetLastCommittedURL(); 119 source_page_handle->web_contents()->GetLastCommittedURL();
119 if (!dom_distiller::url_utils::IsUrlDistillable(last_committed_url)) 120 if (!dom_distiller::url_utils::IsUrlDistillable(last_committed_url))
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 DCHECK(source_web_contents); 172 DCHECK(source_web_contents);
172 DCHECK(destination_web_contents); 173 DCHECK(destination_web_contents);
173 174
174 std::unique_ptr<SourcePageHandleWebContents> source_page_handle( 175 std::unique_ptr<SourcePageHandleWebContents> source_page_handle(
175 new SourcePageHandleWebContents(source_web_contents, false)); 176 new SourcePageHandleWebContents(source_web_contents, false));
176 177
177 MaybeStartDistillation(std::move(source_page_handle)); 178 MaybeStartDistillation(std::move(source_page_handle));
178 StartNavigationToDistillerViewer(destination_web_contents, 179 StartNavigationToDistillerViewer(destination_web_contents,
179 source_web_contents->GetLastCommittedURL()); 180 source_web_contents->GetLastCommittedURL());
180 } 181 }
OLDNEW
« no previous file with comments | « no previous file | components/dom_distiller/content/browser/dom_distiller_viewer_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698