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

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

Issue 149053006: cc: Add TRACE_EVENTs to SingleThreadProxy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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/debug/benchmark_instrumentation.h" 9 #include "cc/debug/benchmark_instrumentation.h"
10 #include "cc/output/context_provider.h" 10 #include "cc/output/context_provider.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 if (layer_tree_host_impl_->IsContextLost()) 77 if (layer_tree_host_impl_->IsContextLost())
78 return false; 78 return false;
79 } 79 }
80 80
81 return true; 81 return true;
82 } 82 }
83 83
84 void SingleThreadProxy::FinishAllRendering() { 84 void SingleThreadProxy::FinishAllRendering() {
85 DCHECK(Proxy::IsMainThread()); 85 DCHECK(Proxy::IsMainThread());
86 TRACE_EVENT0("cc", "SingleThreadProxy::FinishAllRendering");
enne (OOO) 2014/01/30 00:03:18 nit: put this trace before the DCHECK for consiste
danakj 2014/01/30 00:06:25 Oh I did it after for consistency with what I saw
86 { 87 {
87 DebugScopedSetImplThread impl(this); 88 DebugScopedSetImplThread impl(this);
88 layer_tree_host_impl_->FinishAllRendering(); 89 layer_tree_host_impl_->FinishAllRendering();
89 } 90 }
90 } 91 }
91 92
92 bool SingleThreadProxy::IsStarted() const { 93 bool SingleThreadProxy::IsStarted() const {
93 DCHECK(Proxy::IsMainThread()); 94 DCHECK(Proxy::IsMainThread());
94 return layer_tree_host_impl_; 95 return layer_tree_host_impl_;
95 } 96 }
96 97
97 void SingleThreadProxy::SetLayerTreeHostClientReady() { 98 void SingleThreadProxy::SetLayerTreeHostClientReady() {
99 TRACE_EVENT0("cc", "SingleThreadProxy::SetLayerTreeHostClientReady");
98 // Scheduling is controlled by the embedder in the single thread case, so 100 // Scheduling is controlled by the embedder in the single thread case, so
99 // nothing to do. 101 // nothing to do.
100 } 102 }
101 103
102 void SingleThreadProxy::SetVisible(bool visible) { 104 void SingleThreadProxy::SetVisible(bool visible) {
105 TRACE_EVENT0("cc", "SingleThreadProxy::SetVisible");
103 DebugScopedSetImplThread impl(this); 106 DebugScopedSetImplThread impl(this);
104 layer_tree_host_impl_->SetVisible(visible); 107 layer_tree_host_impl_->SetVisible(visible);
105 108
106 // Changing visibility could change ShouldComposite(). 109 // Changing visibility could change ShouldComposite().
107 UpdateBackgroundAnimateTicking(); 110 UpdateBackgroundAnimateTicking();
108 } 111 }
109 112
110 void SingleThreadProxy::CreateAndInitializeOutputSurface() { 113 void SingleThreadProxy::CreateAndInitializeOutputSurface() {
111 TRACE_EVENT0( 114 TRACE_EVENT0(
112 "cc", "SingleThreadProxy::CreateAndInitializeOutputSurface"); 115 "cc", "SingleThreadProxy::CreateAndInitializeOutputSurface");
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 172 }
170 } 173 }
171 174
172 const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const { 175 const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const {
173 DCHECK(Proxy::IsMainThread()); 176 DCHECK(Proxy::IsMainThread());
174 DCHECK(!layer_tree_host_->output_surface_lost()); 177 DCHECK(!layer_tree_host_->output_surface_lost());
175 return renderer_capabilities_for_main_thread_; 178 return renderer_capabilities_for_main_thread_;
176 } 179 }
177 180
178 void SingleThreadProxy::SetNeedsAnimate() { 181 void SingleThreadProxy::SetNeedsAnimate() {
182 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsAnimate");
179 DCHECK(Proxy::IsMainThread()); 183 DCHECK(Proxy::IsMainThread());
180 client_->ScheduleAnimation(); 184 client_->ScheduleAnimation();
181 } 185 }
182 186
183 void SingleThreadProxy::SetNeedsUpdateLayers() { 187 void SingleThreadProxy::SetNeedsUpdateLayers() {
188 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsUpdateLayers");
184 DCHECK(Proxy::IsMainThread()); 189 DCHECK(Proxy::IsMainThread());
185 client_->ScheduleComposite(); 190 client_->ScheduleComposite();
186 } 191 }
187 192
188 void SingleThreadProxy::DoCommit(scoped_ptr<ResourceUpdateQueue> queue) { 193 void SingleThreadProxy::DoCommit(scoped_ptr<ResourceUpdateQueue> queue) {
189 DCHECK(Proxy::IsMainThread()); 194 DCHECK(Proxy::IsMainThread());
195 TRACE_EVENT0("cc", "SingleThreadProxy::DoCommit");
190 // Commit immediately. 196 // Commit immediately.
191 { 197 {
192 DebugScopedSetMainThreadBlocked main_thread_blocked(this); 198 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
193 DebugScopedSetImplThread impl(this); 199 DebugScopedSetImplThread impl(this);
194 200
195 // This CapturePostTasks should be destroyed before CommitComplete() is 201 // This CapturePostTasks should be destroyed before CommitComplete() is
196 // called since that goes out to the embedder, and we want the embedder 202 // called since that goes out to the embedder, and we want the embedder
197 // to receive its callbacks before that. 203 // to receive its callbacks before that.
198 BlockingTaskRunner::CapturePostTasks blocked; 204 BlockingTaskRunner::CapturePostTasks blocked;
199 205
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 layer_tree_host_->CommitComplete(); 244 layer_tree_host_->CommitComplete();
239 next_frame_is_newly_committed_frame_ = true; 245 next_frame_is_newly_committed_frame_ = true;
240 } 246 }
241 247
242 void SingleThreadProxy::SetNeedsCommit() { 248 void SingleThreadProxy::SetNeedsCommit() {
243 DCHECK(Proxy::IsMainThread()); 249 DCHECK(Proxy::IsMainThread());
244 client_->ScheduleComposite(); 250 client_->ScheduleComposite();
245 } 251 }
246 252
247 void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { 253 void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) {
254 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsRedraw");
248 SetNeedsRedrawRectOnImplThread(damage_rect); 255 SetNeedsRedrawRectOnImplThread(damage_rect);
249 client_->ScheduleComposite(); 256 client_->ScheduleComposite();
250 } 257 }
251 258
252 void SingleThreadProxy::SetNextCommitWaitsForActivation() { 259 void SingleThreadProxy::SetNextCommitWaitsForActivation() {
253 // There is no activation here other than commit. So do nothing. 260 // There is no activation here other than commit. So do nothing.
254 } 261 }
255 262
256 void SingleThreadProxy::SetDeferCommits(bool defer_commits) { 263 void SingleThreadProxy::SetDeferCommits(bool defer_commits) {
257 // Thread-only feature. 264 // Thread-only feature.
(...skipping 16 matching lines...) Expand all
274 DebugScopedSetImplThread impl(this); 281 DebugScopedSetImplThread impl(this);
275 282
276 layer_tree_host_->DeleteContentsTexturesOnImplThread( 283 layer_tree_host_->DeleteContentsTexturesOnImplThread(
277 layer_tree_host_impl_->resource_provider()); 284 layer_tree_host_impl_->resource_provider());
278 layer_tree_host_impl_.reset(); 285 layer_tree_host_impl_.reset();
279 } 286 }
280 layer_tree_host_ = NULL; 287 layer_tree_host_ = NULL;
281 } 288 }
282 289
283 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { 290 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) {
291 TRACE_EVENT1(
292 "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw);
284 DCHECK(Proxy::IsImplThread()); 293 DCHECK(Proxy::IsImplThread());
285 UpdateBackgroundAnimateTicking(); 294 UpdateBackgroundAnimateTicking();
286 } 295 }
287 296
288 void SingleThreadProxy::NotifyReadyToActivate() { 297 void SingleThreadProxy::NotifyReadyToActivate() {
289 // Thread-only feature. 298 // Thread-only feature.
290 NOTREACHED(); 299 NOTREACHED();
291 } 300 }
292 301
293 void SingleThreadProxy::SetNeedsRedrawOnImplThread() { 302 void SingleThreadProxy::SetNeedsRedrawOnImplThread() {
(...skipping 20 matching lines...) Expand all
314 } 323 }
315 324
316 void SingleThreadProxy::SetNeedsCommitOnImplThread() { 325 void SingleThreadProxy::SetNeedsCommitOnImplThread() {
317 client_->ScheduleComposite(); 326 client_->ScheduleComposite();
318 } 327 }
319 328
320 void SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread( 329 void SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread(
321 scoped_ptr<AnimationEventsVector> events, 330 scoped_ptr<AnimationEventsVector> events,
322 base::Time wall_clock_time) { 331 base::Time wall_clock_time) {
323 DCHECK(Proxy::IsImplThread()); 332 DCHECK(Proxy::IsImplThread());
333 TRACE_EVENT0(
334 "cc", "SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread");
324 DebugScopedSetMainThread main(this); 335 DebugScopedSetMainThread main(this);
325 layer_tree_host_->SetAnimationEvents(events.Pass(), wall_clock_time); 336 layer_tree_host_->SetAnimationEvents(events.Pass(), wall_clock_time);
326 } 337 }
327 338
328 bool SingleThreadProxy::ReduceContentsTextureMemoryOnImplThread( 339 bool SingleThreadProxy::ReduceContentsTextureMemoryOnImplThread(
329 size_t limit_bytes, 340 size_t limit_bytes,
330 int priority_cutoff) { 341 int priority_cutoff) {
331 DCHECK(IsImplThread()); 342 DCHECK(IsImplThread());
332 PrioritizedResourceManager* contents_texture_manager = 343 PrioritizedResourceManager* contents_texture_manager =
333 layer_tree_host_->contents_texture_manager(); 344 layer_tree_host_->contents_texture_manager();
(...skipping 19 matching lines...) Expand all
353 364
354 layer_tree_host_impl_->SendManagedMemoryStats( 365 layer_tree_host_impl_->SendManagedMemoryStats(
355 contents_texture_manager->MemoryVisibleBytes(), 366 contents_texture_manager->MemoryVisibleBytes(),
356 contents_texture_manager->MemoryVisibleAndNearbyBytes(), 367 contents_texture_manager->MemoryVisibleAndNearbyBytes(),
357 contents_texture_manager->MemoryUseBytes()); 368 contents_texture_manager->MemoryUseBytes());
358 } 369 }
359 370
360 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } 371 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; }
361 372
362 void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() { 373 void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() {
374 TRACE_EVENT0("cc", "SingleThreadProxy::DidLoseOutputSurfaceOnImplThread");
363 // Cause a commit so we can notice the lost context. 375 // Cause a commit so we can notice the lost context.
364 SetNeedsCommitOnImplThread(); 376 SetNeedsCommitOnImplThread();
365 client_->DidAbortSwapBuffers(); 377 client_->DidAbortSwapBuffers();
366 } 378 }
367 379
368 void SingleThreadProxy::DidSwapBuffersOnImplThread() { 380 void SingleThreadProxy::DidSwapBuffersOnImplThread() {
369 client_->DidPostSwapBuffers(); 381 client_->DidPostSwapBuffers();
370 } 382 }
371 383
372 void SingleThreadProxy::OnSwapBuffersCompleteOnImplThread() { 384 void SingleThreadProxy::OnSwapBuffersCompleteOnImplThread() {
385 TRACE_EVENT0("cc", "SingleThreadProxy::OnSwapBuffersCompleteOnImplThread");
373 client_->DidCompleteSwapBuffers(); 386 client_->DidCompleteSwapBuffers();
374 } 387 }
375 388
376 // Called by the legacy scheduling path (e.g. where render_widget does the 389 // Called by the legacy scheduling path (e.g. where render_widget does the
377 // scheduling) 390 // scheduling)
378 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { 391 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) {
392 TRACE_EVENT0("cc", "SingleThreadProxy::CompositeImmediately");
379 gfx::Rect device_viewport_damage_rect; 393 gfx::Rect device_viewport_damage_rect;
380 394
381 LayerTreeHostImpl::FrameData frame; 395 LayerTreeHostImpl::FrameData frame;
382 if (CommitAndComposite(frame_begin_time, 396 if (CommitAndComposite(frame_begin_time,
383 device_viewport_damage_rect, 397 device_viewport_damage_rect,
384 false, // for_readback 398 false, // for_readback
385 &frame)) { 399 &frame)) {
386 { 400 {
387 DebugScopedSetMainThreadBlocked main_thread_blocked(this); 401 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
388 DebugScopedSetImplThread impl(this); 402 DebugScopedSetImplThread impl(this);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 } 439 }
426 } 440 }
427 } 441 }
428 442
429 bool SingleThreadProxy::CommitAndComposite( 443 bool SingleThreadProxy::CommitAndComposite(
430 base::TimeTicks frame_begin_time, 444 base::TimeTicks frame_begin_time,
431 const gfx::Rect& device_viewport_damage_rect, 445 const gfx::Rect& device_viewport_damage_rect,
432 bool for_readback, 446 bool for_readback,
433 LayerTreeHostImpl::FrameData* frame) { 447 LayerTreeHostImpl::FrameData* frame) {
434 DCHECK(Proxy::IsMainThread()); 448 DCHECK(Proxy::IsMainThread());
449 TRACE_EVENT0("cc", "SingleThreadProxy::CommitAndComposite");
435 450
436 if (!layer_tree_host_->InitializeOutputSurfaceIfNeeded()) 451 if (!layer_tree_host_->InitializeOutputSurfaceIfNeeded())
437 return false; 452 return false;
438 453
439 layer_tree_host_->AnimateLayers(frame_begin_time); 454 layer_tree_host_->AnimateLayers(frame_begin_time);
440 455
441 if (PrioritizedResourceManager* contents_texture_manager = 456 if (PrioritizedResourceManager* contents_texture_manager =
442 layer_tree_host_->contents_texture_manager()) { 457 layer_tree_host_->contents_texture_manager()) {
443 contents_texture_manager->UnlinkAndClearEvictedBackings(); 458 contents_texture_manager->UnlinkAndClearEvictedBackings();
444 contents_texture_manager->SetMaxMemoryLimitBytes( 459 contents_texture_manager->SetMaxMemoryLimitBytes(
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 !ShouldComposite() && layer_tree_host_impl_->active_tree()->root_layer()); 503 !ShouldComposite() && layer_tree_host_impl_->active_tree()->root_layer());
489 } 504 }
490 505
491 bool SingleThreadProxy::DoComposite( 506 bool SingleThreadProxy::DoComposite(
492 scoped_refptr<ContextProvider> offscreen_context_provider, 507 scoped_refptr<ContextProvider> offscreen_context_provider,
493 base::TimeTicks frame_begin_time, 508 base::TimeTicks frame_begin_time,
494 const gfx::Rect& device_viewport_damage_rect, 509 const gfx::Rect& device_viewport_damage_rect,
495 bool for_readback, 510 bool for_readback,
496 LayerTreeHostImpl::FrameData* frame) { 511 LayerTreeHostImpl::FrameData* frame) {
497 DCHECK(!layer_tree_host_->output_surface_lost()); 512 DCHECK(!layer_tree_host_->output_surface_lost());
513 TRACE_EVENT0("cc", "SingleThreadProxy::DoComposite");
498 514
499 bool lost_output_surface = false; 515 bool lost_output_surface = false;
500 { 516 {
501 DebugScopedSetImplThread impl(this); 517 DebugScopedSetImplThread impl(this);
502 base::AutoReset<bool> mark_inside(&inside_draw_, true); 518 base::AutoReset<bool> mark_inside(&inside_draw_, true);
503 519
504 layer_tree_host_impl_->SetOffscreenContextProvider( 520 layer_tree_host_impl_->SetOffscreenContextProvider(
505 offscreen_context_provider); 521 offscreen_context_provider);
506 522
507 bool can_do_readback = layer_tree_host_impl_->renderer()->CanReadPixels(); 523 bool can_do_readback = layer_tree_host_impl_->renderer()->CanReadPixels();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 void SingleThreadProxy::DidSwapFrame() { 564 void SingleThreadProxy::DidSwapFrame() {
549 if (next_frame_is_newly_committed_frame_) { 565 if (next_frame_is_newly_committed_frame_) {
550 next_frame_is_newly_committed_frame_ = false; 566 next_frame_is_newly_committed_frame_ = false;
551 layer_tree_host_->DidCommitAndDrawFrame(); 567 layer_tree_host_->DidCommitAndDrawFrame();
552 } 568 }
553 } 569 }
554 570
555 bool SingleThreadProxy::CommitPendingForTesting() { return false; } 571 bool SingleThreadProxy::CommitPendingForTesting() { return false; }
556 572
557 } // namespace cc 573 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698