| OLD | NEW |
| 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 28 matching lines...) Expand all Loading... |
| 39 using blink::WebFloatPoint; | 39 using blink::WebFloatPoint; |
| 40 using blink::WebVector; | 40 using blink::WebVector; |
| 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; | |
| 50 | |
| 51 base::LazyInstance<cc::LayerSettings> g_layer_settings = | 49 base::LazyInstance<cc::LayerSettings> g_layer_settings = |
| 52 LAZY_INSTANCE_INITIALIZER; | 50 LAZY_INSTANCE_INITIALIZER; |
| 53 | 51 |
| 54 } // namespace | 52 } // namespace |
| 55 | 53 |
| 56 WebLayerImpl::WebLayerImpl() : layer_(Layer::Create(LayerSettings())) { | 54 WebLayerImpl::WebLayerImpl() : layer_(Layer::Create(LayerSettings())) { |
| 57 web_layer_client_ = nullptr; | 55 web_layer_client_ = nullptr; |
| 58 layer_->SetLayerClient(this); | 56 layer_->SetLayerClient(this); |
| 59 } | 57 } |
| 60 | 58 |
| 61 WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) : layer_(layer) { | 59 WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) : layer_(layer) { |
| 62 web_layer_client_ = nullptr; | 60 web_layer_client_ = nullptr; |
| 63 layer_->SetLayerClient(this); | 61 layer_->SetLayerClient(this); |
| 64 } | 62 } |
| 65 | 63 |
| 66 WebLayerImpl::~WebLayerImpl() { | 64 WebLayerImpl::~WebLayerImpl() { |
| 67 layer_->ClearRenderSurface(); | 65 layer_->ClearRenderSurface(); |
| 68 if (animation_delegate_adapter_.get()) | 66 if (animation_delegate_adapter_.get()) |
| 69 layer_->set_layer_animation_delegate(nullptr); | 67 layer_->set_layer_animation_delegate(nullptr); |
| 70 web_layer_client_ = nullptr; | 68 web_layer_client_ = nullptr; |
| 71 } | 69 } |
| 72 | 70 |
| 73 // static | 71 // static |
| 74 bool WebLayerImpl::UsingPictureLayer() { | |
| 75 return g_impl_side_painting_enabled; | |
| 76 } | |
| 77 | |
| 78 // static | |
| 79 void WebLayerImpl::SetImplSidePaintingEnabled(bool enabled) { | |
| 80 g_impl_side_painting_enabled = enabled; | |
| 81 } | |
| 82 | |
| 83 // static | |
| 84 void WebLayerImpl::SetLayerSettings(const cc::LayerSettings& settings) { | 72 void WebLayerImpl::SetLayerSettings(const cc::LayerSettings& settings) { |
| 85 g_layer_settings.Get() = settings; | 73 g_layer_settings.Get() = settings; |
| 86 } | 74 } |
| 87 | 75 |
| 88 // static | 76 // static |
| 89 const cc::LayerSettings& WebLayerImpl::LayerSettings() { | 77 const cc::LayerSettings& WebLayerImpl::LayerSettings() { |
| 90 return g_layer_settings.Get(); | 78 return g_layer_settings.Get(); |
| 91 } | 79 } |
| 92 | 80 |
| 93 int WebLayerImpl::id() const { | 81 int WebLayerImpl::id() const { |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 if (parent) | 531 if (parent) |
| 544 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); | 532 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); |
| 545 layer_->SetClipParent(clip_parent); | 533 layer_->SetClipParent(clip_parent); |
| 546 } | 534 } |
| 547 | 535 |
| 548 Layer* WebLayerImpl::layer() const { | 536 Layer* WebLayerImpl::layer() const { |
| 549 return layer_.get(); | 537 return layer_.get(); |
| 550 } | 538 } |
| 551 | 539 |
| 552 } // namespace cc_blink | 540 } // namespace cc_blink |
| OLD | NEW |