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

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

Issue 1346113003: Mandoline: WebGL: Pass context creation attributes to GPU. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 3 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/pdf_viewer/pdf_viewer.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 "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/gles2/gles2_context.h" 8 #include "mojo/gles2/gles2_context.h"
9 #include "mojo/gpu/mojo_gles2_impl_autogen.h" 9 #include "mojo/gpu/mojo_gles2_impl_autogen.h"
10 #include "third_party/mojo/src/mojo/public/cpp/environment/environment.h" 10 #include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 13
14 ContextProviderMojo::ContextProviderMojo( 14 ContextProviderMojo::ContextProviderMojo(
15 ScopedMessagePipeHandle command_buffer_handle) 15 ScopedMessagePipeHandle command_buffer_handle)
16 : command_buffer_handle_(command_buffer_handle.Pass()), 16 : command_buffer_handle_(command_buffer_handle.Pass()),
17 context_(nullptr) { 17 context_(nullptr) {
18 // Enabled the CHROMIUM_image extension to use GpuMemoryBuffers. The 18 // Enabled the CHROMIUM_image extension to use GpuMemoryBuffers. The
19 // implementation of which is used in CommandBufferDriver. 19 // implementation of which is used in CommandBufferDriver.
20 capabilities_.gpu.image = true; 20 capabilities_.gpu.image = true;
21 } 21 }
22 22
23 bool ContextProviderMojo::BindToCurrentThread() { 23 bool ContextProviderMojo::BindToCurrentThread() {
24 DCHECK(command_buffer_handle_.is_valid()); 24 DCHECK(command_buffer_handle_.is_valid());
25 context_ = MojoGLES2CreateContext(command_buffer_handle_.release().value(), 25 context_ = MojoGLES2CreateContext(command_buffer_handle_.release().value(),
26 nullptr,
26 &ContextLostThunk, 27 &ContextLostThunk,
27 this, 28 this,
28 Environment::GetDefaultAsyncWaiter()); 29 Environment::GetDefaultAsyncWaiter());
29 context_gl_.reset(new MojoGLES2Impl(context_)); 30 context_gl_.reset(new MojoGLES2Impl(context_));
30 return !!context_; 31 return !!context_;
31 } 32 }
32 33
33 gpu::gles2::GLES2Interface* ContextProviderMojo::ContextGL() { 34 gpu::gles2::GLES2Interface* ContextProviderMojo::ContextGL() {
34 return context_gl_.get(); 35 return context_gl_.get();
35 } 36 }
(...skipping 26 matching lines...) Expand all
62 ContextProviderMojo::~ContextProviderMojo() { 63 ContextProviderMojo::~ContextProviderMojo() {
63 context_gl_.reset(); 64 context_gl_.reset();
64 if (context_) 65 if (context_)
65 MojoGLES2DestroyContext(context_); 66 MojoGLES2DestroyContext(context_);
66 } 67 }
67 68
68 void ContextProviderMojo::ContextLost() { 69 void ContextProviderMojo::ContextLost() {
69 } 70 }
70 71
71 } // namespace mojo 72 } // namespace mojo
OLDNEW
« no previous file with comments | « components/pdf_viewer/pdf_viewer.cc ('k') | mojo/gles2/command_buffer_client_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698