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

Side by Side Diff: cc/blimp/layer_tree_host_remote.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
« no previous file with comments | « cc/blimp/layer_tree_host_remote.h ('k') | cc/blimp/layer_tree_host_remote_unittest.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/blimp/layer_tree_host_remote.h" 5 #include "cc/blimp/layer_tree_host_remote.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "base/auto_reset.h" 8 #include "base/auto_reset.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "cc/animation/animation_host.h" 10 #include "cc/animation/animation_host.h"
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 MainFrameComplete(); 407 MainFrameComplete();
408 408
409 // We can not wait for updates dispatched from the client about the state of 409 // We can not wait for updates dispatched from the client about the state of
410 // drawing or swaps for frames sent. Since these calls can be used by the 410 // drawing or swaps for frames sent. Since these calls can be used by the
411 // LayerTreeHostClient to throttle further frame updates, so dispatch them 411 // LayerTreeHostClient to throttle further frame updates, so dispatch them
412 // right after the update is processed by the bridge. 412 // right after the update is processed by the bridge.
413 // TODO(khushalsagar): We can not really know what these callbacks end up 413 // TODO(khushalsagar): We can not really know what these callbacks end up
414 // being used for. Consider migrating clients to understand/cope with the fact 414 // being used for. Consider migrating clients to understand/cope with the fact
415 // that there is no actual compositing happening here. 415 // that there is no actual compositing happening here.
416 task_runner_provider_->MainThreadTaskRunner()->PostTask( 416 task_runner_provider_->MainThreadTaskRunner()->PostTask(
417 FROM_HERE, base::Bind(&LayerTreeHostRemote::DispatchDrawAndSwapCallbacks, 417 FROM_HERE,
418 weak_factory_.GetWeakPtr())); 418 base::Bind(&LayerTreeHostRemote::DispatchDrawAndSubmitCallbacks,
419 weak_factory_.GetWeakPtr()));
419 } 420 }
420 421
421 bool LayerTreeHostRemote::ApplyScrollAndScaleUpdateFromClient( 422 bool LayerTreeHostRemote::ApplyScrollAndScaleUpdateFromClient(
422 const ScrollOffsetMap& client_scroll_map, 423 const ScrollOffsetMap& client_scroll_map,
423 float client_page_scale) { 424 float client_page_scale) {
424 DCHECK(!synchronizing_client_updates_); 425 DCHECK(!synchronizing_client_updates_);
425 426
426 base::AutoReset<bool> synchronizing_updates(&synchronizing_client_updates_, 427 base::AutoReset<bool> synchronizing_updates(&synchronizing_client_updates_,
427 true); 428 true);
428 bool layer_sync_successful = true; 429 bool layer_sync_successful = true;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 DCHECK_EQ(current_pipeline_stage_, FramePipelineStage::COMMIT); 465 DCHECK_EQ(current_pipeline_stage_, FramePipelineStage::COMMIT);
465 466
466 current_pipeline_stage_ = FramePipelineStage::NONE; 467 current_pipeline_stage_ = FramePipelineStage::NONE;
467 max_pipeline_stage_for_current_frame_ = FramePipelineStage::NONE; 468 max_pipeline_stage_for_current_frame_ = FramePipelineStage::NONE;
468 source_frame_number_++; 469 source_frame_number_++;
469 470
470 client_->DidCommit(); 471 client_->DidCommit();
471 client_->DidBeginMainFrame(); 472 client_->DidBeginMainFrame();
472 } 473 }
473 474
474 void LayerTreeHostRemote::DispatchDrawAndSwapCallbacks() { 475 void LayerTreeHostRemote::DispatchDrawAndSubmitCallbacks() {
475 client_->DidCommitAndDrawFrame(); 476 client_->DidCommitAndDrawFrame();
476 client_->DidCompleteSwapBuffers(); 477 client_->DidReceiveCompositorFrameAck();
477 } 478 }
478 479
479 void LayerTreeHostRemote::SetTaskRunnerProviderForTesting( 480 void LayerTreeHostRemote::SetTaskRunnerProviderForTesting(
480 std::unique_ptr<TaskRunnerProvider> task_runner_provider) { 481 std::unique_ptr<TaskRunnerProvider> task_runner_provider) {
481 task_runner_provider_ = std::move(task_runner_provider); 482 task_runner_provider_ = std::move(task_runner_provider);
482 } 483 }
483 484
484 void LayerTreeHostRemote::SerializeCurrentState( 485 void LayerTreeHostRemote::SerializeCurrentState(
485 proto::LayerTreeHost* layer_tree_host_proto) { 486 proto::LayerTreeHost* layer_tree_host_proto) {
486 // We need to serialize only the inputs received from the embedder. 487 // We need to serialize only the inputs received from the embedder.
487 const bool inputs_only = true; 488 const bool inputs_only = true;
488 489
489 // Serialize the LayerTree. 490 // Serialize the LayerTree.
490 layer_tree_->ToProtobuf(layer_tree_host_proto->mutable_layer_tree(), 491 layer_tree_->ToProtobuf(layer_tree_host_proto->mutable_layer_tree(),
491 inputs_only); 492 inputs_only);
492 493
493 // Serialize the dirty layers. 494 // Serialize the dirty layers.
494 for (auto* layer : layer_tree_->LayersThatShouldPushProperties()) 495 for (auto* layer : layer_tree_->LayersThatShouldPushProperties())
495 layer->ToLayerPropertiesProto( 496 layer->ToLayerPropertiesProto(
496 layer_tree_host_proto->mutable_layer_updates(), inputs_only); 497 layer_tree_host_proto->mutable_layer_updates(), inputs_only);
497 layer_tree_->LayersThatShouldPushProperties().clear(); 498 layer_tree_->LayersThatShouldPushProperties().clear();
498 499
499 std::vector<PictureData> pictures = 500 std::vector<PictureData> pictures =
500 engine_picture_cache_->CalculateCacheUpdateAndFlush(); 501 engine_picture_cache_->CalculateCacheUpdateAndFlush();
501 proto::PictureDataVectorToSkPicturesProto( 502 proto::PictureDataVectorToSkPicturesProto(
502 pictures, layer_tree_host_proto->mutable_pictures()); 503 pictures, layer_tree_host_proto->mutable_pictures());
503 } 504 }
504 505
505 } // namespace cc 506 } // namespace cc
OLDNEW
« no previous file with comments | « cc/blimp/layer_tree_host_remote.h ('k') | cc/blimp/layer_tree_host_remote_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698