Commit 61e346d5 authored by shimazu's avatar shimazu Committed by Commit bot

SW: Move TRACE_EVENT_ASYNC_END to avoid early return and fix typo

BUG=N/A
TEST=N/A

Review URL: https://codereview.chromium.org/603863002

Cr-Commit-Position: refs/heads/master@{#296863}
parent 470df4f9
...@@ -228,6 +228,10 @@ void EmbeddedWorkerInstance::ProcessAllocated( ...@@ -228,6 +228,10 @@ void EmbeddedWorkerInstance::ProcessAllocated(
int process_id, int process_id,
ServiceWorkerStatusCode status) { ServiceWorkerStatusCode status) {
DCHECK_EQ(process_id_, -1); DCHECK_EQ(process_id_, -1);
TRACE_EVENT_ASYNC_END1("ServiceWorker",
"EmbeddedWorkerInstance::ProcessAllocate",
params.get(),
"Status", status);
if (status != SERVICE_WORKER_OK) { if (status != SERVICE_WORKER_OK) {
status_ = STOPPED; status_ = STOPPED;
callback.Run(status); callback.Run(status);
...@@ -236,10 +240,6 @@ void EmbeddedWorkerInstance::ProcessAllocated( ...@@ -236,10 +240,6 @@ void EmbeddedWorkerInstance::ProcessAllocated(
const int64 service_worker_version_id = params->service_worker_version_id; const int64 service_worker_version_id = params->service_worker_version_id;
process_id_ = process_id; process_id_ = process_id;
GURL script_url(params->script_url); GURL script_url(params->script_url);
TRACE_EVENT_ASYNC_END1("ServiceWorker",
"EmbeddedWorkerInstance::ProcessAllocate",
params.get(),
"Status", status);
RegisterToWorkerDevToolsManager( RegisterToWorkerDevToolsManager(
process_id, process_id,
context_.get(), context_.get(),
......
...@@ -109,7 +109,7 @@ void ServiceWorkerDispatcher::RegisterServiceWorker( ...@@ -109,7 +109,7 @@ void ServiceWorkerDispatcher::RegisterServiceWorker(
TRACE_EVENT_ASYNC_BEGIN2("ServiceWorker", TRACE_EVENT_ASYNC_BEGIN2("ServiceWorker",
"ServiceWorkerDispatcher::RegisterServiceWorker", "ServiceWorkerDispatcher::RegisterServiceWorker",
request_id, request_id,
"Pettern", pattern.spec(), "Scope", pattern.spec(),
"Script URL", script_url.spec()); "Script URL", script_url.spec());
thread_safe_sender_->Send(new ServiceWorkerHostMsg_RegisterServiceWorker( thread_safe_sender_->Send(new ServiceWorkerHostMsg_RegisterServiceWorker(
CurrentWorkerId(), request_id, provider_id, pattern, script_url)); CurrentWorkerId(), request_id, provider_id, pattern, script_url));
...@@ -134,7 +134,7 @@ void ServiceWorkerDispatcher::UnregisterServiceWorker( ...@@ -134,7 +134,7 @@ void ServiceWorkerDispatcher::UnregisterServiceWorker(
TRACE_EVENT_ASYNC_BEGIN1("ServiceWorker", TRACE_EVENT_ASYNC_BEGIN1("ServiceWorker",
"ServiceWorkerDispatcher::UnregisterServiceWorker", "ServiceWorkerDispatcher::UnregisterServiceWorker",
request_id, request_id,
"Pettern", pattern.spec()); "Scope", pattern.spec());
thread_safe_sender_->Send(new ServiceWorkerHostMsg_UnregisterServiceWorker( thread_safe_sender_->Send(new ServiceWorkerHostMsg_UnregisterServiceWorker(
CurrentWorkerId(), request_id, provider_id, pattern)); CurrentWorkerId(), request_id, provider_id, pattern));
} }
...@@ -325,6 +325,9 @@ void ServiceWorkerDispatcher::OnRegistered( ...@@ -325,6 +325,9 @@ void ServiceWorkerDispatcher::OnRegistered(
"ServiceWorkerDispatcher::RegisterServiceWorker", "ServiceWorkerDispatcher::RegisterServiceWorker",
request_id, request_id,
"OnRegistered"); "OnRegistered");
TRACE_EVENT_ASYNC_END0("ServiceWorker",
"ServiceWorkerDispatcher::RegisterServiceWorker",
request_id);
WebServiceWorkerRegistrationCallbacks* callbacks = WebServiceWorkerRegistrationCallbacks* callbacks =
pending_registration_callbacks_.Lookup(request_id); pending_registration_callbacks_.Lookup(request_id);
DCHECK(callbacks); DCHECK(callbacks);
...@@ -333,29 +336,26 @@ void ServiceWorkerDispatcher::OnRegistered( ...@@ -333,29 +336,26 @@ void ServiceWorkerDispatcher::OnRegistered(
callbacks->onSuccess(FindOrCreateRegistration(info, attrs)); callbacks->onSuccess(FindOrCreateRegistration(info, attrs));
pending_registration_callbacks_.Remove(request_id); pending_registration_callbacks_.Remove(request_id);
TRACE_EVENT_ASYNC_END0("ServiceWorker",
"ServiceWorkerDispatcher::RegisterServiceWorker",
request_id);
} }
void ServiceWorkerDispatcher::OnUnregistered(int thread_id, void ServiceWorkerDispatcher::OnUnregistered(int thread_id,
int request_id, int request_id,
bool is_success) { bool is_success) {
WebServiceWorkerUnregistrationCallbacks* callbacks =
pending_unregistration_callbacks_.Lookup(request_id);
TRACE_EVENT_ASYNC_STEP_INTO0( TRACE_EVENT_ASYNC_STEP_INTO0(
"ServiceWorker", "ServiceWorker",
"ServiceWorkerDispatcher::UnregisterServiceWorker", "ServiceWorkerDispatcher::UnregisterServiceWorker",
request_id, request_id,
"OnUnregistered"); "OnUnregistered");
TRACE_EVENT_ASYNC_END0("ServiceWorker",
"ServiceWorkerDispatcher::UnregisterServiceWorker",
request_id);
WebServiceWorkerUnregistrationCallbacks* callbacks =
pending_unregistration_callbacks_.Lookup(request_id);
DCHECK(callbacks); DCHECK(callbacks);
if (!callbacks) if (!callbacks)
return; return;
callbacks->onSuccess(&is_success); callbacks->onSuccess(&is_success);
pending_unregistration_callbacks_.Remove(request_id); pending_unregistration_callbacks_.Remove(request_id);
TRACE_EVENT_ASYNC_END0("ServiceWorker",
"ServiceWorkerDispatcher::UnregisterServiceWorker",
request_id);
} }
void ServiceWorkerDispatcher::OnDidGetRegistration( void ServiceWorkerDispatcher::OnDidGetRegistration(
...@@ -363,13 +363,16 @@ void ServiceWorkerDispatcher::OnDidGetRegistration( ...@@ -363,13 +363,16 @@ void ServiceWorkerDispatcher::OnDidGetRegistration(
int request_id, int request_id,
const ServiceWorkerRegistrationObjectInfo& info, const ServiceWorkerRegistrationObjectInfo& info,
const ServiceWorkerVersionAttributes& attrs) { const ServiceWorkerVersionAttributes& attrs) {
WebServiceWorkerRegistrationCallbacks* callbacks =
pending_get_registration_callbacks_.Lookup(request_id);
TRACE_EVENT_ASYNC_STEP_INTO0( TRACE_EVENT_ASYNC_STEP_INTO0(
"ServiceWorker", "ServiceWorker",
"ServiceWorkerDispatcher::GetRegistration", "ServiceWorkerDispatcher::GetRegistration",
request_id, request_id,
"OnDidGetRegistration"); "OnDidGetRegistration");
TRACE_EVENT_ASYNC_END0("ServiceWorker",
"ServiceWorkerDispatcher::GetRegistration",
request_id);
WebServiceWorkerRegistrationCallbacks* callbacks =
pending_get_registration_callbacks_.Lookup(request_id);
DCHECK(callbacks); DCHECK(callbacks);
if (!callbacks) if (!callbacks)
return; return;
...@@ -380,9 +383,6 @@ void ServiceWorkerDispatcher::OnDidGetRegistration( ...@@ -380,9 +383,6 @@ void ServiceWorkerDispatcher::OnDidGetRegistration(
callbacks->onSuccess(registration); callbacks->onSuccess(registration);
pending_get_registration_callbacks_.Remove(request_id); pending_get_registration_callbacks_.Remove(request_id);
TRACE_EVENT_ASYNC_END0("ServiceWorker",
"ServiceWorkerDispatcher::GetRegistration",
request_id);
} }
void ServiceWorkerDispatcher::OnRegistrationError( void ServiceWorkerDispatcher::OnRegistrationError(
...@@ -394,6 +394,9 @@ void ServiceWorkerDispatcher::OnRegistrationError( ...@@ -394,6 +394,9 @@ void ServiceWorkerDispatcher::OnRegistrationError(
"ServiceWorkerDispatcher::RegisterServiceWorker", "ServiceWorkerDispatcher::RegisterServiceWorker",
request_id, request_id,
"OnRegistrationError"); "OnRegistrationError");
TRACE_EVENT_ASYNC_END0("ServiceWorker",
"ServiceWorkerDispatcher::RegisterServiceWorker",
request_id);
WebServiceWorkerRegistrationCallbacks* callbacks = WebServiceWorkerRegistrationCallbacks* callbacks =
pending_registration_callbacks_.Lookup(request_id); pending_registration_callbacks_.Lookup(request_id);
DCHECK(callbacks); DCHECK(callbacks);
...@@ -404,9 +407,6 @@ void ServiceWorkerDispatcher::OnRegistrationError( ...@@ -404,9 +407,6 @@ void ServiceWorkerDispatcher::OnRegistrationError(
new WebServiceWorkerError(error_type, message)); new WebServiceWorkerError(error_type, message));
callbacks->onError(error.release()); callbacks->onError(error.release());
pending_registration_callbacks_.Remove(request_id); pending_registration_callbacks_.Remove(request_id);
TRACE_EVENT_ASYNC_END0("ServiceWorker",
"ServiceWorkerDispatcher::RegisterServiceWorker",
request_id);
} }
void ServiceWorkerDispatcher::OnUnregistrationError( void ServiceWorkerDispatcher::OnUnregistrationError(
...@@ -419,6 +419,9 @@ void ServiceWorkerDispatcher::OnUnregistrationError( ...@@ -419,6 +419,9 @@ void ServiceWorkerDispatcher::OnUnregistrationError(
"ServiceWorkerDispatcher::UnregisterServiceWorker", "ServiceWorkerDispatcher::UnregisterServiceWorker",
request_id, request_id,
"OnUnregistrationError"); "OnUnregistrationError");
TRACE_EVENT_ASYNC_END0("ServiceWorker",
"ServiceWorkerDispatcher::UnregisterServiceWorker",
request_id);
WebServiceWorkerUnregistrationCallbacks* callbacks = WebServiceWorkerUnregistrationCallbacks* callbacks =
pending_unregistration_callbacks_.Lookup(request_id); pending_unregistration_callbacks_.Lookup(request_id);
DCHECK(callbacks); DCHECK(callbacks);
...@@ -429,9 +432,6 @@ void ServiceWorkerDispatcher::OnUnregistrationError( ...@@ -429,9 +432,6 @@ void ServiceWorkerDispatcher::OnUnregistrationError(
new WebServiceWorkerError(error_type, message)); new WebServiceWorkerError(error_type, message));
callbacks->onError(error.release()); callbacks->onError(error.release());
pending_unregistration_callbacks_.Remove(request_id); pending_unregistration_callbacks_.Remove(request_id);
TRACE_EVENT_ASYNC_END0("ServiceWorker",
"ServiceWorkerDispatcher::UnregisterServiceWorker",
request_id);
} }
void ServiceWorkerDispatcher::OnGetRegistrationError( void ServiceWorkerDispatcher::OnGetRegistrationError(
...@@ -444,6 +444,9 @@ void ServiceWorkerDispatcher::OnGetRegistrationError( ...@@ -444,6 +444,9 @@ void ServiceWorkerDispatcher::OnGetRegistrationError(
"ServiceWorkerDispatcher::GetRegistration", "ServiceWorkerDispatcher::GetRegistration",
request_id, request_id,
"OnGetRegistrationError"); "OnGetRegistrationError");
TRACE_EVENT_ASYNC_END0("ServiceWorker",
"ServiceWorkerDispatcher::GetRegistration",
request_id);
WebServiceWorkerGetRegistrationCallbacks* callbacks = WebServiceWorkerGetRegistrationCallbacks* callbacks =
pending_get_registration_callbacks_.Lookup(request_id); pending_get_registration_callbacks_.Lookup(request_id);
DCHECK(callbacks); DCHECK(callbacks);
...@@ -454,9 +457,6 @@ void ServiceWorkerDispatcher::OnGetRegistrationError( ...@@ -454,9 +457,6 @@ void ServiceWorkerDispatcher::OnGetRegistrationError(
new WebServiceWorkerError(error_type, message)); new WebServiceWorkerError(error_type, message));
callbacks->onError(error.release()); callbacks->onError(error.release());
pending_get_registration_callbacks_.Remove(request_id); pending_get_registration_callbacks_.Remove(request_id);
TRACE_EVENT_ASYNC_END0("ServiceWorker",
"ServiceWorkerDispatcher::GetRegistration",
request_id);
} }
void ServiceWorkerDispatcher::OnServiceWorkerStateChanged( void ServiceWorkerDispatcher::OnServiceWorkerStateChanged(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment