summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2011-02-14 07:36:51 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-02-14 07:36:51 -0800
commita38cdf7feffba4f61bd533e43fcacec7418ea150 (patch)
tree3575205c39fd9be84d05f8cd653ce376be4303ea
parentd3578c52328364ca99012a1de1a8dba8cccd83db (diff)
parent401ea8d9bf635ef098571e20c69b9a1a93c5041e (diff)
downloadexternal_webkit-a38cdf7feffba4f61bd533e43fcacec7418ea150.zip
external_webkit-a38cdf7feffba4f61bd533e43fcacec7418ea150.tar.gz
external_webkit-a38cdf7feffba4f61bd533e43fcacec7418ea150.tar.bz2
Merge "Adding debug information about requests. #ifdef out by default"
-rw-r--r--WebKit/android/WebCoreSupport/WebRequest.cpp24
-rw-r--r--WebKit/android/WebCoreSupport/WebRequest.h3
2 files changed, 26 insertions, 1 deletions
diff --git a/WebKit/android/WebCoreSupport/WebRequest.cpp b/WebKit/android/WebCoreSupport/WebRequest.cpp
index fd6bbe2..a14036f 100644
--- a/WebKit/android/WebCoreSupport/WebRequest.cpp
+++ b/WebKit/android/WebCoreSupport/WebRequest.cpp
@@ -116,10 +116,28 @@ const std::string& WebRequest::getUserAgent() const
return m_userAgent;
}
+#ifdef LOG_REQUESTS
+namespace {
+int remaining = 0;
+}
+#endif
+
void WebRequest::finish(bool success)
{
m_runnableFactory.RevokeAll();
- ASSERT(m_loadState < Finished, "called finish on an already finished WebRequest (%d)", m_loadState);
+ ASSERT(m_loadState < Finished, "(%p) called finish on an already finished WebRequest (%d) (%s)", this, m_loadState, m_url.c_str());
+ if (m_loadState >= Finished)
+ return;
+#ifdef LOG_REQUESTS
+ time_t finish;
+ time(&finish);
+ finish = finish - m_startTime;
+ struct tm * timeinfo;
+ char buffer[80];
+ timeinfo = localtime(&finish);
+ strftime(buffer, 80, "Time: %M:%S",timeinfo);
+ android_printLog(ANDROID_LOG_DEBUG, "KM", "(%p) finish (%d) (%s) (%d) (%s)", this, --remaining, buffer, success, m_url.c_str());
+#endif
// Make sure WebUrlLoaderClient doesn't delete us in the middle of this method.
scoped_refptr<WebRequest> guard(this);
@@ -183,6 +201,10 @@ void WebRequest::updateLoadFlags(int& loadFlags)
void WebRequest::start()
{
ASSERT(m_loadState == Created, "Start called on a WebRequest not in CREATED state: (%s)", m_url.c_str());
+#ifdef LOG_REQUESTS
+ android_printLog(ANDROID_LOG_DEBUG, "KM", "(%p) start (%d) (%s)", this, ++remaining, m_url.c_str());
+ time(&m_startTime);
+#endif
m_loadState = Started;
diff --git a/WebKit/android/WebCoreSupport/WebRequest.h b/WebKit/android/WebCoreSupport/WebRequest.h
index ae386fd..dba7559 100644
--- a/WebKit/android/WebCoreSupport/WebRequest.h
+++ b/WebKit/android/WebCoreSupport/WebRequest.h
@@ -113,6 +113,9 @@ private:
ScopedRunnableMethodFactory<WebRequest> m_runnableFactory;
bool m_wantToPause;
bool m_isPaused;
+#ifdef LOG_REQUESTS
+ time_t m_startTime;
+#endif
};
} // namespace android