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

Unified Diff: services/ui/public/cpp/gles2_context.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/public/cpp/gles2_context.h ('k') | services/ui/public/cpp/output_surface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/public/cpp/gles2_context.cc
diff --git a/services/ui/public/cpp/gles2_context.cc b/services/ui/public/cpp/gles2_context.cc
index 2049dfbff399c04f63217e67daacf1f534ac0966..52a8b5a50e9fbc0d4b57fa16951cda7933a76fd3 100644
--- a/services/ui/public/cpp/gles2_context.cc
+++ b/services/ui/public/cpp/gles2_context.cc
@@ -13,6 +13,7 @@
#include "gpu/command_buffer/client/shared_memory_limits.h"
#include "gpu/command_buffer/client/transfer_buffer.h"
#include "gpu/ipc/client/command_buffer_proxy_impl.h"
+#include "gpu/ipc/client/gpu_channel_host.h"
#include "mojo/public/cpp/system/core.h"
#include "services/ui/common/gpu_service.h"
#include "services/ui/public/cpp/command_buffer_client_impl.h"
@@ -26,9 +27,9 @@ GLES2Context::GLES2Context() {}
GLES2Context::~GLES2Context() {}
-bool GLES2Context::Initialize(const std::vector<int32_t>& attribs) {
+bool GLES2Context::Initialize(GpuService* gpu_service) {
scoped_refptr<gpu::GpuChannelHost> gpu_channel_host =
- GpuService::GetInstance()->EstablishGpuChannelSync();
+ gpu_service->EstablishGpuChannelSync();
if (!gpu_channel_host)
return false;
gpu::SurfaceHandle surface_handle = gfx::kNullAcceleratedWidget;
@@ -41,8 +42,6 @@ bool GLES2Context::Initialize(const std::vector<int32_t>& attribs) {
GURL active_url;
scoped_refptr<base::SingleThreadTaskRunner> task_runner =
base::ThreadTaskRunnerHandle::Get();
- if (!attributes.Parse(attribs))
- return false;
command_buffer_proxy_impl_ = gpu::CommandBufferProxyImpl::Create(
std::move(gpu_channel_host), surface_handle, shared_command_buffer,
stream_id, stream_priority, attributes, active_url,
@@ -79,9 +78,9 @@ bool GLES2Context::Initialize(const std::vector<int32_t>& attribs) {
// static
std::unique_ptr<GLES2Context> GLES2Context::CreateOffscreenContext(
- const std::vector<int32_t>& attribs) {
+ GpuService* gpu_service) {
std::unique_ptr<GLES2Context> gles2_context(new GLES2Context);
- if (!gles2_context->Initialize(attribs))
+ if (!gles2_context->Initialize(gpu_service))
gles2_context.reset();
return gles2_context;
}
« no previous file with comments | « services/ui/public/cpp/gles2_context.h ('k') | services/ui/public/cpp/output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698