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/test/fake_picture_layer.h" | 5 #include "cc/test/fake_picture_layer.h" |
6 | 6 |
7 #include "cc/test/delayed_raster_picture_pile_impl.h" | |
7 #include "cc/test/fake_picture_layer_impl.h" | 8 #include "cc/test/fake_picture_layer_impl.h" |
8 | 9 |
9 namespace cc { | 10 namespace cc { |
10 | 11 |
11 FakePictureLayer::FakePictureLayer(ContentLayerClient* client) | 12 FakePictureLayer::FakePictureLayer(ContentLayerClient* client) |
12 : PictureLayer(client), | 13 : PictureLayer(client), |
13 update_count_(0), | 14 update_count_(0), |
14 push_properties_count_(0), | 15 push_properties_count_(0), |
16 output_surface_created_count_(0), | |
15 always_update_resources_(false), | 17 always_update_resources_(false), |
16 output_surface_created_count_(0) { | 18 delayed_raster_trigger_(nullptr) { |
17 SetBounds(gfx::Size(1, 1)); | 19 SetBounds(gfx::Size(1, 1)); |
18 SetIsDrawable(true); | 20 SetIsDrawable(true); |
19 } | 21 } |
20 | 22 |
21 FakePictureLayer::~FakePictureLayer() {} | 23 FakePictureLayer::~FakePictureLayer() {} |
22 | 24 |
23 scoped_ptr<LayerImpl> FakePictureLayer::CreateLayerImpl( | 25 scoped_ptr<LayerImpl> FakePictureLayer::CreateLayerImpl( |
24 LayerTreeImpl* tree_impl) { | 26 LayerTreeImpl* tree_impl) { |
25 return FakePictureLayerImpl::Create(tree_impl, layer_id_); | 27 return FakePictureLayerImpl::Create(tree_impl, layer_id_); |
26 } | 28 } |
27 | 29 |
28 bool FakePictureLayer::Update(ResourceUpdateQueue* queue, | 30 bool FakePictureLayer::Update(ResourceUpdateQueue* queue, |
29 const OcclusionTracker<Layer>* occlusion) { | 31 const OcclusionTracker<Layer>* occlusion) { |
30 bool updated = PictureLayer::Update(queue, occlusion); | 32 bool updated = PictureLayer::Update(queue, occlusion); |
31 update_count_++; | 33 update_count_++; |
32 return updated || always_update_resources_; | 34 return updated || always_update_resources_; |
33 } | 35 } |
34 | 36 |
35 void FakePictureLayer::PushPropertiesTo(LayerImpl* layer) { | 37 void FakePictureLayer::PushPropertiesTo(LayerImpl* layer) { |
36 PictureLayer::PushPropertiesTo(layer); | 38 PictureLayer::PushPropertiesTo(layer); |
37 push_properties_count_++; | 39 push_properties_count_++; |
38 } | 40 } |
39 | 41 |
40 void FakePictureLayer::OnOutputSurfaceCreated() { | 42 void FakePictureLayer::OnOutputSurfaceCreated() { |
41 PictureLayer::OnOutputSurfaceCreated(); | 43 PictureLayer::OnOutputSurfaceCreated(); |
42 output_surface_created_count_++; | 44 output_surface_created_count_++; |
43 } | 45 } |
44 | 46 |
47 scoped_refptr<PicturePileImpl> FakePictureLayer::CreatePicturePileImpl() { | |
48 if (!delayed_raster_trigger_) | |
49 return PictureLayer::CreatePicturePileImpl(); | |
50 return DelayedRasterPicturePileImpl::CreateFromOther( | |
51 GetPicturePileForTesting(), delayed_raster_trigger_); | |
reveman
2014/11/10 23:43:02
note: if you end up reusing FakePicturePileImpl th
danakj
2014/11/12 20:19:40
I added a constructor to FakePictureLayer to overr
| |
52 } | |
53 | |
45 } // namespace cc | 54 } // namespace cc |
OLD | NEW |