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

Unified Diff: services/ui/common/gpu_service.cc

Issue 2233003003: services/ui: Inject GpuService instance where needed, instead of singleton. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
« no previous file with comments | « services/ui/common/gpu_service.h ('k') | services/ui/demo/mus_demo.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/common/gpu_service.cc
diff --git a/services/ui/common/gpu_service.cc b/services/ui/common/gpu_service.cc
index 113d08682570ce0ae112e5e54271b36302a3be8e..8856b7cca80ce62d00ea763537c22e668da7d231 100644
--- a/services/ui/common/gpu_service.cc
+++ b/services/ui/common/gpu_service.cc
@@ -28,7 +28,6 @@ void PostTask(scoped_refptr<base::SingleThreadTaskRunner> runner,
base::Bind(callback, std::move(established_channel_host)));
}
-GpuService* g_gpu_service = nullptr;
}
GpuService::GpuService(shell::Connector* connector)
@@ -49,24 +48,14 @@ GpuService::GpuService(shell::Connector* connector)
GpuService::~GpuService() {
DCHECK(IsMainThread());
- DCHECK_EQ(this, g_gpu_service);
if (gpu_channel_)
gpu_channel_->DestroyChannel();
- g_gpu_service = nullptr;
}
// static
std::unique_ptr<GpuService> GpuService::Initialize(
shell::Connector* connector) {
- DCHECK(!g_gpu_service);
- g_gpu_service = new GpuService(connector);
- return base::WrapUnique(g_gpu_service);
-}
-
-// static
-GpuService* GpuService::GetInstance() {
- DCHECK(g_gpu_service);
- return g_gpu_service;
+ return base::WrapUnique(new GpuService(connector));
}
void GpuService::EstablishGpuChannel(
« no previous file with comments | « services/ui/common/gpu_service.h ('k') | services/ui/demo/mus_demo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698