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

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

Issue 636253004: ServiceWorker: Move TRACE_EVENT to avoid early return and mismatching (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate a review Created 6 years, 2 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
« no previous file with comments | « content/browser/service_worker/service_worker_storage.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 54eacd657f51bf4593d953a1f8bdf61a97cf6656..69e48f37ab2b678e670eebb4bdb9bf23615cc519 100644
--- a/content/browser/service_worker/service_worker_storage.cc
+++ b/content/browser/service_worker/service_worker_storage.cc
@@ -252,11 +252,6 @@ 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()),
- "URL", document_url.spec());
if (!LazyInitialize(base::Bind(
&ServiceWorkerStorage::FindRegistrationForDocument,
weak_factory_.GetWeakPtr(), document_url, callback))) {
@@ -264,6 +259,11 @@ void ServiceWorkerStorage::FindRegistrationForDocument(
CompleteFindNow(scoped_refptr<ServiceWorkerRegistration>(),
SERVICE_WORKER_ERROR_FAILED, callback);
}
+ TRACE_EVENT_INSTANT1(
+ "ServiceWorker",
+ "ServiceWorkerStorage::FindRegistrationForDocument:LazyInitialize",
nhiroki 2014/10/14 09:31:53 just suggestion: ":" looks a separator of namespac
+ TRACE_EVENT_SCOPE_THREAD,
+ "URL", document_url.spec());
return;
}
DCHECK_EQ(INITIALIZED, state_);
@@ -273,14 +273,28 @@ void ServiceWorkerStorage::FindRegistrationForDocument(
// Look for something currently being installed.
scoped_refptr<ServiceWorkerRegistration> installing_registration =
FindInstallingRegistrationForDocument(document_url);
+ ServiceWorkerStatusCode status = installing_registration.get() ?
+ SERVICE_WORKER_OK : SERVICE_WORKER_ERROR_NOT_FOUND;
+ TRACE_EVENT_INSTANT2(
+ "ServiceWorker",
+ "ServiceWorkerStorage::FindRegistrationForDocument:CheckInstalling",
nhiroki 2014/10/14 09:31:53 ditto.
+ TRACE_EVENT_SCOPE_THREAD,
+ "URL", document_url.spec(),
+ "Status", (status == SERVICE_WORKER_OK) ? "Found" : "Not Found");
nhiroki 2014/10/14 09:31:53 nit: "OK" is used for SERVICE_WORKER_OK at line 79
CompleteFindNow(installing_registration,
- installing_registration.get()
- ? SERVICE_WORKER_OK
- : SERVICE_WORKER_ERROR_NOT_FOUND,
+ status,
callback);
return;
}
+ // To connect this TRACE_EVENT with the callback, TimeTicks is used for
+ // callback id.
+ int64 callback_id = base::TimeTicks::Now().ToInternalValue();
+ TRACE_EVENT_ASYNC_BEGIN1(
+ "ServiceWorker",
+ "ServiceWorkerStorage::FindRegistrationForDocument",
+ callback_id,
+ "URL", document_url.spec());
database_task_runner_->PostTask(
FROM_HERE,
base::Bind(
@@ -289,7 +303,10 @@ void ServiceWorkerStorage::FindRegistrationForDocument(
base::MessageLoopProxy::current(),
document_url,
base::Bind(&ServiceWorkerStorage::DidFindRegistrationForDocument,
- weak_factory_.GetWeakPtr(), document_url, callback)));
+ weak_factory_.GetWeakPtr(),
+ document_url,
+ callback,
+ callback_id)));
}
void ServiceWorkerStorage::FindRegistrationForPattern(
@@ -769,6 +786,7 @@ void ServiceWorkerStorage::DidReadInitialData(
void ServiceWorkerStorage::DidFindRegistrationForDocument(
const GURL& document_url,
const FindRegistrationCallback& callback,
+ int64 callback_id,
const ServiceWorkerDatabase::RegistrationData& data,
const ResourceList& resources,
ServiceWorkerDatabase::Status status) {
@@ -777,7 +795,7 @@ void ServiceWorkerStorage::DidFindRegistrationForDocument(
TRACE_EVENT_ASYNC_END1(
"ServiceWorker",
"ServiceWorkerStorage::FindRegistrationForDocument",
- base::Hash(document_url.spec()),
+ callback_id,
"Status", "OK");
return;
}
@@ -792,7 +810,7 @@ void ServiceWorkerStorage::DidFindRegistrationForDocument(
TRACE_EVENT_ASYNC_END1(
"ServiceWorker",
"ServiceWorkerStorage::FindRegistrationForDocument",
- base::Hash(document_url.spec()),
+ callback_id,
"Status", status);
return;
}
@@ -803,7 +821,7 @@ void ServiceWorkerStorage::DidFindRegistrationForDocument(
TRACE_EVENT_ASYNC_END1(
"ServiceWorker",
"ServiceWorkerStorage::FindRegistrationForDocument",
- base::Hash(document_url.spec()),
+ callback_id,
"Status", status);
}
« no previous file with comments | « content/browser/service_worker/service_worker_storage.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698