| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_RASTER_BUFFER_PROVIDER_H_ | 5 #ifndef CC_RASTER_RASTER_BUFFER_PROVIDER_H_ |
| 6 #define CC_RASTER_RASTER_BUFFER_PROVIDER_H_ | 6 #define CC_RASTER_RASTER_BUFFER_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "cc/playback/raster_source.h" | 10 #include "cc/playback/raster_source.h" |
| 11 #include "cc/raster/raster_buffer.h" | 11 #include "cc/raster/raster_buffer.h" |
| 12 #include "cc/raster/task_graph_runner.h" | 12 #include "cc/raster/task_graph_runner.h" |
| 13 #include "cc/raster/tile_task.h" | 13 #include "cc/raster/tile_task.h" |
| 14 #include "cc/resources/resource_format.h" | 14 #include "cc/resources/resource_format.h" |
| 15 #include "cc/resources/resource_provider.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
| 17 | 18 |
| 18 namespace cc { | 19 namespace cc { |
| 19 class Resource; | 20 class Resource; |
| 20 | 21 |
| 21 class CC_EXPORT RasterBufferProvider { | 22 class CC_EXPORT RasterBufferProvider { |
| 22 public: | 23 public: |
| 23 RasterBufferProvider(); | 24 RasterBufferProvider(); |
| 24 virtual ~RasterBufferProvider(); | 25 virtual ~RasterBufferProvider(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // Returns the format to use for the tiles. | 57 // Returns the format to use for the tiles. |
| 57 virtual ResourceFormat GetResourceFormat(bool must_support_alpha) const = 0; | 58 virtual ResourceFormat GetResourceFormat(bool must_support_alpha) const = 0; |
| 58 | 59 |
| 59 // Determine if the resource requires swizzling. | 60 // Determine if the resource requires swizzling. |
| 60 virtual bool IsResourceSwizzleRequired(bool must_support_alpha) const = 0; | 61 virtual bool IsResourceSwizzleRequired(bool must_support_alpha) const = 0; |
| 61 | 62 |
| 62 // Determine if the RasterBufferProvider can handle partial raster into | 63 // Determine if the RasterBufferProvider can handle partial raster into |
| 63 // the Resource provided in AcquireBufferForRaster. | 64 // the Resource provided in AcquireBufferForRaster. |
| 64 virtual bool CanPartialRasterIntoProvidedResource() const = 0; | 65 virtual bool CanPartialRasterIntoProvidedResource() const = 0; |
| 65 | 66 |
| 67 // Returns true if the indicated resource is ready to draw. |
| 68 virtual bool IsResourceReadyToDraw(ResourceId id) const = 0; |
| 69 |
| 70 // Calls the provided |callback| when the provided |resources| are ready to |
| 71 // draw. Returns a callback ID which can be used to track this callback. |
| 72 // Will return 0 if no callback is needed (resources are already ready to |
| 73 // draw). The caller may optionally pass the ID of a pending callback to |
| 74 // avoid creating a new callback unnecessarily. If the caller does not |
| 75 // have a pending callback, 0 should be passed for |pending_callback_id|. |
| 76 virtual uint64_t SetReadyToDrawCallback( |
| 77 const ResourceProvider::ResourceIdArray& resource_ids, |
| 78 const base::Callback<void()>& callback, |
| 79 uint64_t pending_callback_id) const = 0; |
| 80 |
| 66 // Shutdown for doing cleanup. | 81 // Shutdown for doing cleanup. |
| 67 virtual void Shutdown() = 0; | 82 virtual void Shutdown() = 0; |
| 68 | 83 |
| 69 protected: | 84 protected: |
| 70 // Check if resource format matches output format. | 85 // Check if resource format matches output format. |
| 71 static bool ResourceFormatRequiresSwizzle(ResourceFormat format); | 86 static bool ResourceFormatRequiresSwizzle(ResourceFormat format); |
| 72 }; | 87 }; |
| 73 | 88 |
| 74 } // namespace cc | 89 } // namespace cc |
| 75 | 90 |
| 76 #endif // CC_RASTER_RASTER_BUFFER_PROVIDER_H_ | 91 #endif // CC_RASTER_RASTER_BUFFER_PROVIDER_H_ |
| OLD | NEW |