| OLD | NEW |
| 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 "base/threading/thread_restrictions.h" |
| 19 #include "cc/base/switches.h" | 19 #include "cc/base/switches.h" |
| 20 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 20 #include "content/browser/gpu/gpu_process_host.h" |
| 21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 22 #include "content/public/common/content_constants.h" | 22 #include "content/public/common/content_constants.h" |
| 23 #include "content/public/common/url_constants.h" | 23 #include "content/public/common/url_constants.h" |
| 24 #include "ppapi/features/features.h" | 24 #include "ppapi/features/features.h" |
| 25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
| 26 | 26 |
| 27 #if BUILDFLAG(ENABLE_PLUGINS) | 27 #if BUILDFLAG(ENABLE_PLUGINS) |
| 28 #include "content/browser/ppapi_plugin_process_host.h" // nogncheck | 28 #include "content/browser/ppapi_plugin_process_host.h" // nogncheck |
| 29 #include "ppapi/proxy/ppapi_messages.h" // nogncheck | 29 #include "ppapi/proxy/ppapi_messages.h" // nogncheck |
| 30 #endif | 30 #endif |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 if (url == kChromeUIDelayedBrowserUIHang) { | 160 if (url == kChromeUIDelayedBrowserUIHang) { |
| 161 // Webdriver-safe url to hang the ui thread. Webdriver waits for the onload | 161 // Webdriver-safe url to hang the ui thread. Webdriver waits for the onload |
| 162 // event in javascript which needs a little more time to fire. | 162 // event in javascript which needs a little more time to fire. |
| 163 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, | 163 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, |
| 164 base::Bind(&HangCurrentThread), | 164 base::Bind(&HangCurrentThread), |
| 165 base::TimeDelta::FromSeconds(2)); | 165 base::TimeDelta::FromSeconds(2)); |
| 166 return true; | 166 return true; |
| 167 } | 167 } |
| 168 | 168 |
| 169 if (url == kChromeUIGpuCleanURL) { | 169 if (url == kChromeUIGpuCleanURL) { |
| 170 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); | 170 GpuProcessHost::CallOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
| 171 if (shim) | 171 false /* force_create */, |
| 172 shim->SimulateRemoveAllContext(); | 172 base::Bind([](GpuProcessHost* host) { |
| 173 host->gpu_service()->DestroyAllChannels(); |
| 174 })); |
| 173 return true; | 175 return true; |
| 174 } | 176 } |
| 175 | 177 |
| 176 if (url == kChromeUIGpuCrashURL) { | 178 if (url == kChromeUIGpuCrashURL) { |
| 177 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); | 179 GpuProcessHost::CallOnIO( |
| 178 if (shim) | 180 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, false /* force_create */, |
| 179 shim->SimulateCrash(); | 181 base::Bind([](GpuProcessHost* host) { host->gpu_service()->Crash(); })); |
| 180 return true; | 182 return true; |
| 181 } | 183 } |
| 182 | 184 |
| 183 #if defined(OS_ANDROID) | 185 #if defined(OS_ANDROID) |
| 184 if (url == kChromeUIGpuJavaCrashURL) { | 186 if (url == kChromeUIGpuJavaCrashURL) { |
| 185 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); | 187 GpuProcessHost::CallOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
| 186 if (shim) | 188 false /* force_create */, |
| 187 shim->SimulateJavaCrash(); | 189 base::Bind([](GpuProcessHost* host) { |
| 190 host->gpu_service()->ThrowJavaException(); |
| 191 })); |
| 188 return true; | 192 return true; |
| 189 } | 193 } |
| 190 #endif | 194 #endif |
| 191 | 195 |
| 192 if (url == kChromeUIGpuHangURL) { | 196 if (url == kChromeUIGpuHangURL) { |
| 193 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); | 197 GpuProcessHost::CallOnIO( |
| 194 if (shim) | 198 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, false /* force_create */, |
| 195 shim->SimulateHang(); | 199 base::Bind([](GpuProcessHost* host) { host->gpu_service()->Hang(); })); |
| 196 return true; | 200 return true; |
| 197 } | 201 } |
| 198 | 202 |
| 199 if (url == kChromeUIPpapiFlashCrashURL || url == kChromeUIPpapiFlashHangURL) { | 203 if (url == kChromeUIPpapiFlashCrashURL || url == kChromeUIPpapiFlashHangURL) { |
| 200 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 204 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 201 base::Bind(&HandlePpapiFlashDebugURL, url)); | 205 base::Bind(&HandlePpapiFlashDebugURL, url)); |
| 202 return true; | 206 return true; |
| 203 } | 207 } |
| 204 | 208 |
| 205 return false; | 209 return false; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 216 url == kChromeUIBadCastCrashURL || | 220 url == kChromeUIBadCastCrashURL || |
| 217 url == kChromeUICrashURL || | 221 url == kChromeUICrashURL || |
| 218 url == kChromeUIDumpURL || | 222 url == kChromeUIDumpURL || |
| 219 url == kChromeUIKillURL || | 223 url == kChromeUIKillURL || |
| 220 url == kChromeUIHangURL || | 224 url == kChromeUIHangURL || |
| 221 url == kChromeUIShorthangURL || | 225 url == kChromeUIShorthangURL || |
| 222 url == kChromeUIMemoryExhaustURL; | 226 url == kChromeUIMemoryExhaustURL; |
| 223 } | 227 } |
| 224 | 228 |
| 225 } // namespace content | 229 } // namespace content |
| OLD | NEW |