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

Side by Side Diff: components/mus/public/cpp/lib/context_provider.cc

Issue 1725123002: Mojo bindings environment: remove usage in gles2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « components/bitmap_uploader/bitmap_uploader.cc ('k') | mojo/gles2/command_buffer_client_impl.h » ('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 "components/mus/public/cpp/context_provider.h" 5 #include "components/mus/public/cpp/context_provider.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "mojo/gles2/gles2_context.h" 10 #include "mojo/gles2/gles2_context.h"
11 #include "mojo/gpu/mojo_gles2_impl_autogen.h" 11 #include "mojo/gpu/mojo_gles2_impl_autogen.h"
12 #include "mojo/public/cpp/environment/environment.h"
13 12
14 namespace mus { 13 namespace mus {
15 14
16 ContextProvider::ContextProvider( 15 ContextProvider::ContextProvider(
17 mojo::ScopedMessagePipeHandle command_buffer_handle) 16 mojo::ScopedMessagePipeHandle command_buffer_handle)
18 : command_buffer_handle_(std::move(command_buffer_handle)), 17 : command_buffer_handle_(std::move(command_buffer_handle)),
19 context_(nullptr) { 18 context_(nullptr) {
20 // Enabled the CHROMIUM_image extension to use GpuMemoryBuffers. The 19 // Enabled the CHROMIUM_image extension to use GpuMemoryBuffers. The
21 // implementation of which is used in CommandBufferDriver. 20 // implementation of which is used in CommandBufferDriver.
22 capabilities_.gpu.image = true; 21 capabilities_.gpu.image = true;
23 } 22 }
24 23
25 bool ContextProvider::BindToCurrentThread() { 24 bool ContextProvider::BindToCurrentThread() {
26 DCHECK(command_buffer_handle_.is_valid()); 25 DCHECK(command_buffer_handle_.is_valid());
27 context_ = MojoGLES2CreateContext(command_buffer_handle_.release().value(), 26 context_ = MojoGLES2CreateContext(command_buffer_handle_.release().value(),
28 nullptr, &ContextLostThunk, this, 27 nullptr, &ContextLostThunk, this);
29 mojo::Environment::GetDefaultAsyncWaiter());
30 context_gl_.reset(new mojo::MojoGLES2Impl(context_)); 28 context_gl_.reset(new mojo::MojoGLES2Impl(context_));
31 return !!context_; 29 return !!context_;
32 } 30 }
33 31
34 gpu::gles2::GLES2Interface* ContextProvider::ContextGL() { 32 gpu::gles2::GLES2Interface* ContextProvider::ContextGL() {
35 return context_gl_.get(); 33 return context_gl_.get();
36 } 34 }
37 35
38 gpu::ContextSupport* ContextProvider::ContextSupport() { 36 gpu::ContextSupport* ContextProvider::ContextSupport() {
39 if (!context_) 37 if (!context_)
(...skipping 20 matching lines...) Expand all
60 58
61 ContextProvider::~ContextProvider() { 59 ContextProvider::~ContextProvider() {
62 context_gl_.reset(); 60 context_gl_.reset();
63 if (context_) 61 if (context_)
64 MojoGLES2DestroyContext(context_); 62 MojoGLES2DestroyContext(context_);
65 } 63 }
66 64
67 void ContextProvider::ContextLost() {} 65 void ContextProvider::ContextLost() {}
68 66
69 } // namespace mus 67 } // namespace mus
OLDNEW
« no previous file with comments | « components/bitmap_uploader/bitmap_uploader.cc ('k') | mojo/gles2/command_buffer_client_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698