| 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 | 15 |
| 16 namespace gpu { |
| 17 class GpuChannelHost; |
| 18 } |
| 19 |
| 16 namespace shell { | 20 namespace shell { |
| 17 class Connector; | 21 class Connector; |
| 18 } | 22 } |
| 19 | 23 |
| 20 namespace ui { | 24 namespace ui { |
| 21 | 25 |
| 22 class GLES2Context; | 26 class GLES2Context; |
| 23 class GpuService; | |
| 24 | 27 |
| 25 class ContextProvider : public cc::ContextProvider { | 28 class ContextProvider : public cc::ContextProvider { |
| 26 public: | 29 public: |
| 27 explicit ContextProvider(GpuService* gpu_service); | 30 explicit ContextProvider(scoped_refptr<gpu::GpuChannelHost> gpu_channel_host); |
| 28 | 31 |
| 29 // cc::ContextProvider implementation. | 32 // cc::ContextProvider implementation. |
| 30 bool BindToCurrentThread() override; | 33 bool BindToCurrentThread() override; |
| 31 gpu::gles2::GLES2Interface* ContextGL() override; | 34 gpu::gles2::GLES2Interface* ContextGL() override; |
| 32 gpu::ContextSupport* ContextSupport() override; | 35 gpu::ContextSupport* ContextSupport() override; |
| 33 class GrContext* GrContext() override; | 36 class GrContext* GrContext() override; |
| 34 void InvalidateGrContext(uint32_t state) override; | 37 void InvalidateGrContext(uint32_t state) override; |
| 35 base::Lock* GetLock() override; | 38 base::Lock* GetLock() override; |
| 36 gpu::Capabilities ContextCapabilities() override; | 39 gpu::Capabilities ContextCapabilities() override; |
| 37 void DeleteCachedResources() override {} | 40 void DeleteCachedResources() override {} |
| 38 void SetLostContextCallback( | 41 void SetLostContextCallback( |
| 39 const LostContextCallback& lost_context_callback) override {} | 42 const LostContextCallback& lost_context_callback) override {} |
| 40 | 43 |
| 41 protected: | 44 protected: |
| 42 friend class base::RefCountedThreadSafe<ContextProvider>; | 45 friend class base::RefCountedThreadSafe<ContextProvider>; |
| 43 ~ContextProvider() override; | 46 ~ContextProvider() override; |
| 44 | 47 |
| 45 private: | 48 private: |
| 46 std::unique_ptr<GLES2Context> context_; | 49 std::unique_ptr<GLES2Context> context_; |
| 47 GpuService* gpu_service_; | 50 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host_; |
| 48 | 51 |
| 49 DISALLOW_COPY_AND_ASSIGN(ContextProvider); | 52 DISALLOW_COPY_AND_ASSIGN(ContextProvider); |
| 50 }; | 53 }; |
| 51 | 54 |
| 52 } // namespace ui | 55 } // namespace ui |
| 53 | 56 |
| 54 #endif // SERVICES_UI_PUBLIC_CPP_CONTEXT_PROVIDER_H_ | 57 #endif // SERVICES_UI_PUBLIC_CPP_CONTEXT_PROVIDER_H_ |
| OLD | NEW |