| OLD | NEW |
| 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 #ifndef SERVICES_UI_PUBLIC_CPP_CONTEXT_PROVIDER_H_ | 5 #ifndef SERVICES_UI_PUBLIC_CPP_CONTEXT_PROVIDER_H_ |
| 6 #define SERVICES_UI_PUBLIC_CPP_CONTEXT_PROVIDER_H_ | 6 #define SERVICES_UI_PUBLIC_CPP_CONTEXT_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "cc/output/context_provider.h" | 13 #include "cc/output/context_provider.h" |
| 14 #include "mojo/public/cpp/system/core.h" | 14 #include "mojo/public/cpp/system/core.h" |
| 15 #include "services/ui/public/interfaces/command_buffer.mojom.h" | 15 #include "services/ui/public/interfaces/command_buffer.mojom.h" |
| 16 | 16 |
| 17 namespace shell { | 17 namespace shell { |
| 18 class Connector; | 18 class Connector; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace ui { | 21 namespace ui { |
| 22 | 22 |
| 23 class GLES2Context; | 23 class GLES2Context; |
| 24 class GpuService; |
| 24 | 25 |
| 25 class ContextProvider : public cc::ContextProvider { | 26 class ContextProvider : public cc::ContextProvider { |
| 26 public: | 27 public: |
| 27 ContextProvider(); | 28 explicit ContextProvider(GpuService* gpu_service); |
| 28 | 29 |
| 29 // cc::ContextProvider implementation. | 30 // cc::ContextProvider implementation. |
| 30 bool BindToCurrentThread() override; | 31 bool BindToCurrentThread() override; |
| 31 gpu::gles2::GLES2Interface* ContextGL() override; | 32 gpu::gles2::GLES2Interface* ContextGL() override; |
| 32 gpu::ContextSupport* ContextSupport() override; | 33 gpu::ContextSupport* ContextSupport() override; |
| 33 class GrContext* GrContext() override; | 34 class GrContext* GrContext() override; |
| 34 void InvalidateGrContext(uint32_t state) override; | 35 void InvalidateGrContext(uint32_t state) override; |
| 35 base::Lock* GetLock() override; | 36 base::Lock* GetLock() override; |
| 36 gpu::Capabilities ContextCapabilities() override; | 37 gpu::Capabilities ContextCapabilities() override; |
| 37 void DeleteCachedResources() override {} | 38 void DeleteCachedResources() override {} |
| 38 void SetLostContextCallback( | 39 void SetLostContextCallback( |
| 39 const LostContextCallback& lost_context_callback) override {} | 40 const LostContextCallback& lost_context_callback) override {} |
| 40 | 41 |
| 41 protected: | 42 protected: |
| 42 friend class base::RefCountedThreadSafe<ContextProvider>; | 43 friend class base::RefCountedThreadSafe<ContextProvider>; |
| 43 ~ContextProvider() override; | 44 ~ContextProvider() override; |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 std::unique_ptr<GLES2Context> context_; | 47 std::unique_ptr<GLES2Context> context_; |
| 48 GpuService* gpu_service_; |
| 47 | 49 |
| 48 DISALLOW_COPY_AND_ASSIGN(ContextProvider); | 50 DISALLOW_COPY_AND_ASSIGN(ContextProvider); |
| 49 }; | 51 }; |
| 50 | 52 |
| 51 } // namespace ui | 53 } // namespace ui |
| 52 | 54 |
| 53 #endif // SERVICES_UI_PUBLIC_CPP_CONTEXT_PROVIDER_H_ | 55 #endif // SERVICES_UI_PUBLIC_CPP_CONTEXT_PROVIDER_H_ |
| OLD | NEW |