Chromium Code Reviews| Index: content/browser/service_worker/service_worker_version.cc |
| diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc |
| index 53f05f35587fccc65f3b26b5fb4fadef4e6cd0c0..dcde8cfb00df002e182cd921dbc925c0e4c86c7b 100644 |
| --- a/content/browser/service_worker/service_worker_version.cc |
| +++ b/content/browser/service_worker/service_worker_version.cc |
| @@ -307,8 +307,6 @@ ServiceWorkerVersion::ServiceWorkerVersion( |
| context_(context), |
| script_cache_map_(this, context), |
| ping_state_(NOT_PINGING), |
| - is_doomed_(false), |
| - skip_waiting_(false), |
| weak_factory_(this) { |
| DCHECK(context_); |
| DCHECK(registration); |
| @@ -788,8 +786,13 @@ void ServiceWorkerVersion::SetDevToolsAttached(bool attached) { |
| ClearTick(&start_time_); |
| return; |
| } |
| - if (!timeout_timer_.IsRunning()) |
| - StartTimeoutTimer(); |
| + if (timeout_timer_.IsRunning() && running_status() == STARTING) { |
| + // Reactivate the timer for start timeout. |
| + RestartTick(&start_time_); |
|
falken
2015/03/13 07:14:10
The start timeout sometimes should be in effect fo
nhiroki
2015/03/16 01:58:02
Thank you, I didn't notice it. Tweaked the conditi
|
| + |
| + // Once the DevTools is attached, we cannot record an accurate startup time. |
| + skip_recording_startup_time_ = true; |
|
falken
2015/03/13 07:14:10
This line and line 785-786 essentially do the same
nhiroki
2015/03/16 01:58:02
Exactly. Merged this into line 785.
|
| + } |
| } |
| void ServiceWorkerVersion::SetMainScriptHttpResponseInfo( |
| @@ -886,6 +889,7 @@ void ServiceWorkerVersion::OnStopped( |
| ClearTick(&start_time_); |
| else |
| RestartTick(&start_time_); |
| + skip_recording_startup_time_ = false; |
| cache_listener_.reset(new ServiceWorkerCacheListener(this, context_)); |
| embedded_worker_->Start( |
| version_id_, scope_, script_url_, false /* pause_after_download */, |
| @@ -1449,6 +1453,7 @@ void ServiceWorkerVersion::StartTimeoutTimer() { |
| ClearTick(&start_time_); |
| else |
| RestartTick(&start_time_); |
| + skip_recording_startup_time_ = false; |
| start_callbacks_.push_back( |
| base::Bind(&ServiceWorkerVersion::RecordStartWorkerResult, |
| weak_factory_.GetWeakPtr())); |
| @@ -1568,7 +1573,8 @@ void ServiceWorkerVersion::RecordStartWorkerResult( |
| UMA_HISTOGRAM_ENUMERATION("ServiceWorker.StartWorker.Status", status, |
| SERVICE_WORKER_ERROR_MAX_VALUE); |
| - if (status == SERVICE_WORKER_OK && !start_time.is_null()) { |
| + if (status == SERVICE_WORKER_OK && !start_time.is_null() && |
| + !skip_recording_startup_time_) { |
| UMA_HISTOGRAM_MEDIUM_TIMES("ServiceWorker.StartWorker.Time", |
| GetTickDuration(start_time)); |
| } |