[GCM] Remove GCMDriver::Purge and GCMClient::CheckOut
[chromium-blink-merge.git] / cc / test / fake_picture_layer_tiling_client.cc
blob293d4f6563e82ad1cf0fe684fa7fdc55bce5bb06
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/test/fake_picture_layer_tiling_client.h"
7 #include <limits>
9 #include "cc/test/fake_picture_pile_impl.h"
10 #include "cc/test/fake_tile_manager.h"
12 namespace cc {
14 FakePictureLayerTilingClient::FakePictureLayerTilingClient()
15 : tile_manager_(new FakeTileManager(&tile_manager_client_)),
16 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()),
17 twin_set_(nullptr),
18 twin_tiling_(nullptr),
19 recycled_twin_tiling_(nullptr),
20 max_tile_priority_bin_(TilePriority::NOW) {
23 FakePictureLayerTilingClient::FakePictureLayerTilingClient(
24 ResourceProvider* resource_provider)
25 : resource_pool_(
26 ResourcePool::Create(resource_provider, GL_TEXTURE_2D, RGBA_8888)),
27 tile_manager_(
28 new FakeTileManager(&tile_manager_client_, resource_pool_.get())),
29 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()),
30 twin_set_(nullptr),
31 twin_tiling_(nullptr),
32 recycled_twin_tiling_(nullptr),
33 max_tile_priority_bin_(TilePriority::NOW) {
36 FakePictureLayerTilingClient::~FakePictureLayerTilingClient() {
39 scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile(
40 float content_scale,
41 const gfx::Rect& rect) {
42 return tile_manager_->CreateTile(pile_.get(), tile_size_, rect, 1, 0, 0, 0);
45 void FakePictureLayerTilingClient::SetTileSize(const gfx::Size& tile_size) {
46 tile_size_ = tile_size;
49 gfx::Size FakePictureLayerTilingClient::CalculateTileSize(
50 const gfx::Size& /* content_bounds */) const {
51 return tile_size_;
54 TilePriority::PriorityBin FakePictureLayerTilingClient::GetMaxTilePriorityBin()
55 const {
56 return max_tile_priority_bin_;
59 const Region* FakePictureLayerTilingClient::GetPendingInvalidation() {
60 return &invalidation_;
63 const PictureLayerTiling*
64 FakePictureLayerTilingClient::GetPendingOrActiveTwinTiling(
65 const PictureLayerTiling* tiling) const {
66 if (!twin_set_)
67 return twin_tiling_;
68 for (size_t i = 0; i < twin_set_->num_tilings(); ++i) {
69 if (twin_set_->tiling_at(i)->contents_scale() == tiling->contents_scale())
70 return twin_set_->tiling_at(i);
72 return nullptr;
75 PictureLayerTiling* FakePictureLayerTilingClient::GetRecycledTwinTiling(
76 const PictureLayerTiling* tiling) {
77 return recycled_twin_tiling_;
80 WhichTree FakePictureLayerTilingClient::GetTree() const {
81 return tree_;
84 bool FakePictureLayerTilingClient::RequiresHighResToDraw() const {
85 return false;
88 } // namespace cc