Commit 2162c86f authored by Adrienne Walker's avatar Adrienne Walker Committed by Commit Bot

cc: Don't inline PaintOpReader::SetInvalid

This should help track down why deserialization issues are failing.

Bug: 945482
Change-Id: I4fcb584eeb5d4dfcc6585236657effdc0c8fb669
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1642027Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Commit-Queue: enne <enne@chromium.org>
Auto-Submit: enne <enne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665676}
parent fb1fb302
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <algorithm> #include <algorithm>
#include "base/bits.h" #include "base/bits.h"
#include "base/compiler_specific.h"
#include "base/debug/dump_without_crashing.h" #include "base/debug/dump_without_crashing.h"
#include "base/rand_util.h" #include "base/rand_util.h"
#include "base/stl_util.h" #include "base/stl_util.h"
...@@ -236,7 +237,9 @@ void PaintOpReader::Read(SkPath* path) { ...@@ -236,7 +237,9 @@ void PaintOpReader::Read(SkPath* path) {
case PaintCacheEntryState::kInlined: { case PaintCacheEntryState::kInlined: {
size_t path_bytes = 0u; size_t path_bytes = 0u;
ReadSize(&path_bytes); ReadSize(&path_bytes);
if (path_bytes > remaining_bytes_ || path_bytes == 0u) if (path_bytes > remaining_bytes_)
SetInvalid();
if (path_bytes == 0u)
SetInvalid(); SetInvalid();
if (!valid_) if (!valid_)
return; return;
...@@ -445,7 +448,11 @@ void PaintOpReader::Read(sk_sp<SkTextBlob>* blob) { ...@@ -445,7 +448,11 @@ void PaintOpReader::Read(sk_sp<SkTextBlob>* blob) {
auto* scratch = CopyScratchSpace(data_bytes); auto* scratch = CopyScratchSpace(data_bytes);
sk_sp<SkTextBlob> deserialized_blob = sk_sp<SkTextBlob> deserialized_blob =
SkTextBlob::Deserialize(scratch, data_bytes, procs); SkTextBlob::Deserialize(scratch, data_bytes, procs);
if (!deserialized_blob || typeface_ctx.invalid_typeface) { if (!deserialized_blob) {
SetInvalid();
return;
}
if (typeface_ctx.invalid_typeface) {
SetInvalid(); SetInvalid();
return; return;
} }
...@@ -629,7 +636,8 @@ void PaintOpReader::AlignMemory(size_t alignment) { ...@@ -629,7 +636,8 @@ void PaintOpReader::AlignMemory(size_t alignment) {
remaining_bytes_ -= padding; remaining_bytes_ -= padding;
} }
inline void PaintOpReader::SetInvalid() { // Don't inline this function so that crash reports can show the caller.
NOINLINE void PaintOpReader::SetInvalid() {
if (valid_ && options_.crash_dump_on_failure && base::RandInt(1, 10) == 1) { if (valid_ && options_.crash_dump_on_failure && base::RandInt(1, 10) == 1) {
base::debug::DumpWithoutCrashing(); base::debug::DumpWithoutCrashing();
} }
......
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