| 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> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "cc/raster/raster_buffer.h" |
| 13 #include "cc/raster/task_graph_runner.h" | 14 #include "cc/raster/task_graph_runner.h" |
| 14 #include "cc/resources/resource_format.h" | 15 #include "cc/resources/resource_format.h" |
| 15 | 16 |
| 16 namespace cc { | 17 namespace cc { |
| 17 class ImageDecodeTask; | |
| 18 class RasterTask; | |
| 19 class Resource; | |
| 20 class RasterBuffer; | |
| 21 | |
| 22 class CC_EXPORT TileTaskClient { | |
| 23 public: | |
| 24 virtual std::unique_ptr<RasterBuffer> AcquireBufferForRaster( | |
| 25 const Resource* resource, | |
| 26 uint64_t resource_content_id, | |
| 27 uint64_t previous_content_id) = 0; | |
| 28 virtual void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) = 0; | |
| 29 | |
| 30 protected: | |
| 31 virtual ~TileTaskClient() {} | |
| 32 }; | |
| 33 | 18 |
| 34 class CC_EXPORT TileTask : public Task { | 19 class CC_EXPORT TileTask : public Task { |
| 35 public: | 20 public: |
| 36 typedef std::vector<scoped_refptr<TileTask>> Vector; | 21 typedef std::vector<scoped_refptr<TileTask>> Vector; |
| 37 | 22 |
| 38 virtual void ScheduleOnOriginThread(TileTaskClient* client) = 0; | 23 virtual void ScheduleOnOriginThread(RasterBufferProvider* provider) = 0; |
| 39 virtual void CompleteOnOriginThread(TileTaskClient* client) = 0; | 24 virtual void CompleteOnOriginThread(RasterBufferProvider* provider) = 0; |
| 40 | 25 |
| 41 void WillSchedule(); | 26 void WillSchedule(); |
| 42 void DidSchedule(); | 27 void DidSchedule(); |
| 43 bool HasBeenScheduled() const; | 28 bool HasBeenScheduled() const; |
| 44 | 29 |
| 45 void WillComplete(); | 30 void WillComplete(); |
| 46 void DidComplete(); | 31 void DidComplete(); |
| 47 bool HasCompleted() const; | 32 bool HasCompleted() const; |
| 48 | 33 |
| 49 protected: | 34 protected: |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 94 |
| 110 // Check for completed tasks and dispatch reply callbacks. | 95 // Check for completed tasks and dispatch reply callbacks. |
| 111 virtual void CheckForCompletedTasks() = 0; | 96 virtual void CheckForCompletedTasks() = 0; |
| 112 | 97 |
| 113 // Returns the format to use for the tiles. | 98 // Returns the format to use for the tiles. |
| 114 virtual ResourceFormat GetResourceFormat(bool must_support_alpha) const = 0; | 99 virtual ResourceFormat GetResourceFormat(bool must_support_alpha) const = 0; |
| 115 | 100 |
| 116 // Determine if the resource requires swizzling. | 101 // Determine if the resource requires swizzling. |
| 117 virtual bool GetResourceRequiresSwizzle(bool must_support_alpha) const = 0; | 102 virtual bool GetResourceRequiresSwizzle(bool must_support_alpha) const = 0; |
| 118 | 103 |
| 104 // Downcasting routine for RasterBufferProvider interface. |
| 105 virtual RasterBufferProvider* AsRasterBufferProvider() = 0; |
| 106 |
| 119 protected: | 107 protected: |
| 120 // Check if resource format matches output format. | 108 // Check if resource format matches output format. |
| 121 static bool ResourceFormatRequiresSwizzle(ResourceFormat format); | 109 static bool ResourceFormatRequiresSwizzle(ResourceFormat format); |
| 122 | 110 |
| 123 virtual ~TileTaskRunner() {} | 111 virtual ~TileTaskRunner() {} |
| 124 }; | 112 }; |
| 125 | 113 |
| 126 } // namespace cc | 114 } // namespace cc |
| 127 | 115 |
| 128 #endif // CC_RASTER_TILE_TASK_RUNNER_H_ | 116 #endif // CC_RASTER_TILE_TASK_RUNNER_H_ |
| OLD | NEW |