| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/mus/public/cpp/context_provider.h" | |
| 6 | |
| 7 #include <stdint.h> | |
| 8 | |
| 9 #include "base/logging.h" | |
| 10 #include "components/mus/public/cpp/gles2_context.h" | |
| 11 #include "services/shell/public/cpp/connector.h" | |
| 12 | |
| 13 namespace mus { | |
| 14 | |
| 15 ContextProvider::ContextProvider(shell::Connector* connector) | |
| 16 : connector_(connector->Clone()) {} | |
| 17 | |
| 18 bool ContextProvider::BindToCurrentThread() { | |
| 19 if (connector_) { | |
| 20 context_ = GLES2Context::CreateOffscreenContext(std::vector<int32_t>(), | |
| 21 connector_.get()); | |
| 22 // We don't need the connector anymore, so release it. | |
| 23 connector_.reset(); | |
| 24 } | |
| 25 return !!context_; | |
| 26 } | |
| 27 | |
| 28 gpu::gles2::GLES2Interface* ContextProvider::ContextGL() { | |
| 29 return context_->interface(); | |
| 30 } | |
| 31 | |
| 32 gpu::ContextSupport* ContextProvider::ContextSupport() { | |
| 33 if (!context_) | |
| 34 return NULL; | |
| 35 return context_->context_support(); | |
| 36 } | |
| 37 | |
| 38 class GrContext* ContextProvider::GrContext() { | |
| 39 return NULL; | |
| 40 } | |
| 41 | |
| 42 void ContextProvider::InvalidateGrContext(uint32_t state) {} | |
| 43 | |
| 44 gpu::Capabilities ContextProvider::ContextCapabilities() { | |
| 45 gpu::Capabilities capabilities; | |
| 46 // Enabled the CHROMIUM_image extension to use GpuMemoryBuffers. The | |
| 47 // implementation of which is used in CommandBufferDriver. | |
| 48 capabilities.image = true; | |
| 49 return capabilities; | |
| 50 } | |
| 51 | |
| 52 base::Lock* ContextProvider::GetLock() { | |
| 53 // This context provider is not used on multiple threads. | |
| 54 NOTREACHED(); | |
| 55 return nullptr; | |
| 56 } | |
| 57 | |
| 58 ContextProvider::~ContextProvider() { | |
| 59 } | |
| 60 | |
| 61 } // namespace mus | |
| OLD | NEW |