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 #include "cc/raster/one_copy_tile_task_worker_pool.h" | 5 #include "cc/raster/one_copy_tile_task_worker_pool.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
(...skipping 29 matching lines...) Expand all Loading... |
40 const Resource* resource, | 40 const Resource* resource, |
41 uint64_t previous_content_id) | 41 uint64_t previous_content_id) |
42 : worker_pool_(worker_pool), | 42 : worker_pool_(worker_pool), |
43 resource_(resource), | 43 resource_(resource), |
44 lock_(resource_provider, resource->id()), | 44 lock_(resource_provider, resource->id()), |
45 previous_content_id_(previous_content_id) {} | 45 previous_content_id_(previous_content_id) {} |
46 | 46 |
47 ~RasterBufferImpl() override {} | 47 ~RasterBufferImpl() override {} |
48 | 48 |
49 // Overridden from RasterBuffer: | 49 // Overridden from RasterBuffer: |
50 void Playback(const RasterSource* raster_source, | 50 void Playback( |
51 const gfx::Rect& raster_full_rect, | 51 const RasterSource* raster_source, |
52 const gfx::Rect& raster_dirty_rect, | 52 const gfx::Rect& raster_full_rect, |
53 uint64_t new_content_id, | 53 const gfx::Rect& raster_dirty_rect, |
54 float scale, | 54 uint64_t new_content_id, |
55 bool include_images) override { | 55 float scale, |
| 56 const RasterSource::PlaybackSettings& playback_settings) override { |
56 worker_pool_->PlaybackAndCopyOnWorkerThread( | 57 worker_pool_->PlaybackAndCopyOnWorkerThread( |
57 resource_, &lock_, raster_source, raster_full_rect, raster_dirty_rect, | 58 resource_, &lock_, raster_source, raster_full_rect, raster_dirty_rect, |
58 scale, include_images, previous_content_id_, new_content_id); | 59 scale, playback_settings, previous_content_id_, new_content_id); |
59 } | 60 } |
60 | 61 |
61 private: | 62 private: |
62 OneCopyTileTaskWorkerPool* worker_pool_; | 63 OneCopyTileTaskWorkerPool* worker_pool_; |
63 const Resource* resource_; | 64 const Resource* resource_; |
64 ResourceProvider::ScopedWriteLockGL lock_; | 65 ResourceProvider::ScopedWriteLockGL lock_; |
65 uint64_t previous_content_id_; | 66 uint64_t previous_content_id_; |
66 | 67 |
67 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); | 68 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); |
68 }; | 69 }; |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 316 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
316 } | 317 } |
317 | 318 |
318 void OneCopyTileTaskWorkerPool::PlaybackAndCopyOnWorkerThread( | 319 void OneCopyTileTaskWorkerPool::PlaybackAndCopyOnWorkerThread( |
319 const Resource* resource, | 320 const Resource* resource, |
320 ResourceProvider::ScopedWriteLockGL* resource_lock, | 321 ResourceProvider::ScopedWriteLockGL* resource_lock, |
321 const RasterSource* raster_source, | 322 const RasterSource* raster_source, |
322 const gfx::Rect& raster_full_rect, | 323 const gfx::Rect& raster_full_rect, |
323 const gfx::Rect& raster_dirty_rect, | 324 const gfx::Rect& raster_dirty_rect, |
324 float scale, | 325 float scale, |
325 bool include_images, | 326 const RasterSource::PlaybackSettings& playback_settings, |
326 uint64_t previous_content_id, | 327 uint64_t previous_content_id, |
327 uint64_t new_content_id) { | 328 uint64_t new_content_id) { |
328 base::AutoLock lock(lock_); | 329 base::AutoLock lock(lock_); |
329 | 330 |
330 scoped_ptr<StagingBuffer> staging_buffer = | 331 scoped_ptr<StagingBuffer> staging_buffer = |
331 AcquireStagingBuffer(resource, previous_content_id); | 332 AcquireStagingBuffer(resource, previous_content_id); |
332 DCHECK(staging_buffer); | 333 DCHECK(staging_buffer); |
333 | 334 |
334 { | 335 { |
335 base::AutoUnlock unlock(lock_); | 336 base::AutoUnlock unlock(lock_); |
(...skipping 25 matching lines...) Expand all Loading... |
361 DCHECK(rv); | 362 DCHECK(rv); |
362 DCHECK(buffer->memory(0)); | 363 DCHECK(buffer->memory(0)); |
363 // TileTaskWorkerPool::PlaybackToMemory only supports unsigned strides. | 364 // TileTaskWorkerPool::PlaybackToMemory only supports unsigned strides. |
364 DCHECK_GE(buffer->stride(0), 0); | 365 DCHECK_GE(buffer->stride(0), 0); |
365 | 366 |
366 DCHECK(!playback_rect.IsEmpty()) | 367 DCHECK(!playback_rect.IsEmpty()) |
367 << "Why are we rastering a tile that's not dirty?"; | 368 << "Why are we rastering a tile that's not dirty?"; |
368 TileTaskWorkerPool::PlaybackToMemory( | 369 TileTaskWorkerPool::PlaybackToMemory( |
369 buffer->memory(0), resource->format(), staging_buffer->size, | 370 buffer->memory(0), resource->format(), staging_buffer->size, |
370 buffer->stride(0), raster_source, raster_full_rect, playback_rect, | 371 buffer->stride(0), raster_source, raster_full_rect, playback_rect, |
371 scale, include_images); | 372 scale, playback_settings); |
372 buffer->Unmap(); | 373 buffer->Unmap(); |
373 staging_buffer->content_id = new_content_id; | 374 staging_buffer->content_id = new_content_id; |
374 } | 375 } |
375 } | 376 } |
376 | 377 |
377 ContextProvider* context_provider = | 378 ContextProvider* context_provider = |
378 resource_provider_->output_surface()->worker_context_provider(); | 379 resource_provider_->output_surface()->worker_context_provider(); |
379 DCHECK(context_provider); | 380 DCHECK(context_provider); |
380 | 381 |
381 { | 382 { |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 return; | 737 return; |
737 | 738 |
738 busy_buffers_.front()->DestroyGLResources(gl); | 739 busy_buffers_.front()->DestroyGLResources(gl); |
739 RemoveStagingBuffer(busy_buffers_.front().get()); | 740 RemoveStagingBuffer(busy_buffers_.front().get()); |
740 busy_buffers_.pop_front(); | 741 busy_buffers_.pop_front(); |
741 } | 742 } |
742 } | 743 } |
743 } | 744 } |
744 | 745 |
745 } // namespace cc | 746 } // namespace cc |
OLD | NEW |