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

Side by Side Diff: cc/blink/web_layer_impl.cc

Issue 1101823002: CC Animations: Make LayerAnimationController creation optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Plumb LayerSettings parameter for cc::Layer construction. Created 5 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/blink/web_layer_impl.h" 5 #include "cc/blink/web_layer_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 30 matching lines...) Expand all
41 using blink::WebRect; 41 using blink::WebRect;
42 using blink::WebSize; 42 using blink::WebSize;
43 using blink::WebColor; 43 using blink::WebColor;
44 using blink::WebFilterOperations; 44 using blink::WebFilterOperations;
45 45
46 namespace cc_blink { 46 namespace cc_blink {
47 namespace { 47 namespace {
48 48
49 bool g_impl_side_painting_enabled = false; 49 bool g_impl_side_painting_enabled = false;
50 50
51 cc::LayerSettings g_layer_settings;
piman 2015/05/11 21:31:24 Non-POD globals are forbidden by style guide. You
52
51 } // namespace 53 } // namespace
52 54
53 WebLayerImpl::WebLayerImpl() : layer_(Layer::Create()) { 55 WebLayerImpl::WebLayerImpl() : layer_(Layer::Create(LayerSettings())) {
54 web_layer_client_ = nullptr; 56 web_layer_client_ = nullptr;
55 layer_->SetLayerClient(this); 57 layer_->SetLayerClient(this);
56 } 58 }
57 59
58 WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) : layer_(layer) { 60 WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) : layer_(layer) {
59 web_layer_client_ = nullptr; 61 web_layer_client_ = nullptr;
60 layer_->SetLayerClient(this); 62 layer_->SetLayerClient(this);
61 } 63 }
62 64
63 WebLayerImpl::~WebLayerImpl() { 65 WebLayerImpl::~WebLayerImpl() {
64 layer_->ClearRenderSurface(); 66 layer_->ClearRenderSurface();
65 layer_->set_layer_animation_delegate(nullptr); 67 if (animation_delegate_adapter_.get())
68 layer_->set_layer_animation_delegate(nullptr);
66 web_layer_client_ = nullptr; 69 web_layer_client_ = nullptr;
67 } 70 }
68 71
69 // static 72 // static
70 bool WebLayerImpl::UsingPictureLayer() { 73 bool WebLayerImpl::UsingPictureLayer() {
71 return g_impl_side_painting_enabled; 74 return g_impl_side_painting_enabled;
72 } 75 }
73 76
74 // static 77 // static
75 void WebLayerImpl::SetImplSidePaintingEnabled(bool enabled) { 78 void WebLayerImpl::SetImplSidePaintingEnabled(bool enabled) {
76 g_impl_side_painting_enabled = enabled; 79 g_impl_side_painting_enabled = enabled;
77 } 80 }
78 81
82 // static
83 void WebLayerImpl::SetLayerSettings(const cc::LayerSettings& settings) {
84 g_layer_settings = settings;
85 }
86
87 // static
88 cc::LayerSettings& WebLayerImpl::LayerSettings() {
89 return g_layer_settings;
90 }
91
79 int WebLayerImpl::id() const { 92 int WebLayerImpl::id() const {
80 return layer_->id(); 93 return layer_->id();
81 } 94 }
82 95
83 void WebLayerImpl::invalidateRect(const blink::WebRect& rect) { 96 void WebLayerImpl::invalidateRect(const blink::WebRect& rect) {
84 layer_->SetNeedsDisplayRect(rect); 97 layer_->SetNeedsDisplayRect(rect);
85 } 98 }
86 99
87 void WebLayerImpl::invalidate() { 100 void WebLayerImpl::invalidate() {
88 layer_->SetNeedsDisplay(); 101 layer_->SetNeedsDisplay();
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 if (parent) 542 if (parent)
530 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); 543 clip_parent = static_cast<WebLayerImpl*>(parent)->layer();
531 layer_->SetClipParent(clip_parent); 544 layer_->SetClipParent(clip_parent);
532 } 545 }
533 546
534 Layer* WebLayerImpl::layer() const { 547 Layer* WebLayerImpl::layer() const {
535 return layer_.get(); 548 return layer_.get();
536 } 549 }
537 550
538 } // namespace cc_blink 551 } // namespace cc_blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698