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

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

Issue 1063753005: Allow Waitable event to be used to intentionally hang the UI thread for debugging purposes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 | « base/threading/thread_restrictions.h ('k') | no next file » | 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
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/debug/asan_invalid_access.h" 14 #include "base/debug/asan_invalid_access.h"
15 #include "base/debug/profiler.h" 15 #include "base/debug/profiler.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/synchronization/waitable_event.h" 17 #include "base/synchronization/waitable_event.h"
18 #include "base/threading/thread_restrictions.h"
18 #include "cc/base/switches.h" 19 #include "cc/base/switches.h"
19 #include "content/browser/gpu/gpu_process_host_ui_shim.h" 20 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
20 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
21 #include "content/public/common/content_constants.h" 22 #include "content/public/common/content_constants.h"
22 #include "content/public/common/url_constants.h" 23 #include "content/public/common/url_constants.h"
23 #include "ppapi/proxy/ppapi_messages.h" 24 #include "ppapi/proxy/ppapi_messages.h"
24 #include "url/gurl.h" 25 #include "url/gurl.h"
25 26
26 #if defined(ENABLE_PLUGINS) 27 #if defined(ENABLE_PLUGINS)
27 #include "content/browser/ppapi_plugin_process_host.h" 28 #include "content/browser/ppapi_plugin_process_host.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 return false; 144 return false;
144 } 145 }
145 #endif 146 #endif
146 147
147 return true; 148 return true;
148 } 149 }
149 150
150 151
151 } // namespace 152 } // namespace
152 153
154 class ScopedAllowWaitForDebugURL {
155 private:
156 base::ThreadRestrictions::ScopedAllowWait wait;
157 };
158
153 bool HandleDebugURL(const GURL& url, ui::PageTransition transition) { 159 bool HandleDebugURL(const GURL& url, ui::PageTransition transition) {
154 // Ensure that the user explicitly navigated to this URL, unless 160 // Ensure that the user explicitly navigated to this URL, unless
155 // kEnableGpuBenchmarking is enabled by Telemetry. 161 // kEnableGpuBenchmarking is enabled by Telemetry.
156 bool is_telemetry_navigation = 162 bool is_telemetry_navigation =
157 base::CommandLine::ForCurrentProcess()->HasSwitch( 163 base::CommandLine::ForCurrentProcess()->HasSwitch(
158 cc::switches::kEnableGpuBenchmarking) && 164 cc::switches::kEnableGpuBenchmarking) &&
159 (transition & ui::PAGE_TRANSITION_TYPED); 165 (transition & ui::PAGE_TRANSITION_TYPED);
160 166
161 if (!(transition & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR) && 167 if (!(transition & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR) &&
162 !is_telemetry_navigation) 168 !is_telemetry_navigation)
163 return false; 169 return false;
164 170
165 if (IsAsanDebugURL(url)) 171 if (IsAsanDebugURL(url))
166 return HandleAsanDebugURL(url); 172 return HandleAsanDebugURL(url);
167 173
168 if (IsKaskoDebugURL(url)) { 174 if (IsKaskoDebugURL(url)) {
169 HandleKaskoDebugURL(); 175 HandleKaskoDebugURL();
170 return true; 176 return true;
171 } 177 }
172 178
173 if (url == GURL(kChromeUIBrowserCrashURL)) { 179 if (url == GURL(kChromeUIBrowserCrashURL)) {
174 // Induce an intentional crash in the browser process. 180 // Induce an intentional crash in the browser process.
175 CHECK(false); 181 CHECK(false);
176 return true; 182 return true;
177 } 183 }
178 184
179 if (url == GURL(kChromeUIBrowserUIHang)) { 185 if (url == GURL(kChromeUIBrowserUIHang)) {
186 ScopedAllowWaitForDebugURL allow_wait;
180 base::WaitableEvent(false, false).Wait(); 187 base::WaitableEvent(false, false).Wait();
181 return true; 188 return true;
182 } 189 }
183 190
184 if (url == GURL(kChromeUIGpuCleanURL)) { 191 if (url == GURL(kChromeUIGpuCleanURL)) {
185 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); 192 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance();
186 if (shim) 193 if (shim)
187 shim->SimulateRemoveAllContext(); 194 shim->SimulateRemoveAllContext();
188 return true; 195 return true;
189 } 196 }
(...skipping 30 matching lines...) Expand all
220 return true; 227 return true;
221 228
222 return url == GURL(kChromeUICrashURL) || 229 return url == GURL(kChromeUICrashURL) ||
223 url == GURL(kChromeUIDumpURL) || 230 url == GURL(kChromeUIDumpURL) ||
224 url == GURL(kChromeUIKillURL) || 231 url == GURL(kChromeUIKillURL) ||
225 url == GURL(kChromeUIHangURL) || 232 url == GURL(kChromeUIHangURL) ||
226 url == GURL(kChromeUIShorthangURL); 233 url == GURL(kChromeUIShorthangURL);
227 } 234 }
228 235
229 } // namespace content 236 } // namespace content
OLDNEW
« no previous file with comments | « base/threading/thread_restrictions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698