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

Side by Side Diff: components/dom_distiller/content/browser/dom_distiller_viewer_source.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, 7 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
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 "components/dom_distiller/content/browser/dom_distiller_viewer_source.h " 5 #include "components/dom_distiller/content/browser/dom_distiller_viewer_source.h "
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/ref_counted_memory.h" 12 #include "base/memory/ref_counted_memory.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/metrics/user_metrics.h" 14 #include "base/metrics/histogram_macros.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "components/dom_distiller/content/browser/distiller_javascript_service_ impl.h" 18 #include "components/dom_distiller/content/browser/distiller_javascript_service_ impl.h"
19 #include "components/dom_distiller/content/browser/distiller_javascript_utils.h" 19 #include "components/dom_distiller/content/browser/distiller_javascript_utils.h"
20 #include "components/dom_distiller/content/browser/distiller_ui_handle.h" 20 #include "components/dom_distiller/content/browser/distiller_ui_handle.h"
21 #include "components/dom_distiller/content/common/distiller_page_notifier_servic e.mojom.h" 21 #include "components/dom_distiller/content/common/distiller_page_notifier_servic e.mojom.h"
22 #include "components/dom_distiller/core/distilled_page_prefs.h" 22 #include "components/dom_distiller/core/distilled_page_prefs.h"
23 #include "components/dom_distiller/core/dom_distiller_request_view_base.h" 23 #include "components/dom_distiller/core/dom_distiller_request_view_base.h"
24 #include "components/dom_distiller/core/dom_distiller_service.h" 24 #include "components/dom_distiller/core/dom_distiller_service.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 150 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
151 } 151 }
152 152
153 void DomDistillerViewerSource::RequestViewerHandle::DidFinishLoad( 153 void DomDistillerViewerSource::RequestViewerHandle::DidFinishLoad(
154 content::RenderFrameHost* render_frame_host, 154 content::RenderFrameHost* render_frame_host,
155 const GURL& validated_url) { 155 const GURL& validated_url) {
156 if (render_frame_host->GetParent()) { 156 if (render_frame_host->GetParent()) {
157 return; 157 return;
158 } 158 }
159 159
160 int64_t start_time_ms = url_utils::GetTimeFromDistillerUrl(validated_url);
161 if (start_time_ms > 0) {
162 base::TimeTicks start_time =
163 base::TimeDelta::FromMilliseconds(start_time_ms) + base::TimeTicks();
164 base::TimeDelta latency = base::TimeTicks::Now() - start_time;
165
166 UMA_HISTOGRAM_TIMES("DomDistiller.Time.ViewerLoading", latency);
167 }
168
160 // No SendJavaScript() calls allowed before |buffer_| is run and cleared. 169 // No SendJavaScript() calls allowed before |buffer_| is run and cleared.
161 waiting_for_page_ready_ = false; 170 waiting_for_page_ready_ = false;
162 if (!buffer_.empty()) { 171 if (!buffer_.empty()) {
163 RunIsolatedJavaScript(web_contents()->GetMainFrame(), buffer_); 172 RunIsolatedJavaScript(web_contents()->GetMainFrame(), buffer_);
164 buffer_.clear(); 173 buffer_.clear();
165 } 174 }
166 // No need to Cancel() here. 175 // No need to Cancel() here.
167 } 176 }
168 177
169 DomDistillerViewerSource::DomDistillerViewerSource( 178 DomDistillerViewerSource::DomDistillerViewerSource(
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 std::string DomDistillerViewerSource::GetContentSecurityPolicyObjectSrc() 292 std::string DomDistillerViewerSource::GetContentSecurityPolicyObjectSrc()
284 const { 293 const {
285 return "object-src 'none'; style-src 'self' https://fonts.googleapis.com;"; 294 return "object-src 'none'; style-src 'self' https://fonts.googleapis.com;";
286 } 295 }
287 296
288 std::string DomDistillerViewerSource::GetContentSecurityPolicyFrameSrc() const { 297 std::string DomDistillerViewerSource::GetContentSecurityPolicyFrameSrc() const {
289 return "frame-src *;"; 298 return "frame-src *;";
290 } 299 }
291 300
292 } // namespace dom_distiller 301 } // namespace dom_distiller
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698