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

Side by Side Diff: mojo/cc/context_provider_mojo.cc

Issue 272323003: Mojo: Implement support for |Foo&| mojom syntax (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 | Annotate | Revision Log
« no previous file with comments | « mojo/cc/context_provider_mojo.h ('k') | mojo/examples/compositor_app/compositor_app.cc » ('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 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/cc/context_provider_mojo.h" 5 #include "mojo/cc/context_provider_mojo.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace mojo { 9 namespace mojo {
10 10
11 ContextProviderMojo::ContextProviderMojo(ScopedMessagePipeHandle gl_pipe) 11 ContextProviderMojo::ContextProviderMojo(
12 : gl_pipe_(gl_pipe.Pass()) {} 12 ScopedMessagePipeHandle command_buffer_handle)
13 : command_buffer_handle_(command_buffer_handle.Pass()) {}
13 14
14 bool ContextProviderMojo::BindToCurrentThread() { 15 bool ContextProviderMojo::BindToCurrentThread() {
15 DCHECK(gl_pipe_.is_valid()); 16 DCHECK(command_buffer_handle_.is_valid());
16 context_ = MojoGLES2CreateContext( 17 context_ = MojoGLES2CreateContext(
17 gl_pipe_.release().value(), &ContextLostThunk, NULL, this); 18 command_buffer_handle_.release().value(),
19 &ContextLostThunk,
20 NULL,
21 this);
18 return !!context_; 22 return !!context_;
19 } 23 }
20 24
21 gpu::gles2::GLES2Interface* ContextProviderMojo::ContextGL() { 25 gpu::gles2::GLES2Interface* ContextProviderMojo::ContextGL() {
22 if (!context_) 26 if (!context_)
23 return NULL; 27 return NULL;
24 return static_cast<gpu::gles2::GLES2Interface*>( 28 return static_cast<gpu::gles2::GLES2Interface*>(
25 MojoGLES2GetGLES2Interface(context_)); 29 MojoGLES2GetGLES2Interface(context_));
26 } 30 }
27 31
(...skipping 19 matching lines...) Expand all
47 } 51 }
48 52
49 void ContextProviderMojo::ContextLost() { 53 void ContextProviderMojo::ContextLost() {
50 if (context_) { 54 if (context_) {
51 MojoGLES2DestroyContext(context_); 55 MojoGLES2DestroyContext(context_);
52 context_ = NULL; 56 context_ = NULL;
53 } 57 }
54 } 58 }
55 59
56 } // namespace mojo 60 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/cc/context_provider_mojo.h ('k') | mojo/examples/compositor_app/compositor_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698