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

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

Issue 538913002: ServiceWorker: Insert TRACE_EVENT to watch a breakdown of the ServiceWorker's performance on chome:… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change messages in TRACE_EVENTs Created 6 years, 3 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_storage.cc
diff --git a/content/browser/service_worker/service_worker_storage.cc b/content/browser/service_worker/service_worker_storage.cc
index 8b8b20c057966087205ff267e4a470469272a95f..21debd618425a14dd172298a864c42d03fcfd58e 100644
--- a/content/browser/service_worker/service_worker_storage.cc
+++ b/content/browser/service_worker/service_worker_storage.cc
@@ -7,7 +7,9 @@
#include <string>
#include "base/bind_helpers.h"
+#include "base/debug/trace_event.h"
#include "base/file_util.h"
+#include "base/hash.h"
#include "base/message_loop/message_loop.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
@@ -250,6 +252,11 @@ void ServiceWorkerStorage::FindRegistrationForDocument(
const GURL& document_url,
const FindRegistrationCallback& callback) {
DCHECK(!document_url.has_ref());
+ TRACE_EVENT_ASYNC_BEGIN1(
+ "ServiceWorker",
+ "ServiceWorkerStorage::FindRegistrationForDocument",
+ base::Hash(document_url.spec()),
horo 2014/09/05 11:02:32 I think we can use the pointer of callback as ID.
shimazu 2014/09/08 07:04:46 I think so, too. But the pointer is different betw
+ "URL", document_url.spec());
if (!LazyInitialize(base::Bind(
&ServiceWorkerStorage::FindRegistrationForDocument,
weak_factory_.GetWeakPtr(), document_url, callback))) {
@@ -767,6 +774,12 @@ void ServiceWorkerStorage::DidFindRegistrationForDocument(
ServiceWorkerDatabase::Status status) {
if (status == ServiceWorkerDatabase::STATUS_OK) {
ReturnFoundRegistration(callback, data, resources);
+ TRACE_EVENT_ASYNC_END1(
+ "ServiceWorker",
+ "ServiceWorkerStorage::FindRegistrationForDocument -> "
+ "ServiceWorkerStorage::DidFindRegistrationForDocument",
+ base::Hash(document_url.spec()),
+ "Status", "OK");
return;
}
@@ -777,12 +790,24 @@ void ServiceWorkerStorage::DidFindRegistrationForDocument(
callback.Run(installing_registration.get() ? SERVICE_WORKER_OK
: SERVICE_WORKER_ERROR_NOT_FOUND,
installing_registration);
+ TRACE_EVENT_ASYNC_END1(
+ "ServiceWorker",
+ "ServiceWorkerStorage::FindRegistrationForDocument -> "
+ "ServiceWorkerStorage::DidFindRegistrationForDocument",
+ base::Hash(document_url.spec()),
+ "Status", status);
return;
}
ScheduleDeleteAndStartOver();
callback.Run(DatabaseStatusToStatusCode(status),
scoped_refptr<ServiceWorkerRegistration>());
+ TRACE_EVENT_ASYNC_END1(
+ "ServiceWorker",
+ "ServiceWorkerStorage::FindRegistrationForDocument -> "
+ "ServiceWorkerStorage::DidFindRegistrationForDocument",
+ base::Hash(document_url.spec()),
+ "Status", status);
}
void ServiceWorkerStorage::DidFindRegistrationForPattern(

Powered by Google App Engine
This is Rietveld 408576698