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

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

Issue 62283012: cc: Added tile bundles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years 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
« no previous file with comments | « cc/resources/tile.h ('k') | cc/resources/tile_bundle.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "cc/base/math_util.h" 7 #include "cc/base/math_util.h"
8 #include "cc/debug/traced_value.h" 8 #include "cc/debug/traced_value.h"
9 #include "cc/resources/tile_manager.h" 9 #include "cc/resources/tile_manager.h"
10 #include "third_party/khronos/GLES2/gl2.h" 10 #include "third_party/khronos/GLES2/gl2.h"
(...skipping 13 matching lines...) Expand all
24 int flags) 24 int flags)
25 : RefCountedManaged<Tile>(tile_manager), 25 : RefCountedManaged<Tile>(tile_manager),
26 tile_manager_(tile_manager), 26 tile_manager_(tile_manager),
27 tile_size_(tile_size), 27 tile_size_(tile_size),
28 content_rect_(content_rect), 28 content_rect_(content_rect),
29 contents_scale_(contents_scale), 29 contents_scale_(contents_scale),
30 opaque_rect_(opaque_rect), 30 opaque_rect_(opaque_rect),
31 layer_id_(layer_id), 31 layer_id_(layer_id),
32 source_frame_number_(source_frame_number), 32 source_frame_number_(source_frame_number),
33 flags_(flags), 33 flags_(flags),
34 required_for_activation_(false),
35 is_visible_(false),
34 id_(s_next_id_++) { 36 id_(s_next_id_++) {
35 set_picture_pile(picture_pile); 37 set_picture_pile(picture_pile);
36 } 38 }
37 39
38 Tile::~Tile() { 40 Tile::~Tile() {
39 TRACE_EVENT_OBJECT_DELETED_WITH_ID( 41 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
40 TRACE_DISABLED_BY_DEFAULT("cc.debug"), 42 TRACE_DISABLED_BY_DEFAULT("cc.debug"),
41 "cc::Tile", this); 43 "cc::Tile", this);
42 } 44 }
43 45
44 void Tile::SetPriority(WhichTree tree, const TilePriority& priority) { 46 void Tile::MarkRequiredForActivation() {
45 if (priority == priority_[tree]) 47 if (required_for_activation_)
46 return; 48 return;
47 49
48 priority_[tree] = priority; 50 required_for_activation_ = true;
49 tile_manager_->DidChangeTilePriority(this); 51 tile_manager_->DidChangeTilePriority(this);
50 } 52 }
51 53
52 void Tile::MarkRequiredForActivation() {
53 if (priority_[PENDING_TREE].required_for_activation)
54 return;
55
56 priority_[PENDING_TREE].required_for_activation = true;
57 tile_manager_->DidChangeTilePriority(this);
58 }
59
60 scoped_ptr<base::Value> Tile::AsValue() const { 54 scoped_ptr<base::Value> Tile::AsValue() const {
61 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); 55 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue());
62 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( 56 TracedValue::MakeDictIntoImplicitSnapshotWithCategory(
63 TRACE_DISABLED_BY_DEFAULT("cc.debug"), res.get(), "cc::Tile", this); 57 TRACE_DISABLED_BY_DEFAULT("cc.debug"), res.get(), "cc::Tile", this);
64 res->Set("picture_pile", 58 res->Set("picture_pile",
65 TracedValue::CreateIDRef(picture_pile_.get()).release()); 59 TracedValue::CreateIDRef(picture_pile_.get()).release());
66 res->SetDouble("contents_scale", contents_scale_); 60 res->SetDouble("contents_scale", contents_scale_);
67 res->Set("content_rect", MathUtil::AsValue(content_rect_).release()); 61 res->Set("content_rect", MathUtil::AsValue(content_rect_).release());
68 res->SetInteger("layer_id", layer_id_); 62 res->SetInteger("layer_id", layer_id_);
69 res->Set("active_priority", priority_[ACTIVE_TREE].AsValue().release());
70 res->Set("pending_priority", priority_[PENDING_TREE].AsValue().release());
71 res->Set("managed_state", managed_state_.AsValue().release()); 63 res->Set("managed_state", managed_state_.AsValue().release());
72 res->SetBoolean("can_use_lcd_text", can_use_lcd_text()); 64 res->SetBoolean("can_use_lcd_text", can_use_lcd_text());
73 res->SetBoolean("use_gpu_rasterization", use_gpu_rasterization()); 65 res->SetBoolean("use_gpu_rasterization", use_gpu_rasterization());
66 res->SetBoolean("required_for_activation", required_for_activation_);
74 return res.PassAs<base::Value>(); 67 return res.PassAs<base::Value>();
75 } 68 }
76 69
77 size_t Tile::GPUMemoryUsageInBytes() const { 70 size_t Tile::GPUMemoryUsageInBytes() const {
78 size_t total_size = 0; 71 size_t total_size = 0;
79 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) 72 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode)
80 total_size += managed_state_.tile_versions[mode].GPUMemoryUsageInBytes(); 73 total_size += managed_state_.tile_versions[mode].GPUMemoryUsageInBytes();
81 return total_size; 74 return total_size;
82 } 75 }
83 76
84 } // namespace cc 77 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile.h ('k') | cc/resources/tile_bundle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698