Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(834)

Side by Side Diff: cc/test/fake_scrollbar_layer.cc

Issue 18191020: UI Resource Manager (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Switched to resource client instead of callback Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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),
22 last_update_full_upload_size_(0),
23 last_update_partial_upload_size_(0) {
24 SetAnchorPoint(gfx::PointF(0.f, 0.f)); 21 SetAnchorPoint(gfx::PointF(0.f, 0.f));
25 SetBounds(gfx::Size(1, 1)); 22 SetBounds(gfx::Size(1, 1));
26 SetIsDrawable(true); 23 SetIsDrawable(true);
27 } 24 }
28 25
29 FakeScrollbarLayer::~FakeScrollbarLayer() {} 26 FakeScrollbarLayer::~FakeScrollbarLayer() {}
30 27
31 bool FakeScrollbarLayer::Update(ResourceUpdateQueue* queue, 28 bool FakeScrollbarLayer::Update(ResourceUpdateQueue* queue,
32 const OcclusionTracker* occlusion) { 29 const OcclusionTracker* occlusion) {
33 size_t full = queue->FullUploadSize();
34 size_t partial = queue->PartialUploadSize();
35 bool updated = ScrollbarLayer::Update(queue, occlusion); 30 bool updated = ScrollbarLayer::Update(queue, occlusion);
36 update_count_++; 31 update_count_++;
37 last_update_full_upload_size_ = queue->FullUploadSize() - full;
38 last_update_partial_upload_size_ = queue->PartialUploadSize() - partial;
39 return updated; 32 return updated;
40 } 33 }
41 34
42 void FakeScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { 35 void FakeScrollbarLayer::PushPropertiesTo(LayerImpl* layer) {
43 ScrollbarLayer::PushPropertiesTo(layer); 36 ScrollbarLayer::PushPropertiesTo(layer);
44 ++push_properties_count_; 37 ++push_properties_count_;
45 } 38 }
46 39
47 scoped_ptr<base::AutoReset<bool> > FakeScrollbarLayer::IgnoreSetNeedsCommit() { 40 scoped_ptr<base::AutoReset<bool> > FakeScrollbarLayer::IgnoreSetNeedsCommit() {
48 return make_scoped_ptr( 41 return make_scoped_ptr(
49 new base::AutoReset<bool>(&ignore_set_needs_commit_, true)); 42 new base::AutoReset<bool>(&ignore_set_needs_commit_, true));
50 } 43 }
51 44
52 } // namespace cc 45 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698