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

Side by Side Diff: cc/trees/single_thread_proxy.cc

Issue 12519006: cc:: Add RenderingStatsInstrumentation to manage collection of RenderingStats (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Updated all tests Created 7 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
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | cc/trees/thread_proxy.h » ('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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 #include "cc/trees/single_thread_proxy.h" 5 #include "cc/trees/single_thread_proxy.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "cc/base/thread.h" 9 #include "cc/base/thread.h"
10 #include "cc/output/context_provider.h" 10 #include "cc/output/context_provider.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 offscreen_context_provider->VerifyContexts(); 164 offscreen_context_provider->VerifyContexts();
165 } 165 }
166 } 166 }
167 167
168 if (initialized) 168 if (initialized)
169 output_surface_lost_ = false; 169 output_surface_lost_ = false;
170 170
171 return initialized; 171 return initialized;
172 } 172 }
173 173
174 void SingleThreadProxy::CollectRenderingStats(RenderingStats* stats) {
175 stats->totalCommitTime = total_commit_time_;
176 stats->totalCommitCount = total_commit_count_;
177 layer_tree_host_impl_->CollectRenderingStats(stats);
178 }
179
180 const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const { 174 const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const {
181 DCHECK(renderer_initialized_); 175 DCHECK(renderer_initialized_);
182 // Note: this gets called during the commit by the "impl" thread. 176 // Note: this gets called during the commit by the "impl" thread.
183 return renderer_capabilities_for_main_thread_; 177 return renderer_capabilities_for_main_thread_;
184 } 178 }
185 179
186 void SingleThreadProxy::SetNeedsAnimate() { 180 void SingleThreadProxy::SetNeedsAnimate() {
187 // Thread-only feature. 181 // Thread-only feature.
188 NOTREACHED(); 182 NOTREACHED();
189 } 183 }
190 184
191 void SingleThreadProxy::DoCommit(scoped_ptr<ResourceUpdateQueue> queue) { 185 void SingleThreadProxy::DoCommit(scoped_ptr<ResourceUpdateQueue> queue) {
192 DCHECK(Proxy::IsMainThread()); 186 DCHECK(Proxy::IsMainThread());
193 // Commit immediately. 187 // Commit immediately.
194 { 188 {
195 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); 189 DebugScopedSetMainThreadBlocked mainThreadBlocked(this);
196 DebugScopedSetImplThread impl(this); 190 DebugScopedSetImplThread impl(this);
197 191
198 base::TimeTicks startTime = base::TimeTicks::HighResNow(); 192 RenderingStatsInstrumentation* stats_instrumentation =
193 layer_tree_host_->rendering_stats_instrumentation();
194 base::TimeTicks startTime = stats_instrumentation->StartRecording();
195
199 layer_tree_host_impl_->BeginCommit(); 196 layer_tree_host_impl_->BeginCommit();
200 197
201 layer_tree_host_->contents_texture_manager()-> 198 layer_tree_host_->contents_texture_manager()->
202 PushTexturePrioritiesToBackings(); 199 PushTexturePrioritiesToBackings();
203 layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get()); 200 layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get());
204 201
205 scoped_ptr<ResourceUpdateController> updateController = 202 scoped_ptr<ResourceUpdateController> updateController =
206 ResourceUpdateController::Create( 203 ResourceUpdateController::Create(
207 NULL, 204 NULL,
208 Proxy::MainThread(), 205 Proxy::MainThread(),
209 queue.Pass(), 206 queue.Pass(),
210 layer_tree_host_impl_->resource_provider()); 207 layer_tree_host_impl_->resource_provider());
211 updateController->Finalize(); 208 updateController->Finalize();
212 209
213 layer_tree_host_->FinishCommitOnImplThread(layer_tree_host_impl_.get()); 210 layer_tree_host_->FinishCommitOnImplThread(layer_tree_host_impl_.get());
214 211
215 layer_tree_host_impl_->CommitComplete(); 212 layer_tree_host_impl_->CommitComplete();
216 213
217 #ifndef NDEBUG 214 #ifndef NDEBUG
218 // In the single-threaded case, the scroll deltas should never be 215 // In the single-threaded case, the scroll deltas should never be
219 // touched on the impl layer tree. 216 // touched on the impl layer tree.
220 scoped_ptr<ScrollAndScaleSet> scrollInfo = 217 scoped_ptr<ScrollAndScaleSet> scrollInfo =
221 layer_tree_host_impl_->ProcessScrollDeltas(); 218 layer_tree_host_impl_->ProcessScrollDeltas();
222 DCHECK(!scrollInfo->scrolls.size()); 219 DCHECK(!scrollInfo->scrolls.size());
223 #endif 220 #endif
224 221
225 base::TimeTicks endTime = base::TimeTicks::HighResNow(); 222 base::TimeDelta duration = stats_instrumentation->EndRecording(startTime);
226 total_commit_time_ += endTime - startTime; 223 stats_instrumentation->AddCommit(duration);
227 total_commit_count_++;
228 } 224 }
229 layer_tree_host_->CommitComplete(); 225 layer_tree_host_->CommitComplete();
230 next_frame_is_newly_committed_frame_ = true; 226 next_frame_is_newly_committed_frame_ = true;
231 } 227 }
232 228
233 void SingleThreadProxy::SetNeedsCommit() { 229 void SingleThreadProxy::SetNeedsCommit() {
234 DCHECK(Proxy::IsMainThread()); 230 DCHECK(Proxy::IsMainThread());
235 layer_tree_host_->ScheduleComposite(); 231 layer_tree_host_->ScheduleComposite();
236 } 232 }
237 233
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 446
451 bool SingleThreadProxy::CommitPendingForTesting() { return false; } 447 bool SingleThreadProxy::CommitPendingForTesting() { return false; }
452 448
453 skia::RefPtr<SkPicture> SingleThreadProxy::CapturePicture() { 449 skia::RefPtr<SkPicture> SingleThreadProxy::CapturePicture() {
454 // Impl-side painting only. 450 // Impl-side painting only.
455 NOTREACHED(); 451 NOTREACHED();
456 return skia::RefPtr<SkPicture>(); 452 return skia::RefPtr<SkPicture>();
457 } 453 }
458 454
459 } // namespace cc 455 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | cc/trees/thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698