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 UI_ANDROID_DELEGATED_FRAME_HOST_ANDROID_H_ | 5 #ifndef UI_ANDROID_DELEGATED_FRAME_HOST_ANDROID_H_ |
6 #define UI_ANDROID_DELEGATED_FRAME_HOST_ANDROID_H_ | 6 #define UI_ANDROID_DELEGATED_FRAME_HOST_ANDROID_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "cc/output/copy_output_request.h" | 10 #include "cc/output/copy_output_request.h" |
11 #include "cc/resources/returned_resource.h" | 11 #include "cc/resources/returned_resource.h" |
12 #include "cc/surfaces/compositor_frame_sink_support.h" | 12 #include "cc/surfaces/compositor_frame_sink_support.h" |
13 #include "cc/surfaces/compositor_frame_sink_support_client.h" | 13 #include "cc/surfaces/compositor_frame_sink_support_client.h" |
| 14 #include "cc/surfaces/surface_info.h" |
14 #include "ui/android/ui_android_export.h" | 15 #include "ui/android/ui_android_export.h" |
15 #include "ui/gfx/selection_bound.h" | |
16 | 16 |
17 namespace cc { | 17 namespace cc { |
18 | 18 |
19 class CompositorFrame; | 19 class CompositorFrame; |
20 class SurfaceManager; | 20 class SurfaceManager; |
21 class SurfaceLayer; | 21 class SurfaceLayer; |
22 class LocalSurfaceIdAllocator; | |
23 enum class SurfaceDrawStatus; | 22 enum class SurfaceDrawStatus; |
24 | 23 |
25 } // namespace cc | 24 } // namespace cc |
26 | 25 |
27 namespace ui { | 26 namespace ui { |
28 class ViewAndroid; | 27 class ViewAndroid; |
29 class WindowAndroidCompositor; | 28 class WindowAndroidCompositor; |
30 | 29 |
31 class UI_ANDROID_EXPORT DelegatedFrameHostAndroid | 30 class UI_ANDROID_EXPORT DelegatedFrameHostAndroid |
32 : public cc::CompositorFrameSinkSupportClient, | 31 : public cc::CompositorFrameSinkSupportClient, |
33 public cc::ExternalBeginFrameSourceClient { | 32 public cc::ExternalBeginFrameSourceClient { |
34 public: | 33 public: |
35 class Client { | 34 class Client { |
36 public: | 35 public: |
37 virtual void SetBeginFrameSource( | 36 virtual void SetBeginFrameSource( |
38 cc::BeginFrameSource* begin_frame_source) = 0; | 37 cc::BeginFrameSource* begin_frame_source) = 0; |
39 virtual void DidReceiveCompositorFrameAck() = 0; | 38 virtual void DidReceiveCompositorFrameAck() = 0; |
40 virtual void ReclaimResources(const cc::ReturnedResourceArray&) = 0; | 39 virtual void ReclaimResources(const cc::ReturnedResourceArray&) = 0; |
41 }; | 40 }; |
42 | 41 |
43 DelegatedFrameHostAndroid(ViewAndroid* view, | 42 DelegatedFrameHostAndroid(ViewAndroid* view, |
44 cc::SurfaceManager* surface_manager, | 43 cc::SurfaceManager* surface_manager, |
45 Client* client, | 44 Client* client, |
46 const cc::FrameSinkId& frame_sink_id); | 45 const cc::FrameSinkId& frame_sink_id); |
47 | 46 |
48 ~DelegatedFrameHostAndroid() override; | 47 ~DelegatedFrameHostAndroid() override; |
49 | 48 |
50 void SubmitCompositorFrame(cc::CompositorFrame frame); | 49 void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, |
| 50 cc::CompositorFrame frame); |
51 | 51 |
52 void DestroyDelegatedContent(); | 52 void DestroyDelegatedContent(); |
53 | 53 |
54 bool HasDelegatedContent() const; | 54 bool HasDelegatedContent() const; |
55 | 55 |
56 cc::FrameSinkId GetFrameSinkId() const; | 56 cc::FrameSinkId GetFrameSinkId() const; |
57 | 57 |
58 // Should only be called when the host has a content layer. | 58 // Should only be called when the host has a content layer. |
59 void RequestCopyOfSurface( | 59 void RequestCopyOfSurface( |
60 WindowAndroidCompositor* compositor, | 60 WindowAndroidCompositor* compositor, |
(...skipping 22 matching lines...) Expand all Loading... |
83 void OnNeedsBeginFrames(bool needs_begin_frames) override; | 83 void OnNeedsBeginFrames(bool needs_begin_frames) override; |
84 void OnDidFinishFrame(const cc::BeginFrameAck& ack) override; | 84 void OnDidFinishFrame(const cc::BeginFrameAck& ack) override; |
85 | 85 |
86 void CreateNewCompositorFrameSinkSupport(); | 86 void CreateNewCompositorFrameSinkSupport(); |
87 | 87 |
88 const cc::FrameSinkId frame_sink_id_; | 88 const cc::FrameSinkId frame_sink_id_; |
89 | 89 |
90 ViewAndroid* view_; | 90 ViewAndroid* view_; |
91 | 91 |
92 cc::SurfaceManager* surface_manager_; | 92 cc::SurfaceManager* surface_manager_; |
93 std::unique_ptr<cc::LocalSurfaceIdAllocator> local_surface_id_allocator_; | |
94 WindowAndroidCompositor* registered_parent_compositor_ = nullptr; | 93 WindowAndroidCompositor* registered_parent_compositor_ = nullptr; |
95 Client* client_; | 94 Client* client_; |
96 | 95 |
97 std::unique_ptr<cc::CompositorFrameSinkSupport> support_; | 96 std::unique_ptr<cc::CompositorFrameSinkSupport> support_; |
98 cc::ExternalBeginFrameSource begin_frame_source_; | 97 cc::ExternalBeginFrameSource begin_frame_source_; |
99 | 98 |
100 struct FrameData { | 99 cc::SurfaceInfo surface_info_; |
101 FrameData(); | 100 bool has_transparent_background_ = false; |
102 ~FrameData(); | |
103 | |
104 cc::LocalSurfaceId local_surface_id; | |
105 gfx::Size surface_size; | |
106 float top_controls_height; | |
107 float top_controls_shown_ratio; | |
108 float bottom_controls_height; | |
109 float bottom_controls_shown_ratio; | |
110 cc::Selection<gfx::SelectionBound> viewport_selection; | |
111 bool has_transparent_background; | |
112 }; | |
113 std::unique_ptr<FrameData> current_frame_; | |
114 | 101 |
115 scoped_refptr<cc::SurfaceLayer> content_layer_; | 102 scoped_refptr<cc::SurfaceLayer> content_layer_; |
116 | 103 |
117 DISALLOW_COPY_AND_ASSIGN(DelegatedFrameHostAndroid); | 104 DISALLOW_COPY_AND_ASSIGN(DelegatedFrameHostAndroid); |
118 }; | 105 }; |
119 | 106 |
120 } // namespace ui | 107 } // namespace ui |
121 | 108 |
122 #endif // UI_ANDROID_DELEGATED_FRAME_HOST_ANDROID_H_ | 109 #endif // UI_ANDROID_DELEGATED_FRAME_HOST_ANDROID_H_ |
OLD | NEW |