Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / cc / tiles / tile.cc
blobda4c08018d57c6bce111f95b354ef924aa44d475
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.
5 #include "cc/tiles/tile.h"
7 #include <algorithm>
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/tiles/tile_manager.h"
14 namespace cc {
16 Tile::Id Tile::s_next_id_ = 0;
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) {
40 Tile::~Tile() {
41 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
42 TRACE_DISABLED_BY_DEFAULT("cc.debug"),
43 "cc::Tile", this);
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_);
51 MathUtil::AddToTracedValue("content_rect", content_rect_, value);
53 value->SetInteger("layer_id", layer_id_);
55 value->BeginDictionary("draw_info");
56 draw_info_.AsValueInto(value);
57 value->EndDictionary();
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());
67 size_t Tile::GPUMemoryUsageInBytes() const {
68 if (draw_info_.resource_)
69 return draw_info_.resource_->bytes();
70 return 0;
73 void Tile::Deleter::operator()(Tile* tile) const {
74 TileManager* tile_manager = tile->tile_manager_;
75 tile_manager->Release(tile);
78 } // namespace cc