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

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

Issue 2409923002: cc: Rename SwapBuffers on CompositorFrameSink to SubmitCompositorFrame (Closed)
Patch Set: swap-to-submit: rebase Created 4 years, 2 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/proxy_impl.h" 5 #include "cc/trees/proxy_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 void ProxyImpl::SetBeginFrameSource(BeginFrameSource* source) { 261 void ProxyImpl::SetBeginFrameSource(BeginFrameSource* source) {
262 // During shutdown, destroying the CompositorFrameSink may unset the 262 // During shutdown, destroying the CompositorFrameSink may unset the
263 // BeginFrameSource. 263 // BeginFrameSource.
264 if (scheduler_) { 264 if (scheduler_) {
265 // TODO(enne): this overrides any preexisting begin frame source. Those 265 // TODO(enne): this overrides any preexisting begin frame source. Those
266 // other sources will eventually be removed and this will be the only path. 266 // other sources will eventually be removed and this will be the only path.
267 scheduler_->SetBeginFrameSource(source); 267 scheduler_->SetBeginFrameSource(source);
268 } 268 }
269 } 269 }
270 270
271 void ProxyImpl::DidSwapBuffersCompleteOnImplThread() { 271 void ProxyImpl::DidReceiveCompositorFrameAckOnImplThread() {
272 TRACE_EVENT0("cc,benchmark", "ProxyImpl::DidSwapBuffersCompleteOnImplThread"); 272 TRACE_EVENT0("cc,benchmark",
273 "ProxyImpl::DidReceiveCompositorFrameAckOnImplThread");
273 DCHECK(IsImplThread()); 274 DCHECK(IsImplThread());
274 scheduler_->DidSwapBuffersComplete(); 275 scheduler_->DidReceiveCompositorFrameAck();
275 channel_impl_->DidCompleteSwapBuffers(); 276 channel_impl_->DidReceiveCompositorFrameAck();
276 } 277 }
277 278
278 void ProxyImpl::OnCanDrawStateChanged(bool can_draw) { 279 void ProxyImpl::OnCanDrawStateChanged(bool can_draw) {
279 TRACE_EVENT1("cc", "ProxyImpl::OnCanDrawStateChanged", "can_draw", can_draw); 280 TRACE_EVENT1("cc", "ProxyImpl::OnCanDrawStateChanged", "can_draw", can_draw);
280 DCHECK(IsImplThread()); 281 DCHECK(IsImplThread());
281 scheduler_->SetCanDraw(can_draw); 282 scheduler_->SetCanDraw(can_draw);
282 } 283 }
283 284
284 void ProxyImpl::NotifyReadyToActivate() { 285 void ProxyImpl::NotifyReadyToActivate() {
285 TRACE_EVENT0("cc", "ProxyImpl::NotifyReadyToActivate"); 286 TRACE_EVENT0("cc", "ProxyImpl::NotifyReadyToActivate");
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 begin_main_frame_state->begin_frame_callbacks = 442 begin_main_frame_state->begin_frame_callbacks =
442 layer_tree_host_impl_->ProcessLayerTreeMutations(); 443 layer_tree_host_impl_->ProcessLayerTreeMutations();
443 begin_main_frame_state->scroll_info = 444 begin_main_frame_state->scroll_info =
444 layer_tree_host_impl_->ProcessScrollDeltas(); 445 layer_tree_host_impl_->ProcessScrollDeltas();
445 begin_main_frame_state->evicted_ui_resources = 446 begin_main_frame_state->evicted_ui_resources =
446 layer_tree_host_impl_->EvictedUIResourcesExist(); 447 layer_tree_host_impl_->EvictedUIResourcesExist();
447 channel_impl_->BeginMainFrame(std::move(begin_main_frame_state)); 448 channel_impl_->BeginMainFrame(std::move(begin_main_frame_state));
448 devtools_instrumentation::DidRequestMainThreadFrame(layer_tree_host_id_); 449 devtools_instrumentation::DidRequestMainThreadFrame(layer_tree_host_id_);
449 } 450 }
450 451
451 DrawResult ProxyImpl::ScheduledActionDrawAndSwapIfPossible() { 452 DrawResult ProxyImpl::ScheduledActionSubmitCompositorFrameIfPossible() {
452 TRACE_EVENT0("cc", "ProxyImpl::ScheduledActionDrawAndSwap"); 453 TRACE_EVENT0("cc", "ProxyImpl::ScheduledActionSubmitCompositorFrame");
453 DCHECK(IsImplThread()); 454 DCHECK(IsImplThread());
454 455
455 // SchedulerStateMachine::DidDrawIfPossibleCompleted isn't set up to 456 // SchedulerStateMachine::DidDrawIfPossibleCompleted isn't set up to
456 // handle DRAW_ABORTED_CANT_DRAW. Moreover, the scheduler should 457 // handle DRAW_ABORTED_CANT_DRAW. Moreover, the scheduler should
457 // never generate this call when it can't draw. 458 // never generate this call when it can't draw.
458 DCHECK(layer_tree_host_impl_->CanDraw()); 459 DCHECK(layer_tree_host_impl_->CanDraw());
459 460
460 bool forced_draw = false; 461 bool forced_draw = false;
461 return DrawAndSwapInternal(forced_draw); 462 return SubmitCompositorFrameInternal(forced_draw);
462 } 463 }
463 464
464 DrawResult ProxyImpl::ScheduledActionDrawAndSwapForced() { 465 DrawResult ProxyImpl::ScheduledActionSubmitCompositorFrameForced() {
465 TRACE_EVENT0("cc", "ProxyImpl::ScheduledActionDrawAndSwapForced"); 466 TRACE_EVENT0("cc", "ProxyImpl::ScheduledActionSubmitCompositorFrameForced");
466 DCHECK(IsImplThread()); 467 DCHECK(IsImplThread());
467 bool forced_draw = true; 468 bool forced_draw = true;
468 return DrawAndSwapInternal(forced_draw); 469 return SubmitCompositorFrameInternal(forced_draw);
469 } 470 }
470 471
471 void ProxyImpl::ScheduledActionCommit() { 472 void ProxyImpl::ScheduledActionCommit() {
472 TRACE_EVENT0("cc", "ProxyImpl::ScheduledActionCommit"); 473 TRACE_EVENT0("cc", "ProxyImpl::ScheduledActionCommit");
473 DCHECK(IsImplThread()); 474 DCHECK(IsImplThread());
474 DCHECK(IsMainThreadBlocked()); 475 DCHECK(IsMainThreadBlocked());
475 DCHECK(commit_completion_event_); 476 DCHECK(commit_completion_event_);
476 477
477 layer_tree_host_impl_->BeginCommit(); 478 layer_tree_host_impl_->BeginCommit();
478 blocked_main_commit().layer_tree_host->FinishCommitOnImplThread( 479 blocked_main_commit().layer_tree_host->FinishCommitOnImplThread(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 DCHECK(IsImplThread()); 532 DCHECK(IsImplThread());
532 DCHECK(layer_tree_host_impl_->compositor_frame_sink()); 533 DCHECK(layer_tree_host_impl_->compositor_frame_sink());
533 layer_tree_host_impl_->compositor_frame_sink()->Invalidate(); 534 layer_tree_host_impl_->compositor_frame_sink()->Invalidate();
534 } 535 }
535 536
536 void ProxyImpl::SendBeginMainFrameNotExpectedSoon() { 537 void ProxyImpl::SendBeginMainFrameNotExpectedSoon() {
537 DCHECK(IsImplThread()); 538 DCHECK(IsImplThread());
538 channel_impl_->BeginMainFrameNotExpectedSoon(); 539 channel_impl_->BeginMainFrameNotExpectedSoon();
539 } 540 }
540 541
541 DrawResult ProxyImpl::DrawAndSwapInternal(bool forced_draw) { 542 DrawResult ProxyImpl::SubmitCompositorFrameInternal(bool forced_draw) {
542 TRACE_EVENT_SYNTHETIC_DELAY("cc.DrawAndSwap"); 543 TRACE_EVENT_SYNTHETIC_DELAY("cc.SubmitCompositorFrame");
543 544
544 DCHECK(IsImplThread()); 545 DCHECK(IsImplThread());
545 DCHECK(layer_tree_host_impl_.get()); 546 DCHECK(layer_tree_host_impl_.get());
546 547
547 base::AutoReset<bool> mark_inside(&inside_draw_, true); 548 base::AutoReset<bool> mark_inside(&inside_draw_, true);
548 549
549 if (layer_tree_host_impl_->pending_tree()) { 550 if (layer_tree_host_impl_->pending_tree()) {
550 bool update_lcd_text = false; 551 bool update_lcd_text = false;
551 layer_tree_host_impl_->pending_tree()->UpdateDrawProperties( 552 layer_tree_host_impl_->pending_tree()->UpdateDrawProperties(
552 update_lcd_text); 553 update_lcd_text);
(...skipping 16 matching lines...) Expand all
569 DrawResult result; 570 DrawResult result;
570 if (layer_tree_host_impl_->CanDraw()) { 571 if (layer_tree_host_impl_->CanDraw()) {
571 result = layer_tree_host_impl_->PrepareToDraw(&frame); 572 result = layer_tree_host_impl_->PrepareToDraw(&frame);
572 draw_frame = forced_draw || result == DRAW_SUCCESS; 573 draw_frame = forced_draw || result == DRAW_SUCCESS;
573 } else { 574 } else {
574 result = DRAW_ABORTED_CANT_DRAW; 575 result = DRAW_ABORTED_CANT_DRAW;
575 } 576 }
576 577
577 if (draw_frame) { 578 if (draw_frame) {
578 if (layer_tree_host_impl_->DrawLayers(&frame)) 579 if (layer_tree_host_impl_->DrawLayers(&frame))
579 scheduler_->DidSwapBuffers(); 580 scheduler_->DidSubmitCompositorFrame();
580 result = DRAW_SUCCESS; 581 result = DRAW_SUCCESS;
581 } else { 582 } else {
582 DCHECK_NE(DRAW_SUCCESS, result); 583 DCHECK_NE(DRAW_SUCCESS, result);
583 } 584 }
584 585
585 layer_tree_host_impl_->DidDrawAllLayers(frame); 586 layer_tree_host_impl_->DidDrawAllLayers(frame);
586 587
587 bool start_ready_animations = draw_frame; 588 bool start_ready_animations = draw_frame;
588 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); 589 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations);
589 590
(...skipping 14 matching lines...) Expand all
604 bool ProxyImpl::IsMainThreadBlocked() const { 605 bool ProxyImpl::IsMainThreadBlocked() const {
605 return task_runner_provider_->IsMainThreadBlocked(); 606 return task_runner_provider_->IsMainThreadBlocked();
606 } 607 }
607 608
608 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { 609 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() {
609 DCHECK(IsMainThreadBlocked() && commit_completion_event_); 610 DCHECK(IsMainThreadBlocked() && commit_completion_event_);
610 return main_thread_blocked_commit_vars_unsafe_; 611 return main_thread_blocked_commit_vars_unsafe_;
611 } 612 }
612 613
613 } // namespace cc 614 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698