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