| 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 "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "cc/layers/content_layer_client.h" | 9 #include "cc/layers/content_layer_client.h" |
| 10 #include "cc/layers/picture_layer_impl.h" | 10 #include "cc/layers/picture_layer_impl.h" |
| 11 #include "cc/playback/display_list_recording_source.h" | 11 #include "cc/playback/display_list_recording_source.h" |
| 12 #include "cc/proto/cc_conversions.h" | 12 #include "cc/proto/cc_conversions.h" |
| 13 #include "cc/proto/gfx_conversions.h" | 13 #include "cc/proto/gfx_conversions.h" |
| 14 #include "cc/proto/layer.pb.h" | 14 #include "cc/proto/layer.pb.h" |
| 15 #include "cc/trees/layer_tree_host.h" | 15 #include "cc/trees/layer_tree_host.h" |
| 16 #include "cc/trees/layer_tree_impl.h" | 16 #include "cc/trees/layer_tree_impl.h" |
| 17 #include "third_party/skia/include/core/SkPictureRecorder.h" | 17 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 18 #include "ui/gfx/geometry/rect_conversions.h" | 18 #include "ui/gfx/geometry/rect_conversions.h" |
| 19 | 19 |
| 20 namespace cc { | 20 namespace cc { |
| 21 | 21 |
| 22 scoped_refptr<PictureLayer> PictureLayer::Create(const LayerSettings& settings, | 22 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { |
| 23 ContentLayerClient* client) { | 23 return make_scoped_refptr(new PictureLayer(client)); |
| 24 return make_scoped_refptr(new PictureLayer(settings, client)); | |
| 25 } | 24 } |
| 26 | 25 |
| 27 PictureLayer::PictureLayer(const LayerSettings& settings, | 26 PictureLayer::PictureLayer(ContentLayerClient* client) |
| 28 ContentLayerClient* client) | 27 : client_(client), |
| 29 : Layer(settings), | |
| 30 client_(client), | |
| 31 instrumentation_object_tracker_(id()), | 28 instrumentation_object_tracker_(id()), |
| 32 update_source_frame_number_(-1), | 29 update_source_frame_number_(-1), |
| 33 is_mask_(false), | 30 is_mask_(false), |
| 34 nearest_neighbor_(false) { | 31 nearest_neighbor_(false) {} |
| 35 } | |
| 36 | 32 |
| 37 PictureLayer::PictureLayer(const LayerSettings& settings, | 33 PictureLayer::PictureLayer(ContentLayerClient* client, |
| 38 ContentLayerClient* client, | |
| 39 scoped_ptr<DisplayListRecordingSource> source) | 34 scoped_ptr<DisplayListRecordingSource> source) |
| 40 : PictureLayer(settings, client) { | 35 : PictureLayer(client) { |
| 41 recording_source_ = std::move(source); | 36 recording_source_ = std::move(source); |
| 42 } | 37 } |
| 43 | 38 |
| 44 PictureLayer::~PictureLayer() { | 39 PictureLayer::~PictureLayer() { |
| 45 } | 40 } |
| 46 | 41 |
| 47 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { | 42 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { |
| 48 return PictureLayerImpl::Create(tree_impl, id(), is_mask_); | 43 return PictureLayerImpl::Create(tree_impl, id(), is_mask_); |
| 49 } | 44 } |
| 50 | 45 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 if (update_source_frame_number_ != source_frame_number && | 249 if (update_source_frame_number_ != source_frame_number && |
| 255 recording_source_bounds != layer_bounds) { | 250 recording_source_bounds != layer_bounds) { |
| 256 // Update may not get called for the layer (if it's not in the viewport | 251 // Update may not get called for the layer (if it's not in the viewport |
| 257 // for example), even though it has resized making the recording source no | 252 // for example), even though it has resized making the recording source no |
| 258 // longer valid. In this case just destroy the recording source. | 253 // longer valid. In this case just destroy the recording source. |
| 259 recording_source_->SetEmptyBounds(); | 254 recording_source_->SetEmptyBounds(); |
| 260 } | 255 } |
| 261 } | 256 } |
| 262 | 257 |
| 263 } // namespace cc | 258 } // namespace cc |
| OLD | NEW |