| 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_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ | 5 #ifndef CC_RASTER_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ |
| 6 #define CC_RASTER_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ | 6 #define CC_RASTER_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/cancelable_callback.h" |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "cc/output/context_provider.h" | 12 #include "cc/output/context_provider.h" |
| 12 #include "cc/raster/raster_buffer_provider.h" | 13 #include "cc/raster/raster_buffer_provider.h" |
| 13 #include "cc/raster/staging_buffer_pool.h" | 14 #include "cc/raster/staging_buffer_pool.h" |
| 14 #include "cc/resources/resource_provider.h" | 15 #include "cc/resources/resource_provider.h" |
| 15 #include "gpu/command_buffer/common/sync_token.h" | 16 #include "gpu/command_buffer/common/sync_token.h" |
| 16 | 17 |
| 17 namespace cc { | 18 namespace cc { |
| 18 struct StagingBuffer; | 19 struct StagingBuffer; |
| 19 class StagingBufferPool; | 20 class StagingBufferPool; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 30 ResourceFormat preferred_tile_format, | 31 ResourceFormat preferred_tile_format, |
| 31 bool async_worker_context_enabled); | 32 bool async_worker_context_enabled); |
| 32 ~OneCopyRasterBufferProvider() override; | 33 ~OneCopyRasterBufferProvider() override; |
| 33 | 34 |
| 34 // Overridden from RasterBufferProvider: | 35 // Overridden from RasterBufferProvider: |
| 35 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( | 36 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( |
| 36 const Resource* resource, | 37 const Resource* resource, |
| 37 uint64_t resource_content_id, | 38 uint64_t resource_content_id, |
| 38 uint64_t previous_content_id) override; | 39 uint64_t previous_content_id) override; |
| 39 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override; | 40 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override; |
| 41 bool IsResourceReadyToDraw(const Resource* resource) override; |
| 42 void SignalResourcesReadyToDraw(const std::vector<const Resource*>& resources, |
| 43 const base::Closure& callback) override; |
| 40 void OrderingBarrier() override; | 44 void OrderingBarrier() override; |
| 41 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; | 45 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; |
| 42 bool IsResourceSwizzleRequired(bool must_support_alpha) const override; | 46 bool IsResourceSwizzleRequired(bool must_support_alpha) const override; |
| 43 bool CanPartialRasterIntoProvidedResource() const override; | 47 bool CanPartialRasterIntoProvidedResource() const override; |
| 44 void Shutdown() override; | 48 void Shutdown() override; |
| 45 | 49 |
| 46 // Playback raster source and copy result into |resource|. | 50 // Playback raster source and copy result into |resource|. |
| 47 void PlaybackAndCopyOnWorkerThread( | 51 void PlaybackAndCopyOnWorkerThread( |
| 48 const Resource* resource, | 52 const Resource* resource, |
| 49 ResourceProvider::ScopedWriteLockGL* resource_lock, | 53 ResourceProvider::ScopedWriteLockGL* resource_lock, |
| 50 const gpu::SyncToken& sync_token, | 54 const gpu::SyncToken& sync_token, |
| 51 const RasterSource* raster_source, | 55 const RasterSource* raster_source, |
| 52 const gfx::Rect& raster_full_rect, | 56 const gfx::Rect& raster_full_rect, |
| 53 const gfx::Rect& raster_dirty_rect, | 57 const gfx::Rect& raster_dirty_rect, |
| 54 const gfx::SizeF& scales, | 58 const gfx::SizeF& scales, |
| 55 const RasterSource::PlaybackSettings& playback_settings, | 59 const RasterSource::PlaybackSettings& playback_settings, |
| 56 uint64_t previous_content_id, | 60 uint64_t previous_content_id, |
| 57 uint64_t new_content_id); | 61 uint64_t new_content_id); |
| 58 | 62 |
| 59 private: | 63 private: |
| 60 class RasterBufferImpl : public RasterBuffer { | 64 class RasterBufferImpl : public RasterBuffer { |
| 61 public: | 65 public: |
| 62 RasterBufferImpl(OneCopyRasterBufferProvider* client, | 66 RasterBufferImpl(OneCopyRasterBufferProvider* client, |
| 63 ResourceProvider* resource_provider, | 67 ResourceProvider* resource_provider, |
| 64 const Resource* resource, | 68 const Resource* resource, |
| 65 uint64_t previous_content_id, | 69 uint64_t previous_content_id); |
| 66 bool async_worker_context_enabled); | |
| 67 ~RasterBufferImpl() override; | 70 ~RasterBufferImpl() override; |
| 68 | 71 |
| 69 // Overridden from RasterBuffer: | 72 // Overridden from RasterBuffer: |
| 70 void Playback( | 73 void Playback( |
| 71 const RasterSource* raster_source, | 74 const RasterSource* raster_source, |
| 72 const gfx::Rect& raster_full_rect, | 75 const gfx::Rect& raster_full_rect, |
| 73 const gfx::Rect& raster_dirty_rect, | 76 const gfx::Rect& raster_dirty_rect, |
| 74 uint64_t new_content_id, | 77 uint64_t new_content_id, |
| 75 const gfx::SizeF& scales, | 78 const gfx::SizeF& scales, |
| 76 const RasterSource::PlaybackSettings& playback_settings) override; | 79 const RasterSource::PlaybackSettings& playback_settings) override; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 const bool async_worker_context_enabled_; | 127 const bool async_worker_context_enabled_; |
| 125 | 128 |
| 126 std::set<RasterBufferImpl*> pending_raster_buffers_; | 129 std::set<RasterBufferImpl*> pending_raster_buffers_; |
| 127 | 130 |
| 128 DISALLOW_COPY_AND_ASSIGN(OneCopyRasterBufferProvider); | 131 DISALLOW_COPY_AND_ASSIGN(OneCopyRasterBufferProvider); |
| 129 }; | 132 }; |
| 130 | 133 |
| 131 } // namespace cc | 134 } // namespace cc |
| 132 | 135 |
| 133 #endif // CC_RASTER_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ | 136 #endif // CC_RASTER_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ |
| OLD | NEW |