Chromium Code Reviews| 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. | |
|
vmpstr
2017/01/05 22:00:46
Can you specify to pass 0 if no pending callback e
ericrk
2017/01/09 23:05:21
The RasterBufferProvider knows the last callback i
| |
| 75 virtual uint64_t SetReadyToDrawCallback( | |
| 76 const ResourceProvider::ResourceIdArray& resource_ids, | |
| 77 const base::Callback<void()>& callback, | |
| 78 uint64_t pending_callback_id) const = 0; | |
| 79 | |
| 66 // Shutdown for doing cleanup. | 80 // Shutdown for doing cleanup. |
| 67 virtual void Shutdown() = 0; | 81 virtual void Shutdown() = 0; |
| 68 | 82 |
| 69 protected: | 83 protected: |
| 70 // Check if resource format matches output format. | 84 // Check if resource format matches output format. |
| 71 static bool ResourceFormatRequiresSwizzle(ResourceFormat format); | 85 static bool ResourceFormatRequiresSwizzle(ResourceFormat format); |
| 72 }; | 86 }; |
| 73 | 87 |
| 74 } // namespace cc | 88 } // namespace cc |
| 75 | 89 |
| 76 #endif // CC_RASTER_RASTER_BUFFER_PROVIDER_H_ | 90 #endif // CC_RASTER_RASTER_BUFFER_PROVIDER_H_ |
| OLD | NEW |