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

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

Issue 647953003: Service Worker script sizes in database. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Fixed crash where writer_ was null 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_unittest.cc ('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_write_to_cache_job.cc
diff --git a/content/browser/service_worker/service_worker_write_to_cache_job.cc b/content/browser/service_worker/service_worker_write_to_cache_job.cc
index 4e2c24fd49051f23ed7503186f8882f8e018b1af..c7fe4fd326ec9b23e884d5e00c7985e3747e9fc3 100644
--- a/content/browser/service_worker/service_worker_write_to_cache_job.cc
+++ b/content/browser/service_worker/service_worker_write_to_cache_job.cc
@@ -69,6 +69,7 @@ void ServiceWorkerWriteToCacheJob::Kill() {
if (did_notify_started_ && !did_notify_finished_) {
version_->script_cache_map()->NotifyFinishedCaching(
url_,
+ -1,
net::URLRequestStatus(net::URLRequestStatus::FAILED, net::ERR_ABORTED));
did_notify_finished_ = true;
}
@@ -128,7 +129,8 @@ bool ServiceWorkerWriteToCacheJob::ReadRawData(
// No more data to process, the job is complete.
io_buffer_ = NULL;
- version_->script_cache_map()->NotifyFinishedCaching(url_, status);
+ version_->script_cache_map()->NotifyFinishedCaching(
+ url_, writer_->amount_written(), net::URLRequestStatus());
did_notify_finished_ = true;
return status.is_success();
}
@@ -373,7 +375,7 @@ void ServiceWorkerWriteToCacheJob::OnReadCompleted(
DCHECK(request->status().is_success());
io_buffer_ = NULL;
version_->script_cache_map()->NotifyFinishedCaching(
- url_, net::URLRequestStatus());
+ url_, writer_->amount_written(), net::URLRequestStatus());
did_notify_finished_ = true;
SetStatus(net::URLRequestStatus()); // Clear the IO_PENDING status
NotifyReadComplete(0);
@@ -383,7 +385,11 @@ void ServiceWorkerWriteToCacheJob::AsyncNotifyDoneHelper(
const net::URLRequestStatus& status) {
DCHECK(!status.is_io_pending());
DCHECK(!did_notify_finished_);
- version_->script_cache_map()->NotifyFinishedCaching(url_, status);
+ int size = -1;
+ if (writer_.get()) {
+ size = writer_->amount_written();
+ }
+ version_->script_cache_map()->NotifyFinishedCaching(url_, size, status);
did_notify_finished_ = true;
SetStatus(status);
NotifyDone(status);
« no previous file with comments | « content/browser/service_worker/service_worker_storage_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698