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_scrollbar_layer.h" | 5 #include "cc/test/fake_scrollbar_layer.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "cc/resources/resource_update_queue.h" | 8 #include "cc/resources/resource_update_queue.h" |
9 #include "cc/test/fake_scrollbar.h" | 9 #include "cc/test/fake_scrollbar.h" |
10 | 10 |
11 namespace cc { | 11 namespace cc { |
12 | 12 |
13 FakeScrollbarLayer::FakeScrollbarLayer(bool paint_during_update, | 13 FakeScrollbarLayer::FakeScrollbarLayer(bool paint_during_update, |
14 bool has_thumb, | 14 bool has_thumb, |
15 int scrolling_layer_id) | 15 int scrolling_layer_id) |
16 : ScrollbarLayer( | 16 : ScrollbarLayer( |
17 scoped_ptr<Scrollbar>( | 17 scoped_ptr<Scrollbar>( |
18 new FakeScrollbar(paint_during_update, has_thumb, false)).Pass(), | 18 new FakeScrollbar(paint_during_update, has_thumb, false)).Pass(), |
19 scrolling_layer_id), | 19 scrolling_layer_id), |
20 update_count_(0), | 20 update_count_(0), |
21 push_properties_count_(0) { | 21 push_properties_count_(0), |
| 22 last_update_full_upload_size_(0), |
| 23 last_update_partial_upload_size_(0) { |
22 SetAnchorPoint(gfx::PointF(0.f, 0.f)); | 24 SetAnchorPoint(gfx::PointF(0.f, 0.f)); |
23 SetBounds(gfx::Size(1, 1)); | 25 SetBounds(gfx::Size(1, 1)); |
24 SetIsDrawable(true); | 26 SetIsDrawable(true); |
25 } | 27 } |
26 | 28 |
27 FakeScrollbarLayer::~FakeScrollbarLayer() {} | 29 FakeScrollbarLayer::~FakeScrollbarLayer() {} |
28 | 30 |
29 bool FakeScrollbarLayer::Update(ResourceUpdateQueue* queue, | 31 bool FakeScrollbarLayer::Update(ResourceUpdateQueue* queue, |
30 const OcclusionTracker* occlusion) { | 32 const OcclusionTracker* occlusion) { |
| 33 size_t full = queue->FullUploadSize(); |
| 34 size_t partial = queue->PartialUploadSize(); |
31 bool updated = ScrollbarLayer::Update(queue, occlusion); | 35 bool updated = ScrollbarLayer::Update(queue, occlusion); |
32 ++update_count_; | 36 update_count_++; |
| 37 last_update_full_upload_size_ = queue->FullUploadSize() - full; |
| 38 last_update_partial_upload_size_ = queue->PartialUploadSize() - partial; |
33 return updated; | 39 return updated; |
34 } | 40 } |
35 | 41 |
36 void FakeScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { | 42 void FakeScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { |
37 ScrollbarLayer::PushPropertiesTo(layer); | 43 ScrollbarLayer::PushPropertiesTo(layer); |
38 ++push_properties_count_; | 44 ++push_properties_count_; |
39 } | 45 } |
40 | 46 |
41 scoped_ptr<base::AutoReset<bool> > FakeScrollbarLayer::IgnoreSetNeedsCommit() { | 47 scoped_ptr<base::AutoReset<bool> > FakeScrollbarLayer::IgnoreSetNeedsCommit() { |
42 return make_scoped_ptr( | 48 return make_scoped_ptr( |
43 new base::AutoReset<bool>(&ignore_set_needs_commit_, true)); | 49 new base::AutoReset<bool>(&ignore_set_needs_commit_, true)); |
44 } | 50 } |
45 | 51 |
46 } // namespace cc | 52 } // namespace cc |
OLD | NEW |