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

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

Issue 2424913003: Avoid unnecessary URL parsing for GURL comparisons in //content (Closed)
Patch Set: rebase on dependent PS Created 4 years, 2 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 | content/browser/frame_host/frame_tree.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 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 #if defined(SYZYASAN) 7 #if defined(SYZYASAN)
8 #include <windows.h> 8 #include <windows.h>
9 #endif 9 #endif
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #endif 49 #endif
50 50
51 #if BUILDFLAG(ENABLE_KASKO) 51 #if BUILDFLAG(ENABLE_KASKO)
52 // Define the Kasko debug URLs. 52 // Define the Kasko debug URLs.
53 const char kKaskoCrashDomain[] = "kasko"; 53 const char kKaskoCrashDomain[] = "kasko";
54 const char kKaskoSendReport[] = "/send-report"; 54 const char kKaskoSendReport[] = "/send-report";
55 #endif 55 #endif
56 56
57 void HandlePpapiFlashDebugURL(const GURL& url) { 57 void HandlePpapiFlashDebugURL(const GURL& url) {
58 #if defined(ENABLE_PLUGINS) 58 #if defined(ENABLE_PLUGINS)
59 bool crash = url == GURL(kChromeUIPpapiFlashCrashURL); 59 bool crash = url == kChromeUIPpapiFlashCrashURL;
60 60
61 std::vector<PpapiPluginProcessHost*> hosts; 61 std::vector<PpapiPluginProcessHost*> hosts;
62 PpapiPluginProcessHost::FindByName( 62 PpapiPluginProcessHost::FindByName(
63 base::UTF8ToUTF16(kFlashPluginName), &hosts); 63 base::UTF8ToUTF16(kFlashPluginName), &hosts);
64 for (std::vector<PpapiPluginProcessHost*>::iterator iter = hosts.begin(); 64 for (std::vector<PpapiPluginProcessHost*>::iterator iter = hosts.begin();
65 iter != hosts.end(); ++iter) { 65 iter != hosts.end(); ++iter) {
66 if (crash) 66 if (crash)
67 (*iter)->Send(new PpapiMsg_Crash()); 67 (*iter)->Send(new PpapiMsg_Crash());
68 else 68 else
69 (*iter)->Send(new PpapiMsg_Hang()); 69 (*iter)->Send(new PpapiMsg_Hang());
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 return false; 191 return false;
192 192
193 if (IsAsanDebugURL(url)) 193 if (IsAsanDebugURL(url))
194 return HandleAsanDebugURL(url); 194 return HandleAsanDebugURL(url);
195 195
196 if (IsKaskoDebugURL(url)) { 196 if (IsKaskoDebugURL(url)) {
197 HandleKaskoDebugURL(); 197 HandleKaskoDebugURL();
198 return true; 198 return true;
199 } 199 }
200 200
201 if (url == GURL(kChromeUIBrowserCrashURL)) { 201 if (url == kChromeUIBrowserCrashURL) {
202 // Induce an intentional crash in the browser process. 202 // Induce an intentional crash in the browser process.
203 CHECK(false); 203 CHECK(false);
204 return true; 204 return true;
205 } 205 }
206 206
207 if (url == GURL(kChromeUIBrowserUIHang)) { 207 if (url == kChromeUIBrowserUIHang) {
208 HangCurrentThread(); 208 HangCurrentThread();
209 return true; 209 return true;
210 } 210 }
211 211
212 if (url == GURL(kChromeUIDelayedBrowserUIHang)) { 212 if (url == kChromeUIDelayedBrowserUIHang) {
213 // Webdriver-safe url to hang the ui thread. Webdriver waits for the onload 213 // Webdriver-safe url to hang the ui thread. Webdriver waits for the onload
214 // event in javascript which needs a little more time to fire. 214 // event in javascript which needs a little more time to fire.
215 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, 215 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE,
216 base::Bind(&HangCurrentThread), 216 base::Bind(&HangCurrentThread),
217 base::TimeDelta::FromSeconds(2)); 217 base::TimeDelta::FromSeconds(2));
218 return true; 218 return true;
219 } 219 }
220 220
221 if (url == GURL(kChromeUIGpuCleanURL)) { 221 if (url == kChromeUIGpuCleanURL) {
222 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); 222 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance();
223 if (shim) 223 if (shim)
224 shim->SimulateRemoveAllContext(); 224 shim->SimulateRemoveAllContext();
225 return true; 225 return true;
226 } 226 }
227 227
228 if (url == GURL(kChromeUIGpuCrashURL)) { 228 if (url == kChromeUIGpuCrashURL) {
229 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); 229 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance();
230 if (shim) 230 if (shim)
231 shim->SimulateCrash(); 231 shim->SimulateCrash();
232 return true; 232 return true;
233 } 233 }
234 234
235 if (url == GURL(kChromeUIGpuHangURL)) { 235 if (url == kChromeUIGpuHangURL) {
236 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); 236 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance();
237 if (shim) 237 if (shim)
238 shim->SimulateHang(); 238 shim->SimulateHang();
239 return true; 239 return true;
240 } 240 }
241 241
242 if (url == GURL(kChromeUIPpapiFlashCrashURL) || 242 if (url == kChromeUIPpapiFlashCrashURL || url == kChromeUIPpapiFlashHangURL) {
243 url == GURL(kChromeUIPpapiFlashHangURL)) {
244 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 243 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
245 base::Bind(&HandlePpapiFlashDebugURL, url)); 244 base::Bind(&HandlePpapiFlashDebugURL, url));
246 return true; 245 return true;
247 } 246 }
248 247
249 return false; 248 return false;
250 } 249 }
251 250
252 bool IsRendererDebugURL(const GURL& url) { 251 bool IsRendererDebugURL(const GURL& url) {
253 if (!url.is_valid()) 252 if (!url.is_valid())
254 return false; 253 return false;
255 254
256 if (url.SchemeIs(url::kJavaScriptScheme)) 255 if (url.SchemeIs(url::kJavaScriptScheme))
257 return true; 256 return true;
258 257
259 return url == GURL(kChromeUIBadCastCrashURL) || 258 return url == kChromeUIBadCastCrashURL ||
260 url == GURL(kChromeUICrashURL) || 259 url == kChromeUICrashURL ||
261 url == GURL(kChromeUIDumpURL) || 260 url == kChromeUIDumpURL ||
262 url == GURL(kChromeUIKillURL) || 261 url == kChromeUIKillURL ||
263 url == GURL(kChromeUIHangURL) || 262 url == kChromeUIHangURL ||
264 url == GURL(kChromeUIShorthangURL) || 263 url == kChromeUIShorthangURL ||
265 url == GURL(kChromeUIMemoryExhaustURL); 264 url == kChromeUIMemoryExhaustURL;
266 } 265 }
267 266
268 } // namespace content 267 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/frame_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698