OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/layers/picture_layer.h" | 5 #include "cc/layers/picture_layer.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "cc/layers/content_layer_client.h" | 8 #include "cc/layers/content_layer_client.h" |
9 #include "cc/layers/picture_layer_impl.h" | 9 #include "cc/layers/picture_layer_impl.h" |
10 #include "cc/trees/layer_tree_impl.h" | 10 #include "cc/trees/layer_tree_impl.h" |
11 #include "third_party/skia/include/core/SkPictureRecorder.h" | 11 #include "third_party/skia/include/core/SkPictureRecorder.h" |
12 #include "ui/gfx/geometry/rect_conversions.h" | 12 #include "ui/gfx/geometry/rect_conversions.h" |
13 | 13 |
14 namespace cc { | 14 namespace cc { |
15 | 15 |
16 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { | 16 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { |
17 return make_scoped_refptr(new PictureLayer(client)); | 17 return make_scoped_refptr(new PictureLayer(client)); |
18 } | 18 } |
19 | 19 |
20 PictureLayer::PictureLayer(ContentLayerClient* client) | 20 PictureLayer::PictureLayer(ContentLayerClient* client) |
21 : client_(client), | 21 : client_(client), |
22 recording_source_(new PicturePile), | 22 recording_source_(new PicturePile), |
23 instrumentation_object_tracker_(id()), | 23 instrumentation_object_tracker_(id()), |
24 update_source_frame_number_(-1), | 24 update_source_frame_number_(-1), |
25 can_use_lcd_text_last_frame_(can_use_lcd_text()) { | 25 can_use_lcd_text_last_frame_(can_use_lcd_text()) { |
26 } | 26 } |
27 | 27 |
| 28 PictureLayer::PictureLayer(ContentLayerClient* client, |
| 29 scoped_ptr<RecordingSource> source) |
| 30 : PictureLayer(client) { |
| 31 recording_source_ = source.Pass(); |
| 32 } |
| 33 |
28 PictureLayer::~PictureLayer() { | 34 PictureLayer::~PictureLayer() { |
29 } | 35 } |
30 | 36 |
31 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { | 37 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { |
32 return PictureLayerImpl::Create(tree_impl, id()); | 38 return PictureLayerImpl::Create(tree_impl, id()); |
33 } | 39 } |
34 | 40 |
35 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { | 41 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { |
36 Layer::PushPropertiesTo(base_layer); | 42 Layer::PushPropertiesTo(base_layer); |
37 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); | 43 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 197 |
192 bool PictureLayer::HasDrawableContent() const { | 198 bool PictureLayer::HasDrawableContent() const { |
193 return client_ && Layer::HasDrawableContent(); | 199 return client_ && Layer::HasDrawableContent(); |
194 } | 200 } |
195 | 201 |
196 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 202 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
197 benchmark->RunOnLayer(this); | 203 benchmark->RunOnLayer(this); |
198 } | 204 } |
199 | 205 |
200 } // namespace cc | 206 } // namespace cc |
OLD | NEW |