| 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_GPU_RASTER_BUFFER_PROVIDER_H_ | 5 #ifndef CC_RASTER_GPU_RASTER_BUFFER_PROVIDER_H_ |
| 6 #define CC_RASTER_GPU_RASTER_BUFFER_PROVIDER_H_ | 6 #define CC_RASTER_GPU_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/raster/raster_buffer_provider.h" | 12 #include "cc/raster/raster_buffer_provider.h" |
| 12 #include "cc/resources/resource_provider.h" | 13 #include "cc/resources/resource_provider.h" |
| 13 #include "gpu/command_buffer/common/sync_token.h" | 14 #include "gpu/command_buffer/common/sync_token.h" |
| 14 | 15 |
| 15 namespace cc { | 16 namespace cc { |
| 16 class ContextProvider; | 17 class ContextProvider; |
| 17 | 18 |
| 18 class CC_EXPORT GpuRasterBufferProvider : public RasterBufferProvider { | 19 class CC_EXPORT GpuRasterBufferProvider : public RasterBufferProvider { |
| 19 public: | 20 public: |
| 20 GpuRasterBufferProvider(ContextProvider* compositor_context_provider, | 21 GpuRasterBufferProvider(ContextProvider* compositor_context_provider, |
| 21 ContextProvider* worker_context_provider, | 22 ContextProvider* worker_context_provider, |
| 22 ResourceProvider* resource_provider, | 23 ResourceProvider* resource_provider, |
| 23 bool use_distance_field_text, | 24 bool use_distance_field_text, |
| 24 int gpu_rasterization_msaa_sample_count, | 25 int gpu_rasterization_msaa_sample_count, |
| 25 bool async_worker_context_enabled); | 26 bool async_worker_context_enabled); |
| 26 ~GpuRasterBufferProvider() override; | 27 ~GpuRasterBufferProvider() override; |
| 27 | 28 |
| 28 // Overridden from RasterBufferProvider: | 29 // Overridden from RasterBufferProvider: |
| 29 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( | 30 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( |
| 30 const Resource* resource, | 31 const Resource* resource, |
| 31 uint64_t resource_content_id, | 32 uint64_t resource_content_id, |
| 32 uint64_t previous_content_id) override; | 33 uint64_t previous_content_id) override; |
| 33 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override; | 34 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override; |
| 34 void OrderingBarrier() override; | 35 void OrderingBarrier() override; |
| 36 bool IsResourceReadyToDraw(const Resource* resource) override; |
| 37 void SignalResourcesReadyToDraw(const std::vector<const Resource*>& resources, |
| 38 const base::Closure& callback) override; |
| 35 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; | 39 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; |
| 36 bool IsResourceSwizzleRequired(bool must_support_alpha) const override; | 40 bool IsResourceSwizzleRequired(bool must_support_alpha) const override; |
| 37 bool CanPartialRasterIntoProvidedResource() const override; | 41 bool CanPartialRasterIntoProvidedResource() const override; |
| 38 void Shutdown() override; | 42 void Shutdown() override; |
| 39 | 43 |
| 40 void PlaybackOnWorkerThread( | 44 void PlaybackOnWorkerThread( |
| 41 ResourceProvider::ScopedWriteLockGL* resource_lock, | 45 ResourceProvider::ScopedWriteLockGL* resource_lock, |
| 42 const gpu::SyncToken& sync_token, | 46 const gpu::SyncToken& sync_token, |
| 43 bool resource_has_previous_content, | 47 bool resource_has_previous_content, |
| 44 const RasterSource* raster_source, | 48 const RasterSource* raster_source, |
| 45 const gfx::Rect& raster_full_rect, | 49 const gfx::Rect& raster_full_rect, |
| 46 const gfx::Rect& raster_dirty_rect, | 50 const gfx::Rect& raster_dirty_rect, |
| 47 uint64_t new_content_id, | 51 uint64_t new_content_id, |
| 48 const gfx::SizeF& scales, | 52 const gfx::SizeF& scales, |
| 49 const RasterSource::PlaybackSettings& playback_settings); | 53 const RasterSource::PlaybackSettings& playback_settings); |
| 50 | 54 |
| 51 private: | 55 private: |
| 52 class RasterBufferImpl : public RasterBuffer { | 56 class RasterBufferImpl : public RasterBuffer { |
| 53 public: | 57 public: |
| 54 RasterBufferImpl(GpuRasterBufferProvider* client, | 58 RasterBufferImpl(GpuRasterBufferProvider* client, |
| 55 ResourceProvider* resource_provider, | 59 ResourceProvider* resource_provider, |
| 56 ResourceId resource_id, | 60 ResourceId resource_id, |
| 57 bool async_worker_context_enabled, | |
| 58 bool resource_has_previous_content); | 61 bool resource_has_previous_content); |
| 59 ~RasterBufferImpl() override; | 62 ~RasterBufferImpl() override; |
| 60 | 63 |
| 61 // Overridden from RasterBuffer: | 64 // Overridden from RasterBuffer: |
| 62 void Playback( | 65 void Playback( |
| 63 const RasterSource* raster_source, | 66 const RasterSource* raster_source, |
| 64 const gfx::Rect& raster_full_rect, | 67 const gfx::Rect& raster_full_rect, |
| 65 const gfx::Rect& raster_dirty_rect, | 68 const gfx::Rect& raster_dirty_rect, |
| 66 uint64_t new_content_id, | 69 uint64_t new_content_id, |
| 67 const gfx::SizeF& scales, | 70 const gfx::SizeF& scales, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 89 const bool async_worker_context_enabled_; | 92 const bool async_worker_context_enabled_; |
| 90 | 93 |
| 91 std::set<RasterBufferImpl*> pending_raster_buffers_; | 94 std::set<RasterBufferImpl*> pending_raster_buffers_; |
| 92 | 95 |
| 93 DISALLOW_COPY_AND_ASSIGN(GpuRasterBufferProvider); | 96 DISALLOW_COPY_AND_ASSIGN(GpuRasterBufferProvider); |
| 94 }; | 97 }; |
| 95 | 98 |
| 96 } // namespace cc | 99 } // namespace cc |
| 97 | 100 |
| 98 #endif // CC_RASTER_GPU_RASTER_BUFFER_PROVIDER_H_ | 101 #endif // CC_RASTER_GPU_RASTER_BUFFER_PROVIDER_H_ |
| OLD | NEW |