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

Side by Side Diff: content/browser/frame_host/debug_urls.cc

Issue 418733002: Prevent duplicate navigation to debug URLs from Telemetry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comment. Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/frame_host/debug_urls.h" 5 #include "content/browser/frame_host/debug_urls.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h"
9 #include "base/debug/asan_invalid_access.h" 10 #include "base/debug/asan_invalid_access.h"
10 #include "base/debug/profiler.h" 11 #include "base/debug/profiler.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "cc/base/switches.h"
12 #include "content/browser/gpu/gpu_process_host_ui_shim.h" 14 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
13 #include "content/browser/ppapi_plugin_process_host.h" 15 #include "content/browser/ppapi_plugin_process_host.h"
14 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
15 #include "content/public/common/content_constants.h" 17 #include "content/public/common/content_constants.h"
16 #include "content/public/common/url_constants.h" 18 #include "content/public/common/url_constants.h"
17 #include "ppapi/proxy/ppapi_messages.h" 19 #include "ppapi/proxy/ppapi_messages.h"
18 #include "url/gurl.h" 20 #include "url/gurl.h"
19 21
20 namespace content { 22 namespace content {
21 23
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 101 }
100 #endif 102 #endif
101 103
102 return true; 104 return true;
103 } 105 }
104 106
105 107
106 } // namespace 108 } // namespace
107 109
108 bool HandleDebugURL(const GURL& url, PageTransition transition) { 110 bool HandleDebugURL(const GURL& url, PageTransition transition) {
109 // Ensure that the user explicitly navigated to this URL. 111 // Ensure that the user explicitly navigated to this URL, unless
110 if (!(transition & PAGE_TRANSITION_FROM_ADDRESS_BAR)) 112 // kEnableGpuBenchmarking is enabled by Telemetry.
113 bool is_telemetry_navigation = CommandLine::ForCurrentProcess()->HasSwitch(
114 cc::switches::kEnableGpuBenchmarking) &&
115 (transition & PAGE_TRANSITION_TYPED);
116
117 if (!(transition & PAGE_TRANSITION_FROM_ADDRESS_BAR) &&
118 !is_telemetry_navigation)
111 return false; 119 return false;
112 120
113 // NOTE: when you add handling of any URLs to this function, also
114 // update IsDebugURL, below.
115
116 if (IsAsanDebugURL(url)) 121 if (IsAsanDebugURL(url))
117 return HandleAsanDebugURL(url); 122 return HandleAsanDebugURL(url);
118 123
119 if (url.host() == kChromeUIBrowserCrashHost) { 124 if (url.host() == kChromeUIBrowserCrashHost) {
120 // Induce an intentional crash in the browser process. 125 // Induce an intentional crash in the browser process.
121 CHECK(false); 126 CHECK(false);
122 return true; 127 return true;
123 } 128 }
124 129
125 if (url == GURL(kChromeUIGpuCleanURL)) { 130 if (url == GURL(kChromeUIGpuCleanURL)) {
(...skipping 20 matching lines...) Expand all
146 if (url == GURL(kChromeUIPpapiFlashCrashURL) || 151 if (url == GURL(kChromeUIPpapiFlashCrashURL) ||
147 url == GURL(kChromeUIPpapiFlashHangURL)) { 152 url == GURL(kChromeUIPpapiFlashHangURL)) {
148 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 153 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
149 base::Bind(&HandlePpapiFlashDebugURL, url)); 154 base::Bind(&HandlePpapiFlashDebugURL, url));
150 return true; 155 return true;
151 } 156 }
152 157
153 return false; 158 return false;
154 } 159 }
155 160
156 bool IsDebugURL(const GURL& url) {
157 // NOTE: when you add any URLs to this list, also update
158 // HandleDebugURL, above.
159 return IsRendererDebugURL(url) || IsAsanDebugURL(url) ||
160 (url.is_valid() &&
161 (url.host() == kChromeUIBrowserCrashHost ||
162 url == GURL(kChromeUIGpuCleanURL) ||
163 url == GURL(kChromeUIGpuCrashURL) ||
164 url == GURL(kChromeUIGpuHangURL) ||
165 url == GURL(kChromeUIPpapiFlashCrashURL) ||
166 url == GURL(kChromeUIPpapiFlashHangURL)));
167 }
168
169 bool IsRendererDebugURL(const GURL& url) { 161 bool IsRendererDebugURL(const GURL& url) {
170 if (!url.is_valid()) 162 if (!url.is_valid())
171 return false; 163 return false;
172 164
173 if (url.SchemeIs(url::kJavaScriptScheme)) 165 if (url.SchemeIs(url::kJavaScriptScheme))
174 return true; 166 return true;
175 167
176 return url == GURL(kChromeUICrashURL) || 168 return url == GURL(kChromeUICrashURL) ||
177 url == GURL(kChromeUIDumpURL) || 169 url == GURL(kChromeUIDumpURL) ||
178 url == GURL(kChromeUIKillURL) || 170 url == GURL(kChromeUIKillURL) ||
179 url == GURL(kChromeUIHangURL) || 171 url == GURL(kChromeUIHangURL) ||
180 url == GURL(kChromeUIShorthangURL); 172 url == GURL(kChromeUIShorthangURL);
181 } 173 }
182 174
183 } // namespace content 175 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/debug_urls.h ('k') | content/browser/frame_host/navigation_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698