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

Unified Diff: components/bitmap_uploader/bitmap_uploader.cc

Issue 1976703003: Impl mus::mojom::GpuService to enable using Chrome IPC version gpu CmdBuf in mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 7 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 | « no previous file | components/mus/common/BUILD.gn » ('j') | content/renderer/mus/render_widget_mus_connection.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « no previous file | components/mus/common/BUILD.gn » ('j') | content/renderer/mus/render_widget_mus_connection.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698