OLD | NEW |
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/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
15 #include "cc/raster/raster_buffer.h" | 15 #include "cc/raster/raster_buffer.h" |
16 #include "cc/raster/tile_task_runner.h" | 16 #include "cc/raster/tile_task_runner.h" |
17 | 17 |
18 namespace cc { | 18 namespace cc { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 class FakeTileTaskRunnerImpl : public TileTaskRunner, public TileTaskClient { | 22 class FakeTileTaskRunnerImpl : public TileTaskRunner, |
| 23 public RasterBufferProvider { |
23 public: | 24 public: |
24 // Overridden from TileTaskRunner: | 25 // Overridden from TileTaskRunner: |
25 void Shutdown() override {} | 26 void Shutdown() override {} |
26 void ScheduleTasks(TaskGraph* graph) override { | 27 void ScheduleTasks(TaskGraph* graph) override { |
27 for (const auto& node : graph->nodes) { | 28 for (const auto& node : graph->nodes) { |
28 RasterTask* task = static_cast<RasterTask*>(node.task); | 29 RasterTask* task = static_cast<RasterTask*>(node.task); |
29 | 30 |
30 task->WillSchedule(); | 31 task->WillSchedule(); |
31 task->ScheduleOnOriginThread(this); | 32 task->ScheduleOnOriginThread(this); |
32 task->DidSchedule(); | 33 task->DidSchedule(); |
(...skipping 12 matching lines...) Expand all Loading... |
45 task->DidComplete(); | 46 task->DidComplete(); |
46 } | 47 } |
47 completed_tasks_.clear(); | 48 completed_tasks_.clear(); |
48 } | 49 } |
49 ResourceFormat GetResourceFormat(bool must_support_alpha) const override { | 50 ResourceFormat GetResourceFormat(bool must_support_alpha) const override { |
50 return RGBA_8888; | 51 return RGBA_8888; |
51 } | 52 } |
52 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override { | 53 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override { |
53 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); | 54 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); |
54 } | 55 } |
| 56 RasterBufferProvider* AsRasterBufferProvider() override { return this; } |
55 | 57 |
56 // Overridden from TileTaskClient: | 58 // Overridden from RasterBufferProvider: |
57 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( | 59 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( |
58 const Resource* resource, | 60 const Resource* resource, |
59 uint64_t resource_content_id, | 61 uint64_t resource_content_id, |
60 uint64_t previous_content_id) override { | 62 uint64_t previous_content_id) override { |
61 return nullptr; | 63 return nullptr; |
62 } | 64 } |
63 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override {} | 65 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override {} |
64 | 66 |
65 private: | 67 private: |
66 RasterTask::Vector completed_tasks_; | 68 RasterTask::Vector completed_tasks_; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 102 } |
101 | 103 |
102 void FakeTileManager::Release(Tile* tile) { | 104 void FakeTileManager::Release(Tile* tile) { |
103 TileManager::Release(tile); | 105 TileManager::Release(tile); |
104 | 106 |
105 FreeResourcesForReleasedTiles(); | 107 FreeResourcesForReleasedTiles(); |
106 CleanUpReleasedTiles(); | 108 CleanUpReleasedTiles(); |
107 } | 109 } |
108 | 110 |
109 } // namespace cc | 111 } // namespace cc |
OLD | NEW |