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

Side by Side Diff: cc/test/fake_tile_manager.cc

Issue 1951193002: cc: Add mailbox support to ResourceProvider write locks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@worker_context_stream
Patch Set: Created 4 years, 6 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/test/fake_tile_manager.h" 5 #include "cc/test/fake_tile_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <deque> 10 #include <deque>
11 #include <limits> 11 #include <limits>
12 12
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/threading/thread_task_runner_handle.h" 14 #include "base/threading/thread_task_runner_handle.h"
15 #include "cc/raster/raster_buffer.h" 15 #include "cc/raster/raster_buffer.h"
16 #include "cc/test/fake_tile_task_manager.h" 16 #include "cc/test/fake_tile_task_manager.h"
17 #include "cc/trees/layer_tree_settings.h" 17 #include "cc/trees/layer_tree_settings.h"
18 18
19 namespace cc { 19 namespace cc {
20 20
21 namespace { 21 namespace {
22 22
23 base::LazyInstance<FakeTileTaskManagerImpl> g_fake_tile_task_manager = 23 base::LazyInstance<FakeTileTaskManagerImpl> g_fake_tile_task_manager =
24 LAZY_INSTANCE_INITIALIZER; 24 LAZY_INSTANCE_INITIALIZER;
25 25
26 base::LazyInstance<FakeRasterBufferProviderImpl> g_fake_raster_buffer_provider =
27 LAZY_INSTANCE_INITIALIZER;
28
26 } // namespace 29 } // namespace
27 30
28 FakeTileManager::FakeTileManager(TileManagerClient* client) 31 FakeTileManager::FakeTileManager(TileManagerClient* client)
29 : TileManager(client, 32 : TileManager(client,
30 base::ThreadTaskRunnerHandle::Get().get(), 33 base::ThreadTaskRunnerHandle::Get().get(),
31 std::numeric_limits<size_t>::max(), 34 std::numeric_limits<size_t>::max(),
32 false /* use_partial_raster */, 35 false /* use_partial_raster */,
33 LayerTreeSettings().max_preraster_distance_in_screen_pixels), 36 LayerTreeSettings().max_preraster_distance_in_screen_pixels),
34 image_decode_controller_( 37 image_decode_controller_(
35 ResourceFormat::RGBA_8888, 38 ResourceFormat::RGBA_8888,
36 LayerTreeSettings().software_decoded_image_budget_bytes) { 39 LayerTreeSettings().software_decoded_image_budget_bytes) {
37 SetResources( 40 SetResources(
38 nullptr, &image_decode_controller_, g_fake_tile_task_manager.Pointer(), 41 nullptr, &image_decode_controller_, g_fake_tile_task_manager.Pointer(),
42 g_fake_raster_buffer_provider.Pointer(),
39 std::numeric_limits<size_t>::max(), false /* use_gpu_rasterization */); 43 std::numeric_limits<size_t>::max(), false /* use_gpu_rasterization */);
40 } 44 }
41 45
42 FakeTileManager::FakeTileManager(TileManagerClient* client, 46 FakeTileManager::FakeTileManager(TileManagerClient* client,
43 ResourcePool* resource_pool) 47 ResourcePool* resource_pool)
44 : TileManager(client, 48 : TileManager(client,
45 base::ThreadTaskRunnerHandle::Get().get(), 49 base::ThreadTaskRunnerHandle::Get().get(),
46 std::numeric_limits<size_t>::max(), 50 std::numeric_limits<size_t>::max(),
47 false /* use_partial_raster */, 51 false /* use_partial_raster */,
48 LayerTreeSettings().max_preraster_distance_in_screen_pixels), 52 LayerTreeSettings().max_preraster_distance_in_screen_pixels),
49 image_decode_controller_( 53 image_decode_controller_(
50 ResourceFormat::RGBA_8888, 54 ResourceFormat::RGBA_8888,
51 LayerTreeSettings().software_decoded_image_budget_bytes) { 55 LayerTreeSettings().software_decoded_image_budget_bytes) {
52 SetResources(resource_pool, &image_decode_controller_, 56 SetResources(resource_pool, &image_decode_controller_,
53 g_fake_tile_task_manager.Pointer(), 57 g_fake_tile_task_manager.Pointer(),
58 g_fake_raster_buffer_provider.Pointer(),
54 std::numeric_limits<size_t>::max(), 59 std::numeric_limits<size_t>::max(),
55 false /* use_gpu_rasterization */); 60 false /* use_gpu_rasterization */);
56 } 61 }
57 62
58 FakeTileManager::~FakeTileManager() {} 63 FakeTileManager::~FakeTileManager() {}
59 64
60 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) { 65 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) {
61 return std::find(tiles_for_raster.begin(), 66 return std::find(tiles_for_raster.begin(),
62 tiles_for_raster.end(), 67 tiles_for_raster.end(),
63 tile) != tiles_for_raster.end(); 68 tile) != tiles_for_raster.end();
64 } 69 }
65 70
66 void FakeTileManager::Release(Tile* tile) { 71 void FakeTileManager::Release(Tile* tile) {
67 TileManager::Release(tile); 72 TileManager::Release(tile);
68 73
69 FreeResourcesForReleasedTiles(); 74 FreeResourcesForReleasedTiles();
70 CleanUpReleasedTiles(); 75 CleanUpReleasedTiles();
71 } 76 }
72 77
73 } // namespace cc 78 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698