Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(555)

Side by Side Diff: cc/raster/gpu_raster_buffer_provider.cc

Issue 2509983004: Revert "Change call-sites now that SkCanvas is not ref-counted" (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/playback/display_item_list_unittest.cc ('k') | cc/test/fake_content_layer_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 static_cast<float>(playback_rect.size().GetArea()) / full_rect_size; 53 static_cast<float>(playback_rect.size().GetArea()) / full_rect_size;
54 float fraction_saved = 1.0f - fraction_partial_rastered; 54 float fraction_saved = 1.0f - fraction_partial_rastered;
55 UMA_HISTOGRAM_PERCENTAGE( 55 UMA_HISTOGRAM_PERCENTAGE(
56 base::StringPrintf("Renderer4.%s.PartialRasterPercentageSaved.Gpu", 56 base::StringPrintf("Renderer4.%s.PartialRasterPercentageSaved.Gpu",
57 client_name), 57 client_name),
58 100.0f * fraction_saved); 58 100.0f * fraction_saved);
59 } 59 }
60 60
61 // Play back raster_source into temp SkPicture. 61 // Play back raster_source into temp SkPicture.
62 SkPictureRecorder recorder; 62 SkPictureRecorder recorder;
63 SkCanvas* canvas = 63 sk_sp<SkCanvas> canvas = sk_ref_sp(
64 recorder.beginRecording(resource_size.width(), resource_size.height()); 64 recorder.beginRecording(resource_size.width(), resource_size.height()));
65 canvas->save(); 65 canvas->save();
66 66
67 // The GPU image decode controller assumes that Skia is done with an image 67 // The GPU image decode controller assumes that Skia is done with an image
68 // when playback is complete. However, in this case, where we play back to a 68 // when playback is complete. However, in this case, where we play back to a
69 // picture, we don't actually finish with the images until the picture is 69 // picture, we don't actually finish with the images until the picture is
70 // rasterized later. This can cause lifetime issues in the GPU image decode 70 // rasterized later. This can cause lifetime issues in the GPU image decode
71 // controller. To avoid this, we disable the image hijack canvas (and image 71 // controller. To avoid this, we disable the image hijack canvas (and image
72 // decode controller) for this playback step, instead enabling it for the 72 // decode controller) for this playback step, instead enabling it for the
73 // later picture rasterization. 73 // later picture rasterization.
74 RasterSource::PlaybackSettings settings = playback_settings; 74 RasterSource::PlaybackSettings settings = playback_settings;
75 settings.use_image_hijack_canvas = false; 75 settings.use_image_hijack_canvas = false;
76 raster_source->PlaybackToCanvas(canvas, raster_full_rect, playback_rect, 76 raster_source->PlaybackToCanvas(canvas.get(), raster_full_rect, playback_rect,
77 scales, settings); 77 scales, settings);
78 canvas->restore(); 78 canvas->restore();
79 return recorder.finishRecordingAsPicture(); 79 return recorder.finishRecordingAsPicture();
80 } 80 }
81 81
82 static void RasterizePicture(SkPicture* picture, 82 static void RasterizePicture(SkPicture* picture,
83 ContextProvider* context_provider, 83 ContextProvider* context_provider,
84 ResourceProvider::ScopedWriteLockGL* resource_lock, 84 ResourceProvider::ScopedWriteLockGL* resource_lock,
85 bool async_worker_context_enabled, 85 bool async_worker_context_enabled,
86 bool use_distance_field_text, 86 bool use_distance_field_text,
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 gl->OrderingBarrierCHROMIUM(); 280 gl->OrderingBarrierCHROMIUM();
281 281
282 // Generate sync token after the barrier for cross context synchronization. 282 // Generate sync token after the barrier for cross context synchronization.
283 gpu::SyncToken resource_sync_token; 283 gpu::SyncToken resource_sync_token;
284 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, resource_sync_token.GetData()); 284 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, resource_sync_token.GetData());
285 resource_lock->set_sync_token(resource_sync_token); 285 resource_lock->set_sync_token(resource_sync_token);
286 resource_lock->set_synchronized(!async_worker_context_enabled_); 286 resource_lock->set_synchronized(!async_worker_context_enabled_);
287 } 287 }
288 288
289 } // namespace cc 289 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/display_item_list_unittest.cc ('k') | cc/test/fake_content_layer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698