summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android/jni/WebHistory.cpp
diff options
context:
space:
mode:
authorRussell Brenner <russellbrenner@google.com>2012-01-24 10:05:57 -0800
committerRussell Brenner <russellbrenner@google.com>2012-01-24 10:17:09 -0800
commit541839a11103a72d486edaab8a5c9e9499554511 (patch)
tree62ec7ae86e15b8490d65d5752f7783c2e50044df /Source/WebKit/android/jni/WebHistory.cpp
parente18ec51fbe570f52876a50202d603346eb1bbd01 (diff)
downloadexternal_webkit-541839a11103a72d486edaab8a5c9e9499554511.zip
external_webkit-541839a11103a72d486edaab8a5c9e9499554511.tar.gz
external_webkit-541839a11103a72d486edaab8a5c9e9499554511.tar.bz2
Refine WebHistory log output
Log output is more explicit upon failure, but otherwise quiet. Bug: 5143832 Change-Id: I8696c36277b0fac12698b4ace9cf4131344f6a0c
Diffstat (limited to 'Source/WebKit/android/jni/WebHistory.cpp')
-rw-r--r--Source/WebKit/android/jni/WebHistory.cpp41
1 files changed, 31 insertions, 10 deletions
diff --git a/Source/WebKit/android/jni/WebHistory.cpp b/Source/WebKit/android/jni/WebHistory.cpp
index e1ae28a..9bb29e3 100644
--- a/Source/WebKit/android/jni/WebHistory.cpp
+++ b/Source/WebKit/android/jni/WebHistory.cpp
@@ -488,7 +488,8 @@ bool readUnsigned(const char*& data, const char* end, unsigned& result, const ch
{
// Check if we have enough data left to continue.
if ((end < data) || (static_cast<size_t>(end - data) < sizeof(unsigned))) {
- ALOGW("\tNot enough data to read unsigned; end=%p data=%p", end, data);
+ ALOGW("\tNot enough data to read unsigned; tag=\"%s\" end=%p data=%p",
+ dbgLabel ? dbgLabel : "<no tag>", end, data);
return false;
}
@@ -503,7 +504,8 @@ bool readInt(const char*& data, const char* end, int& result, const char* dbgLab
{
// Check if we have enough data left to continue.
if ((end < data) || (static_cast<size_t>(end - data) < sizeof(int))) {
- ALOGW("\tNot enough data to read int; end=%p data=%p", end, data);
+ ALOGW("Not enough data to read int; tag=\"%s\" end=%p data=%p",
+ dbgLabel ? dbgLabel : "<no tag>", end, data);
return false;
}
@@ -518,7 +520,8 @@ bool readInt64(const char*& data, const char* end, int64_t& result, const char*
{
// Check if we have enough data left to continue.
if ((end < data) || (static_cast<size_t>(end - data) < sizeof(int64_t))) {
- ALOGW("\tNot enough data to read int64_t; end=%p data=%p", end, data);
+ ALOGW("Not enough data to read int64_t; tag=\"%s\" end=%p data=%p",
+ dbgLabel ? dbgLabel : "<no tag>", end, data);
return false;
}
@@ -533,7 +536,8 @@ bool readFloat(const char*& data, const char* end, float& result, const char* db
{
// Check if we have enough data left to continue.
if ((end < data) || (static_cast<size_t>(end - data) < sizeof(float))) {
- ALOGW("\tNot enough data to read float; end=%p data=%p", end, data);
+ ALOGW("Not enough data to read float; tag=\"%s\" end=%p data=%p",
+ dbgLabel ? dbgLabel : "<no tag>", end, data);
return false;
}
@@ -550,7 +554,8 @@ bool readBool(const char*& data, const char* end, bool& result, const char* dbgL
{
// Check if we have enough data left to continue.
if ((end < data) || (static_cast<size_t>(end - data) < sizeof(char))) {
- ALOGW("\tNot enough data to read bool; end=%p data=%p", end, data);
+ ALOGW("Not enough data to read bool; tag=\"%s\" end=%p data=%p",
+ dbgLabel ? dbgLabel : "<no tag>", end, data);
return false;
}
@@ -563,7 +568,8 @@ bool readBool(const char*& data, const char* end, bool& result, const char* dbgL
// Valid bool results are 0 or 1
if ((c != 0) && (c != 1)) {
- ALOGW("\tInvalid value for bool; end=%p data=%p c=%u", end, data, c);
+ ALOGW("Invalid value for bool; tag=\"%s\" end=%p data=%p c=%u",
+ dbgLabel ? dbgLabel : "<no tag>", end, data, c);
return false;
}
@@ -574,7 +580,8 @@ bool readString(const char*& data, const char* end, String& result, const char*
{
unsigned stringLength;
if (!readUnsigned(data, end, stringLength)) {
- ALOGW("Not enough data to read string length; end=%p data=%p", end, data);
+ ALOGW("Not enough data to read string length; tag=\"%s\" end=%p data=%p",
+ dbgLabel ? dbgLabel : "<no tag>", end, data);
return false;
}
@@ -588,21 +595,35 @@ bool readString(const char*& data, const char* end, String& result, const char*
}
if ((end < data) || ((unsigned)(end - data) < stringLength)) {
- ALOGW("\tNot enough data to read content; end=%p data=%p stringLength=%u", end, data, stringLength);
+ ALOGW("Not enough data to read content; tag=\"%s\" end=%p data=%p stringLength=%u",
+ dbgLabel ? dbgLabel : "<no tag>", end, data, stringLength);
return false;
}
+ const unsigned MAX_REASONABLE_STRING_LENGTH = 10000;
+ if (stringLength > MAX_REASONABLE_STRING_LENGTH) {
+ ALOGW("String length is suspiciously large (>%d); tag=\"%s\" end=%p data=%p stringLength=%u",
+ MAX_REASONABLE_STRING_LENGTH, dbgLabel ? dbgLabel : "<no tag>",
+ end, data, stringLength);
+ }
+
bool decodeFailed;
static const WebCore::TextEncoding& encoding = WebCore::UTF8Encoding();
result = encoding.decode(data, stringLength, true, decodeFailed);
if (decodeFailed) {
- ALOGW("\tdecode failed, end=%p data=%p stringLength=%u content=\"%s\"",
- end, data, stringLength, result.utf8().data());
+ ALOGW("Decode failed, tag=\"%s\" end=%p data=%p stringLength=%u content=\"%s\"",
+ dbgLabel ? dbgLabel : "<no tag>", end, data, stringLength,
+ result.utf8().data());
// Although an error was reported, the previous implementation did not
// stop here, and debug output of the result, which looks correct, makes
// it unclear just what the error was.
}
+ if (stringLength > MAX_REASONABLE_STRING_LENGTH) {
+ ALOGW("\tdecodeFailed=%d (flag is ignored) content=\"%s\"",
+ decodeFailed, result.utf8().data());
+ }
+
data += stringLength;
return true;
}