Commit 3af9f604 authored by danakj's avatar danakj Committed by Commit bot

cc: Null-check the result of GrContext::wrapBackendTexture.

This function can return NULL if it fails to attach a stencil buffer,
or if it fails to allocate a GrGLTexture object.

R=enne@chromium.org
BUG=416795

Review URL: https://codereview.chromium.org/596343002

Cr-Commit-Position: refs/heads/master@{#296425}
parent 9cebaada
......@@ -637,6 +637,12 @@ static skia::RefPtr<SkImage> ApplyImageFilter(
skia::RefPtr<GrTexture> texture =
skia::AdoptRef(use_gr_context->context()->wrapBackendTexture(
backend_texture_description));
if (!texture) {
TRACE_EVENT_INSTANT0("cc",
"ApplyImageFilter wrap background texture failed",
TRACE_EVENT_SCOPE_THREAD);
return skia::RefPtr<SkImage>();
}
SkImageInfo info =
SkImageInfo::MakeN32Premul(source_texture_resource->size().width(),
......@@ -660,7 +666,7 @@ static skia::RefPtr<SkImage> ApplyImageFilter(
use_gr_context->context(), desc, GrContext::kExact_ScratchTexMatch);
skia::RefPtr<GrTexture> backing_store =
skia::AdoptRef(scratch_texture.detach());
if (backing_store.get() == NULL) {
if (!backing_store) {
TRACE_EVENT_INSTANT0("cc",
"ApplyImageFilter scratch texture allocation failed",
TRACE_EVENT_SCOPE_THREAD);
......@@ -741,6 +747,13 @@ static skia::RefPtr<SkImage> ApplyBlendModeWithBackdrop(
skia::RefPtr<GrTexture> source_texture =
skia::AdoptRef(use_gr_context->context()->wrapBackendTexture(
backend_texture_description));
if (!source_texture) {
TRACE_EVENT_INSTANT0(
"cc",
"ApplyBlendModeWithBackdrop wrap source texture failed",
TRACE_EVENT_SCOPE_THREAD);
return skia::RefPtr<SkImage>();
}
backend_texture_description.fWidth = background_size.width();
backend_texture_description.fHeight = background_size.height();
......@@ -748,6 +761,13 @@ static skia::RefPtr<SkImage> ApplyBlendModeWithBackdrop(
skia::RefPtr<GrTexture> background_texture =
skia::AdoptRef(use_gr_context->context()->wrapBackendTexture(
backend_texture_description));
if (!background_texture) {
TRACE_EVENT_INSTANT0(
"cc",
"ApplyBlendModeWithBackdrop wrap background texture failed",
TRACE_EVENT_SCOPE_THREAD);
return skia::RefPtr<SkImage>();
}
SkImageInfo source_info =
SkImageInfo::MakeN32Premul(source_size.width(), source_size.height());
......@@ -780,7 +800,7 @@ static skia::RefPtr<SkImage> ApplyBlendModeWithBackdrop(
use_gr_context->context(), desc, GrContext::kExact_ScratchTexMatch);
skia::RefPtr<GrTexture> backing_store =
skia::AdoptRef(scratch_texture.detach());
if (backing_store.get() == NULL) {
if (!backing_store) {
TRACE_EVENT_INSTANT0(
"cc",
"ApplyBlendModeWithBackdrop scratch texture allocation failed",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment