• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #include "mojo/services/native_viewport/gpu_impl.h"
6 
7 #include "gpu/command_buffer/service/mailbox_manager.h"
8 #include "mojo/services/gles2/command_buffer_impl.h"
9 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h"
10 #include "ui/gl/gl_share_group.h"
11 
12 namespace mojo {
13 
GpuImpl(const scoped_refptr<gfx::GLShareGroup> & share_group,const scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager)14 GpuImpl::GpuImpl(
15     const scoped_refptr<gfx::GLShareGroup>& share_group,
16     const scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager)
17     : share_group_(share_group), mailbox_manager_(mailbox_manager) {
18 }
19 
~GpuImpl()20 GpuImpl::~GpuImpl() {
21 }
22 
CreateOnscreenGLES2Context(uint64_t native_viewport_id,SizePtr size,InterfaceRequest<CommandBuffer> command_buffer_request)23 void GpuImpl::CreateOnscreenGLES2Context(
24     uint64_t native_viewport_id,
25     SizePtr size,
26     InterfaceRequest<CommandBuffer> command_buffer_request) {
27   gfx::AcceleratedWidget widget = bit_cast<gfx::AcceleratedWidget>(
28       static_cast<uintptr_t>(native_viewport_id));
29   BindToRequest(new CommandBufferImpl(widget,
30                                       size.To<gfx::Size>(),
31                                       share_group_.get(),
32                                       mailbox_manager_.get()),
33                 &command_buffer_request);
34 }
35 
CreateOffscreenGLES2Context(InterfaceRequest<CommandBuffer> command_buffer_request)36 void GpuImpl::CreateOffscreenGLES2Context(
37     InterfaceRequest<CommandBuffer> command_buffer_request) {
38   BindToRequest(
39       new CommandBufferImpl(share_group_.get(), mailbox_manager_.get()),
40       &command_buffer_request);
41 }
42 
43 }  // namespace mojo
44