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/macros.h" | 10 #include "base/macros.h" |
11 #include "cc/raster/raster_buffer_provider.h" | 11 #include "cc/raster/raster_buffer_provider.h" |
| 12 #include "cc/resources/resource_provider.h" |
| 13 #include "gpu/command_buffer/common/sync_token.h" |
12 | 14 |
13 namespace cc { | 15 namespace cc { |
14 class ContextProvider; | 16 class ContextProvider; |
15 class GpuRasterizer; | 17 class GpuRasterizer; |
16 class ResourceProvider; | |
17 | 18 |
18 class CC_EXPORT GpuRasterBufferProvider : public RasterBufferProvider { | 19 class CC_EXPORT GpuRasterBufferProvider : public RasterBufferProvider { |
19 public: | 20 public: |
20 ~GpuRasterBufferProvider() override; | 21 ~GpuRasterBufferProvider() override; |
21 | 22 |
22 static std::unique_ptr<RasterBufferProvider> Create( | 23 static std::unique_ptr<RasterBufferProvider> Create( |
23 ContextProvider* context_provider, | 24 ContextProvider* context_provider, |
24 ResourceProvider* resource_provider, | 25 ResourceProvider* resource_provider, |
25 bool use_distance_field_text, | 26 bool use_distance_field_text, |
26 int gpu_rasterization_msaa_sample_count); | 27 int gpu_rasterization_msaa_sample_count, |
| 28 bool async_worker_context_enabled); |
27 | 29 |
28 // Overridden from RasterBufferProvider: | 30 // Overridden from RasterBufferProvider: |
29 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( | 31 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( |
30 const Resource* resource, | 32 const Resource* resource, |
31 uint64_t resource_content_id, | 33 uint64_t resource_content_id, |
32 uint64_t previous_content_id) override; | 34 uint64_t previous_content_id) override; |
33 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override; | 35 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override; |
34 void OrderingBarrier() override; | 36 void OrderingBarrier() override; |
35 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; | 37 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; |
36 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override; | 38 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override; |
37 void Shutdown() override; | 39 void Shutdown() override; |
38 | 40 |
| 41 void PlaybackOnWorkerThread( |
| 42 ResourceProvider::ScopedWriteLockGr* lock, |
| 43 bool resource_has_previous_content, |
| 44 const RasterSource* raster_source, |
| 45 const gfx::Rect& raster_full_rect, |
| 46 const gfx::Rect& raster_dirty_rect, |
| 47 uint64_t new_content_id, |
| 48 float scale, |
| 49 const RasterSource::PlaybackSettings& playback_settings); |
| 50 |
39 private: | 51 private: |
40 GpuRasterBufferProvider(ContextProvider* context_provider, | 52 GpuRasterBufferProvider(ContextProvider* context_provider, |
41 ResourceProvider* resource_provider, | 53 ResourceProvider* resource_provider, |
42 bool use_distance_field_text, | 54 bool use_distance_field_text, |
43 int gpu_rasterization_msaa_sample_count); | 55 int gpu_rasterization_msaa_sample_count, |
| 56 bool async_worker_context_enabled); |
44 | 57 |
45 std::unique_ptr<GpuRasterizer> rasterizer_; | 58 std::unique_ptr<GpuRasterizer> rasterizer_; |
| 59 bool async_worker_context_enabled_; |
| 60 gpu::SyncToken sync_token_; |
46 | 61 |
47 DISALLOW_COPY_AND_ASSIGN(GpuRasterBufferProvider); | 62 DISALLOW_COPY_AND_ASSIGN(GpuRasterBufferProvider); |
48 }; | 63 }; |
49 | 64 |
50 } // namespace cc | 65 } // namespace cc |
51 | 66 |
52 #endif // CC_RASTER_GPU_RASTER_BUFFER_PROVIDER_H_ | 67 #endif // CC_RASTER_GPU_RASTER_BUFFER_PROVIDER_H_ |
OLD | NEW |