Index: services/ui/gpu/gpu_service_internal.cc |
diff --git a/services/ui/gpu/gpu_service_internal.cc b/services/ui/gpu/gpu_service_internal.cc |
index f68197d02f7344be9b4832653ffff71d1e11f7a3..3539bb41fec5dc6ae34fd02661648aea256d53e2 100644 |
--- a/services/ui/gpu/gpu_service_internal.cc |
+++ b/services/ui/gpu/gpu_service_internal.cc |
@@ -5,7 +5,6 @@ |
#include "services/ui/gpu/gpu_service_internal.h" |
#include "base/memory/shared_memory.h" |
-#include "base/memory/singleton.h" |
#include "base/synchronization/waitable_event.h" |
#include "base/threading/thread_task_runner_handle.h" |
#include "build/build_config.h" |
@@ -45,12 +44,16 @@ void EstablishGpuChannelDone( |
} // namespace |
-GpuServiceInternal::GpuServiceInternal() |
+GpuServiceInternal::GpuServiceInternal( |
+ gpu::GpuWatchdogThread* watchdog_thread, |
+ gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory) |
: main_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL, |
base::WaitableEvent::InitialState::NOT_SIGNALED), |
gpu_thread_("GpuThread"), |
io_thread_("GpuIOThread"), |
+ watchdog_thread_(watchdog_thread), |
+ gpu_memory_buffer_factory_(gpu_memory_buffer_factory), |
binding_(this) {} |
GpuServiceInternal::~GpuServiceInternal() { |
@@ -170,11 +173,6 @@ void GpuServiceInternal::InitializeOnGpuThread(base::WaitableEvent* event) { |
ui::OzonePlatform::InitializeForGPU(); |
#endif |
- if (gpu::GetNativeGpuMemoryBufferType() != gfx::EMPTY_BUFFER) { |
- gpu_memory_buffer_factory_ = |
- gpu::GpuMemoryBufferFactory::CreateNativeType(); |
- } |
- |
if (!gl::init::InitializeGLOneOff()) |
VLOG(1) << "gl::init::InitializeGLOneOff failed"; |
@@ -186,12 +184,11 @@ void GpuServiceInternal::InitializeOnGpuThread(base::WaitableEvent* event) { |
// Defer creation of the render thread. This is to prevent it from handling |
// IPC messages before the sandbox has been enabled and all other necessary |
// initialization has succeeded. |
- watchdog_thread_ = gpu::GpuWatchdogThread::Create(); |
gpu_channel_manager_.reset(new gpu::GpuChannelManager( |
- gpu_preferences_, this, watchdog_thread_.get(), |
+ gpu_preferences_, this, watchdog_thread_, |
base::ThreadTaskRunnerHandle::Get().get(), io_thread_.task_runner().get(), |
&shutdown_event_, owned_sync_point_manager_.get(), |
- gpu_memory_buffer_factory_.get())); |
+ gpu_memory_buffer_factory_)); |
media_service_.reset(new media::MediaService(gpu_channel_manager_.get())); |
event->Signal(); |
@@ -235,7 +232,6 @@ void GpuServiceInternal::Initialize(const InitializeCallback& callback) { |
base::Unretained(this), &event)); |
event.Wait(); |
- // TODO(sad): Get the real GPUInfo. |
callback.Run(gpu_info_); |
} |
@@ -252,10 +248,4 @@ void GpuServiceInternal::EstablishGpuChannel( |
allow_real_time_streams, callback); |
} |
-// static |
-GpuServiceInternal* GpuServiceInternal::GetInstance() { |
- return base::Singleton<GpuServiceInternal, |
- base::LeakySingletonTraits<GpuServiceInternal>>::get(); |
-} |
- |
} // namespace ui |