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

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

Issue 18581004: cc: Remove tile ref counting in tile manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/resources/tile.h" 5 #include "cc/resources/tile.h"
6 6
7 #include "cc/debug/traced_value.h" 7 #include "cc/debug/traced_value.h"
8 #include "cc/resources/tile_manager.h" 8 #include "cc/resources/tile_manager.h"
9 #include "third_party/khronos/GLES2/gl2.h" 9 #include "third_party/khronos/GLES2/gl2.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 uint64 Tile::s_next_id_ = 0;
14
13 Tile::Tile(TileManager* tile_manager, 15 Tile::Tile(TileManager* tile_manager,
14 PicturePileImpl* picture_pile, 16 PicturePileImpl* picture_pile,
15 gfx::Size tile_size, 17 gfx::Size tile_size,
16 gfx::Rect content_rect, 18 gfx::Rect content_rect,
17 gfx::Rect opaque_rect, 19 gfx::Rect opaque_rect,
18 float contents_scale, 20 float contents_scale,
19 int layer_id, 21 int layer_id,
20 int source_frame_number, 22 int source_frame_number,
21 bool can_use_lcd_text) 23 bool can_use_lcd_text)
22 : tile_manager_(tile_manager), 24 : tile_manager_(tile_manager),
23 tile_size_(tile_size), 25 tile_size_(tile_size),
24 content_rect_(content_rect), 26 content_rect_(content_rect),
25 contents_scale_(contents_scale), 27 contents_scale_(contents_scale),
26 opaque_rect_(opaque_rect), 28 opaque_rect_(opaque_rect),
27 layer_id_(layer_id), 29 layer_id_(layer_id),
28 source_frame_number_(source_frame_number), 30 source_frame_number_(source_frame_number),
29 can_use_lcd_text_(can_use_lcd_text) { 31 can_use_lcd_text_(can_use_lcd_text),
32 id_(s_next_id_++) {
30 set_picture_pile(picture_pile); 33 set_picture_pile(picture_pile);
31 tile_manager_->RegisterTile(this); 34 tile_manager_->RegisterTile(this);
32 } 35 }
33 36
34 Tile::~Tile() { 37 Tile::~Tile() {
35 TRACE_EVENT_OBJECT_DELETED_WITH_ID( 38 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
36 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::Tile", this); 39 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::Tile", this);
37 tile_manager_->UnregisterTile(this); 40 tile_manager_->UnregisterTile(this);
38 } 41 }
39 42
40 scoped_ptr<base::Value> Tile::AsValue() const { 43 scoped_ptr<base::Value> Tile::AsValue() const {
41 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); 44 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue());
42 TracedValue::MakeDictIntoImplicitSnapshot(res.get(), "cc::Tile", this); 45 TracedValue::MakeDictIntoImplicitSnapshot(res.get(), "cc::Tile", this);
43 res->Set("picture_pile", 46 res->Set("picture_pile",
44 TracedValue::CreateIDRef(picture_pile_.get()).release()); 47 TracedValue::CreateIDRef(picture_pile_.get()).release());
45 res->SetDouble("contents_scale", contents_scale_); 48 res->SetDouble("contents_scale", contents_scale_);
46 res->Set("active_priority", priority_[ACTIVE_TREE].AsValue().release()); 49 res->Set("active_priority", priority_[ACTIVE_TREE].AsValue().release());
47 res->Set("pending_priority", priority_[PENDING_TREE].AsValue().release()); 50 res->Set("pending_priority", priority_[PENDING_TREE].AsValue().release());
48 res->Set("managed_state", managed_state_.AsValue().release()); 51 res->Set("managed_state", managed_state_.AsValue().release());
49 return res.PassAs<base::Value>(); 52 return res.PassAs<base::Value>();
50 } 53 }
51 54
52 } // namespace cc 55 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698