OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 BLIMP_CLIENT_CORE_COMPOSITOR_DELEGATED_OUTPUT_SURFACE_H_ | 5 #ifndef BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_FRAME_SINK_H_ |
6 #define BLIMP_CLIENT_CORE_COMPOSITOR_DELEGATED_OUTPUT_SURFACE_H_ | 6 #define BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_FRAME_SINK_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "blimp/client/core/compositor/blimp_output_surface.h" | 12 #include "blimp/client/core/compositor/blimp_compositor_frame_sink_proxy.h" |
13 #include "cc/output/output_surface.h" | 13 #include "cc/output/compositor_frame_sink.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class SingleThreadTaskRunner; | 16 class SingleThreadTaskRunner; |
17 } // namespace base | 17 } // namespace base |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 class BeginFrameSource; | 20 class BeginFrameSource; |
21 class ContextProvider; | 21 class ContextProvider; |
22 } // namespace cc | 22 } // namespace cc |
23 | 23 |
24 namespace blimp { | 24 namespace blimp { |
25 namespace client { | 25 namespace client { |
26 | 26 |
27 // This class is created on the main thread, but then becomes bound to the | 27 // This class is created on the main thread, but then becomes bound to the |
28 // compositor thread and will be destroyed there (soon, crbug.com/640730). | 28 // compositor thread and will be destroyed there (soon, crbug.com/640730). |
29 class DelegatedOutputSurface : public cc::OutputSurface, | 29 class BlimpCompositorFrameSink : public cc::CompositorFrameSink, |
30 public BlimpOutputSurface { | 30 public BlimpCompositorFrameSinkProxyClient { |
31 public: | 31 public: |
32 DelegatedOutputSurface( | 32 BlimpCompositorFrameSink( |
33 scoped_refptr<cc::ContextProvider> compositor_context_provider, | 33 scoped_refptr<cc::ContextProvider> compositor_context_provider, |
34 scoped_refptr<cc::ContextProvider> worker_context_provider, | 34 scoped_refptr<cc::ContextProvider> worker_context_provider, |
35 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 35 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
36 base::WeakPtr<BlimpOutputSurfaceClient> client); | 36 base::WeakPtr<BlimpCompositorFrameSinkProxy> main_thread_proxy); |
37 | 37 |
38 ~DelegatedOutputSurface() override; | 38 ~BlimpCompositorFrameSink() override; |
39 | 39 |
40 // cc::OutputSurface implementation. | 40 // cc::CompositorFrameSink implementation. |
41 uint32_t GetFramebufferCopyTextureFormat() override; | 41 uint32_t GetFramebufferCopyTextureFormat() override; |
42 bool BindToClient(cc::OutputSurfaceClient* client) override; | 42 bool BindToClient(cc::CompositorFrameSinkClient* client) override; |
43 void SwapBuffers(cc::CompositorFrame frame) override; | 43 void SwapBuffers(cc::CompositorFrame frame) override; |
44 void DetachFromClient() override; | 44 void DetachFromClient() override; |
45 | 45 |
46 // BlimpOutputSurface implementation. | 46 // BlimpCompositorFrameSinkProxyClient implementation. |
47 void ReclaimCompositorResources( | 47 void ReclaimCompositorResources( |
48 const cc::ReturnedResourceArray& resources) override; | 48 const cc::ReturnedResourceArray& resources) override; |
49 | 49 |
50 private: | 50 private: |
51 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 51 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
52 base::WeakPtr<BlimpOutputSurfaceClient> blimp_client_; | 52 base::WeakPtr<BlimpCompositorFrameSinkProxy> main_thread_proxy_; |
53 | 53 |
54 bool bound_to_client_; | 54 bool bound_to_client_; |
55 | 55 |
56 // This OutputSurface is responsible for providing the BeginFrameSource to | 56 // This CompositorFrameSink is responsible for providing the BeginFrameSource |
57 // drive frame creation. This will be built on the compositor impl thread at | 57 // to drive frame creation. This will be built on the compositor impl thread |
58 // BindToClient call time. | 58 // at BindToClient call time. |
59 std::unique_ptr<cc::BeginFrameSource> begin_frame_source_; | 59 std::unique_ptr<cc::BeginFrameSource> begin_frame_source_; |
60 | 60 |
61 base::WeakPtrFactory<DelegatedOutputSurface> weak_factory_; | 61 base::WeakPtrFactory<BlimpCompositorFrameSink> weak_factory_; |
62 | 62 |
63 DISALLOW_COPY_AND_ASSIGN(DelegatedOutputSurface); | 63 DISALLOW_COPY_AND_ASSIGN(BlimpCompositorFrameSink); |
64 }; | 64 }; |
65 | 65 |
66 } // namespace client | 66 } // namespace client |
67 } // namespace blimp | 67 } // namespace blimp |
68 | 68 |
69 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_DELEGATED_OUTPUT_SURFACE_H_ | 69 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_FRAME_SINK_H_ |
OLD | NEW |