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_raster_buffer_provider.h" | 5 #include "cc/raster/gpu_raster_buffer_provider.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 int msaa_sample_count) { | 42 int msaa_sample_count) { |
43 ScopedGpuRaster gpu_raster(context_provider); | 43 ScopedGpuRaster gpu_raster(context_provider); |
44 | 44 |
45 ResourceProvider::ScopedSkSurfaceProvider scoped_surface( | 45 ResourceProvider::ScopedSkSurfaceProvider scoped_surface( |
46 context_provider, resource_lock, async_worker_context_enabled, | 46 context_provider, resource_lock, async_worker_context_enabled, |
47 use_distance_field_text, raster_source->CanUseLCDText(), | 47 use_distance_field_text, raster_source->CanUseLCDText(), |
48 raster_source->HasImpliedColorSpace(), msaa_sample_count); | 48 raster_source->HasImpliedColorSpace(), msaa_sample_count); |
49 SkSurface* sk_surface = scoped_surface.sk_surface(); | 49 SkSurface* sk_surface = scoped_surface.sk_surface(); |
50 // Allocating an SkSurface will fail after a lost context. Pretend we | 50 // Allocating an SkSurface will fail after a lost context. Pretend we |
51 // rasterized, as the contents of the resource don't matter anymore. | 51 // rasterized, as the contents of the resource don't matter anymore. |
52 if (!sk_surface) | 52 if (!sk_surface) { |
| 53 DLOG(ERROR) << "Failed to allocate raster surface"; |
53 return; | 54 return; |
| 55 } |
54 | 56 |
55 // Playback | 57 // Playback |
56 gfx::Rect playback_rect = raster_full_rect; | 58 gfx::Rect playback_rect = raster_full_rect; |
57 if (resource_has_previous_content) { | 59 if (resource_has_previous_content) { |
58 playback_rect.Intersect(raster_dirty_rect); | 60 playback_rect.Intersect(raster_dirty_rect); |
59 } | 61 } |
60 DCHECK(!playback_rect.IsEmpty()) | 62 DCHECK(!playback_rect.IsEmpty()) |
61 << "Why are we rastering a tile that's not dirty?"; | 63 << "Why are we rastering a tile that's not dirty?"; |
62 | 64 |
63 // Log a histogram of the percentage of pixels that were saved due to | 65 // Log a histogram of the percentage of pixels that were saved due to |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 gl->OrderingBarrierCHROMIUM(); | 269 gl->OrderingBarrierCHROMIUM(); |
268 | 270 |
269 // Generate sync token after the barrier for cross context synchronization. | 271 // Generate sync token after the barrier for cross context synchronization. |
270 gpu::SyncToken resource_sync_token; | 272 gpu::SyncToken resource_sync_token; |
271 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, resource_sync_token.GetData()); | 273 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, resource_sync_token.GetData()); |
272 resource_lock->set_sync_token(resource_sync_token); | 274 resource_lock->set_sync_token(resource_sync_token); |
273 resource_lock->set_synchronized(!async_worker_context_enabled_); | 275 resource_lock->set_synchronized(!async_worker_context_enabled_); |
274 } | 276 } |
275 | 277 |
276 } // namespace cc | 278 } // namespace cc |
OLD | NEW |