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

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

Issue 903933005: Android: Fix GPU recovery issues (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | content/browser/renderer_host/compositor_impl_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/cancelable_callback.h" 9 #include "base/cancelable_callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 void Layout() override; 69 void Layout() override;
70 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, 70 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
71 const gfx::Vector2dF& outer_delta, 71 const gfx::Vector2dF& outer_delta,
72 const gfx::Vector2dF& elastic_overscroll_delta, 72 const gfx::Vector2dF& elastic_overscroll_delta,
73 float page_scale, 73 float page_scale,
74 float top_controls_delta) override {} 74 float top_controls_delta) override {}
75 void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta, 75 void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta,
76 float page_scale, 76 float page_scale,
77 float top_controls_delta) override {} 77 float top_controls_delta) override {}
78 void RequestNewOutputSurface() override; 78 void RequestNewOutputSurface() override;
79 void DidInitializeOutputSurface() override {} 79 void DidInitializeOutputSurface() override;
80 void DidFailToInitializeOutputSurface() override; 80 void DidFailToInitializeOutputSurface() override;
81 void WillCommit() override {} 81 void WillCommit() override {}
82 void DidCommit() override; 82 void DidCommit() override;
83 void DidCommitAndDrawFrame() override {} 83 void DidCommitAndDrawFrame() override {}
84 void DidCompleteSwapBuffers() override; 84 void DidCompleteSwapBuffers() override;
85 void DidCompletePageScaleAnimation() override {} 85 void DidCompletePageScaleAnimation() override {}
86 86
87 // LayerTreeHostSingleThreadClient implementation. 87 // LayerTreeHostSingleThreadClient implementation.
88 void ScheduleComposite() override; 88 void ScheduleComposite() override;
89 void ScheduleAnimation() override; 89 void ScheduleAnimation() override;
(...skipping 22 matching lines...) Expand all
112 bool WillCompositeThisFrame() const { 112 bool WillCompositeThisFrame() const {
113 return current_composite_task_ && 113 return current_composite_task_ &&
114 !current_composite_task_->callback().is_null(); 114 !current_composite_task_->callback().is_null();
115 } 115 }
116 bool DidCompositeThisFrame() const { 116 bool DidCompositeThisFrame() const {
117 return current_composite_task_ && 117 return current_composite_task_ &&
118 current_composite_task_->callback().is_null(); 118 current_composite_task_->callback().is_null();
119 } 119 }
120 bool WillComposite() const { 120 bool WillComposite() const {
121 return WillCompositeThisFrame() || 121 return WillCompositeThisFrame() ||
122 composite_on_vsync_trigger_ != DO_NOT_COMPOSITE || 122 composite_on_vsync_trigger_ != DO_NOT_COMPOSITE;
123 defer_composite_for_gpu_channel_;
124 } 123 }
125 void CancelComposite() { 124 void CancelComposite() {
126 DCHECK(WillComposite()); 125 DCHECK(WillComposite());
127 if (WillCompositeThisFrame()) 126 if (WillCompositeThisFrame())
128 current_composite_task_->Cancel(); 127 current_composite_task_->Cancel();
129 current_composite_task_.reset(); 128 current_composite_task_.reset();
130 composite_on_vsync_trigger_ = DO_NOT_COMPOSITE; 129 composite_on_vsync_trigger_ = DO_NOT_COMPOSITE;
131 will_composite_immediately_ = false; 130 will_composite_immediately_ = false;
132 } 131 }
133 void CreateLayerTreeHost(); 132 void CreateLayerTreeHost();
134 void OnGpuChannelEstablished();
135 133
136 // root_layer_ is the persistent internal root layer, while subroot_layer_ 134 // root_layer_ is the persistent internal root layer, while subroot_layer_
137 // is the one attached by the compositor client. 135 // is the one attached by the compositor client.
138 scoped_refptr<cc::Layer> root_layer_; 136 scoped_refptr<cc::Layer> root_layer_;
139 scoped_refptr<cc::Layer> subroot_layer_; 137 scoped_refptr<cc::Layer> subroot_layer_;
140 138
141 scoped_ptr<cc::LayerTreeHost> host_; 139 scoped_ptr<cc::LayerTreeHost> host_;
142 ui::UIResourceProvider ui_resource_provider_; 140 ui::UIResourceProvider ui_resource_provider_;
143 ui::ResourceManagerImpl resource_manager_; 141 ui::ResourceManagerImpl resource_manager_;
144 142
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // How we should schedule Composite during the next vsync. 174 // How we should schedule Composite during the next vsync.
177 CompositingTrigger composite_on_vsync_trigger_; 175 CompositingTrigger composite_on_vsync_trigger_;
178 176
179 // The Composite operation scheduled for the current vsync interval. 177 // The Composite operation scheduled for the current vsync interval.
180 scoped_ptr<base::CancelableClosure> current_composite_task_; 178 scoped_ptr<base::CancelableClosure> current_composite_task_;
181 179
182 // The number of SwapBuffer calls that have not returned and ACK'd from 180 // The number of SwapBuffer calls that have not returned and ACK'd from
183 // the GPU thread. 181 // the GPU thread.
184 unsigned int pending_swapbuffers_; 182 unsigned int pending_swapbuffers_;
185 183
186 // Whether we are currently deferring a requested Composite operation until 184 size_t num_successive_context_creation_failures_;
187 // the GPU channel is established (it was either lost or not yet fully
188 // established the first time we tried to composite).
189 bool defer_composite_for_gpu_channel_;
190 185
191 base::TimeDelta vsync_period_; 186 base::TimeDelta vsync_period_;
192 base::TimeTicks last_vsync_; 187 base::TimeTicks last_vsync_;
193 188
189 // If set, a pending task to request or create a new OutputSurface for the
190 // current host. Cancelled when |host_| gets destroyed, so we don't call
191 // into the new LayerTreeHost with an old LTH's request.
192 scoped_ptr<base::CancelableClosure> output_surface_task_for_host_;
193
194 base::WeakPtrFactory<CompositorImpl> weak_factory_; 194 base::WeakPtrFactory<CompositorImpl> weak_factory_;
195 195
196 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); 196 DISALLOW_COPY_AND_ASSIGN(CompositorImpl);
197 }; 197 };
198 198
199 } // namespace content 199 } // namespace content
200 200
201 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ 201 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/compositor_impl_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698