| 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/bitmap_tile_task_worker_pool.h" | 5 #include "cc/raster/bitmap_tile_task_worker_pool.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
| 15 #include "base/trace_event/trace_event_argument.h" | 15 #include "base/trace_event/trace_event_argument.h" |
| 16 #include "cc/debug/traced_value.h" | 16 #include "cc/debug/traced_value.h" |
| 17 #include "cc/playback/display_list_raster_source.h" | 17 #include "cc/playback/raster_source.h" |
| 18 #include "cc/raster/raster_buffer.h" | 18 #include "cc/raster/raster_buffer.h" |
| 19 #include "cc/resources/platform_color.h" | 19 #include "cc/resources/platform_color.h" |
| 20 #include "cc/resources/resource.h" | 20 #include "cc/resources/resource.h" |
| 21 | 21 |
| 22 namespace cc { | 22 namespace cc { |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 class RasterBufferImpl : public RasterBuffer { | 25 class RasterBufferImpl : public RasterBuffer { |
| 26 public: | 26 public: |
| 27 RasterBufferImpl(ResourceProvider* resource_provider, | 27 RasterBufferImpl(ResourceProvider* resource_provider, |
| 28 const Resource* resource, | 28 const Resource* resource, |
| 29 uint64_t resource_content_id, | 29 uint64_t resource_content_id, |
| 30 uint64_t previous_content_id) | 30 uint64_t previous_content_id) |
| 31 : lock_(resource_provider, resource->id()), | 31 : lock_(resource_provider, resource->id()), |
| 32 resource_(resource), | 32 resource_(resource), |
| 33 resource_has_previous_content_( | 33 resource_has_previous_content_( |
| 34 resource_content_id && resource_content_id == previous_content_id) { | 34 resource_content_id && resource_content_id == previous_content_id) { |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Overridden from RasterBuffer: | 37 // Overridden from RasterBuffer: |
| 38 void Playback(const DisplayListRasterSource* raster_source, | 38 void Playback(const RasterSource* raster_source, |
| 39 const gfx::Rect& raster_full_rect, | 39 const gfx::Rect& raster_full_rect, |
| 40 const gfx::Rect& raster_dirty_rect, | 40 const gfx::Rect& raster_dirty_rect, |
| 41 uint64_t new_content_id, | 41 uint64_t new_content_id, |
| 42 float scale, | 42 float scale, |
| 43 bool include_images) override { | 43 bool include_images) override { |
| 44 gfx::Rect playback_rect = raster_full_rect; | 44 gfx::Rect playback_rect = raster_full_rect; |
| 45 if (resource_has_previous_content_) { | 45 if (resource_has_previous_content_) { |
| 46 playback_rect.Intersect(raster_dirty_rect); | 46 playback_rect.Intersect(raster_dirty_rect); |
| 47 } | 47 } |
| 48 DCHECK(!playback_rect.IsEmpty()) | 48 DCHECK(!playback_rect.IsEmpty()) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 return scoped_ptr<RasterBuffer>(new RasterBufferImpl( | 138 return scoped_ptr<RasterBuffer>(new RasterBufferImpl( |
| 139 resource_provider_, resource, resource_content_id, previous_content_id)); | 139 resource_provider_, resource, resource_content_id, previous_content_id)); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void BitmapTileTaskWorkerPool::ReleaseBufferForRaster( | 142 void BitmapTileTaskWorkerPool::ReleaseBufferForRaster( |
| 143 scoped_ptr<RasterBuffer> buffer) { | 143 scoped_ptr<RasterBuffer> buffer) { |
| 144 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 144 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace cc | 147 } // namespace cc |
| OLD | NEW |