| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/cache_storage/cache_storage_dispatcher_host.h" | 5 #include "content/browser/cache_storage/cache_storage_dispatcher_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 : BrowserMessageFilter(kFilteredMessageClasses, | 73 : BrowserMessageFilter(kFilteredMessageClasses, |
| 74 arraysize(kFilteredMessageClasses)) {} | 74 arraysize(kFilteredMessageClasses)) {} |
| 75 | 75 |
| 76 CacheStorageDispatcherHost::~CacheStorageDispatcherHost() { | 76 CacheStorageDispatcherHost::~CacheStorageDispatcherHost() { |
| 77 } | 77 } |
| 78 | 78 |
| 79 void CacheStorageDispatcherHost::Init(CacheStorageContextImpl* context) { | 79 void CacheStorageDispatcherHost::Init(CacheStorageContextImpl* context) { |
| 80 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 80 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 81 BrowserThread::PostTask( | 81 BrowserThread::PostTask( |
| 82 BrowserThread::IO, FROM_HERE, | 82 BrowserThread::IO, FROM_HERE, |
| 83 base::Bind(&CacheStorageDispatcherHost::CreateCacheListener, this, | 83 base::BindOnce(&CacheStorageDispatcherHost::CreateCacheListener, this, |
| 84 base::RetainedRef(context))); | 84 base::RetainedRef(context))); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void CacheStorageDispatcherHost::OnDestruct() const { | 87 void CacheStorageDispatcherHost::OnDestruct() const { |
| 88 BrowserThread::DeleteOnIOThread::Destruct(this); | 88 BrowserThread::DeleteOnIOThread::Destruct(this); |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool CacheStorageDispatcherHost::OnMessageReceived( | 91 bool CacheStorageDispatcherHost::OnMessageReceived( |
| 92 const IPC::Message& message) { | 92 const IPC::Message& message) { |
| 93 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 93 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 94 | 94 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 int request_id, | 126 int request_id, |
| 127 const url::Origin& origin, | 127 const url::Origin& origin, |
| 128 const base::string16& cache_name) { | 128 const base::string16& cache_name) { |
| 129 TRACE_EVENT0("CacheStorage", "CacheStorageDispatcherHost::OnCacheStorageHas"); | 129 TRACE_EVENT0("CacheStorage", "CacheStorageDispatcherHost::OnCacheStorageHas"); |
| 130 if (!OriginCanAccessCacheStorage(origin)) { | 130 if (!OriginCanAccessCacheStorage(origin)) { |
| 131 bad_message::ReceivedBadMessage(this, bad_message::CSDH_INVALID_ORIGIN); | 131 bad_message::ReceivedBadMessage(this, bad_message::CSDH_INVALID_ORIGIN); |
| 132 return; | 132 return; |
| 133 } | 133 } |
| 134 context_->cache_manager()->HasCache( | 134 context_->cache_manager()->HasCache( |
| 135 origin.GetURL(), base::UTF16ToUTF8(cache_name), | 135 origin.GetURL(), base::UTF16ToUTF8(cache_name), |
| 136 base::Bind(&CacheStorageDispatcherHost::OnCacheStorageHasCallback, this, | 136 base::BindOnce(&CacheStorageDispatcherHost::OnCacheStorageHasCallback, |
| 137 thread_id, request_id)); | 137 this, thread_id, request_id)); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void CacheStorageDispatcherHost::OnCacheStorageOpen( | 140 void CacheStorageDispatcherHost::OnCacheStorageOpen( |
| 141 int thread_id, | 141 int thread_id, |
| 142 int request_id, | 142 int request_id, |
| 143 const url::Origin& origin, | 143 const url::Origin& origin, |
| 144 const base::string16& cache_name) { | 144 const base::string16& cache_name) { |
| 145 TRACE_EVENT0("CacheStorage", | 145 TRACE_EVENT0("CacheStorage", |
| 146 "CacheStorageDispatcherHost::OnCacheStorageOpen"); | 146 "CacheStorageDispatcherHost::OnCacheStorageOpen"); |
| 147 if (!OriginCanAccessCacheStorage(origin)) { | 147 if (!OriginCanAccessCacheStorage(origin)) { |
| 148 bad_message::ReceivedBadMessage(this, bad_message::CSDH_INVALID_ORIGIN); | 148 bad_message::ReceivedBadMessage(this, bad_message::CSDH_INVALID_ORIGIN); |
| 149 return; | 149 return; |
| 150 } | 150 } |
| 151 context_->cache_manager()->OpenCache( | 151 context_->cache_manager()->OpenCache( |
| 152 origin.GetURL(), base::UTF16ToUTF8(cache_name), | 152 origin.GetURL(), base::UTF16ToUTF8(cache_name), |
| 153 base::Bind(&CacheStorageDispatcherHost::OnCacheStorageOpenCallback, this, | 153 base::BindOnce(&CacheStorageDispatcherHost::OnCacheStorageOpenCallback, |
| 154 thread_id, request_id)); | 154 this, thread_id, request_id)); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void CacheStorageDispatcherHost::OnCacheStorageDelete( | 157 void CacheStorageDispatcherHost::OnCacheStorageDelete( |
| 158 int thread_id, | 158 int thread_id, |
| 159 int request_id, | 159 int request_id, |
| 160 const url::Origin& origin, | 160 const url::Origin& origin, |
| 161 const base::string16& cache_name) { | 161 const base::string16& cache_name) { |
| 162 TRACE_EVENT0("CacheStorage", | 162 TRACE_EVENT0("CacheStorage", |
| 163 "CacheStorageDispatcherHost::OnCacheStorageDelete"); | 163 "CacheStorageDispatcherHost::OnCacheStorageDelete"); |
| 164 if (!OriginCanAccessCacheStorage(origin)) { | 164 if (!OriginCanAccessCacheStorage(origin)) { |
| 165 bad_message::ReceivedBadMessage(this, bad_message::CSDH_INVALID_ORIGIN); | 165 bad_message::ReceivedBadMessage(this, bad_message::CSDH_INVALID_ORIGIN); |
| 166 return; | 166 return; |
| 167 } | 167 } |
| 168 context_->cache_manager()->DeleteCache( | 168 context_->cache_manager()->DeleteCache( |
| 169 origin.GetURL(), base::UTF16ToUTF8(cache_name), | 169 origin.GetURL(), base::UTF16ToUTF8(cache_name), |
| 170 base::Bind(&CacheStorageDispatcherHost::OnCacheStorageDeleteCallback, | 170 base::BindOnce(&CacheStorageDispatcherHost::OnCacheStorageDeleteCallback, |
| 171 this, thread_id, request_id)); | 171 this, thread_id, request_id)); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void CacheStorageDispatcherHost::OnCacheStorageKeys(int thread_id, | 174 void CacheStorageDispatcherHost::OnCacheStorageKeys(int thread_id, |
| 175 int request_id, | 175 int request_id, |
| 176 const url::Origin& origin) { | 176 const url::Origin& origin) { |
| 177 TRACE_EVENT0("CacheStorage", | 177 TRACE_EVENT0("CacheStorage", |
| 178 "CacheStorageDispatcherHost::OnCacheStorageKeys"); | 178 "CacheStorageDispatcherHost::OnCacheStorageKeys"); |
| 179 if (!OriginCanAccessCacheStorage(origin)) { | 179 if (!OriginCanAccessCacheStorage(origin)) { |
| 180 bad_message::ReceivedBadMessage(this, bad_message::CSDH_INVALID_ORIGIN); | 180 bad_message::ReceivedBadMessage(this, bad_message::CSDH_INVALID_ORIGIN); |
| 181 return; | 181 return; |
| 182 } | 182 } |
| 183 context_->cache_manager()->EnumerateCaches( | 183 context_->cache_manager()->EnumerateCaches( |
| 184 origin.GetURL(), | 184 origin.GetURL(), |
| 185 base::Bind(&CacheStorageDispatcherHost::OnCacheStorageKeysCallback, this, | 185 base::BindOnce(&CacheStorageDispatcherHost::OnCacheStorageKeysCallback, |
| 186 thread_id, request_id)); | 186 this, thread_id, request_id)); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void CacheStorageDispatcherHost::OnCacheStorageMatch( | 189 void CacheStorageDispatcherHost::OnCacheStorageMatch( |
| 190 int thread_id, | 190 int thread_id, |
| 191 int request_id, | 191 int request_id, |
| 192 const url::Origin& origin, | 192 const url::Origin& origin, |
| 193 const ServiceWorkerFetchRequest& request, | 193 const ServiceWorkerFetchRequest& request, |
| 194 const CacheStorageCacheQueryParams& match_params) { | 194 const CacheStorageCacheQueryParams& match_params) { |
| 195 TRACE_EVENT0("CacheStorage", | 195 TRACE_EVENT0("CacheStorage", |
| 196 "CacheStorageDispatcherHost::OnCacheStorageMatch"); | 196 "CacheStorageDispatcherHost::OnCacheStorageMatch"); |
| 197 if (!OriginCanAccessCacheStorage(origin)) { | 197 if (!OriginCanAccessCacheStorage(origin)) { |
| 198 bad_message::ReceivedBadMessage(this, bad_message::CSDH_INVALID_ORIGIN); | 198 bad_message::ReceivedBadMessage(this, bad_message::CSDH_INVALID_ORIGIN); |
| 199 return; | 199 return; |
| 200 } | 200 } |
| 201 std::unique_ptr<ServiceWorkerFetchRequest> scoped_request( | 201 std::unique_ptr<ServiceWorkerFetchRequest> scoped_request( |
| 202 new ServiceWorkerFetchRequest(request.url, request.method, | 202 new ServiceWorkerFetchRequest(request.url, request.method, |
| 203 request.headers, request.referrer, | 203 request.headers, request.referrer, |
| 204 request.is_reload)); | 204 request.is_reload)); |
| 205 | 205 |
| 206 if (match_params.cache_name.is_null()) { | 206 if (match_params.cache_name.is_null()) { |
| 207 context_->cache_manager()->MatchAllCaches( | 207 context_->cache_manager()->MatchAllCaches( |
| 208 origin.GetURL(), std::move(scoped_request), match_params, | 208 origin.GetURL(), std::move(scoped_request), match_params, |
| 209 base::Bind(&CacheStorageDispatcherHost::OnCacheStorageMatchCallback, | 209 base::BindOnce(&CacheStorageDispatcherHost::OnCacheStorageMatchCallback, |
| 210 this, thread_id, request_id)); | 210 this, thread_id, request_id)); |
| 211 return; | 211 return; |
| 212 } | 212 } |
| 213 context_->cache_manager()->MatchCache( | 213 context_->cache_manager()->MatchCache( |
| 214 origin.GetURL(), base::UTF16ToUTF8(match_params.cache_name.string()), | 214 origin.GetURL(), base::UTF16ToUTF8(match_params.cache_name.string()), |
| 215 std::move(scoped_request), match_params, | 215 std::move(scoped_request), match_params, |
| 216 base::Bind(&CacheStorageDispatcherHost::OnCacheStorageMatchCallback, this, | 216 base::BindOnce(&CacheStorageDispatcherHost::OnCacheStorageMatchCallback, |
| 217 thread_id, request_id)); | 217 this, thread_id, request_id)); |
| 218 } | 218 } |
| 219 | 219 |
| 220 void CacheStorageDispatcherHost::OnCacheMatch( | 220 void CacheStorageDispatcherHost::OnCacheMatch( |
| 221 int thread_id, | 221 int thread_id, |
| 222 int request_id, | 222 int request_id, |
| 223 int cache_id, | 223 int cache_id, |
| 224 const ServiceWorkerFetchRequest& request, | 224 const ServiceWorkerFetchRequest& request, |
| 225 const CacheStorageCacheQueryParams& match_params) { | 225 const CacheStorageCacheQueryParams& match_params) { |
| 226 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id); | 226 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id); |
| 227 if (it == id_to_cache_map_.end() || !it->second->value()) { | 227 if (it == id_to_cache_map_.end() || !it->second->value()) { |
| 228 Send(new CacheStorageMsg_CacheMatchError( | 228 Send(new CacheStorageMsg_CacheMatchError( |
| 229 thread_id, request_id, blink::kWebServiceWorkerCacheErrorNotFound)); | 229 thread_id, request_id, blink::kWebServiceWorkerCacheErrorNotFound)); |
| 230 return; | 230 return; |
| 231 } | 231 } |
| 232 | 232 |
| 233 CacheStorageCache* cache = it->second->value(); | 233 CacheStorageCache* cache = it->second->value(); |
| 234 std::unique_ptr<ServiceWorkerFetchRequest> scoped_request( | 234 std::unique_ptr<ServiceWorkerFetchRequest> scoped_request( |
| 235 new ServiceWorkerFetchRequest(request.url, request.method, | 235 new ServiceWorkerFetchRequest(request.url, request.method, |
| 236 request.headers, request.referrer, | 236 request.headers, request.referrer, |
| 237 request.is_reload)); | 237 request.is_reload)); |
| 238 cache->Match( | 238 cache->Match( |
| 239 std::move(scoped_request), match_params, | 239 std::move(scoped_request), match_params, |
| 240 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchCallback, this, | 240 base::BindOnce(&CacheStorageDispatcherHost::OnCacheMatchCallback, this, |
| 241 thread_id, request_id, base::Passed(it->second->Clone()))); | 241 thread_id, request_id, base::Passed(it->second->Clone()))); |
| 242 } | 242 } |
| 243 | 243 |
| 244 void CacheStorageDispatcherHost::OnCacheMatchAll( | 244 void CacheStorageDispatcherHost::OnCacheMatchAll( |
| 245 int thread_id, | 245 int thread_id, |
| 246 int request_id, | 246 int request_id, |
| 247 int cache_id, | 247 int cache_id, |
| 248 const ServiceWorkerFetchRequest& request, | 248 const ServiceWorkerFetchRequest& request, |
| 249 const CacheStorageCacheQueryParams& match_params) { | 249 const CacheStorageCacheQueryParams& match_params) { |
| 250 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id); | 250 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id); |
| 251 if (it == id_to_cache_map_.end() || !it->second->value()) { | 251 if (it == id_to_cache_map_.end() || !it->second->value()) { |
| 252 Send(new CacheStorageMsg_CacheMatchError( | 252 Send(new CacheStorageMsg_CacheMatchError( |
| 253 thread_id, request_id, blink::kWebServiceWorkerCacheErrorNotFound)); | 253 thread_id, request_id, blink::kWebServiceWorkerCacheErrorNotFound)); |
| 254 return; | 254 return; |
| 255 } | 255 } |
| 256 | 256 |
| 257 CacheStorageCache* cache = it->second->value(); | 257 CacheStorageCache* cache = it->second->value(); |
| 258 if (request.url.is_empty()) { | 258 if (request.url.is_empty()) { |
| 259 cache->MatchAll( | 259 cache->MatchAll( |
| 260 std::unique_ptr<ServiceWorkerFetchRequest>(), match_params, | 260 std::unique_ptr<ServiceWorkerFetchRequest>(), match_params, |
| 261 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallback, this, | 261 base::BindOnce(&CacheStorageDispatcherHost::OnCacheMatchAllCallback, |
| 262 thread_id, request_id, base::Passed(it->second->Clone()))); | 262 this, thread_id, request_id, |
| 263 base::Passed(it->second->Clone()))); |
| 263 return; | 264 return; |
| 264 } | 265 } |
| 265 | 266 |
| 266 std::unique_ptr<ServiceWorkerFetchRequest> scoped_request( | 267 std::unique_ptr<ServiceWorkerFetchRequest> scoped_request( |
| 267 new ServiceWorkerFetchRequest(request.url, request.method, | 268 new ServiceWorkerFetchRequest(request.url, request.method, |
| 268 request.headers, request.referrer, | 269 request.headers, request.referrer, |
| 269 request.is_reload)); | 270 request.is_reload)); |
| 270 if (match_params.ignore_search) { | 271 if (match_params.ignore_search) { |
| 271 cache->MatchAll( | 272 cache->MatchAll( |
| 272 std::move(scoped_request), match_params, | 273 std::move(scoped_request), match_params, |
| 273 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallback, this, | 274 base::BindOnce(&CacheStorageDispatcherHost::OnCacheMatchAllCallback, |
| 274 thread_id, request_id, base::Passed(it->second->Clone()))); | 275 this, thread_id, request_id, |
| 276 base::Passed(it->second->Clone()))); |
| 275 return; | 277 return; |
| 276 } | 278 } |
| 277 cache->Match( | 279 cache->Match( |
| 278 std::move(scoped_request), match_params, | 280 std::move(scoped_request), match_params, |
| 279 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallbackAdapter, | 281 base::BindOnce( |
| 280 this, thread_id, request_id, | 282 &CacheStorageDispatcherHost::OnCacheMatchAllCallbackAdapter, this, |
| 281 base::Passed(it->second->Clone()))); | 283 thread_id, request_id, base::Passed(it->second->Clone()))); |
| 282 } | 284 } |
| 283 | 285 |
| 284 void CacheStorageDispatcherHost::OnCacheKeys( | 286 void CacheStorageDispatcherHost::OnCacheKeys( |
| 285 int thread_id, | 287 int thread_id, |
| 286 int request_id, | 288 int request_id, |
| 287 int cache_id, | 289 int cache_id, |
| 288 const ServiceWorkerFetchRequest& request, | 290 const ServiceWorkerFetchRequest& request, |
| 289 const CacheStorageCacheQueryParams& match_params) { | 291 const CacheStorageCacheQueryParams& match_params) { |
| 290 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id); | 292 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id); |
| 291 if (it == id_to_cache_map_.end() || !it->second->value()) { | 293 if (it == id_to_cache_map_.end() || !it->second->value()) { |
| 292 Send(new CacheStorageMsg_CacheKeysError( | 294 Send(new CacheStorageMsg_CacheKeysError( |
| 293 thread_id, request_id, blink::kWebServiceWorkerCacheErrorNotFound)); | 295 thread_id, request_id, blink::kWebServiceWorkerCacheErrorNotFound)); |
| 294 return; | 296 return; |
| 295 } | 297 } |
| 296 | 298 |
| 297 CacheStorageCache* cache = it->second->value(); | 299 CacheStorageCache* cache = it->second->value(); |
| 298 std::unique_ptr<ServiceWorkerFetchRequest> request_ptr( | 300 std::unique_ptr<ServiceWorkerFetchRequest> request_ptr( |
| 299 new ServiceWorkerFetchRequest(request.url, request.method, | 301 new ServiceWorkerFetchRequest(request.url, request.method, |
| 300 request.headers, request.referrer, | 302 request.headers, request.referrer, |
| 301 request.is_reload)); | 303 request.is_reload)); |
| 302 cache->Keys( | 304 cache->Keys( |
| 303 std::move(request_ptr), match_params, | 305 std::move(request_ptr), match_params, |
| 304 base::Bind(&CacheStorageDispatcherHost::OnCacheKeysCallback, this, | 306 base::BindOnce(&CacheStorageDispatcherHost::OnCacheKeysCallback, this, |
| 305 thread_id, request_id, base::Passed(it->second->Clone()))); | 307 thread_id, request_id, base::Passed(it->second->Clone()))); |
| 306 } | 308 } |
| 307 | 309 |
| 308 void CacheStorageDispatcherHost::OnCacheBatch( | 310 void CacheStorageDispatcherHost::OnCacheBatch( |
| 309 int thread_id, | 311 int thread_id, |
| 310 int request_id, | 312 int request_id, |
| 311 int cache_id, | 313 int cache_id, |
| 312 const std::vector<CacheStorageBatchOperation>& operations) { | 314 const std::vector<CacheStorageBatchOperation>& operations) { |
| 313 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id); | 315 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id); |
| 314 if (it == id_to_cache_map_.end() || !it->second->value()) { | 316 if (it == id_to_cache_map_.end() || !it->second->value()) { |
| 315 Send(new CacheStorageMsg_CacheBatchError( | 317 Send(new CacheStorageMsg_CacheBatchError( |
| 316 thread_id, request_id, blink::kWebServiceWorkerCacheErrorNotFound)); | 318 thread_id, request_id, blink::kWebServiceWorkerCacheErrorNotFound)); |
| 317 return; | 319 return; |
| 318 } | 320 } |
| 319 | 321 |
| 320 CacheStorageCache* cache = it->second->value(); | 322 CacheStorageCache* cache = it->second->value(); |
| 321 cache->BatchOperation( | 323 cache->BatchOperation( |
| 322 operations, | 324 operations, |
| 323 base::Bind(&CacheStorageDispatcherHost::OnCacheBatchCallback, this, | 325 base::BindOnce(&CacheStorageDispatcherHost::OnCacheBatchCallback, this, |
| 324 thread_id, request_id, base::Passed(it->second->Clone()))); | 326 thread_id, request_id, base::Passed(it->second->Clone()))); |
| 325 } | 327 } |
| 326 | 328 |
| 327 void CacheStorageDispatcherHost::OnCacheClosed(int cache_id) { | 329 void CacheStorageDispatcherHost::OnCacheClosed(int cache_id) { |
| 328 DropCacheReference(cache_id); | 330 DropCacheReference(cache_id); |
| 329 } | 331 } |
| 330 | 332 |
| 331 void CacheStorageDispatcherHost::OnBlobDataHandled(const std::string& uuid) { | 333 void CacheStorageDispatcherHost::OnBlobDataHandled(const std::string& uuid) { |
| 332 DropBlobDataHandle(uuid); | 334 DropBlobDataHandle(uuid); |
| 333 } | 335 } |
| 334 | 336 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 358 if (error != CACHE_STORAGE_OK) { | 360 if (error != CACHE_STORAGE_OK) { |
| 359 Send(new CacheStorageMsg_CacheStorageOpenError( | 361 Send(new CacheStorageMsg_CacheStorageOpenError( |
| 360 thread_id, request_id, ToWebServiceWorkerCacheError(error))); | 362 thread_id, request_id, ToWebServiceWorkerCacheError(error))); |
| 361 return; | 363 return; |
| 362 } | 364 } |
| 363 | 365 |
| 364 // Hang on to the cache for a few seconds. This way if the user quickly closes | 366 // Hang on to the cache for a few seconds. This way if the user quickly closes |
| 365 // and reopens it the cache backend won't have to be reinitialized. | 367 // and reopens it the cache backend won't have to be reinitialized. |
| 366 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 368 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 367 FROM_HERE, | 369 FROM_HERE, |
| 368 base::Bind(&StopPreservingCache, base::Passed(cache_handle->Clone())), | 370 base::BindOnce(&StopPreservingCache, base::Passed(cache_handle->Clone())), |
| 369 base::TimeDelta::FromSeconds(kCachePreservationSeconds)); | 371 base::TimeDelta::FromSeconds(kCachePreservationSeconds)); |
| 370 | 372 |
| 371 CacheID cache_id = StoreCacheReference(std::move(cache_handle)); | 373 CacheID cache_id = StoreCacheReference(std::move(cache_handle)); |
| 372 Send(new CacheStorageMsg_CacheStorageOpenSuccess(thread_id, request_id, | 374 Send(new CacheStorageMsg_CacheStorageOpenSuccess(thread_id, request_id, |
| 373 cache_id)); | 375 cache_id)); |
| 374 } | 376 } |
| 375 | 377 |
| 376 void CacheStorageDispatcherHost::OnCacheStorageDeleteCallback( | 378 void CacheStorageDispatcherHost::OnCacheStorageDeleteCallback( |
| 377 int thread_id, | 379 int thread_id, |
| 378 int request_id, | 380 int request_id, |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 UUIDToBlobDataHandleList::iterator it = blob_handle_store_.find(uuid); | 533 UUIDToBlobDataHandleList::iterator it = blob_handle_store_.find(uuid); |
| 532 if (it == blob_handle_store_.end()) | 534 if (it == blob_handle_store_.end()) |
| 533 return; | 535 return; |
| 534 DCHECK(!it->second.empty()); | 536 DCHECK(!it->second.empty()); |
| 535 it->second.pop_front(); | 537 it->second.pop_front(); |
| 536 if (it->second.empty()) | 538 if (it->second.empty()) |
| 537 blob_handle_store_.erase(it); | 539 blob_handle_store_.erase(it); |
| 538 } | 540 } |
| 539 | 541 |
| 540 } // namespace content | 542 } // namespace content |
| OLD | NEW |