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

Unified Diff: services/ui/public/cpp/gles2_context.cc

Issue 2257693002: services/ui: Use a gpu::GpuChannelHost when creating ui::OutputSurface. (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 4d4dec8ac62b46cab0597d24ca44aaac56ac3822..ba8cc3b52da86db84e863a761dc6e9cc5cfa2064 100644
--- a/services/ui/public/cpp/gles2_context.cc
+++ b/services/ui/public/cpp/gles2_context.cc
@@ -25,11 +25,9 @@ GLES2Context::GLES2Context() {}
GLES2Context::~GLES2Context() {}
-bool GLES2Context::Initialize(GpuService* gpu_service) {
- scoped_refptr<gpu::GpuChannelHost> gpu_channel_host =
- gpu_service->EstablishGpuChannelSync();
- if (!gpu_channel_host)
- return false;
+bool GLES2Context::Initialize(
+ scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) {
+ DCHECK(gpu_channel_host);
gpu::SurfaceHandle surface_handle = gfx::kNullAcceleratedWidget;
// TODO(penghuang): support shared group.
gpu::CommandBufferProxyImpl* shared_command_buffer = nullptr;
@@ -76,9 +74,14 @@ bool GLES2Context::Initialize(GpuService* gpu_service) {
// static
std::unique_ptr<GLES2Context> GLES2Context::CreateOffscreenContext(
- GpuService* gpu_service) {
+ scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) {
+ if (!gpu_channel_host)
+ return nullptr;
+
+ // Return the GLES2Context only if it is successfully initialized. If
+ // initialization fails, then return null.
std::unique_ptr<GLES2Context> gles2_context(new GLES2Context);
- if (!gles2_context->Initialize(gpu_service))
+ if (!gles2_context->Initialize(std::move(gpu_channel_host)))
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