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

Side by Side Diff: content/browser/renderer_host/compositor_impl_android.h

Issue 2527283003: cc: Introduce BeginFrame sequence numbers and acknowledgements.
Patch Set: Address Brian's comments. Created 4 years 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // ----------------------------------------------------------------------------- 46 // -----------------------------------------------------------------------------
47 // Browser-side compositor that manages a tree of content and UI layers. 47 // Browser-side compositor that manages a tree of content and UI layers.
48 // ----------------------------------------------------------------------------- 48 // -----------------------------------------------------------------------------
49 class CONTENT_EXPORT CompositorImpl 49 class CONTENT_EXPORT CompositorImpl
50 : public Compositor, 50 : public Compositor,
51 public cc::LayerTreeHostClient, 51 public cc::LayerTreeHostClient,
52 public cc::LayerTreeHostSingleThreadClient, 52 public cc::LayerTreeHostSingleThreadClient,
53 public ui::UIResourceProvider, 53 public ui::UIResourceProvider,
54 public ui::WindowAndroidCompositor { 54 public ui::WindowAndroidCompositor {
55 public: 55 public:
56 class VSyncObserver {
57 public:
58 virtual void OnVSync(base::TimeTicks timebase,
59 base::TimeDelta interval) = 0;
60 };
61
62 CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window); 56 CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window);
63 ~CompositorImpl() override; 57 ~CompositorImpl() override;
64 58
65 static bool IsInitialized(); 59 static bool IsInitialized();
66 60
67 void AddObserver(VSyncObserver* observer);
68 void RemoveObserver(VSyncObserver* observer);
69 void OnNeedsBeginFramesChange(bool needs_begin_frames);
70
71 // ui::ResourceProvider implementation. 61 // ui::ResourceProvider implementation.
72 cc::UIResourceId CreateUIResource(cc::UIResourceClient* client) override; 62 cc::UIResourceId CreateUIResource(cc::UIResourceClient* client) override;
73 void DeleteUIResource(cc::UIResourceId resource_id) override; 63 void DeleteUIResource(cc::UIResourceId resource_id) override;
74 bool SupportsETC1NonPowerOfTwo() const override; 64 bool SupportsETC1NonPowerOfTwo() const override;
75 65
76 private: 66 private:
77 // Compositor implementation. 67 // Compositor implementation.
78 void SetRootLayer(scoped_refptr<cc::Layer> root) override; 68 void SetRootLayer(scoped_refptr<cc::Layer> root) override;
79 void SetSurface(jobject surface) override; 69 void SetSurface(jobject surface) override;
80 void setDeviceScaleFactor(float factor) override; 70 void setDeviceScaleFactor(float factor) override;
(...skipping 24 matching lines...) Expand all
105 void DidCompletePageScaleAnimation() override {} 95 void DidCompletePageScaleAnimation() override {}
106 96
107 // LayerTreeHostSingleThreadClient implementation. 97 // LayerTreeHostSingleThreadClient implementation.
108 void DidSubmitCompositorFrame() override; 98 void DidSubmitCompositorFrame() override;
109 void DidLoseCompositorFrameSink() override; 99 void DidLoseCompositorFrameSink() override;
110 100
111 // WindowAndroidCompositor implementation. 101 // WindowAndroidCompositor implementation.
112 void AttachLayerForReadback(scoped_refptr<cc::Layer> layer) override; 102 void AttachLayerForReadback(scoped_refptr<cc::Layer> layer) override;
113 void RequestCopyOfOutputOnRootLayer( 103 void RequestCopyOfOutputOnRootLayer(
114 std::unique_ptr<cc::CopyOutputRequest> request) override; 104 std::unique_ptr<cc::CopyOutputRequest> request) override;
115 void OnVSync(base::TimeTicks frame_time,
116 base::TimeDelta vsync_period) override;
117 void SetNeedsAnimate() override; 105 void SetNeedsAnimate() override;
118 cc::FrameSinkId GetFrameSinkId() override; 106 cc::FrameSinkId GetFrameSinkId() override;
119 107
120 void SetVisible(bool visible); 108 void SetVisible(bool visible);
121 void CreateLayerTreeHost(); 109 void CreateLayerTreeHost();
122 110
123 void HandlePendingCompositorFrameSinkRequest(); 111 void HandlePendingCompositorFrameSinkRequest();
124 112
125 #if defined(ENABLE_VULKAN) 113 #if defined(ENABLE_VULKAN)
126 void CreateVulkanOutputSurface(); 114 void CreateVulkanOutputSurface();
(...skipping 12 matching lines...) Expand all
139 cc::FrameSinkId frame_sink_id_; 127 cc::FrameSinkId frame_sink_id_;
140 128
141 // root_layer_ is the persistent internal root layer, while subroot_layer_ 129 // root_layer_ is the persistent internal root layer, while subroot_layer_
142 // is the one attached by the compositor client. 130 // is the one attached by the compositor client.
143 scoped_refptr<cc::Layer> subroot_layer_; 131 scoped_refptr<cc::Layer> subroot_layer_;
144 132
145 // Subtree for hidden layers with CopyOutputRequests on them. 133 // Subtree for hidden layers with CopyOutputRequests on them.
146 scoped_refptr<cc::Layer> readback_layer_tree_; 134 scoped_refptr<cc::Layer> readback_layer_tree_;
147 135
148 // Destruction order matters here: 136 // Destruction order matters here:
149 base::ObserverList<VSyncObserver, true> observer_list_;
150 std::unique_ptr<cc::AnimationHost> animation_host_; 137 std::unique_ptr<cc::AnimationHost> animation_host_;
151 std::unique_ptr<cc::LayerTreeHost> host_; 138 std::unique_ptr<cc::LayerTreeHost> host_;
152 ui::ResourceManagerImpl resource_manager_; 139 ui::ResourceManagerImpl resource_manager_;
153 140
154 std::unique_ptr<cc::Display> display_; 141 std::unique_ptr<cc::Display> display_;
155 142
156 gfx::Size size_; 143 gfx::Size size_;
157 bool has_transparent_background_; 144 bool has_transparent_background_;
158 float device_scale_factor_; 145 float device_scale_factor_;
159 146
(...skipping 13 matching lines...) Expand all
173 160
174 size_t num_successive_context_creation_failures_; 161 size_t num_successive_context_creation_failures_;
175 162
176 // Whether there is an CompositorFrameSink request pending from the current 163 // Whether there is an CompositorFrameSink request pending from the current
177 // |host_|. Becomes |true| if RequestNewCompositorFrameSink is called, and 164 // |host_|. Becomes |true| if RequestNewCompositorFrameSink is called, and
178 // |false| if |host_| is deleted or we succeed in creating *and* initializing 165 // |false| if |host_| is deleted or we succeed in creating *and* initializing
179 // a CompositorFrameSink (which is essentially the contract with cc). 166 // a CompositorFrameSink (which is essentially the contract with cc).
180 bool compositor_frame_sink_request_pending_; 167 bool compositor_frame_sink_request_pending_;
181 168
182 gpu::Capabilities gpu_capabilities_; 169 gpu::Capabilities gpu_capabilities_;
183 bool needs_begin_frames_;
184 base::WeakPtrFactory<CompositorImpl> weak_factory_; 170 base::WeakPtrFactory<CompositorImpl> weak_factory_;
185 171
186 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); 172 DISALLOW_COPY_AND_ASSIGN(CompositorImpl);
187 }; 173 };
188 174
189 } // namespace content 175 } // namespace content
190 176
191 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ 177 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/browser_compositor_view_mac.mm ('k') | content/browser/renderer_host/compositor_impl_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698