summaryrefslogtreecommitdiffstats
path: root/WebKit/android/jni
diff options
context:
space:
mode:
authorGrace Kloba <klobag@google.com>2009-11-23 15:40:48 -0800
committerGrace Kloba <klobag@google.com>2009-12-01 14:46:03 -0800
commit537e6e260dbe25b78cd6df29a17118b3294f61a6 (patch)
tree34a8910204f10e5fe9a929939c408a58089b6a26 /WebKit/android/jni
parentc1cf958cf053d63e0f2a09d2af1ec2fafdd32cd9 (diff)
downloadexternal_webkit-537e6e260dbe25b78cd6df29a17118b3294f61a6.zip
external_webkit-537e6e260dbe25b78cd6df29a17118b3294f61a6.tar.gz
external_webkit-537e6e260dbe25b78cd6df29a17118b3294f61a6.tar.bz2
Move dump display tree to sdcard as dom and render tree.
Fix dump render tree code.
Diffstat (limited to 'WebKit/android/jni')
-rw-r--r--WebKit/android/jni/WebViewCore.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 4372171..f138662 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -1153,26 +1153,24 @@ void WebViewCore::dumpDomTree(bool useFile)
void WebViewCore::dumpRenderTree(bool useFile)
{
#ifdef ANDROID_DOM_LOGGING
- if (useFile)
- gRenderTreeFile = fopen(RENDER_TREE_LOG_FILE, "w");
WebCore::CString renderDump = WebCore::externalRepresentation(m_mainFrame->contentRenderer()).utf8();
const char* data = renderDump.data();
- int length = renderDump.length();
- int last = 0;
- for (int i = 0; i < length; i++) {
- if (data[i] == '\n') {
- if (i != last) {
- char* chunk = new char[i - last + 1];
- strncpy(chunk, (data + last), i - last);
- chunk[i - last] = '\0';
- DUMP_RENDER_LOGD("%s", chunk);
- }
- last = i + 1;
- }
- }
- if (gRenderTreeFile) {
+ if (useFile) {
+ gRenderTreeFile = fopen(RENDER_TREE_LOG_FILE, "w");
+ DUMP_RENDER_LOGD("%s", data);
fclose(gRenderTreeFile);
gRenderTreeFile = 0;
+ } else {
+ // adb log can only output 1024 characters, so write out line by line.
+ // exclude '\n' as adb log adds it for each output.
+ int length = renderDump.length();
+ for (int i = 0, last = 0; i < length; i++) {
+ if (data[i] == '\n') {
+ if (i != last)
+ DUMP_RENDER_LOGD("%.*s", (i - last), &(data[last]));
+ last = i + 1;
+ }
+ }
}
#endif
}