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

Side by Side Diff: cc/resources/tile.cc

Issue 367833003: cc: Start using raster/eviction iterators. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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/resources/tile.h" 5 #include "cc/resources/tile.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "cc/base/math_util.h" 9 #include "cc/base/math_util.h"
10 #include "cc/debug/traced_value.h" 10 #include "cc/debug/traced_value.h"
11 #include "cc/resources/tile_manager.h" 11 #include "cc/resources/tile_manager.h"
12 #include "third_party/khronos/GLES2/gl2.h" 12 #include "third_party/khronos/GLES2/gl2.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 Tile::Id Tile::s_next_id_ = 0; 16 Tile::Id Tile::s_next_id_ = 0;
17 17
18 Tile::Tile(TileManager* tile_manager, 18 Tile::Tile(TileManager* tile_manager,
19 PicturePileImpl* picture_pile, 19 PicturePileImpl* picture_pile,
20 const gfx::Size& tile_size, 20 const gfx::Size& tile_size,
21 const gfx::Rect& content_rect, 21 const gfx::Rect& content_rect,
22 const gfx::Rect& opaque_rect, 22 const gfx::Rect& opaque_rect,
23 float contents_scale, 23 float contents_scale,
24 int layer_id, 24 int layer_id,
25 int source_frame_number, 25 int source_frame_number,
26 int flags) 26 int flags)
27 : RefCountedManaged<Tile>(tile_manager), 27 : RefCountedManaged<Tile>(tile_manager),
28 tile_manager_(tile_manager),
29 tile_size_(tile_size), 28 tile_size_(tile_size),
30 content_rect_(content_rect), 29 content_rect_(content_rect),
31 contents_scale_(contents_scale), 30 contents_scale_(contents_scale),
32 opaque_rect_(opaque_rect), 31 opaque_rect_(opaque_rect),
33 is_occluded_(false), 32 is_occluded_(false),
34 layer_id_(layer_id), 33 layer_id_(layer_id),
35 source_frame_number_(source_frame_number), 34 source_frame_number_(source_frame_number),
36 flags_(flags), 35 flags_(flags),
36 tiling_i_index_(-1),
37 tiling_j_index_(-1),
38 required_for_activation_(false),
37 id_(s_next_id_++) { 39 id_(s_next_id_++) {
38 set_picture_pile(picture_pile); 40 set_picture_pile(picture_pile);
39 } 41 }
40 42
41 Tile::~Tile() { 43 Tile::~Tile() {
42 TRACE_EVENT_OBJECT_DELETED_WITH_ID( 44 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
43 TRACE_DISABLED_BY_DEFAULT("cc.debug"), 45 TRACE_DISABLED_BY_DEFAULT("cc.debug"),
44 "cc::Tile", this); 46 "cc::Tile", this);
45 } 47 }
46 48
47 void Tile::SetPriority(WhichTree tree, const TilePriority& priority) { 49 void Tile::SetPriority(WhichTree tree, const TilePriority& priority) {
48 if (priority == priority_[tree])
49 return;
50
51 priority_[tree] = priority; 50 priority_[tree] = priority;
52 tile_manager_->DidChangeTilePriority(this);
53 } 51 }
54 52
55 void Tile::MarkRequiredForActivation() { 53 void Tile::MarkRequiredForActivation() {
56 if (priority_[PENDING_TREE].required_for_activation) 54 required_for_activation_ = true;
57 return; 55 }
58 56
59 priority_[PENDING_TREE].required_for_activation = true; 57 void Tile::UnsetRequiredForActivation() {
60 tile_manager_->DidChangeTilePriority(this); 58 required_for_activation_ = false;
61 } 59 }
62 60
63 scoped_ptr<base::Value> Tile::AsValue() const { 61 scoped_ptr<base::Value> Tile::AsValue() const {
64 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); 62 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue());
65 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( 63 TracedValue::MakeDictIntoImplicitSnapshotWithCategory(
66 TRACE_DISABLED_BY_DEFAULT("cc.debug"), res.get(), "cc::Tile", this); 64 TRACE_DISABLED_BY_DEFAULT("cc.debug"), res.get(), "cc::Tile", this);
67 res->Set("picture_pile", 65 res->Set("picture_pile",
68 TracedValue::CreateIDRef(picture_pile_.get()).release()); 66 TracedValue::CreateIDRef(picture_pile_.get()).release());
69 res->SetDouble("contents_scale", contents_scale_); 67 res->SetDouble("contents_scale", contents_scale_);
70 res->Set("content_rect", MathUtil::AsValue(content_rect_).release()); 68 res->Set("content_rect", MathUtil::AsValue(content_rect_).release());
(...skipping 23 matching lines...) Expand all
94 RasterMode Tile::DetermineRasterModeForResolution( 92 RasterMode Tile::DetermineRasterModeForResolution(
95 TileResolution resolution) const { 93 TileResolution resolution) const {
96 RasterMode current_mode = managed_state_.raster_mode; 94 RasterMode current_mode = managed_state_.raster_mode;
97 RasterMode raster_mode = resolution == LOW_RESOLUTION 95 RasterMode raster_mode = resolution == LOW_RESOLUTION
98 ? LOW_QUALITY_RASTER_MODE 96 ? LOW_QUALITY_RASTER_MODE
99 : HIGH_QUALITY_RASTER_MODE; 97 : HIGH_QUALITY_RASTER_MODE;
100 return std::min(raster_mode, current_mode); 98 return std::min(raster_mode, current_mode);
101 } 99 }
102 100
103 } // namespace cc 101 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698