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

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

Issue 428413002: Make async waiter explicit MojoGLES2CreateContext param (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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/apps/js/main.cc ('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 #include "mojo/public/cpp/environment/environment.h"
8 9
9 namespace mojo { 10 namespace mojo {
10 11
11 ContextProviderMojo::ContextProviderMojo( 12 ContextProviderMojo::ContextProviderMojo(
12 ScopedMessagePipeHandle command_buffer_handle) 13 ScopedMessagePipeHandle command_buffer_handle)
13 : command_buffer_handle_(command_buffer_handle.Pass()), 14 : command_buffer_handle_(command_buffer_handle.Pass()),
14 context_lost_(false) { 15 context_lost_(false) {
15 } 16 }
16 17
17 bool ContextProviderMojo::BindToCurrentThread() { 18 bool ContextProviderMojo::BindToCurrentThread() {
18 DCHECK(command_buffer_handle_.is_valid()); 19 DCHECK(command_buffer_handle_.is_valid());
19 context_ = MojoGLES2CreateContext( 20 context_ = MojoGLES2CreateContext(command_buffer_handle_.release().value(),
20 command_buffer_handle_.release().value(), 21 &ContextLostThunk,
21 &ContextLostThunk, 22 this,
22 this); 23 Environment::GetDefaultAsyncWaiter());
23 return !!context_; 24 return !!context_;
24 } 25 }
25 26
26 gpu::gles2::GLES2Interface* ContextProviderMojo::ContextGL() { 27 gpu::gles2::GLES2Interface* ContextProviderMojo::ContextGL() {
27 if (!context_) 28 if (!context_)
28 return NULL; 29 return NULL;
29 return static_cast<gpu::gles2::GLES2Interface*>( 30 return static_cast<gpu::gles2::GLES2Interface*>(
30 MojoGLES2GetGLES2Interface(context_)); 31 MojoGLES2GetGLES2Interface(context_));
31 } 32 }
32 33
(...skipping 18 matching lines...) Expand all
51 ContextProviderMojo::~ContextProviderMojo() { 52 ContextProviderMojo::~ContextProviderMojo() {
52 if (context_) 53 if (context_)
53 MojoGLES2DestroyContext(context_); 54 MojoGLES2DestroyContext(context_);
54 } 55 }
55 56
56 void ContextProviderMojo::ContextLost() { 57 void ContextProviderMojo::ContextLost() {
57 context_lost_ = true; 58 context_lost_ = true;
58 } 59 }
59 60
60 } // namespace mojo 61 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/apps/js/main.cc ('k') | mojo/examples/compositor_app/compositor_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698