Update V8 to version 4.6.62.
[chromium-blink-merge.git] / cc / test / fake_picture_layer_tiling_client.h
bloba49e2a149709253c4062ba15e6a833e2cf4bf97b
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 #ifndef CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_
6 #define CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_
8 #include "cc/playback/picture_pile_impl.h"
9 #include "cc/test/fake_tile_manager_client.h"
10 #include "cc/tiles/picture_layer_tiling.h"
11 #include "cc/tiles/tile.h"
12 #include "cc/tiles/tile_manager.h"
13 #include "ui/gfx/geometry/rect.h"
15 namespace cc {
17 class FakePictureLayerTilingClient : public PictureLayerTilingClient {
18 public:
19 FakePictureLayerTilingClient();
20 explicit FakePictureLayerTilingClient(ResourceProvider* resource_provider);
21 ~FakePictureLayerTilingClient() override;
23 // PictureLayerTilingClient implementation.
24 ScopedTilePtr CreateTile(float contents_scale,
25 const gfx::Rect& rect) override;
26 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override;
27 bool HasValidTilePriorities() const override;
29 void SetTileSize(const gfx::Size& tile_size);
30 gfx::Size TileSize() const { return tile_size_; }
32 const Region* GetPendingInvalidation() override;
33 const PictureLayerTiling* GetPendingOrActiveTwinTiling(
34 const PictureLayerTiling* tiling) const override;
35 bool RequiresHighResToDraw() const override;
37 void set_twin_tiling_set(PictureLayerTilingSet* set) {
38 twin_set_ = set;
39 twin_tiling_ = nullptr;
41 void set_twin_tiling(PictureLayerTiling* tiling) {
42 twin_tiling_ = tiling;
43 twin_set_ = nullptr;
45 void set_text_rect(const gfx::Rect& rect) { text_rect_ = rect; }
46 void set_invalidation(const Region& region) { invalidation_ = region; }
47 void set_has_valid_tile_priorities(bool has_valid_tile_priorities) {
48 has_valid_tile_priorities_ = has_valid_tile_priorities;
50 RasterSource* raster_source() { return pile_.get(); }
52 TileManager* tile_manager() const {
53 return tile_manager_.get();
56 protected:
57 FakeTileManagerClient tile_manager_client_;
58 scoped_ptr<ResourcePool> resource_pool_;
59 scoped_ptr<TileManager> tile_manager_;
60 scoped_refptr<PicturePileImpl> pile_;
61 gfx::Size tile_size_;
62 PictureLayerTilingSet* twin_set_;
63 PictureLayerTiling* twin_tiling_;
64 gfx::Rect text_rect_;
65 Region invalidation_;
66 bool has_valid_tile_priorities_;
69 } // namespace cc
71 #endif // CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_