forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfake_tile_manager.cc
60 lines (47 loc) · 1.87 KB
/
fake_tile_manager.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cc/test/fake_tile_manager.h"
#include <stddef.h>
#include <stdint.h>
#include <limits>
#include <memory>
#include "base/containers/contains.h"
#include "base/threading/thread_task_runner_handle.h"
#include "cc/raster/raster_buffer.h"
#include "cc/raster/synchronous_task_graph_runner.h"
#include "cc/test/fake_raster_buffer_provider.h"
#include "cc/test/fake_tile_task_manager.h"
#include "cc/trees/layer_tree_settings.h"
namespace cc {
namespace {
SynchronousTaskGraphRunner* GetGlobalTaskGraphRunner() {
static auto* task_graph_runner = new SynchronousTaskGraphRunner;
return task_graph_runner;
}
FakeRasterBufferProviderImpl* GetGlobalRasterBufferProvider() {
static auto* buffer_provider = new FakeRasterBufferProviderImpl;
return buffer_provider;
}
} // namespace
FakeTileManager::FakeTileManager(TileManagerClient* client,
ResourcePool* resource_pool)
: TileManager(client,
base::ThreadTaskRunnerHandle::Get().get(),
nullptr,
std::numeric_limits<size_t>::max(),
TileManagerSettings()),
image_decode_cache_(
kN32_SkColorType,
LayerTreeSettings().decoded_image_working_set_budget_bytes,
PaintImage::kDefaultGeneratorClientId) {
SetResources(resource_pool, &image_decode_cache_, GetGlobalTaskGraphRunner(),
GetGlobalRasterBufferProvider(),
/*use_gpu_rasterization=*/false, nullptr);
SetTileTaskManagerForTesting(std::make_unique<FakeTileTaskManagerImpl>());
}
FakeTileManager::~FakeTileManager() = default;
bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) {
return base::Contains(tiles_for_raster, tile);
}
} // namespace cc