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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/time.h" | |
7 #include "cc/picture_pile.h" | 8 #include "cc/picture_pile.h" |
8 #include "cc/picture_pile_impl.h" | 9 #include "cc/picture_pile_impl.h" |
10 #include "cc/rendering_stats.h" | |
9 | 11 |
10 namespace cc { | 12 namespace cc { |
11 | 13 |
12 PicturePile::PicturePile() { | 14 PicturePile::PicturePile() { |
13 } | 15 } |
14 | 16 |
15 PicturePile::~PicturePile() { | 17 PicturePile::~PicturePile() { |
16 } | 18 } |
17 | 19 |
18 class OutOfBoundsPredicate { | 20 class OutOfBoundsPredicate { |
(...skipping 12 matching lines...) Expand all Loading... | |
31 pile_.erase(std::remove_if(pile_.begin(), pile_.end(), oob), pile_.end()); | 33 pile_.erase(std::remove_if(pile_.begin(), pile_.end(), oob), pile_.end()); |
32 } | 34 } |
33 | 35 |
34 size_ = size; | 36 size_ = size; |
35 } | 37 } |
36 | 38 |
37 void PicturePile::Update( | 39 void PicturePile::Update( |
38 ContentLayerClient* painter, | 40 ContentLayerClient* painter, |
39 const Region&, | 41 const Region&, |
40 RenderingStats& stats) { | 42 RenderingStats& stats) { |
43 base::TimeTicks paintBeginTime = base::TimeTicks::Now(); | |
44 | |
41 // TODO(enne): Add things to the pile, consolidate if needed, etc... | 45 // TODO(enne): Add things to the pile, consolidate if needed, etc... |
42 // TODO(enne): Only re-record invalidated areas. | 46 // TODO(enne): Only re-record invalidated areas. |
43 // TODO(enne): Also re-record areas that have been newly exposed by resize. | 47 // TODO(enne): Also re-record areas that have been newly exposed by resize. |
44 | 48 |
45 // Always re-record the entire layer into a single picture, just to get | 49 // Always re-record the entire layer into a single picture, just to get |
46 // this class up and running. | 50 // this class up and running. |
47 pile_.clear(); | 51 pile_.clear(); |
48 pile_.push_back(Picture::Create()); | 52 pile_.push_back(Picture::Create()); |
49 pile_[0]->Record(painter, gfx::Rect(gfx::Point(), size_), stats); | 53 pile_[0]->Record(painter, gfx::Rect(gfx::Point(), size_), stats); |
54 | |
55 stats.totalPaintTimeInSeconds += (base::TimeTicks::Now() - | |
nduca
2012/11/29 18:16:30
Lets move this into accounting Picture::Record
Tom Hudson
2012/11/29 19:16:11
D'oh! Picture::Record already does it, so this was
| |
56 paintBeginTime).InSecondsF(); | |
nduca
2012/11/29 18:16:30
i think we also need to track the number of pixels
Tom Hudson
2012/11/29 19:16:11
Done.
| |
50 } | 57 } |
51 | 58 |
52 void PicturePile::PushPropertiesTo(PicturePileImpl* other) { | 59 void PicturePile::PushPropertiesTo(PicturePileImpl* other) { |
53 other->pile_.resize(pile_.size()); | 60 other->pile_.resize(pile_.size()); |
54 for (size_t i = 0; i < pile_.size(); ++i) | 61 for (size_t i = 0; i < pile_.size(); ++i) |
55 other->pile_[i] = pile_[i]; | 62 other->pile_[i] = pile_[i]; |
56 } | 63 } |
57 | 64 |
58 } // namespace cc | 65 } // namespace cc |
OLD | NEW |