OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CC_RASTER_TILE_TASK_RUNNER_H_ | 5 #ifndef CC_RASTER_TILE_TASK_RUNNER_H_ |
6 #define CC_RASTER_TILE_TASK_RUNNER_H_ | 6 #define CC_RASTER_TILE_TASK_RUNNER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 17 matching lines...) Expand all Loading... |
28 virtual void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) = 0; | 28 virtual void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) = 0; |
29 | 29 |
30 protected: | 30 protected: |
31 virtual ~TileTaskClient() {} | 31 virtual ~TileTaskClient() {} |
32 }; | 32 }; |
33 | 33 |
34 class CC_EXPORT TileTask : public Task { | 34 class CC_EXPORT TileTask : public Task { |
35 public: | 35 public: |
36 typedef std::vector<scoped_refptr<TileTask>> Vector; | 36 typedef std::vector<scoped_refptr<TileTask>> Vector; |
37 | 37 |
38 virtual void ScheduleOnOriginThread(TileTaskClient* client) = 0; | |
39 virtual void CompleteOnOriginThread(TileTaskClient* client) = 0; | |
40 | |
41 void WillSchedule(); | |
42 void DidSchedule(); | |
43 bool HasBeenScheduled() const; | |
44 | |
45 void WillComplete(); | |
46 void DidComplete(); | 38 void DidComplete(); |
47 bool HasCompleted() const; | 39 bool HasCompleted() const; |
48 | 40 |
49 protected: | 41 protected: |
50 TileTask(); | 42 TileTask(); |
51 ~TileTask() override; | 43 ~TileTask() override; |
52 | 44 |
53 bool did_schedule_; | |
54 bool did_complete_; | 45 bool did_complete_; |
55 }; | 46 }; |
56 | 47 |
57 class CC_EXPORT ImageDecodeTask : public TileTask { | 48 class CC_EXPORT ImageDecodeTask : public TileTask { |
58 public: | 49 public: |
59 typedef std::vector<scoped_refptr<ImageDecodeTask>> Vector; | 50 typedef std::vector<scoped_refptr<ImageDecodeTask>> Vector; |
60 | 51 |
61 protected: | 52 protected: |
62 ImageDecodeTask(); | 53 ImageDecodeTask(); |
63 ~ImageDecodeTask() override; | 54 ~ImageDecodeTask() override; |
(...skipping 23 matching lines...) Expand all Loading... |
87 // CheckForCompletedTasks() is called. | 78 // CheckForCompletedTasks() is called. |
88 virtual void Shutdown() = 0; | 79 virtual void Shutdown() = 0; |
89 | 80 |
90 // Schedule running of tile tasks in |graph| and all dependencies. | 81 // Schedule running of tile tasks in |graph| and all dependencies. |
91 // Previously scheduled tasks that are not in |graph| will be canceled unless | 82 // Previously scheduled tasks that are not in |graph| will be canceled unless |
92 // already running. Once scheduled, reply callbacks are guaranteed to run for | 83 // already running. Once scheduled, reply callbacks are guaranteed to run for |
93 // all tasks even if they later get canceled by another call to | 84 // all tasks even if they later get canceled by another call to |
94 // ScheduleTasks(). | 85 // ScheduleTasks(). |
95 virtual void ScheduleTasks(TaskGraph* graph) = 0; | 86 virtual void ScheduleTasks(TaskGraph* graph) = 0; |
96 | 87 |
97 // Check for completed tasks and dispatch reply callbacks. | 88 // Collect completed tasks. |
98 virtual void CheckForCompletedTasks() = 0; | 89 virtual void CollectCompletedTasks(Task::Vector* completed_tasks) = 0; |
99 | 90 |
100 // Returns the format to use for the tiles. | 91 // Returns the format to use for the tiles. |
101 virtual ResourceFormat GetResourceFormat(bool must_support_alpha) const = 0; | 92 virtual ResourceFormat GetResourceFormat(bool must_support_alpha) const = 0; |
102 | 93 |
103 // Determine if the resource requires swizzling. | 94 // Determine if the resource requires swizzling. |
104 virtual bool GetResourceRequiresSwizzle(bool must_support_alpha) const = 0; | 95 virtual bool GetResourceRequiresSwizzle(bool must_support_alpha) const = 0; |
105 | 96 |
| 97 // TODO(prashant.n): This will be removed soon. Don't use this. |
| 98 virtual TileTaskClient* AsTileTaskClient() = 0; |
| 99 |
106 protected: | 100 protected: |
107 // Check if resource format matches output format. | 101 // Check if resource format matches output format. |
108 static bool ResourceFormatRequiresSwizzle(ResourceFormat format); | 102 static bool ResourceFormatRequiresSwizzle(ResourceFormat format); |
109 | 103 |
110 virtual ~TileTaskRunner() {} | 104 virtual ~TileTaskRunner() {} |
111 }; | 105 }; |
112 | 106 |
113 } // namespace cc | 107 } // namespace cc |
114 | 108 |
115 #endif // CC_RASTER_TILE_TASK_RUNNER_H_ | 109 #endif // CC_RASTER_TILE_TASK_RUNNER_H_ |
OLD | NEW |