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

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

Issue 1144693002: cc: Move files out of cc/resources/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resources: android Created 5 years, 7 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
« no previous file with comments | « cc/resources/tile.h ('k') | cc/resources/tile_draw_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "cc/resources/tile.h"
6
7 #include <algorithm>
8
9 #include "base/trace_event/trace_event_argument.h"
10 #include "cc/base/math_util.h"
11 #include "cc/debug/traced_value.h"
12 #include "cc/resources/tile_manager.h"
13
14 namespace cc {
15
16 Tile::Id Tile::s_next_id_ = 0;
17
18 Tile::Tile(TileManager* tile_manager,
19 const gfx::Size& desired_texture_size,
20 const gfx::Rect& content_rect,
21 float contents_scale,
22 int layer_id,
23 int source_frame_number,
24 int flags)
25 : tile_manager_(tile_manager),
26 desired_texture_size_(desired_texture_size),
27 content_rect_(content_rect),
28 contents_scale_(contents_scale),
29 layer_id_(layer_id),
30 source_frame_number_(source_frame_number),
31 flags_(flags),
32 tiling_i_index_(-1),
33 tiling_j_index_(-1),
34 required_for_activation_(false),
35 required_for_draw_(false),
36 id_(s_next_id_++),
37 scheduled_priority_(0) {
38 }
39
40 Tile::~Tile() {
41 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
42 TRACE_DISABLED_BY_DEFAULT("cc.debug"),
43 "cc::Tile", this);
44 }
45
46 void Tile::AsValueInto(base::trace_event::TracedValue* value) const {
47 TracedValue::MakeDictIntoImplicitSnapshotWithCategory(
48 TRACE_DISABLED_BY_DEFAULT("cc.debug"), value, "cc::Tile", this);
49 value->SetDouble("contents_scale", contents_scale_);
50
51 MathUtil::AddToTracedValue("content_rect", content_rect_, value);
52
53 value->SetInteger("layer_id", layer_id_);
54
55 value->BeginDictionary("draw_info");
56 draw_info_.AsValueInto(value);
57 value->EndDictionary();
58
59 value->SetBoolean("has_resource", draw_info().has_resource());
60 value->SetBoolean("is_using_gpu_memory",
61 draw_info().has_resource() || HasRasterTask());
62 value->SetInteger("scheduled_priority", scheduled_priority_);
63 value->SetBoolean("use_picture_analysis", use_picture_analysis());
64 value->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes());
65 }
66
67 size_t Tile::GPUMemoryUsageInBytes() const {
68 if (draw_info_.resource_)
69 return draw_info_.resource_->bytes();
70 return 0;
71 }
72
73 void Tile::Deleter::operator()(Tile* tile) const {
74 TileManager* tile_manager = tile->tile_manager_;
75 tile_manager->Release(tile);
76 }
77
78 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile.h ('k') | cc/resources/tile_draw_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698