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/gpu_tile_task_worker_pool.h" | 5 #include "cc/raster/gpu_tile_task_worker_pool.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
13 #include "cc/playback/display_list_raster_source.h" | 13 #include "cc/playback/raster_source.h" |
14 #include "cc/raster/gpu_rasterizer.h" | 14 #include "cc/raster/gpu_rasterizer.h" |
15 #include "cc/raster/raster_buffer.h" | 15 #include "cc/raster/raster_buffer.h" |
16 #include "cc/raster/scoped_gpu_raster.h" | 16 #include "cc/raster/scoped_gpu_raster.h" |
17 #include "cc/resources/resource.h" | 17 #include "cc/resources/resource.h" |
18 #include "gpu/command_buffer/client/gles2_interface.h" | 18 #include "gpu/command_buffer/client/gles2_interface.h" |
19 #include "third_party/skia/include/core/SkMultiPictureDraw.h" | 19 #include "third_party/skia/include/core/SkMultiPictureDraw.h" |
20 #include "third_party/skia/include/core/SkPictureRecorder.h" | 20 #include "third_party/skia/include/core/SkPictureRecorder.h" |
21 #include "third_party/skia/include/core/SkSurface.h" | 21 #include "third_party/skia/include/core/SkSurface.h" |
22 #include "third_party/skia/include/gpu/GrContext.h" | 22 #include "third_party/skia/include/gpu/GrContext.h" |
23 | 23 |
24 namespace cc { | 24 namespace cc { |
25 namespace { | 25 namespace { |
26 | 26 |
27 class RasterBufferImpl : public RasterBuffer { | 27 class RasterBufferImpl : public RasterBuffer { |
28 public: | 28 public: |
29 RasterBufferImpl(GpuRasterizer* rasterizer, | 29 RasterBufferImpl(GpuRasterizer* rasterizer, |
30 const Resource* resource, | 30 const Resource* resource, |
31 uint64_t resource_content_id, | 31 uint64_t resource_content_id, |
32 uint64_t previous_content_id) | 32 uint64_t previous_content_id) |
33 : rasterizer_(rasterizer), | 33 : rasterizer_(rasterizer), |
34 lock_(rasterizer->resource_provider(), resource->id()), | 34 lock_(rasterizer->resource_provider(), resource->id()), |
35 resource_has_previous_content_( | 35 resource_has_previous_content_( |
36 resource_content_id && resource_content_id == previous_content_id) { | 36 resource_content_id && resource_content_id == previous_content_id) { |
37 } | 37 } |
38 | 38 |
39 // Overridden from RasterBuffer: | 39 // Overridden from RasterBuffer: |
40 void Playback(const DisplayListRasterSource* raster_source, | 40 void Playback(const RasterSource* raster_source, |
41 const gfx::Rect& raster_full_rect, | 41 const gfx::Rect& raster_full_rect, |
42 const gfx::Rect& raster_dirty_rect, | 42 const gfx::Rect& raster_dirty_rect, |
43 uint64_t new_content_id, | 43 uint64_t new_content_id, |
44 float scale, | 44 float scale, |
45 bool include_images) override { | 45 bool include_images) override { |
46 TRACE_EVENT0("cc", "RasterBufferImpl::Playback"); | 46 TRACE_EVENT0("cc", "RasterBufferImpl::Playback"); |
47 // GPU raster doesn't do low res tiles, so should always include images. | 47 // GPU raster doesn't do low res tiles, so should always include images. |
48 DCHECK(include_images); | 48 DCHECK(include_images); |
49 ContextProvider* context_provider = rasterizer_->resource_provider() | 49 ContextProvider* context_provider = rasterizer_->resource_provider() |
50 ->output_surface() | 50 ->output_surface() |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 return scoped_ptr<RasterBuffer>(new RasterBufferImpl( | 184 return scoped_ptr<RasterBuffer>(new RasterBufferImpl( |
185 rasterizer_.get(), resource, resource_content_id, previous_content_id)); | 185 rasterizer_.get(), resource, resource_content_id, previous_content_id)); |
186 } | 186 } |
187 | 187 |
188 void GpuTileTaskWorkerPool::ReleaseBufferForRaster( | 188 void GpuTileTaskWorkerPool::ReleaseBufferForRaster( |
189 scoped_ptr<RasterBuffer> buffer) { | 189 scoped_ptr<RasterBuffer> buffer) { |
190 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 190 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
191 } | 191 } |
192 | 192 |
193 } // namespace cc | 193 } // namespace cc |
OLD | NEW |