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

Unified Diff: content/gpu/gpu_main.cc

Issue 2286063003: gpu: Move GpuWatchdogThread into //gpu/ipc/service from content. (Closed)
Patch Set: . Created 4 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 side-by-side diff with in-line comments
Download patch
Index: content/gpu/gpu_main.cc
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
index c1077998dca9b3a55de2c1911b52ebcae9f1ed6f..36a228be91a1edc5ae9fb14e22f1d868ae368b11 100644
--- a/content/gpu/gpu_main.cc
+++ b/content/gpu/gpu_main.cc
@@ -26,7 +26,6 @@
#include "content/common/sandbox_linux/sandbox_linux.h"
#include "content/gpu/gpu_child_thread.h"
#include "content/gpu/gpu_process.h"
-#include "content/gpu/gpu_watchdog_thread.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/main_function_params.h"
@@ -37,6 +36,7 @@
#include "gpu/ipc/common/gpu_memory_buffer_support.h"
#include "gpu/ipc/service/gpu_config.h"
#include "gpu/ipc/service/gpu_memory_buffer_factory.h"
+#include "gpu/ipc/service/gpu_watchdog_thread.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_implementation.h"
@@ -86,16 +86,6 @@
#include <sanitizer/coverage_interface.h>
#endif
-#if defined(CYGPROFILE_INSTRUMENTATION)
-const int kGpuTimeout = 30000;
-#elif defined(OS_WIN)
-// Use a slightly longer timeout on Windows due to prevalence of slow and
-// infected machines.
-const int kGpuTimeout = 15000;
-#else
-const int kGpuTimeout = 10000;
-#endif
-
namespace content {
namespace {
@@ -112,7 +102,7 @@ bool CollectGraphicsInfo(gpu::GPUInfo& gpu_info);
#if !defined(OS_CHROMEOS)
bool CanAccessNvidiaDeviceFile();
#endif
-bool StartSandboxLinux(const gpu::GPUInfo&, GpuWatchdogThread*, bool);
+bool StartSandboxLinux(const gpu::GPUInfo&, gpu::GpuWatchdogThread*, bool);
#elif defined(OS_WIN)
bool StartSandboxWindows(const sandbox::SandboxInterfaceInfo*);
#endif
@@ -235,16 +225,12 @@ int GpuMain(const MainFunctionParams& parameters) {
delayed_watchdog_enable = true;
#endif
- scoped_refptr<GpuWatchdogThread> watchdog_thread;
+ scoped_refptr<gpu::GpuWatchdogThread> watchdog_thread;
// Start the GPU watchdog only after anything that is expected to be time
// consuming has completed, otherwise the process is liable to be aborted.
- if (enable_watchdog && !delayed_watchdog_enable) {
- watchdog_thread = new GpuWatchdogThread(kGpuTimeout);
- base::Thread::Options options;
- options.timer_slack = base::TIMER_SLACK_MAXIMUM;
- watchdog_thread->StartWithOptions(options);
- }
+ if (enable_watchdog && !delayed_watchdog_enable)
+ watchdog_thread = gpu::GpuWatchdogThread::Create();
// Initializes StatisticsRecorder which tracks UMA histograms.
base::StatisticsRecorder::Initialize();
@@ -354,10 +340,7 @@ int GpuMain(const MainFunctionParams& parameters) {
initialize_one_off_time);
if (enable_watchdog && delayed_watchdog_enable) {
Fady Samuel 2016/08/29 16:41:37 nit: get rid of braces.
sadrul 2016/08/29 20:00:32 Done.
- watchdog_thread = new GpuWatchdogThread(kGpuTimeout);
- base::Thread::Options options;
- options.timer_slack = base::TIMER_SLACK_MAXIMUM;
- watchdog_thread->StartWithOptions(options);
+ watchdog_thread = gpu::GpuWatchdogThread::Create();
}
// OSMesa is expected to run very slowly, so disable the watchdog in that
@@ -571,7 +554,7 @@ void WarmUpSandboxNvidia(const gpu::GPUInfo& gpu_info,
}
bool StartSandboxLinux(const gpu::GPUInfo& gpu_info,
- GpuWatchdogThread* watchdog_thread,
+ gpu::GpuWatchdogThread* watchdog_thread,
bool should_initialize_gl_context) {
TRACE_EVENT0("gpu,startup", "Initialize sandbox");

Powered by Google App Engine
This is Rietveld 408576698