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

Side by Side Diff: ui/compositor/layer.cc

Issue 1783613004: CC Animation: Erase cc::LayerSettings everywhere. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@eraseandroid
Patch Set: Rebase. Created 4 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 | « ui/compositor/compositor.cc ('k') | ui/compositor/layer_animator.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/compositor/layer.h" 5 #include "ui/compositor/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/json/json_writer.h" 12 #include "base/json/json_writer.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/trace_event/trace_event.h" 15 #include "base/trace_event/trace_event.h"
16 #include "cc/layers/layer_settings.h"
17 #include "cc/layers/nine_patch_layer.h" 16 #include "cc/layers/nine_patch_layer.h"
18 #include "cc/layers/picture_layer.h" 17 #include "cc/layers/picture_layer.h"
19 #include "cc/layers/solid_color_layer.h" 18 #include "cc/layers/solid_color_layer.h"
20 #include "cc/layers/surface_layer.h" 19 #include "cc/layers/surface_layer.h"
21 #include "cc/layers/texture_layer.h" 20 #include "cc/layers/texture_layer.h"
22 #include "cc/output/copy_output_request.h" 21 #include "cc/output/copy_output_request.h"
23 #include "cc/output/filter_operation.h" 22 #include "cc/output/filter_operation.h"
24 #include "cc/output/filter_operations.h" 23 #include "cc/output/filter_operations.h"
25 #include "cc/playback/display_item_list_settings.h" 24 #include "cc/playback/display_item_list_settings.h"
26 #include "cc/resources/transferable_resource.h" 25 #include "cc/resources/transferable_resource.h"
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 512
514 SetLayerFilters(); 513 SetLayerFilters();
515 SetLayerBackgroundFilters(); 514 SetLayerBackgroundFilters();
516 } 515 }
517 516
518 bool Layer::HasPendingThreadedAnimationsForTesting() const { 517 bool Layer::HasPendingThreadedAnimationsForTesting() const {
519 return animator_->HasPendingThreadedAnimationsForTesting(); 518 return animator_->HasPendingThreadedAnimationsForTesting();
520 } 519 }
521 520
522 void Layer::SwitchCCLayerForTest() { 521 void Layer::SwitchCCLayerForTest() {
523 scoped_refptr<cc::Layer> new_layer = 522 scoped_refptr<cc::Layer> new_layer = cc::PictureLayer::Create(this);
524 cc::PictureLayer::Create(cc::LayerSettings(), this);
525 SwitchToLayer(new_layer); 523 SwitchToLayer(new_layer);
526 content_layer_ = new_layer; 524 content_layer_ = new_layer;
527 } 525 }
528 526
529 void Layer::SetTextureMailbox( 527 void Layer::SetTextureMailbox(
530 const cc::TextureMailbox& mailbox, 528 const cc::TextureMailbox& mailbox,
531 scoped_ptr<cc::SingleReleaseCallback> release_callback, 529 scoped_ptr<cc::SingleReleaseCallback> release_callback,
532 gfx::Size texture_size_in_dip) { 530 gfx::Size texture_size_in_dip) {
533 DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR); 531 DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR);
534 DCHECK(mailbox.IsValid()); 532 DCHECK(mailbox.IsValid());
535 DCHECK(release_callback); 533 DCHECK(release_callback);
536 if (!texture_layer_.get()) { 534 if (!texture_layer_.get()) {
537 scoped_refptr<cc::TextureLayer> new_layer = 535 scoped_refptr<cc::TextureLayer> new_layer =
538 cc::TextureLayer::CreateForMailbox(cc::LayerSettings(), this); 536 cc::TextureLayer::CreateForMailbox(this);
539 new_layer->SetFlipped(true); 537 new_layer->SetFlipped(true);
540 SwitchToLayer(new_layer); 538 SwitchToLayer(new_layer);
541 texture_layer_ = new_layer; 539 texture_layer_ = new_layer;
542 // Reset the frame_size_in_dip_ so that SetTextureSize() will not early out, 540 // Reset the frame_size_in_dip_ so that SetTextureSize() will not early out,
543 // the frame_size_in_dip_ was for a previous (different) |texture_layer_|. 541 // the frame_size_in_dip_ was for a previous (different) |texture_layer_|.
544 frame_size_in_dip_ = gfx::Size(); 542 frame_size_in_dip_ = gfx::Size();
545 } 543 }
546 if (mailbox_release_callback_) 544 if (mailbox_release_callback_)
547 mailbox_release_callback_->Run(gpu::SyncToken(), false); 545 mailbox_release_callback_->Run(gpu::SyncToken(), false);
548 mailbox_release_callback_ = std::move(release_callback); 546 mailbox_release_callback_ = std::move(release_callback);
(...skipping 22 matching lines...) Expand all
571 569
572 void Layer::SetShowSurface( 570 void Layer::SetShowSurface(
573 cc::SurfaceId surface_id, 571 cc::SurfaceId surface_id,
574 const cc::SurfaceLayer::SatisfyCallback& satisfy_callback, 572 const cc::SurfaceLayer::SatisfyCallback& satisfy_callback,
575 const cc::SurfaceLayer::RequireCallback& require_callback, 573 const cc::SurfaceLayer::RequireCallback& require_callback,
576 gfx::Size surface_size, 574 gfx::Size surface_size,
577 float scale, 575 float scale,
578 gfx::Size frame_size_in_dip) { 576 gfx::Size frame_size_in_dip) {
579 DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR); 577 DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR);
580 578
581 scoped_refptr<cc::SurfaceLayer> new_layer = cc::SurfaceLayer::Create( 579 scoped_refptr<cc::SurfaceLayer> new_layer =
582 cc::LayerSettings(), satisfy_callback, require_callback); 580 cc::SurfaceLayer::Create(satisfy_callback, require_callback);
583 new_layer->SetSurfaceId(surface_id, scale, surface_size); 581 new_layer->SetSurfaceId(surface_id, scale, surface_size);
584 SwitchToLayer(new_layer); 582 SwitchToLayer(new_layer);
585 surface_layer_ = new_layer; 583 surface_layer_ = new_layer;
586 584
587 frame_size_in_dip_ = frame_size_in_dip; 585 frame_size_in_dip_ = frame_size_in_dip;
588 RecomputeDrawsContentAndUVRect(); 586 RecomputeDrawsContentAndUVRect();
589 } 587 }
590 588
591 void Layer::SetShowSolidColorContent() { 589 void Layer::SetShowSolidColorContent() {
592 DCHECK_EQ(type_, LAYER_SOLID_COLOR); 590 DCHECK_EQ(type_, LAYER_SOLID_COLOR);
593 591
594 if (solid_color_layer_.get()) 592 if (solid_color_layer_.get())
595 return; 593 return;
596 594
597 scoped_refptr<cc::SolidColorLayer> new_layer = 595 scoped_refptr<cc::SolidColorLayer> new_layer = cc::SolidColorLayer::Create();
598 cc::SolidColorLayer::Create(cc::LayerSettings());
599 SwitchToLayer(new_layer); 596 SwitchToLayer(new_layer);
600 solid_color_layer_ = new_layer; 597 solid_color_layer_ = new_layer;
601 598
602 mailbox_ = cc::TextureMailbox(); 599 mailbox_ = cc::TextureMailbox();
603 if (mailbox_release_callback_) { 600 if (mailbox_release_callback_) {
604 mailbox_release_callback_->Run(gpu::SyncToken(), false); 601 mailbox_release_callback_->Run(gpu::SyncToken(), false);
605 mailbox_release_callback_.reset(); 602 mailbox_release_callback_.reset();
606 } 603 }
607 RecomputeDrawsContentAndUVRect(); 604 RecomputeDrawsContentAndUVRect();
608 } 605 }
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 return cc_layer_; 954 return cc_layer_;
958 } 955 }
959 956
960 LayerThreadedAnimationDelegate* Layer::GetThreadedAnimationDelegate() { 957 LayerThreadedAnimationDelegate* Layer::GetThreadedAnimationDelegate() {
961 DCHECK(animator_); 958 DCHECK(animator_);
962 return animator_.get(); 959 return animator_.get();
963 } 960 }
964 961
965 void Layer::CreateCcLayer() { 962 void Layer::CreateCcLayer() {
966 if (type_ == LAYER_SOLID_COLOR) { 963 if (type_ == LAYER_SOLID_COLOR) {
967 solid_color_layer_ = cc::SolidColorLayer::Create(cc::LayerSettings()); 964 solid_color_layer_ = cc::SolidColorLayer::Create();
968 cc_layer_ = solid_color_layer_.get(); 965 cc_layer_ = solid_color_layer_.get();
969 } else if (type_ == LAYER_NINE_PATCH) { 966 } else if (type_ == LAYER_NINE_PATCH) {
970 nine_patch_layer_ = cc::NinePatchLayer::Create(cc::LayerSettings()); 967 nine_patch_layer_ = cc::NinePatchLayer::Create();
971 cc_layer_ = nine_patch_layer_.get(); 968 cc_layer_ = nine_patch_layer_.get();
972 } else { 969 } else {
973 content_layer_ = cc::PictureLayer::Create(cc::LayerSettings(), this); 970 content_layer_ = cc::PictureLayer::Create(this);
974 cc_layer_ = content_layer_.get(); 971 cc_layer_ = content_layer_.get();
975 } 972 }
976 cc_layer_->SetTransformOrigin(gfx::Point3F()); 973 cc_layer_->SetTransformOrigin(gfx::Point3F());
977 cc_layer_->SetContentsOpaque(true); 974 cc_layer_->SetContentsOpaque(true);
978 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN); 975 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN);
979 cc_layer_->SetLayerClient(this); 976 cc_layer_->SetLayerClient(this);
980 RecomputePosition(); 977 RecomputePosition();
981 } 978 }
982 979
983 gfx::Transform Layer::transform() const { 980 gfx::Transform Layer::transform() const {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 if (animator_) { 1023 if (animator_) {
1027 animator_->ResetCompositor(compositor); 1024 animator_->ResetCompositor(compositor);
1028 animator_->RemoveFromCollection(collection); 1025 animator_->RemoveFromCollection(collection);
1029 } 1026 }
1030 1027
1031 for (auto* child : children_) 1028 for (auto* child : children_)
1032 child->ResetCompositorForAnimatorsInTree(compositor); 1029 child->ResetCompositorForAnimatorsInTree(compositor);
1033 } 1030 }
1034 1031
1035 } // namespace ui 1032 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/compositor.cc ('k') | ui/compositor/layer_animator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698