OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/services/gles2/gpu_impl.h" | 5 #include "mojo/services/gles2/gpu_impl.h" |
6 | 6 |
7 #include "gpu/command_buffer/service/mailbox_manager.h" | 7 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 8 #include "gpu/command_buffer/service/mailbox_manager_impl.h" |
8 #include "mojo/converters/geometry/geometry_type_converters.h" | 9 #include "mojo/converters/geometry/geometry_type_converters.h" |
9 #include "mojo/services/gles2/command_buffer_driver.h" | 10 #include "mojo/services/gles2/command_buffer_driver.h" |
10 #include "mojo/services/gles2/command_buffer_impl.h" | 11 #include "mojo/services/gles2/command_buffer_impl.h" |
11 #include "ui/gl/gl_share_group.h" | 12 #include "ui/gl/gl_share_group.h" |
| 13 #include "ui/gl/gl_surface.h" |
12 | 14 |
13 namespace mojo { | 15 namespace mojo { |
14 | 16 |
15 GpuImpl::GpuImpl( | 17 GpuImpl::State::State() |
16 InterfaceRequest<Gpu> request, | 18 : control_thread_("gpu_command_buffer_control"), |
17 const scoped_refptr<gfx::GLShareGroup>& share_group, | 19 share_group_(new gfx::GLShareGroup), |
18 const scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager) | 20 mailbox_manager_(new gpu::gles2::MailboxManagerImpl) { |
19 : share_group_(share_group), | 21 control_thread_.Start(); |
20 mailbox_manager_(mailbox_manager), | 22 } |
21 binding_(this, request.Pass()) { | 23 |
| 24 GpuImpl::State::~State() { |
| 25 } |
| 26 |
| 27 GpuImpl::GpuImpl(InterfaceRequest<Gpu> request, |
| 28 const scoped_refptr<State>& state) |
| 29 : binding_(this, request.Pass()), state_(state) { |
22 } | 30 } |
23 | 31 |
24 GpuImpl::~GpuImpl() { | 32 GpuImpl::~GpuImpl() { |
25 } | 33 } |
26 | 34 |
27 void GpuImpl::CreateOnscreenGLES2Context( | 35 void GpuImpl::CreateOnscreenGLES2Context( |
28 uint64_t native_viewport_id, | 36 uint64_t native_viewport_id, |
29 SizePtr size, | 37 SizePtr size, |
30 InterfaceRequest<CommandBuffer> request) { | 38 InterfaceRequest<CommandBuffer> request) { |
31 gfx::AcceleratedWidget widget = bit_cast<gfx::AcceleratedWidget>( | 39 gfx::AcceleratedWidget widget = bit_cast<gfx::AcceleratedWidget>( |
32 static_cast<uintptr_t>(native_viewport_id)); | 40 static_cast<uintptr_t>(native_viewport_id)); |
33 new CommandBufferImpl(request.Pass(), | 41 new CommandBufferImpl(request.Pass(), state_->control_task_runner(), |
34 make_scoped_ptr(new CommandBufferDriver( | 42 make_scoped_ptr(new CommandBufferDriver( |
35 widget, size.To<gfx::Size>(), share_group_.get(), | 43 widget, size.To<gfx::Size>(), state_->share_group(), |
36 mailbox_manager_.get()))); | 44 state_->mailbox_manager()))); |
37 } | 45 } |
38 | 46 |
39 void GpuImpl::CreateOffscreenGLES2Context( | 47 void GpuImpl::CreateOffscreenGLES2Context( |
40 InterfaceRequest<CommandBuffer> request) { | 48 InterfaceRequest<CommandBuffer> request) { |
41 new CommandBufferImpl(request.Pass(), | 49 new CommandBufferImpl(request.Pass(), state_->control_task_runner(), |
42 make_scoped_ptr(new CommandBufferDriver( | 50 make_scoped_ptr(new CommandBufferDriver( |
43 share_group_.get(), mailbox_manager_.get()))); | 51 state_->share_group(), state_->mailbox_manager()))); |
44 } | 52 } |
45 | 53 |
46 } // namespace mojo | 54 } // namespace mojo |
OLD | NEW |