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

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

Issue 1135743004: cc: Add null checks for GrContext created by ContextProviderCommandBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/resource_provider.h" 5 #include "cc/resources/resource_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 GrBackendTextureDesc desc; 1128 GrBackendTextureDesc desc;
1129 desc.fFlags = kRenderTarget_GrBackendTextureFlag; 1129 desc.fFlags = kRenderTarget_GrBackendTextureFlag;
1130 desc.fWidth = resource_->size.width(); 1130 desc.fWidth = resource_->size.width();
1131 desc.fHeight = resource_->size.height(); 1131 desc.fHeight = resource_->size.height();
1132 desc.fConfig = ToGrPixelConfig(resource_->format); 1132 desc.fConfig = ToGrPixelConfig(resource_->format);
1133 desc.fOrigin = kTopLeft_GrSurfaceOrigin; 1133 desc.fOrigin = kTopLeft_GrSurfaceOrigin;
1134 desc.fTextureHandle = resource_->gl_id; 1134 desc.fTextureHandle = resource_->gl_id;
1135 desc.fSampleCnt = msaa_sample_count; 1135 desc.fSampleCnt = msaa_sample_count;
1136 1136
1137 bool use_worker_context = true; 1137 bool use_worker_context = true;
1138 skia::RefPtr<GrTexture> gr_texture;
1138 class GrContext* gr_context = 1139 class GrContext* gr_context =
1139 resource_provider_->GrContext(use_worker_context); 1140 resource_provider_->GrContext(use_worker_context);
1140 skia::RefPtr<GrTexture> gr_texture = 1141 if (gr_context)
1141 skia::AdoptRef(gr_context->textureProvider()->wrapBackendTexture(desc)); 1142 gr_texture =
1143 skia::AdoptRef(gr_context->textureProvider()->wrapBackendTexture(desc));
1142 if (gr_texture) { 1144 if (gr_texture) {
1143 uint32_t flags = use_distance_field_text 1145 uint32_t flags = use_distance_field_text
1144 ? SkSurfaceProps::kUseDistanceFieldFonts_Flag 1146 ? SkSurfaceProps::kUseDistanceFieldFonts_Flag
1145 : 0; 1147 : 0;
1146 // Use unknown pixel geometry to disable LCD text. 1148 // Use unknown pixel geometry to disable LCD text.
1147 SkSurfaceProps surface_props(flags, kUnknown_SkPixelGeometry); 1149 SkSurfaceProps surface_props(flags, kUnknown_SkPixelGeometry);
1148 if (can_use_lcd_text) { 1150 if (can_use_lcd_text) {
1149 // LegacyFontHost will get LCD text and skia figures out what type to use. 1151 // LegacyFontHost will get LCD text and skia figures out what type to use.
1150 surface_props = 1152 surface_props =
1151 SkSurfaceProps(flags, SkSurfaceProps::kLegacyFontHost_InitType); 1153 SkSurfaceProps(flags, SkSurfaceProps::kLegacyFontHost_InitType);
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 } 2058 }
2057 2059
2058 class GrContext* ResourceProvider::GrContext(bool worker_context) const { 2060 class GrContext* ResourceProvider::GrContext(bool worker_context) const {
2059 ContextProvider* context_provider = 2061 ContextProvider* context_provider =
2060 worker_context ? output_surface_->worker_context_provider() 2062 worker_context ? output_surface_->worker_context_provider()
2061 : output_surface_->context_provider(); 2063 : output_surface_->context_provider();
2062 return context_provider ? context_provider->GrContext() : NULL; 2064 return context_provider ? context_provider->GrContext() : NULL;
2063 } 2065 }
2064 2066
2065 } // namespace cc 2067 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698