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

Side by Side Diff: content/renderer/mus/render_widget_mus_connection.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, 6 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 unified diff | Download patch
« no previous file with comments | « components/mus/ws/BUILD.gn ('k') | mash/login/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/mus/render_widget_mus_connection.h" 5 #include "content/renderer/mus/render_widget_mus_connection.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "components/mus/public/cpp/context_provider.h" 11 #include "components/mus/public/cpp/context_provider.h"
12 #include "components/mus/public/cpp/gpu_service.h"
12 #include "components/mus/public/cpp/output_surface.h" 13 #include "components/mus/public/cpp/output_surface.h"
13 #include "components/mus/public/interfaces/command_buffer.mojom.h" 14 #include "components/mus/public/interfaces/command_buffer.mojom.h"
14 #include "components/mus/public/interfaces/compositor_frame.mojom.h" 15 #include "components/mus/public/interfaces/compositor_frame.mojom.h"
15 #include "components/mus/public/interfaces/gpu.mojom.h" 16 #include "components/mus/public/interfaces/gpu.mojom.h"
16 #include "components/mus/public/interfaces/window_tree.mojom.h" 17 #include "components/mus/public/interfaces/window_tree.mojom.h"
17 #include "content/public/common/mojo_shell_connection.h" 18 #include "content/public/common/mojo_shell_connection.h"
18 #include "content/renderer/mus/compositor_mus_connection.h" 19 #include "content/renderer/mus/compositor_mus_connection.h"
19 #include "content/renderer/render_thread_impl.h" 20 #include "content/renderer/render_thread_impl.h"
20 #include "content/renderer/render_view_impl.h" 21 #include "content/renderer/render_view_impl.h"
21 #include "mojo/converters/geometry/geometry_type_converters.h" 22 #include "mojo/converters/geometry/geometry_type_converters.h"
(...skipping 20 matching lines...) Expand all
42 if (window_surface_binding_) { 43 if (window_surface_binding_) {
43 compositor_mus_connection_->AttachSurfaceOnMainThread( 44 compositor_mus_connection_->AttachSurfaceOnMainThread(
44 std::move(window_surface_binding_)); 45 std::move(window_surface_binding_));
45 } 46 }
46 } 47 }
47 48
48 std::unique_ptr<cc::OutputSurface> 49 std::unique_ptr<cc::OutputSurface>
49 RenderWidgetMusConnection::CreateOutputSurface() { 50 RenderWidgetMusConnection::CreateOutputSurface() {
50 DCHECK(thread_checker_.CalledOnValidThread()); 51 DCHECK(thread_checker_.CalledOnValidThread());
51 DCHECK(!window_surface_binding_); 52 DCHECK(!window_surface_binding_);
52 mus::mojom::GpuPtr gpu_service; 53 mojo::ScopedMessagePipeHandle scoped_handle;
53 MojoShellConnection::Get()->GetConnector()->ConnectToInterface("mojo:mus", 54 if (mus::GpuService::UseChromeGpuCommandBuffer()) {
piman 2016/05/25 22:53:17 did you mean !mus::GpuService::UseChromeGpuCommand
Peng 2016/05/31 14:24:04 Done.
54 &gpu_service); 55 mus::mojom::GpuPtr gpu_service;
55 mus::mojom::CommandBufferPtr cb; 56 MojoShellConnection::Get()->GetConnector()->ConnectToInterface(
56 gpu_service->CreateOffscreenGLES2Context(GetProxy(&cb)); 57 "mojo:mus", &gpu_service);
58 mus::mojom::CommandBufferPtr cb;
59 gpu_service->CreateOffscreenGLES2Context(GetProxy(&cb));
60 scoped_handle = cb.PassInterface().PassHandle();
61 } else {
62 mus::GpuService::Initialize(MojoShellConnection::Get()->GetConnector());
63 }
57 scoped_refptr<cc::ContextProvider> context_provider( 64 scoped_refptr<cc::ContextProvider> context_provider(
58 new mus::ContextProvider(cb.PassInterface().PassHandle())); 65 new mus::ContextProvider(std::move(scoped_handle)));
66
59 std::unique_ptr<cc::OutputSurface> surface(new mus::OutputSurface( 67 std::unique_ptr<cc::OutputSurface> surface(new mus::OutputSurface(
60 context_provider, mus::WindowSurface::Create(&window_surface_binding_))); 68 context_provider, mus::WindowSurface::Create(&window_surface_binding_)));
61 if (compositor_mus_connection_) { 69 if (compositor_mus_connection_) {
62 compositor_mus_connection_->AttachSurfaceOnMainThread( 70 compositor_mus_connection_->AttachSurfaceOnMainThread(
63 std::move(window_surface_binding_)); 71 std::move(window_surface_binding_));
64 } 72 }
65 return surface; 73 return surface;
66 } 74 }
67 75
68 // static 76 // static
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // previous event. 192 // previous event.
185 // DCHECK(pending_ack_.is_null()); 193 // DCHECK(pending_ack_.is_null());
186 pending_ack_ = ack; 194 pending_ack_ = ack;
187 // TODO(fsamuel, sadrul): Track real latency info. 195 // TODO(fsamuel, sadrul): Track real latency info.
188 ui::LatencyInfo latency_info; 196 ui::LatencyInfo latency_info;
189 input_handler_->HandleInputEvent(*input_event, latency_info, 197 input_handler_->HandleInputEvent(*input_event, latency_info,
190 DISPATCH_TYPE_BLOCKING); 198 DISPATCH_TYPE_BLOCKING);
191 } 199 }
192 200
193 } // namespace content 201 } // namespace content
OLDNEW
« no previous file with comments | « components/mus/ws/BUILD.gn ('k') | mash/login/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698