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

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

Issue 1232923003: ServiceWorker: Record result of purging stale resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use std::abs Created 5 years, 5 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_storage.h" 5 #include "content/browser/service_worker/service_worker_storage.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 id, base::Bind(&ServiceWorkerStorage::OnResourcePurged, 1423 id, base::Bind(&ServiceWorkerStorage::OnResourcePurged,
1424 weak_factory_.GetWeakPtr(), id)); 1424 weak_factory_.GetWeakPtr(), id));
1425 if (rv != net::ERR_IO_PENDING) 1425 if (rv != net::ERR_IO_PENDING)
1426 OnResourcePurged(id, rv); 1426 OnResourcePurged(id, rv);
1427 } 1427 }
1428 1428
1429 void ServiceWorkerStorage::OnResourcePurged(int64 id, int rv) { 1429 void ServiceWorkerStorage::OnResourcePurged(int64 id, int rv) {
1430 DCHECK(is_purge_pending_); 1430 DCHECK(is_purge_pending_);
1431 is_purge_pending_ = false; 1431 is_purge_pending_ = false;
1432 1432
1433 ServiceWorkerMetrics::RecordPurgeResourceResult(rv);
1434
1433 database_task_manager_->GetTaskRunner()->PostTask( 1435 database_task_manager_->GetTaskRunner()->PostTask(
1434 FROM_HERE, 1436 FROM_HERE,
1435 base::Bind(base::IgnoreResult( 1437 base::Bind(base::IgnoreResult(
1436 &ServiceWorkerDatabase::ClearPurgeableResourceIds), 1438 &ServiceWorkerDatabase::ClearPurgeableResourceIds),
1437 base::Unretained(database_.get()), 1439 base::Unretained(database_.get()),
1438 std::set<int64>(&id, &id + 1))); 1440 std::set<int64>(&id, &id + 1)));
1439 1441
1442 // Continue purging resources regardless of the previous result.
1440 ContinuePurgingResources(); 1443 ContinuePurgingResources();
1441 } 1444 }
1442 1445
1443 void ServiceWorkerStorage::DeleteStaleResources() { 1446 void ServiceWorkerStorage::DeleteStaleResources() {
1444 DCHECK(!has_checked_for_stale_resources_); 1447 DCHECK(!has_checked_for_stale_resources_);
1445 has_checked_for_stale_resources_ = true; 1448 has_checked_for_stale_resources_ = true;
1446 database_task_manager_->GetTaskRunner()->PostTask( 1449 database_task_manager_->GetTaskRunner()->PostTask(
1447 FROM_HERE, 1450 FROM_HERE,
1448 base::Bind(&ServiceWorkerStorage::CollectStaleResourcesFromDB, 1451 base::Bind(&ServiceWorkerStorage::CollectStaleResourcesFromDB,
1449 database_.get(), 1452 database_.get(),
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 callback.Run(SERVICE_WORKER_ERROR_FAILED); 1820 callback.Run(SERVICE_WORKER_ERROR_FAILED);
1818 return; 1821 return;
1819 } 1822 }
1820 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; 1823 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully.";
1821 ServiceWorkerMetrics::RecordDeleteAndStartOverResult( 1824 ServiceWorkerMetrics::RecordDeleteAndStartOverResult(
1822 ServiceWorkerMetrics::DELETE_OK); 1825 ServiceWorkerMetrics::DELETE_OK);
1823 callback.Run(SERVICE_WORKER_OK); 1826 callback.Run(SERVICE_WORKER_OK);
1824 } 1827 }
1825 1828
1826 } // namespace content 1829 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_metrics.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698