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

Side by Side Diff: mojo/services/gles2/gles2_impl.cc

Issue 109103003: Mojo: abstract interface implementation from generated Stub classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase + fix build Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/gles2_impl.h" 5 #include "mojo/services/gles2/gles2_impl.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "gpu/command_buffer/client/gl_in_process_context.h" 9 #include "gpu/command_buffer/client/gl_in_process_context.h"
10 #include "gpu/command_buffer/client/gles2_implementation.h" 10 #include "gpu/command_buffer/client/gles2_implementation.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 namespace services { 13 namespace services {
14 14
15 GLES2Impl::GLES2Impl(ScopedMessagePipeHandle client) 15 GLES2Impl::GLES2Impl(ScopedMessagePipeHandle client)
16 : client_(client.Pass()) { 16 : client_(client.Pass(), this) {
17 client_.SetPeer(this);
18 } 17 }
19 18
20 GLES2Impl::~GLES2Impl() { 19 GLES2Impl::~GLES2Impl() {
21 } 20 }
22 21
23 void GLES2Impl::Destroy() { 22 void GLES2Impl::Destroy() {
24 gl_context_.reset(); 23 gl_context_.reset();
25 } 24 }
26 25
27 void GLES2Impl::CreateContext(gfx::AcceleratedWidget widget, 26 void GLES2Impl::CreateContext(gfx::AcceleratedWidget widget,
28 const gfx::Size& size) { 27 const gfx::Size& size) {
29 gpu::GLInProcessContextAttribs attribs; 28 gpu::GLInProcessContextAttribs attribs;
30 gl_context_.reset(gpu::GLInProcessContext::CreateContext( 29 gl_context_.reset(gpu::GLInProcessContext::CreateContext(
31 false, widget, size, false, attribs, gfx::PreferDiscreteGpu)); 30 false, widget, size, false, attribs, gfx::PreferDiscreteGpu));
32 gl_context_->SetContextLostCallback(base::Bind( 31 gl_context_->SetContextLostCallback(base::Bind(
33 &GLES2Impl::OnGLContextLost, base::Unretained(this))); 32 &GLES2Impl::OnGLContextLost, base::Unretained(this)));
34 33
35 gpu::gles2::GLES2Interface* gl = gl_context_->GetImplementation(); 34 gpu::gles2::GLES2Interface* gl = gl_context_->GetImplementation();
36 uint64_t encoded_gl = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(gl)); 35 uint64_t encoded_gl = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(gl));
37 36
38 client_->DidCreateContext(encoded_gl, size.width(), size.height()); 37 client_->DidCreateContext(encoded_gl, size.width(), size.height());
39 } 38 }
40 39
41 void GLES2Impl::OnGLContextLost() { 40 void GLES2Impl::OnGLContextLost() {
42 client_->ContextLost(); 41 client_->ContextLost();
43 } 42 }
44 43
45 } // namespace services 44 } // namespace services
46 } // namespace mojo 45 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/gles2/gles2_impl.h ('k') | mojo/services/native_viewport/native_viewport_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698