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

Side by Side Diff: content/browser/service_worker/service_worker_version.cc

Issue 1710903002: Revert of service worker: use 200 OK for update requests even in the no update case (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/service_worker_version.h" 5 #include "content/browser/service_worker/service_worker_version.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 } 1343 }
1344 } 1344 }
1345 1345
1346 void ServiceWorkerVersion::StartWorkerInternal() { 1346 void ServiceWorkerVersion::StartWorkerInternal() {
1347 if (!metrics_) 1347 if (!metrics_)
1348 metrics_.reset(new Metrics(this)); 1348 metrics_.reset(new Metrics(this));
1349 1349
1350 if (!timeout_timer_.IsRunning()) 1350 if (!timeout_timer_.IsRunning())
1351 StartTimeoutTimer(); 1351 StartTimeoutTimer();
1352 if (running_status() == STOPPED) { 1352 if (running_status() == STOPPED) {
1353 DCHECK(!pause_after_download_ || !IsInstalled(status()));
1354 embedded_worker_->Start( 1353 embedded_worker_->Start(
1355 version_id_, scope_, script_url_, 1354 version_id_, scope_, script_url_,
1356 base::Bind(&ServiceWorkerVersion::OnStartSentAndScriptEvaluated, 1355 base::Bind(&ServiceWorkerVersion::OnStartSentAndScriptEvaluated,
1357 weak_factory_.GetWeakPtr()), 1356 weak_factory_.GetWeakPtr()));
1358 pause_after_download_);
1359 } 1357 }
1360 } 1358 }
1361 1359
1362 void ServiceWorkerVersion::StartTimeoutTimer() { 1360 void ServiceWorkerVersion::StartTimeoutTimer() {
1363 DCHECK(!timeout_timer_.IsRunning()); 1361 DCHECK(!timeout_timer_.IsRunning());
1364 1362
1365 if (embedded_worker_->devtools_attached()) { 1363 if (embedded_worker_->devtools_attached()) {
1366 // Don't record the startup time metric once DevTools is attached. 1364 // Don't record the startup time metric once DevTools is attached.
1367 ClearTick(&start_time_); 1365 ClearTick(&start_time_);
1368 skip_recording_startup_time_ = true; 1366 skip_recording_startup_time_ = true;
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 void ServiceWorkerVersion::OnBeginEvent() { 1752 void ServiceWorkerVersion::OnBeginEvent() {
1755 if (should_exclude_from_uma_ || running_status() != RUNNING || 1753 if (should_exclude_from_uma_ || running_status() != RUNNING ||
1756 idle_time_.is_null()) { 1754 idle_time_.is_null()) {
1757 return; 1755 return;
1758 } 1756 }
1759 ServiceWorkerMetrics::RecordTimeBetweenEvents(base::TimeTicks::Now() - 1757 ServiceWorkerMetrics::RecordTimeBetweenEvents(base::TimeTicks::Now() -
1760 idle_time_); 1758 idle_time_);
1761 } 1759 }
1762 1760
1763 } // namespace content 1761 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698