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

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

Issue 93663004: [#2] Pass gfx structs by const ref (gfx::Rect, gfx::RectF) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT, fix builds on non-linux platforms! Created 6 years, 11 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/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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); 49 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this);
50 } 50 }
51 51
52 SingleThreadProxy::~SingleThreadProxy() { 52 SingleThreadProxy::~SingleThreadProxy() {
53 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy"); 53 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy");
54 DCHECK(Proxy::IsMainThread()); 54 DCHECK(Proxy::IsMainThread());
55 // Make sure Stop() got called or never Started. 55 // Make sure Stop() got called or never Started.
56 DCHECK(!layer_tree_host_impl_); 56 DCHECK(!layer_tree_host_impl_);
57 } 57 }
58 58
59 bool SingleThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) { 59 bool SingleThreadProxy::CompositeAndReadback(void* pixels,
60 const gfx::Rect& rect) {
60 TRACE_EVENT0("cc", "SingleThreadProxy::CompositeAndReadback"); 61 TRACE_EVENT0("cc", "SingleThreadProxy::CompositeAndReadback");
61 DCHECK(Proxy::IsMainThread()); 62 DCHECK(Proxy::IsMainThread());
62 63
63 gfx::Rect device_viewport_damage_rect = rect; 64 gfx::Rect device_viewport_damage_rect = rect;
64 65
65 LayerTreeHostImpl::FrameData frame; 66 LayerTreeHostImpl::FrameData frame;
66 if (!CommitAndComposite(gfx::FrameTime::Now(), 67 if (!CommitAndComposite(gfx::FrameTime::Now(),
67 device_viewport_damage_rect, 68 device_viewport_damage_rect,
68 true, // for_readback 69 true, // for_readback
69 &frame)) 70 &frame))
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 236 }
236 layer_tree_host_->CommitComplete(); 237 layer_tree_host_->CommitComplete();
237 next_frame_is_newly_committed_frame_ = true; 238 next_frame_is_newly_committed_frame_ = true;
238 } 239 }
239 240
240 void SingleThreadProxy::SetNeedsCommit() { 241 void SingleThreadProxy::SetNeedsCommit() {
241 DCHECK(Proxy::IsMainThread()); 242 DCHECK(Proxy::IsMainThread());
242 client_->ScheduleComposite(); 243 client_->ScheduleComposite();
243 } 244 }
244 245
245 void SingleThreadProxy::SetNeedsRedraw(gfx::Rect damage_rect) { 246 void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) {
246 SetNeedsRedrawRectOnImplThread(damage_rect); 247 SetNeedsRedrawRectOnImplThread(damage_rect);
247 client_->ScheduleComposite(); 248 client_->ScheduleComposite();
248 } 249 }
249 250
250 void SingleThreadProxy::SetNextCommitWaitsForActivation() { 251 void SingleThreadProxy::SetNextCommitWaitsForActivation() {
251 // There is no activation here other than commit. So do nothing. 252 // There is no activation here other than commit. So do nothing.
252 } 253 }
253 254
254 void SingleThreadProxy::SetDeferCommits(bool defer_commits) { 255 void SingleThreadProxy::SetDeferCommits(bool defer_commits) {
255 // Thread-only feature. 256 // Thread-only feature.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 291
291 void SingleThreadProxy::SetNeedsRedrawOnImplThread() { 292 void SingleThreadProxy::SetNeedsRedrawOnImplThread() {
292 client_->ScheduleComposite(); 293 client_->ScheduleComposite();
293 } 294 }
294 295
295 void SingleThreadProxy::SetNeedsManageTilesOnImplThread() { 296 void SingleThreadProxy::SetNeedsManageTilesOnImplThread() {
296 // Thread-only/Impl-side-painting-only feature. 297 // Thread-only/Impl-side-painting-only feature.
297 NOTREACHED(); 298 NOTREACHED();
298 } 299 }
299 300
300 void SingleThreadProxy::SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) { 301 void SingleThreadProxy::SetNeedsRedrawRectOnImplThread(
302 const gfx::Rect& damage_rect) {
301 // TODO(brianderson): Once we move render_widget scheduling into this class, 303 // TODO(brianderson): Once we move render_widget scheduling into this class,
302 // we can treat redraw requests more efficiently than CommitAndRedraw 304 // we can treat redraw requests more efficiently than CommitAndRedraw
303 // requests. 305 // requests.
304 layer_tree_host_impl_->SetViewportDamage(damage_rect); 306 layer_tree_host_impl_->SetViewportDamage(damage_rect);
305 SetNeedsCommit(); 307 SetNeedsCommit();
306 } 308 }
307 309
308 void SingleThreadProxy::DidInitializeVisibleTileOnImplThread() { 310 void SingleThreadProxy::DidInitializeVisibleTileOnImplThread() {
309 // Impl-side painting only. 311 // Impl-side painting only.
310 NOTREACHED(); 312 NOTREACHED();
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 DebugScopedSetImplThread impl(this); 420 DebugScopedSetImplThread impl(this);
419 if (layer_tree_host_impl_->renderer()) { 421 if (layer_tree_host_impl_->renderer()) {
420 DCHECK(!layer_tree_host_->output_surface_lost()); 422 DCHECK(!layer_tree_host_->output_surface_lost());
421 layer_tree_host_impl_->renderer()->DoNoOp(); 423 layer_tree_host_impl_->renderer()->DoNoOp();
422 } 424 }
423 } 425 }
424 } 426 }
425 427
426 bool SingleThreadProxy::CommitAndComposite( 428 bool SingleThreadProxy::CommitAndComposite(
427 base::TimeTicks frame_begin_time, 429 base::TimeTicks frame_begin_time,
428 gfx::Rect device_viewport_damage_rect, 430 const gfx::Rect& device_viewport_damage_rect,
429 bool for_readback, 431 bool for_readback,
430 LayerTreeHostImpl::FrameData* frame) { 432 LayerTreeHostImpl::FrameData* frame) {
431 DCHECK(Proxy::IsMainThread()); 433 DCHECK(Proxy::IsMainThread());
432 434
433 if (!layer_tree_host_->InitializeOutputSurfaceIfNeeded()) 435 if (!layer_tree_host_->InitializeOutputSurfaceIfNeeded())
434 return false; 436 return false;
435 437
436 layer_tree_host_->AnimateLayers(frame_begin_time); 438 layer_tree_host_->AnimateLayers(frame_begin_time);
437 439
438 if (PrioritizedResourceManager* contents_texture_manager = 440 if (PrioritizedResourceManager* contents_texture_manager =
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 483
482 void SingleThreadProxy::UpdateBackgroundAnimateTicking() { 484 void SingleThreadProxy::UpdateBackgroundAnimateTicking() {
483 DCHECK(Proxy::IsImplThread()); 485 DCHECK(Proxy::IsImplThread());
484 layer_tree_host_impl_->UpdateBackgroundAnimateTicking( 486 layer_tree_host_impl_->UpdateBackgroundAnimateTicking(
485 !ShouldComposite() && layer_tree_host_impl_->active_tree()->root_layer()); 487 !ShouldComposite() && layer_tree_host_impl_->active_tree()->root_layer());
486 } 488 }
487 489
488 bool SingleThreadProxy::DoComposite( 490 bool SingleThreadProxy::DoComposite(
489 scoped_refptr<ContextProvider> offscreen_context_provider, 491 scoped_refptr<ContextProvider> offscreen_context_provider,
490 base::TimeTicks frame_begin_time, 492 base::TimeTicks frame_begin_time,
491 gfx::Rect device_viewport_damage_rect, 493 const gfx::Rect& device_viewport_damage_rect,
492 bool for_readback, 494 bool for_readback,
493 LayerTreeHostImpl::FrameData* frame) { 495 LayerTreeHostImpl::FrameData* frame) {
494 DCHECK(!layer_tree_host_->output_surface_lost()); 496 DCHECK(!layer_tree_host_->output_surface_lost());
495 497
496 bool lost_output_surface = false; 498 bool lost_output_surface = false;
497 { 499 {
498 DebugScopedSetImplThread impl(this); 500 DebugScopedSetImplThread impl(this);
499 base::AutoReset<bool> mark_inside(&inside_draw_, true); 501 base::AutoReset<bool> mark_inside(&inside_draw_, true);
500 502
501 layer_tree_host_impl_->SetOffscreenContextProvider( 503 layer_tree_host_impl_->SetOffscreenContextProvider(
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 void SingleThreadProxy::DidSwapFrame() { 547 void SingleThreadProxy::DidSwapFrame() {
546 if (next_frame_is_newly_committed_frame_) { 548 if (next_frame_is_newly_committed_frame_) {
547 next_frame_is_newly_committed_frame_ = false; 549 next_frame_is_newly_committed_frame_ = false;
548 layer_tree_host_->DidCommitAndDrawFrame(); 550 layer_tree_host_->DidCommitAndDrawFrame();
549 } 551 }
550 } 552 }
551 553
552 bool SingleThreadProxy::CommitPendingForTesting() { return false; } 554 bool SingleThreadProxy::CommitPendingForTesting() { return false; }
553 555
554 } // namespace cc 556 } // 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