| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_script_cache_map.h" | 5 #include "content/browser/service_worker/service_worker_script_cache_map.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/browser/service_worker/service_worker_context_core.h" | 8 #include "content/browser/service_worker/service_worker_context_core.h" |
| 9 #include "content/browser/service_worker/service_worker_disk_cache.h" | 9 #include "content/browser/service_worker/service_worker_disk_cache.h" |
| 10 #include "content/browser/service_worker/service_worker_storage.h" | 10 #include "content/browser/service_worker/service_worker_storage.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 context_->storage()->StoreUncommittedResponseId(resource_id); | 50 context_->storage()->StoreUncommittedResponseId(resource_id); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void ServiceWorkerScriptCacheMap::NotifyFinishedCaching( | 53 void ServiceWorkerScriptCacheMap::NotifyFinishedCaching( |
| 54 const GURL& url, | 54 const GURL& url, |
| 55 int64 size_bytes, | 55 int64 size_bytes, |
| 56 const net::URLRequestStatus& status, | 56 const net::URLRequestStatus& status, |
| 57 const std::string& status_message) { | 57 const std::string& status_message) { |
| 58 DCHECK_NE(kInvalidServiceWorkerResponseId, LookupResourceId(url)); | 58 DCHECK_NE(kInvalidServiceWorkerResponseId, LookupResourceId(url)); |
| 59 DCHECK(owner_->status() == ServiceWorkerVersion::NEW || | 59 DCHECK(owner_->status() == ServiceWorkerVersion::NEW || |
| 60 owner_->status() == ServiceWorkerVersion::INSTALLING); | 60 owner_->status() == ServiceWorkerVersion::INSTALLING || |
| 61 owner_->status() == ServiceWorkerVersion::REDUNDANT); |
| 61 if (!context_) | 62 if (!context_) |
| 62 return; // Our storage has been wiped via DeleteAndStartOver. | 63 return; // Our storage has been wiped via DeleteAndStartOver. |
| 63 if (!status.is_success()) { | 64 if (!status.is_success()) { |
| 64 context_->storage()->DoomUncommittedResponse(LookupResourceId(url)); | 65 context_->storage()->DoomUncommittedResponse(LookupResourceId(url)); |
| 65 resource_map_.erase(url); | 66 resource_map_.erase(url); |
| 66 if (owner_->script_url() == url) { | 67 if (owner_->script_url() == url) { |
| 67 main_script_status_ = status; | 68 main_script_status_ = status; |
| 68 main_script_status_message_ = status_message; | 69 main_script_status_message_ = status_message; |
| 69 } | 70 } |
| 70 } else { | 71 } else { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 123 } |
| 123 | 124 |
| 124 void ServiceWorkerScriptCacheMap::OnMetadataWritten( | 125 void ServiceWorkerScriptCacheMap::OnMetadataWritten( |
| 125 scoped_ptr<ServiceWorkerResponseMetadataWriter> writer, | 126 scoped_ptr<ServiceWorkerResponseMetadataWriter> writer, |
| 126 const net::CompletionCallback& callback, | 127 const net::CompletionCallback& callback, |
| 127 int result) { | 128 int result) { |
| 128 callback.Run(result); | 129 callback.Run(result); |
| 129 } | 130 } |
| 130 | 131 |
| 131 } // namespace content | 132 } // namespace content |
| OLD | NEW |