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

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

Issue 885693005: Turn off bind_generates_resource in Mojo's GL (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
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 #include "mojo/public/cpp/environment/environment.h"
9 9
10 namespace mojo { 10 namespace mojo {
11 11
12 ContextProviderMojo::ContextProviderMojo( 12 ContextProviderMojo::ContextProviderMojo(
13 ScopedMessagePipeHandle command_buffer_handle) 13 ScopedMessagePipeHandle command_buffer_handle)
14 : command_buffer_handle_(command_buffer_handle.Pass()), 14 : command_buffer_handle_(command_buffer_handle.Pass()),
15 context_(nullptr), 15 context_(nullptr),
16 context_lost_(false) { 16 context_lost_(false) {
17 } 17 }
18 18
19 bool ContextProviderMojo::BindToCurrentThread() { 19 bool ContextProviderMojo::BindToCurrentThread() {
20 DCHECK(command_buffer_handle_.is_valid()); 20 DCHECK(command_buffer_handle_.is_valid());
21 context_ = MojoGLES2CreateContext(command_buffer_handle_.release().value(), 21 context_ = MojoGLES2CreateContext(command_buffer_handle_.release().value(),
22 &ContextLostThunk, 22 &ContextLostThunk,
23 this, 23 this,
24 Environment::GetDefaultAsyncWaiter()); 24 Environment::GetDefaultAsyncWaiter());
25 DCHECK(context_);
25 return !!context_; 26 return !!context_;
26 } 27 }
27 28
28 gpu::gles2::GLES2Interface* ContextProviderMojo::ContextGL() { 29 gpu::gles2::GLES2Interface* ContextProviderMojo::ContextGL() {
29 if (!context_) 30 if (!context_)
30 return nullptr; 31 return nullptr;
31 return static_cast<gpu::gles2::GLES2Interface*>( 32 return static_cast<gpu::gles2::GLES2Interface*>(
32 MojoGLES2GetGLES2Interface(context_)); 33 MojoGLES2GetGLES2Interface(context_));
33 } 34 }
34 35
(...skipping 18 matching lines...) Expand all
53 ContextProviderMojo::~ContextProviderMojo() { 54 ContextProviderMojo::~ContextProviderMojo() {
54 if (context_) 55 if (context_)
55 MojoGLES2DestroyContext(context_); 56 MojoGLES2DestroyContext(context_);
56 } 57 }
57 58
58 void ContextProviderMojo::ContextLost() { 59 void ContextProviderMojo::ContextLost() {
59 context_lost_ = true; 60 context_lost_ = true;
60 } 61 }
61 62
62 } // namespace mojo 63 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | services/gles2/command_buffer_driver.cc » ('j') | services/gles2/command_buffer_driver.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698