Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: ui/android/delegated_frame_host_android.h

Issue 2725763003: DelegatedFrameHostAndroid should use CompositorFrameSinkSupport (Closed)
Patch Set: c Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/surface_factory.h" 12 #include "cc/surfaces/compositor_frame_sink_support.h"
13 #include "cc/surfaces/surface_factory_client.h" 13 #include "cc/surfaces/compositor_frame_sink_support_client.h"
14 #include "ui/android/ui_android_export.h" 14 #include "ui/android/ui_android_export.h"
15 #include "ui/gfx/selection_bound.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; 22 class LocalSurfaceIdAllocator;
23 enum class SurfaceDrawStatus; 23 enum class SurfaceDrawStatus;
24 24
25 } // namespace cc 25 } // namespace cc
26 26
27 namespace ui { 27 namespace ui {
28 class ViewAndroid; 28 class ViewAndroid;
29 class WindowAndroidCompositor; 29 class WindowAndroidCompositor;
30 30
31 class UI_ANDROID_EXPORT DelegatedFrameHostAndroid 31 class UI_ANDROID_EXPORT DelegatedFrameHostAndroid
32 : public cc::SurfaceFactoryClient { 32 : public cc::CompositorFrameSinkSupportClient,
33 public cc::ExternalBeginFrameSourceClient {
33 public: 34 public:
34 class Client { 35 class Client {
35 public: 36 public:
36 virtual void SetBeginFrameSource( 37 virtual void SetBeginFrameSource(
37 cc::BeginFrameSource* begin_frame_source) = 0; 38 cc::BeginFrameSource* begin_frame_source) = 0;
38 virtual void ReturnResources(const cc::ReturnedResourceArray&) = 0; 39 virtual void DidReceiveCompositorFrameAck() = 0;
40 virtual void ReclaimResources(const cc::ReturnedResourceArray&) = 0;
39 }; 41 };
40 42
41 DelegatedFrameHostAndroid(ViewAndroid* view, 43 DelegatedFrameHostAndroid(ViewAndroid* view,
42 cc::SurfaceManager* surface_manager, 44 cc::SurfaceManager* surface_manager,
43 Client* client, 45 Client* client,
44 const cc::FrameSinkId& frame_sink_id); 46 const cc::FrameSinkId& frame_sink_id);
45 47
46 ~DelegatedFrameHostAndroid() override; 48 ~DelegatedFrameHostAndroid() override;
47 49
48 void SubmitCompositorFrame(cc::CompositorFrame frame, 50 void SubmitCompositorFrame(cc::CompositorFrame frame);
49 cc::SurfaceFactory::DrawCallback draw_callback);
50 51
51 void DestroyDelegatedContent(); 52 void DestroyDelegatedContent();
52 53
53 bool HasDelegatedContent() const; 54 bool HasDelegatedContent() const;
54 55
55 cc::FrameSinkId GetFrameSinkId() const; 56 cc::FrameSinkId GetFrameSinkId() const;
56 57
57 // Should only be called when the host has a content layer. 58 // Should only be called when the host has a content layer.
58 void RequestCopyOfSurface( 59 void RequestCopyOfSurface(
59 WindowAndroidCompositor* compositor, 60 WindowAndroidCompositor* compositor,
60 const gfx::Rect& src_subrect_in_pixel, 61 const gfx::Rect& src_subrect_in_pixel,
61 cc::CopyOutputRequest::CopyOutputRequestCallback result_callback); 62 cc::CopyOutputRequest::CopyOutputRequestCallback result_callback);
62 63
63 void CompositorFrameSinkChanged(); 64 void CompositorFrameSinkChanged();
64 65
65 // Called when this DFH is attached/detached from a parent browser compositor 66 // Called when this DFH is attached/detached from a parent browser compositor
66 // and needs to be attached to the surface hierarchy. 67 // and needs to be attached to the surface hierarchy.
67 void AttachToCompositor(WindowAndroidCompositor* compositor); 68 void AttachToCompositor(WindowAndroidCompositor* compositor);
68 void DetachFromCompositor(); 69 void DetachFromCompositor();
69 70
70 private: 71 private:
71 // cc::SurfaceFactoryClient implementation. 72 // cc::CompositorFrameSinkSupportClient implementation.
72 void ReturnResources(const cc::ReturnedResourceArray& resources) override; 73 void DidReceiveCompositorFrameAck() override;
73 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; 74 void OnBeginFrame(const cc::BeginFrameArgs& args) override;
75 void ReclaimResources(const cc::ReturnedResourceArray& resources) override;
76 void WillDrawSurface(const cc::LocalSurfaceId& local_surface_id,
77 const gfx::Rect& damage_rect) override;
78
79 // cc::ExternalBeginFrameSourceClient implementation.
80 void OnNeedsBeginFrames(bool needs_begin_frames) override;
81 void OnDidFinishFrame(const cc::BeginFrameAck& ack) override;
82
83 void CreateNewCompositorFrameSinkSupport();
74 84
75 const cc::FrameSinkId frame_sink_id_; 85 const cc::FrameSinkId frame_sink_id_;
76 86
77 ViewAndroid* view_; 87 ViewAndroid* view_;
78 88
79 cc::SurfaceManager* surface_manager_; 89 cc::SurfaceManager* surface_manager_;
80 std::unique_ptr<cc::LocalSurfaceIdAllocator> local_surface_id_allocator_; 90 std::unique_ptr<cc::LocalSurfaceIdAllocator> local_surface_id_allocator_;
81 WindowAndroidCompositor* registered_parent_compositor_ = nullptr; 91 WindowAndroidCompositor* registered_parent_compositor_ = nullptr;
82 Client* client_; 92 Client* client_;
83 93
84 std::unique_ptr<cc::SurfaceFactory> surface_factory_; 94 std::unique_ptr<cc::CompositorFrameSinkSupport> support_;
95 cc::ExternalBeginFrameSource begin_frame_source_;
85 96
86 struct FrameData { 97 struct FrameData {
87 FrameData(); 98 FrameData();
88 ~FrameData(); 99 ~FrameData();
89 100
90 cc::LocalSurfaceId local_surface_id; 101 cc::LocalSurfaceId local_surface_id;
91 gfx::Size surface_size; 102 gfx::Size surface_size;
92 float top_controls_height; 103 float top_controls_height;
93 float top_controls_shown_ratio; 104 float top_controls_shown_ratio;
94 float bottom_controls_height; 105 float bottom_controls_height;
95 float bottom_controls_shown_ratio; 106 float bottom_controls_shown_ratio;
96 cc::Selection<gfx::SelectionBound> viewport_selection; 107 cc::Selection<gfx::SelectionBound> viewport_selection;
97 bool has_transparent_background; 108 bool has_transparent_background;
98 }; 109 };
99 std::unique_ptr<FrameData> current_frame_; 110 std::unique_ptr<FrameData> current_frame_;
100 111
101 scoped_refptr<cc::SurfaceLayer> content_layer_; 112 scoped_refptr<cc::SurfaceLayer> content_layer_;
102 113
103 DISALLOW_COPY_AND_ASSIGN(DelegatedFrameHostAndroid); 114 DISALLOW_COPY_AND_ASSIGN(DelegatedFrameHostAndroid);
104 }; 115 };
105 116
106 } // namespace ui 117 } // namespace ui
107 118
108 #endif // UI_ANDROID_DELEGATED_FRAME_HOST_ANDROID_H_ 119 #endif // UI_ANDROID_DELEGATED_FRAME_HOST_ANDROID_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.cc ('k') | ui/android/delegated_frame_host_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698