Index: ui/views/mus/surface_binding.cc |
diff --git a/ui/views/mus/surface_binding.cc b/ui/views/mus/surface_binding.cc |
index a3dc98fb7304f2ad4a5c85cb9b99d714bc5ce0fe..72fa2ad86fe50d2723bb65a3bcd0bcfdd34ce17f 100644 |
--- a/ui/views/mus/surface_binding.cc |
+++ b/ui/views/mus/surface_binding.cc |
@@ -20,6 +20,7 @@ |
#include "cc/output/software_output_device.h" |
#include "cc/resources/shared_bitmap_manager.h" |
#include "components/mus/public/cpp/context_provider.h" |
+#include "components/mus/public/cpp/gpu_service.h" |
#include "components/mus/public/cpp/output_surface.h" |
#include "components/mus/public/cpp/window.h" |
#include "components/mus/public/cpp/window_tree_connection.h" |
@@ -100,13 +101,18 @@ SurfaceBinding::PerConnectionState::CreateOutputSurface( |
mus::mojom::SurfaceType surface_type) { |
if (gpu_.encountered_error()) |
return nullptr; |
- // TODO(sky): figure out lifetime here. Do I need to worry about the return |
- // value outliving this? |
- mus::mojom::CommandBufferPtr cb; |
- gpu_->CreateOffscreenGLES2Context(GetProxy(&cb)); |
- |
+ mojo::ScopedMessagePipeHandle scoped_handle; |
+ if (!mus::GpuService::UseChromeGpuCommandBuffer()) { |
+ // TODO(sky): figure out lifetime here. Do I need to worry about the return |
+ // value outliving this? |
+ mus::mojom::CommandBufferPtr cb; |
+ gpu_->CreateOffscreenGLES2Context(GetProxy(&cb)); |
+ scoped_handle = cb.PassInterface().PassHandle(); |
+ } else { |
+ mus::GpuService::Initialize(connector_); |
+ } |
scoped_refptr<cc::ContextProvider> context_provider( |
- new mus::ContextProvider(cb.PassInterface().PassHandle())); |
+ new mus::ContextProvider(std::move(scoped_handle))); |
return base::WrapUnique(new mus::OutputSurface( |
context_provider, window->RequestSurface(surface_type))); |
} |