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

Unified Diff: content/browser/service_worker/service_worker_context_watcher.cc

Issue 1030103003: Report error messages to DevTools window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporated falken's comment Created 5 years, 9 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: content/browser/service_worker/service_worker_context_watcher.cc
diff --git a/content/browser/service_worker/service_worker_context_watcher.cc b/content/browser/service_worker/service_worker_context_watcher.cc
index 45b0065c623ab65aedbbebb954d1a85142556401..13e1228ec154cf3df65f99ad057107826db3d047 100644
--- a/content/browser/service_worker/service_worker_context_watcher.cc
+++ b/content/browser/service_worker/service_worker_context_watcher.cc
@@ -9,6 +9,7 @@
#include "content/browser/service_worker/service_worker_context_observer.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/browser/service_worker/service_worker_version.h"
+#include "content/common/service_worker/service_worker_types.h"
#include "content/public/browser/browser_thread.h"
#include "url/gurl.h"
@@ -26,10 +27,12 @@ bool IsStoppedAndRedundant(const ServiceWorkerVersionInfo& version_info) {
ServiceWorkerContextWatcher::ServiceWorkerContextWatcher(
scoped_refptr<ServiceWorkerContextWrapper> context,
const WorkerRegistrationUpdatedCallback& registration_callback,
- const WorkerVersionUpdatedCallback& version_callback)
+ const WorkerVersionUpdatedCallback& version_callback,
+ const WorkerErrorReportedCallback& error_callback)
: context_(context),
registration_callback_(registration_callback),
- version_callback_(version_callback) {
+ version_callback_(version_callback),
+ error_callback_(error_callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
}
@@ -195,6 +198,18 @@ void ServiceWorkerContextWatcher::OnVersionStateChanged(
version_info_map_.erase(version_id);
}
+void ServiceWorkerContextWatcher::OnErrorReported(int64 version_id,
+ int process_id,
+ int thread_id,
+ const ErrorInfo& info) {
+ int64 registration_id = kInvalidServiceWorkerRegistrationId;
+ if (ServiceWorkerVersionInfo* version = version_info_map_.get(version_id))
+ registration_id = version->registration_id;
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(error_callback_, registration_id, version_id, info));
+}
+
void ServiceWorkerContextWatcher::OnRegistrationStored(int64 registration_id,
const GURL& pattern) {
SendRegistrationInfo(registration_id, pattern,

Powered by Google App Engine
This is Rietveld 408576698