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

Side by Side Diff: cc/tile.cc

Issue 12353003: cc: Refactored Tile::GetResourceId (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed forward declare Created 7 years, 9 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/tile.h" 5 #include "cc/tile.h"
6 6
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "cc/tile_drawing_info.h"
8 #include "cc/tile_manager.h" 9 #include "cc/tile_manager.h"
9 #include "third_party/khronos/GLES2/gl2.h" 10 #include "third_party/khronos/GLES2/gl2.h"
10 11
11 namespace cc { 12 namespace cc {
12 13
13 Tile::Tile(TileManager* tile_manager, 14 Tile::Tile(TileManager* tile_manager,
14 PicturePileImpl* picture_pile, 15 PicturePileImpl* picture_pile,
15 gfx::Size tile_size, 16 gfx::Size tile_size,
16 GLenum format, 17 GLenum format,
17 gfx::Rect content_rect, 18 gfx::Rect content_rect,
18 gfx::Rect opaque_rect, 19 gfx::Rect opaque_rect,
19 float contents_scale, 20 float contents_scale,
20 int layer_id) 21 int layer_id)
21 : tile_manager_(tile_manager), 22 : tile_manager_(tile_manager),
22 tile_size_(tile_size), 23 tile_size_(tile_size),
23 format_(format), 24 format_(format),
24 content_rect_(content_rect), 25 content_rect_(content_rect),
25 opaque_rect_(opaque_rect), 26 opaque_rect_(opaque_rect),
26 contents_scale_(contents_scale), 27 contents_scale_(contents_scale),
27 layer_id_(layer_id) { 28 layer_id_(layer_id),
29 drawing_info_(this) {
28 set_picture_pile(picture_pile); 30 set_picture_pile(picture_pile);
29 tile_manager_->RegisterTile(this); 31 tile_manager_->RegisterTile(this);
30 } 32 }
31 33
32 Tile::~Tile() { 34 Tile::~Tile() {
33 tile_manager_->UnregisterTile(this); 35 tile_manager_->UnregisterTile(this);
34 } 36 }
35 37
36 scoped_ptr<base::Value> Tile::AsValue() const { 38 scoped_ptr<base::Value> Tile::AsValue() const {
37 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); 39 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue());
38 res->SetString("id", base::StringPrintf("%p", this)); 40 res->SetString("id", base::StringPrintf("%p", this));
39 res->SetString("picture_pile", base::StringPrintf("%p", 41 res->SetString("picture_pile", base::StringPrintf("%p",
40 picture_pile_.get())); 42 picture_pile_.get()));
41 res->SetDouble("contents_scale", contents_scale_); 43 res->SetDouble("contents_scale", contents_scale_);
42 res->Set("priority.0", priority_[ACTIVE_TREE].AsValue().release()); 44 res->Set("priority.0", priority_[ACTIVE_TREE].AsValue().release());
43 res->Set("priority.1", priority_[PENDING_TREE].AsValue().release()); 45 res->Set("priority.1", priority_[PENDING_TREE].AsValue().release());
44 res->Set("managed_state", managed_state_.AsValue().release()); 46 res->Set("managed_state", managed_state_.AsValue().release());
45 return res.PassAs<base::Value>(); 47 return res.PassAs<base::Value>();
46 } 48 }
47 49
48 } // namespace cc 50 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698