Chromium Code Reviews| 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 30 matching lines...) Expand all Loading... | |
| 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 base::LazyInstance<cc::LayerSettings> g_layer_settings = | |
| 52 LAZY_INSTANCE_INITIALIZER; | |
| 53 | |
| 51 } // namespace | 54 } // namespace |
| 52 | 55 |
| 53 WebLayerImpl::WebLayerImpl() : layer_(Layer::Create()) { | 56 WebLayerImpl::WebLayerImpl() : layer_(Layer::Create(LayerSettings())) { |
| 54 web_layer_client_ = nullptr; | 57 web_layer_client_ = nullptr; |
| 55 layer_->SetLayerClient(this); | 58 layer_->SetLayerClient(this); |
| 56 } | 59 } |
| 57 | 60 |
| 58 WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) : layer_(layer) { | 61 WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) : layer_(layer) { |
| 59 web_layer_client_ = nullptr; | 62 web_layer_client_ = nullptr; |
| 60 layer_->SetLayerClient(this); | 63 layer_->SetLayerClient(this); |
| 61 } | 64 } |
| 62 | 65 |
| 63 WebLayerImpl::~WebLayerImpl() { | 66 WebLayerImpl::~WebLayerImpl() { |
| 64 layer_->ClearRenderSurface(); | 67 layer_->ClearRenderSurface(); |
| 65 layer_->set_layer_animation_delegate(nullptr); | 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.Get() = settings; | |
| 85 } | |
| 86 | |
| 87 // static | |
| 88 cc::LayerSettings& WebLayerImpl::LayerSettings() { | |
|
danakj
2015/05/12 19:58:14
const?
loyso (OOO)
2015/05/19 04:21:48
Done.
| |
| 89 return g_layer_settings.Get(); | |
| 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 Loading... | |
| 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 |
| OLD | NEW |