| 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) { | |
| 24 SetAnchorPoint(gfx::PointF(0.f, 0.f)); | 22 SetAnchorPoint(gfx::PointF(0.f, 0.f)); |
| 25 SetBounds(gfx::Size(1, 1)); | 23 SetBounds(gfx::Size(1, 1)); |
| 26 SetIsDrawable(true); | 24 SetIsDrawable(true); |
| 27 } | 25 } |
| 28 | 26 |
| 29 FakeScrollbarLayer::~FakeScrollbarLayer() {} | 27 FakeScrollbarLayer::~FakeScrollbarLayer() {} |
| 30 | 28 |
| 31 bool FakeScrollbarLayer::Update(ResourceUpdateQueue* queue, | 29 bool FakeScrollbarLayer::Update(ResourceUpdateQueue* queue, |
| 32 const OcclusionTracker* occlusion) { | 30 const OcclusionTracker* occlusion) { |
| 33 size_t full = queue->FullUploadSize(); | |
| 34 size_t partial = queue->PartialUploadSize(); | |
| 35 bool updated = ScrollbarLayer::Update(queue, occlusion); | 31 bool updated = ScrollbarLayer::Update(queue, occlusion); |
| 36 update_count_++; | 32 ++update_count_; |
| 37 last_update_full_upload_size_ = queue->FullUploadSize() - full; | |
| 38 last_update_partial_upload_size_ = queue->PartialUploadSize() - partial; | |
| 39 return updated; | 33 return updated; |
| 40 } | 34 } |
| 41 | 35 |
| 42 void FakeScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { | 36 void FakeScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { |
| 43 ScrollbarLayer::PushPropertiesTo(layer); | 37 ScrollbarLayer::PushPropertiesTo(layer); |
| 44 ++push_properties_count_; | 38 ++push_properties_count_; |
| 45 } | 39 } |
| 46 | 40 |
| 47 scoped_ptr<base::AutoReset<bool> > FakeScrollbarLayer::IgnoreSetNeedsCommit() { | 41 scoped_ptr<base::AutoReset<bool> > FakeScrollbarLayer::IgnoreSetNeedsCommit() { |
| 48 return make_scoped_ptr( | 42 return make_scoped_ptr( |
| 49 new base::AutoReset<bool>(&ignore_set_needs_commit_, true)); | 43 new base::AutoReset<bool>(&ignore_set_needs_commit_, true)); |
| 50 } | 44 } |
| 51 | 45 |
| 52 } // namespace cc | 46 } // namespace cc |
| OLD | NEW |