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

Side by Side Diff: cc/resources/gpu_rasterizer.cc

Issue 988953002: gpu-raster: Check for NULL sk_surface in GpuRasterizer::RasterizeSource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/resources/gpu_rasterizer.h" 5 #include "cc/resources/gpu_rasterizer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 bool use_distance_field_text = 113 bool use_distance_field_text =
114 use_distance_field_text_ || 114 use_distance_field_text_ ||
115 raster_source->ShouldAttemptToUseDistanceFieldText(); 115 raster_source->ShouldAttemptToUseDistanceFieldText();
116 116
117 // Playback picture into resource. 117 // Playback picture into resource.
118 { 118 {
119 ScopedGpuRaster gpu_raster(GetContextProvider(use_worker_context)); 119 ScopedGpuRaster gpu_raster(GetContextProvider(use_worker_context));
120 write_lock->InitSkSurface(use_worker_context, use_distance_field_text, 120 write_lock->InitSkSurface(use_worker_context, use_distance_field_text,
121 raster_source->CanUseLCDText(), 121 raster_source->CanUseLCDText(),
122 msaa_sample_count_); 122 msaa_sample_count_);
123
124 SkSurface* sk_surface = write_lock->sk_surface();
125 if (!sk_surface)
danakj 2015/03/09 16:38:03 Can you add a comment explaining this is for lost
vmiura 2015/03/09 18:01:26 Done.
126 return;
127
123 SkMultiPictureDraw multi_picture_draw; 128 SkMultiPictureDraw multi_picture_draw;
124 multi_picture_draw.add(write_lock->sk_surface()->getCanvas(), 129 multi_picture_draw.add(sk_surface->getCanvas(), picture.get());
125 picture.get());
126 multi_picture_draw.draw(msaa_sample_count_ > 0); 130 multi_picture_draw.draw(msaa_sample_count_ > 0);
127 write_lock->ReleaseSkSurface(); 131 write_lock->ReleaseSkSurface();
128 } 132 }
129 } 133 }
130 134
131 void GpuRasterizer::PerformSolidColorAnalysis( 135 void GpuRasterizer::PerformSolidColorAnalysis(
132 const Tile* tile, 136 const Tile* tile,
133 RasterSource::SolidColorAnalysis* analysis) { 137 RasterSource::SolidColorAnalysis* analysis) {
134 const void* tile_id = static_cast<const void*>(tile); 138 const void* tile_id = static_cast<const void*>(tile);
135 frame_viewer_instrumentation::ScopedAnalyzeTask analyze_task( 139 frame_viewer_instrumentation::ScopedAnalyzeTask analyze_task(
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 tile->raster_source()->PlaybackToCanvas(canvas.get(), tile->content_rect(), 189 tile->raster_source()->PlaybackToCanvas(canvas.get(), tile->content_rect(),
186 tile->contents_scale()); 190 tile->contents_scale());
187 canvas->restore(); 191 canvas->restore();
188 192
189 // Add the canvas and recorded picture to |multi_picture_draw_|. 193 // Add the canvas and recorded picture to |multi_picture_draw_|.
190 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); 194 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording());
191 multi_picture_draw_.add(sk_surface->getCanvas(), picture.get()); 195 multi_picture_draw_.add(sk_surface->getCanvas(), picture.get());
192 } 196 }
193 197
194 } // namespace cc 198 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698