Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Unified Diff: webkit/appcache/web_application_cache_host_impl.cc

Issue 2910007: Report an error message when an update job results in an error. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/appcache/web_application_cache_host_impl.cc
===================================================================
--- webkit/appcache/web_application_cache_host_impl.cc (revision 52160)
+++ webkit/appcache/web_application_cache_host_impl.cc (working copy)
@@ -26,6 +26,13 @@
typedef IDMap<WebApplicationCacheHostImpl> HostsMap;
+// Note: the order of the elements in this array must match those
+// of the EventID enum in appcache_interfaces.h.
+static const char* kEventNames[] = {
+ "Checking", "Error", "NoUpdate", "Downloading", "Progress",
+ "UpdateReady", "Cached", "Obsolete"
+};
+
static HostsMap* all_hosts() {
return Singleton<HostsMap>::get();
}
@@ -81,6 +88,14 @@
void WebApplicationCacheHostImpl::OnEventRaised(appcache::EventID event_id) {
DCHECK(event_id != PROGRESS_EVENT); // See OnProgressEventRaised.
+ DCHECK(event_id != ERROR_EVENT); // See OnErrorEventRaised.
+
+ // Emit logging output prior to calling out to script as we can get
+ // deleted withing the script event handler.
+ const char* kFormatString = "Application Cache %s event";
+ std::string message = StringPrintf(kFormatString, kEventNames[event_id]);
+ OnLogMessage(LOG_INFO, message);
+
// Most events change the status. Clear out what we know so that the latest
// status will be obtained from the backend.
has_status_ = false;
@@ -90,9 +105,31 @@
void WebApplicationCacheHostImpl::OnProgressEventRaised(
const GURL& url, int num_total, int num_complete) {
+ // Emit logging output prior to calling out to script as we can get
+ // deleted withing the script event handler.
+ const char* kFormatString = "Application Cache Progress event (%d of %d) %s";
+ std::string message = StringPrintf(kFormatString, num_complete,
+ num_total, url.spec().c_str());
+ OnLogMessage(LOG_INFO, message);
+
client_->notifyProgressEventListener(url, num_total, num_complete);
}
+void WebApplicationCacheHostImpl::OnErrorEventRaised(
+ const std::string& message) {
+ // Emit logging output prior to calling out to script as we can get
+ // deleted withing the script event handler.
+ const char* kFormatString = "Application Cache Error event: %s";
+ std::string full_message = StringPrintf(kFormatString, message.c_str());
+ OnLogMessage(LOG_ERROR, full_message);
+
+ // Most events change the status. Clear out what we know so that the latest
+ // status will be obtained from the backend.
+ has_status_ = false;
+ has_cached_status_ = false;
+ client_->notifyEventListener(static_cast<EventID>(ERROR_EVENT));
+}
+
void WebApplicationCacheHostImpl::willStartMainResourceRequest(
WebURLRequest& request) {
request.setAppCacheHostID(host_id_);
« no previous file with comments | « webkit/appcache/web_application_cache_host_impl.h ('k') | webkit/tools/test_shell/simple_appcache_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698