Commit 811fe6a2 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

Add CrashKey to LazyLineBreakIterator on Android

This patch adds CrashKey to investigate where crashes occur.

LazyLineBreakIterator::IsBreakable() has inline and templates
that the stack quality is low.

Bug: 756624
Change-Id: I657b18aa1cb74b2587104352b4a3e826522b6ba8
Reviewed-on: https://chromium-review.googlesource.com/737710Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarLuke Halliwell <halliwell@chromium.org>
Reviewed-by: default avatarDominik Röttsches <drott@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512825}
parent 2a3981b3
......@@ -123,6 +123,9 @@ size_t RegisterWebViewCrashKeys() {
// Accessibility keys. Temporary for http://crbug.com/765490.
{"ax_tree_error", kSmallSize},
{"ax_tree_update", kMediumSize},
// Temporary for crbug.com/756624.
{"break_iterator", kSmallSize},
};
// This dynamic set of keys is used for sets of key value pairs when gathering
......
......@@ -224,6 +224,9 @@ size_t RegisterChromeCrashKeys() {
// Accessibility keys. Temporary for http://crbug.com/765490.
{"ax_tree_error", kSmallSize},
{"ax_tree_update", kMediumSize},
// Temporary for crbug.com/756624.
{"break_iterator", kSmallSize},
};
// This dynamic set of keys is used for sets of key value pairs when gathering
......
......@@ -84,6 +84,9 @@ size_t RegisterCastCrashKeys() {
// Accessibility keys. Temporary for http://crbug.com/765490.
{"ax_tree_error", ::crash_keys::kSmallSize},
{"ax_tree_update", ::crash_keys::kMediumSize},
// Temporary for crbug.com/756624.
{"break_iterator", ::crash_keys::kSmallSize},
};
return base::debug::InitCrashKeys(fixed_keys, arraysize(fixed_keys),
......
......@@ -23,6 +23,7 @@
#include "platform/text/TextBreakIterator.h"
#include "build/build_config.h"
#include "platform/text/Character.h"
#include "platform/wtf/ASCIICType.h"
#include "platform/wtf/StdLibExtras.h"
......@@ -31,6 +32,18 @@
#include <unicode/uchar.h>
#include <unicode/uvernum.h>
#if defined(OS_ANDROID)
// Investigate crash on Android crbug.com/756624
// TODO(kojii): Remove this when investigation is done.
#include "base/strings/stringprintf.h"
#include "platform/wtf/debug/CrashLogging.h"
#define SET_CRASH_KEY 1
using WTF::debug::ScopedCrashKey;
const char kCrashKey[] = "break_iterator";
#endif
namespace blink {
unsigned NumGraphemeClusters(const String& string) {
......@@ -259,6 +272,11 @@ template <typename CharacterType,
inline int LazyLineBreakIterator::NextBreakablePosition(
int pos,
const CharacterType* str) const {
#if defined(SET_CRASH_KEY)
ScopedCrashKey crash_key(kCrashKey,
base::StringPrintf("%d %d %p", lineBreakType, pos,
static_cast<const void*>(str)));
#endif
int len = static_cast<int>(string_.length());
int next_break = -1;
......@@ -268,7 +286,8 @@ inline int LazyLineBreakIterator::NextBreakablePosition(
ULineBreak last_line_break;
if (lineBreakType == LineBreakType::kBreakAll)
last_line_break = LineBreakPropertyValue(last_last_ch, last_ch);
unsigned prior_context_length = PriorContextLength();
const unsigned prior_context_length = PriorContextLength();
TextBreakIterator* break_iterator = nullptr;
CharacterType ch;
bool is_space;
for (int i = pos; i < len;
......@@ -319,8 +338,16 @@ inline int LazyLineBreakIterator::NextBreakablePosition(
// Don't break if positioned at start of primary context and there is no
// prior context.
if (i || prior_context_length) {
TextBreakIterator* break_iterator = Get(prior_context_length);
if (!break_iterator) {
#if defined(SET_CRASH_KEY)
ScopedCrashKey crash_key(kCrashKey, "Get");
#endif
break_iterator = Get(prior_context_length);
}
if (break_iterator) {
#if defined(SET_CRASH_KEY)
ScopedCrashKey crash_key(kCrashKey, "following");
#endif
next_break =
break_iterator->following(i - 1 + prior_context_length);
if (next_break >= 0) {
......@@ -371,6 +398,10 @@ inline int LazyLineBreakIterator::NextBreakablePosition(
template <LineBreakType lineBreakType>
inline int LazyLineBreakIterator::NextBreakablePosition(int pos) const {
#if defined(SET_CRASH_KEY)
ScopedCrashKey crash_key(kCrashKey,
base::StringPrintf("%d %d", lineBreakType, pos));
#endif
if (UNLIKELY(string_.IsNull()))
return 0;
if (string_.Is8Bit()) {
......
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