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