Index: components/bitmap_uploader/bitmap_uploader.cc |
diff --git a/components/bitmap_uploader/bitmap_uploader.cc b/components/bitmap_uploader/bitmap_uploader.cc |
index 5c255dbf2f8a2b68dc45626b5ed808b730b0b526..557218287f9404a4fef274a50e26ce771f8f8b44 100644 |
--- a/components/bitmap_uploader/bitmap_uploader.cc |
+++ b/components/bitmap_uploader/bitmap_uploader.cc |
@@ -10,6 +10,7 @@ |
#include "base/bind.h" |
#include "base/callback.h" |
#include "components/mus/public/cpp/gles2_context.h" |
+#include "components/mus/public/cpp/gpu_service.h" |
#include "components/mus/public/cpp/window.h" |
#include "components/mus/public/cpp/window_surface.h" |
#include "mojo/converters/geometry/geometry_type_converters.h" |
@@ -44,11 +45,18 @@ void BitmapUploader::Init(shell::Connector* connector) { |
surface_->BindToThread(); |
surface_->set_client(this); |
- connector->ConnectToInterface("mojo:mus", &gpu_service_); |
- mus::mojom::CommandBufferPtr gles2_client; |
- gpu_service_->CreateOffscreenGLES2Context(GetProxy(&gles2_client)); |
- gles2_context_.reset(new mus::GLES2Context( |
- std::vector<int32_t>(), gles2_client.PassInterface().PassHandle())); |
+ mojo::ScopedMessagePipeHandle scoped_handle; |
+ if (!mus::GpuService::UseChromeGpuCommandBuffer()) { |
+ connector->ConnectToInterface("mojo:mus", &gpu_service_); |
+ mus::mojom::CommandBufferPtr gles2_client; |
+ gpu_service_->CreateOffscreenGLES2Context(GetProxy(&gles2_client)); |
+ scoped_handle = gles2_client.PassInterface().PassHandle(); |
+ } else { |
+ mus::GpuService::Initialize(connector); |
+ } |
+ |
+ gles2_context_.reset( |
+ new mus::GLES2Context(std::vector<int32_t>(), std::move(scoped_handle))); |
DCHECK(gles2_context_->Initialize()); |
} |
@@ -97,10 +105,10 @@ void BitmapUploader::Upload() { |
mojo::CreateDefaultSQS(bounds.size())); |
if (bitmap_.get()) { |
- gpu::gles2::GLES2Interface* gl = gles2_context_->interface(); |
mojo::Size bitmap_size; |
bitmap_size.width = width_; |
bitmap_size.height = height_; |
+ gpu::gles2::GLES2Interface* gl = gles2_context_->interface(); |
GLuint texture_id = BindTextureForSize(bitmap_size); |
gl->TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bitmap_size.width, |
bitmap_size.height, TextureFormat(), GL_UNSIGNED_BYTE, |