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

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

Issue 1900993002: Move SharedMemoryLimits out of WebGraphicsContext3DCommandBufferImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@limits
Patch Set: move-limits: types Created 4 years, 8 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 "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 12
13 namespace mus { 13 namespace mus {
14 14
15 ContextProvider::ContextProvider( 15 ContextProvider::ContextProvider(
16 mojo::ScopedMessagePipeHandle command_buffer_handle) 16 mojo::ScopedMessagePipeHandle command_buffer_handle)
17 : command_buffer_handle_(std::move(command_buffer_handle)), 17 : command_buffer_handle_(std::move(command_buffer_handle)),
18 context_(nullptr) { 18 context_(nullptr) {
19 // Enabled the CHROMIUM_image extension to use GpuMemoryBuffers. The
20 // implementation of which is used in CommandBufferDriver.
21 capabilities_.gpu.image = true;
22 } 19 }
23 20
24 bool ContextProvider::BindToCurrentThread() { 21 bool ContextProvider::BindToCurrentThread() {
25 DCHECK(command_buffer_handle_.is_valid()); 22 DCHECK(command_buffer_handle_.is_valid());
26 context_ = MojoGLES2CreateContext(command_buffer_handle_.release().value(), 23 context_ = MojoGLES2CreateContext(command_buffer_handle_.release().value(),
27 nullptr, &ContextLostThunk, this); 24 nullptr, &ContextLostThunk, this);
28 context_gl_.reset(new mojo::MojoGLES2Impl(context_)); 25 context_gl_.reset(new mojo::MojoGLES2Impl(context_));
29 return !!context_; 26 return !!context_;
30 } 27 }
31 28
32 gpu::gles2::GLES2Interface* ContextProvider::ContextGL() { 29 gpu::gles2::GLES2Interface* ContextProvider::ContextGL() {
33 return context_gl_.get(); 30 return context_gl_.get();
34 } 31 }
35 32
36 gpu::ContextSupport* ContextProvider::ContextSupport() { 33 gpu::ContextSupport* ContextProvider::ContextSupport() {
37 if (!context_) 34 if (!context_)
38 return NULL; 35 return NULL;
39 // TODO(rjkroege): Ensure that UIP does not take this code path. 36 // TODO(rjkroege): Ensure that UIP does not take this code path.
40 return static_cast<gles2::GLES2Context*>(context_)->context_support(); 37 return static_cast<gles2::GLES2Context*>(context_)->context_support();
41 } 38 }
42 39
43 class GrContext* ContextProvider::GrContext() { 40 class GrContext* ContextProvider::GrContext() {
44 return NULL; 41 return NULL;
45 } 42 }
46 43
47 void ContextProvider::InvalidateGrContext(uint32_t state) {} 44 void ContextProvider::InvalidateGrContext(uint32_t state) {}
48 45
49 cc::ContextProvider::Capabilities ContextProvider::ContextCapabilities() { 46 gpu::Capabilities ContextProvider::ContextCapabilities() {
50 return capabilities_; 47 gpu::Capabilities capabilities;
48 // Enabled the CHROMIUM_image extension to use GpuMemoryBuffers. The
49 // implementation of which is used in CommandBufferDriver.
50 capabilities.image = true;
51 return capabilities;
51 } 52 }
52 53
53 void ContextProvider::SetupLock() {} 54 void ContextProvider::SetupLock() {}
54 55
55 base::Lock* ContextProvider::GetLock() { 56 base::Lock* ContextProvider::GetLock() {
56 return &context_lock_; 57 return &context_lock_;
57 } 58 }
58 59
59 ContextProvider::~ContextProvider() { 60 ContextProvider::~ContextProvider() {
60 context_gl_.reset(); 61 context_gl_.reset();
61 if (context_) 62 if (context_)
62 MojoGLES2DestroyContext(context_); 63 MojoGLES2DestroyContext(context_);
63 } 64 }
64 65
65 void ContextProvider::ContextLost() {} 66 void ContextProvider::ContextLost() {}
66 67
67 } // namespace mus 68 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/public/cpp/context_provider.h ('k') | components/mus/surfaces/direct_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698