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

Side by Side Diff: content/browser/cache_storage/cache_storage_dispatcher_host.cc

Issue 2056983004: [CacheStorage] Give ownership of all CacheStorageCaches to CacheStorage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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 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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/trace_event/trace_event.h" 15 #include "base/trace_event/trace_event.h"
16 #include "content/browser/bad_message.h" 16 #include "content/browser/bad_message.h"
17 #include "content/browser/cache_storage/cache_storage_cache.h" 17 #include "content/browser/cache_storage/cache_storage_cache.h"
18 #include "content/browser/cache_storage/cache_storage_cache_handle.h"
18 #include "content/browser/cache_storage/cache_storage_context_impl.h" 19 #include "content/browser/cache_storage/cache_storage_context_impl.h"
19 #include "content/browser/cache_storage/cache_storage_manager.h" 20 #include "content/browser/cache_storage/cache_storage_manager.h"
20 #include "content/common/cache_storage/cache_storage_messages.h" 21 #include "content/common/cache_storage/cache_storage_messages.h"
21 #include "content/public/browser/content_browser_client.h" 22 #include "content/public/browser/content_browser_client.h"
22 #include "content/public/common/origin_util.h" 23 #include "content/public/common/origin_util.h"
23 #include "storage/browser/blob/blob_data_handle.h" 24 #include "storage/browser/blob/blob_data_handle.h"
24 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerCacheError.h" 25 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerCacheError.h"
25 #include "url/gurl.h" 26 #include "url/gurl.h"
26 #include "url/origin.h" 27 #include "url/origin.h"
27 28
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 int cache_id, 216 int cache_id,
216 const ServiceWorkerFetchRequest& request, 217 const ServiceWorkerFetchRequest& request,
217 const CacheStorageCacheQueryParams& match_params) { 218 const CacheStorageCacheQueryParams& match_params) {
218 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id); 219 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id);
219 if (it == id_to_cache_map_.end()) { 220 if (it == id_to_cache_map_.end()) {
220 Send(new CacheStorageMsg_CacheMatchError( 221 Send(new CacheStorageMsg_CacheMatchError(
221 thread_id, request_id, blink::WebServiceWorkerCacheErrorNotFound)); 222 thread_id, request_id, blink::WebServiceWorkerCacheErrorNotFound));
222 return; 223 return;
223 } 224 }
224 225
225 scoped_refptr<CacheStorageCache> cache = it->second; 226 CacheStorageCache* cache = it->second->value();
227 DCHECK(cache);
228
226 std::unique_ptr<ServiceWorkerFetchRequest> scoped_request( 229 std::unique_ptr<ServiceWorkerFetchRequest> scoped_request(
227 new ServiceWorkerFetchRequest(request.url, request.method, 230 new ServiceWorkerFetchRequest(request.url, request.method,
228 request.headers, request.referrer, 231 request.headers, request.referrer,
229 request.is_reload)); 232 request.is_reload));
230 cache->Match(std::move(scoped_request), 233 cache->Match(
231 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchCallback, 234 std::move(scoped_request),
232 this, thread_id, request_id, cache)); 235 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchCallback, this,
236 thread_id, request_id, base::Passed(it->second->Clone())));
233 } 237 }
234 238
235 void CacheStorageDispatcherHost::OnCacheMatchAll( 239 void CacheStorageDispatcherHost::OnCacheMatchAll(
236 int thread_id, 240 int thread_id,
237 int request_id, 241 int request_id,
238 int cache_id, 242 int cache_id,
239 const ServiceWorkerFetchRequest& request, 243 const ServiceWorkerFetchRequest& request,
240 const CacheStorageCacheQueryParams& match_params) { 244 const CacheStorageCacheQueryParams& match_params) {
241 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id); 245 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id);
242 if (it == id_to_cache_map_.end()) { 246 if (it == id_to_cache_map_.end()) {
243 Send(new CacheStorageMsg_CacheMatchError( 247 Send(new CacheStorageMsg_CacheMatchError(
244 thread_id, request_id, blink::WebServiceWorkerCacheErrorNotFound)); 248 thread_id, request_id, blink::WebServiceWorkerCacheErrorNotFound));
245 return; 249 return;
246 } 250 }
247 251
248 scoped_refptr<CacheStorageCache> cache = it->second; 252 CacheStorageCache* cache = it->second->value();
253 DCHECK(cache);
249 if (request.url.is_empty()) { 254 if (request.url.is_empty()) {
250 cache->MatchAll( 255 cache->MatchAll(
251 std::unique_ptr<ServiceWorkerFetchRequest>(), match_params, 256 std::unique_ptr<ServiceWorkerFetchRequest>(), match_params,
252 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallback, this, 257 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallback, this,
253 thread_id, request_id, cache)); 258 thread_id, request_id, base::Passed(it->second->Clone())));
254 return; 259 return;
255 } 260 }
256 261
257 std::unique_ptr<ServiceWorkerFetchRequest> scoped_request( 262 std::unique_ptr<ServiceWorkerFetchRequest> scoped_request(
258 new ServiceWorkerFetchRequest(request.url, request.method, 263 new ServiceWorkerFetchRequest(request.url, request.method,
259 request.headers, request.referrer, 264 request.headers, request.referrer,
260 request.is_reload)); 265 request.is_reload));
261 if (match_params.ignore_search) { 266 if (match_params.ignore_search) {
262 cache->MatchAll( 267 cache->MatchAll(
263 std::move(scoped_request), match_params, 268 std::move(scoped_request), match_params,
264 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallback, this, 269 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallback, this,
265 thread_id, request_id, cache)); 270 thread_id, request_id, base::Passed(it->second->Clone())));
266 return; 271 return;
267 } 272 }
268 cache->Match( 273 cache->Match(
269 std::move(scoped_request), 274 std::move(scoped_request),
270 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallbackAdapter, 275 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallbackAdapter,
271 this, thread_id, request_id, cache)); 276 this, thread_id, request_id,
277 base::Passed(it->second->Clone())));
272 } 278 }
273 279
274 void CacheStorageDispatcherHost::OnCacheKeys( 280 void CacheStorageDispatcherHost::OnCacheKeys(
275 int thread_id, 281 int thread_id,
276 int request_id, 282 int request_id,
277 int cache_id, 283 int cache_id,
278 const ServiceWorkerFetchRequest& request, 284 const ServiceWorkerFetchRequest& request,
279 const CacheStorageCacheQueryParams& match_params) { 285 const CacheStorageCacheQueryParams& match_params) {
280 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id); 286 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id);
281 if (it == id_to_cache_map_.end()) { 287 if (it == id_to_cache_map_.end()) {
282 Send(new CacheStorageMsg_CacheKeysError( 288 Send(new CacheStorageMsg_CacheKeysError(
283 thread_id, request_id, blink::WebServiceWorkerCacheErrorNotFound)); 289 thread_id, request_id, blink::WebServiceWorkerCacheErrorNotFound));
284 return; 290 return;
285 } 291 }
286 292
287 scoped_refptr<CacheStorageCache> cache = it->second; 293 CacheStorageCache* cache = it->second->value();
294 DCHECK(cache);
288 295
289 cache->Keys(base::Bind(&CacheStorageDispatcherHost::OnCacheKeysCallback, this, 296 cache->Keys(base::Bind(&CacheStorageDispatcherHost::OnCacheKeysCallback, this,
290 thread_id, request_id, cache)); 297 thread_id, request_id,
298 base::Passed(it->second->Clone())));
291 } 299 }
292 300
293 void CacheStorageDispatcherHost::OnCacheBatch( 301 void CacheStorageDispatcherHost::OnCacheBatch(
294 int thread_id, 302 int thread_id,
295 int request_id, 303 int request_id,
296 int cache_id, 304 int cache_id,
297 const std::vector<CacheStorageBatchOperation>& operations) { 305 const std::vector<CacheStorageBatchOperation>& operations) {
298 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id); 306 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id);
299 if (it == id_to_cache_map_.end()) { 307 if (it == id_to_cache_map_.end()) {
300 Send(new CacheStorageMsg_CacheBatchError( 308 Send(new CacheStorageMsg_CacheBatchError(
301 thread_id, request_id, blink::WebServiceWorkerCacheErrorNotFound)); 309 thread_id, request_id, blink::WebServiceWorkerCacheErrorNotFound));
302 return; 310 return;
303 } 311 }
304 scoped_refptr<CacheStorageCache> cache = it->second; 312
313 CacheStorageCache* cache = it->second->value();
314 DCHECK(cache);
305 cache->BatchOperation( 315 cache->BatchOperation(
306 operations, base::Bind(&CacheStorageDispatcherHost::OnCacheBatchCallback, 316 operations,
307 this, thread_id, request_id, cache)); 317 base::Bind(&CacheStorageDispatcherHost::OnCacheBatchCallback, this,
318 thread_id, request_id, base::Passed(it->second->Clone())));
308 } 319 }
309 320
310 void CacheStorageDispatcherHost::OnCacheClosed(int cache_id) { 321 void CacheStorageDispatcherHost::OnCacheClosed(int cache_id) {
311 DropCacheReference(cache_id); 322 DropCacheReference(cache_id);
312 } 323 }
313 324
314 void CacheStorageDispatcherHost::OnBlobDataHandled(const std::string& uuid) { 325 void CacheStorageDispatcherHost::OnBlobDataHandled(const std::string& uuid) {
315 DropBlobDataHandle(uuid); 326 DropBlobDataHandle(uuid);
316 } 327 }
317 328
(...skipping 11 matching lines...) Expand all
329 Send(new CacheStorageMsg_CacheStorageHasError( 340 Send(new CacheStorageMsg_CacheStorageHasError(
330 thread_id, request_id, blink::WebServiceWorkerCacheErrorNotFound)); 341 thread_id, request_id, blink::WebServiceWorkerCacheErrorNotFound));
331 return; 342 return;
332 } 343 }
333 Send(new CacheStorageMsg_CacheStorageHasSuccess(thread_id, request_id)); 344 Send(new CacheStorageMsg_CacheStorageHasSuccess(thread_id, request_id));
334 } 345 }
335 346
336 void CacheStorageDispatcherHost::OnCacheStorageOpenCallback( 347 void CacheStorageDispatcherHost::OnCacheStorageOpenCallback(
337 int thread_id, 348 int thread_id,
338 int request_id, 349 int request_id,
339 scoped_refptr<CacheStorageCache> cache, 350 std::unique_ptr<CacheStorageCacheHandle> cache_handle,
340 CacheStorageError error) { 351 CacheStorageError error) {
341 if (error != CACHE_STORAGE_OK) { 352 if (error != CACHE_STORAGE_OK) {
342 Send(new CacheStorageMsg_CacheStorageOpenError( 353 Send(new CacheStorageMsg_CacheStorageOpenError(
343 thread_id, request_id, ToWebServiceWorkerCacheError(error))); 354 thread_id, request_id, ToWebServiceWorkerCacheError(error)));
344 return; 355 return;
345 } 356 }
346 CacheID cache_id = StoreCacheReference(std::move(cache)); 357 CacheID cache_id = StoreCacheReference(std::move(cache_handle));
347 Send(new CacheStorageMsg_CacheStorageOpenSuccess(thread_id, request_id, 358 Send(new CacheStorageMsg_CacheStorageOpenSuccess(thread_id, request_id,
348 cache_id)); 359 cache_id));
349 } 360 }
350 361
351 void CacheStorageDispatcherHost::OnCacheStorageDeleteCallback( 362 void CacheStorageDispatcherHost::OnCacheStorageDeleteCallback(
352 int thread_id, 363 int thread_id,
353 int request_id, 364 int request_id,
354 bool deleted, 365 bool deleted,
355 CacheStorageError error) { 366 CacheStorageError error) {
356 if (!deleted || error != CACHE_STORAGE_OK) { 367 if (!deleted || error != CACHE_STORAGE_OK) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 if (blob_data_handle) 406 if (blob_data_handle)
396 StoreBlobDataHandle(*blob_data_handle); 407 StoreBlobDataHandle(*blob_data_handle);
397 408
398 Send(new CacheStorageMsg_CacheStorageMatchSuccess(thread_id, request_id, 409 Send(new CacheStorageMsg_CacheStorageMatchSuccess(thread_id, request_id,
399 *response)); 410 *response));
400 } 411 }
401 412
402 void CacheStorageDispatcherHost::OnCacheMatchCallback( 413 void CacheStorageDispatcherHost::OnCacheMatchCallback(
403 int thread_id, 414 int thread_id,
404 int request_id, 415 int request_id,
405 scoped_refptr<CacheStorageCache> cache, 416 std::unique_ptr<CacheStorageCacheHandle> cache_handle,
406 CacheStorageError error, 417 CacheStorageError error,
407 std::unique_ptr<ServiceWorkerResponse> response, 418 std::unique_ptr<ServiceWorkerResponse> response,
408 std::unique_ptr<storage::BlobDataHandle> blob_data_handle) { 419 std::unique_ptr<storage::BlobDataHandle> blob_data_handle) {
409 if (error != CACHE_STORAGE_OK) { 420 if (error != CACHE_STORAGE_OK) {
410 Send(new CacheStorageMsg_CacheMatchError( 421 Send(new CacheStorageMsg_CacheMatchError(
411 thread_id, request_id, ToWebServiceWorkerCacheError(error))); 422 thread_id, request_id, ToWebServiceWorkerCacheError(error)));
412 return; 423 return;
413 } 424 }
414 425
415 if (blob_data_handle) 426 if (blob_data_handle)
416 StoreBlobDataHandle(*blob_data_handle); 427 StoreBlobDataHandle(*blob_data_handle);
417 428
418 Send(new CacheStorageMsg_CacheMatchSuccess(thread_id, request_id, *response)); 429 Send(new CacheStorageMsg_CacheMatchSuccess(thread_id, request_id, *response));
419 } 430 }
420 431
421 void CacheStorageDispatcherHost::OnCacheMatchAllCallbackAdapter( 432 void CacheStorageDispatcherHost::OnCacheMatchAllCallbackAdapter(
422 int thread_id, 433 int thread_id,
423 int request_id, 434 int request_id,
424 scoped_refptr<CacheStorageCache> cache, 435 std::unique_ptr<CacheStorageCacheHandle> cache_handle,
425 CacheStorageError error, 436 CacheStorageError error,
426 std::unique_ptr<ServiceWorkerResponse> response, 437 std::unique_ptr<ServiceWorkerResponse> response,
427 std::unique_ptr<storage::BlobDataHandle> blob_data_handle) { 438 std::unique_ptr<storage::BlobDataHandle> blob_data_handle) {
428 std::unique_ptr<CacheStorageCache::Responses> responses( 439 std::unique_ptr<CacheStorageCache::Responses> responses(
429 new CacheStorageCache::Responses); 440 new CacheStorageCache::Responses);
430 std::unique_ptr<CacheStorageCache::BlobDataHandles> blob_data_handles( 441 std::unique_ptr<CacheStorageCache::BlobDataHandles> blob_data_handles(
431 new CacheStorageCache::BlobDataHandles); 442 new CacheStorageCache::BlobDataHandles);
432 if (error == CACHE_STORAGE_OK) { 443 if (error == CACHE_STORAGE_OK) {
433 DCHECK(response); 444 DCHECK(response);
434 responses->push_back(*response); 445 responses->push_back(*response);
435 if (blob_data_handle) 446 if (blob_data_handle)
436 blob_data_handles->push_back(*blob_data_handle); 447 blob_data_handles->push_back(*blob_data_handle);
437 } 448 }
438 OnCacheMatchAllCallback(thread_id, request_id, std::move(cache), error, 449 OnCacheMatchAllCallback(thread_id, request_id, std::move(cache_handle), error,
439 std::move(responses), std::move(blob_data_handles)); 450 std::move(responses), std::move(blob_data_handles));
440 } 451 }
441 452
442 void CacheStorageDispatcherHost::OnCacheMatchAllCallback( 453 void CacheStorageDispatcherHost::OnCacheMatchAllCallback(
443 int thread_id, 454 int thread_id,
444 int request_id, 455 int request_id,
445 scoped_refptr<CacheStorageCache> cache, 456 std::unique_ptr<CacheStorageCacheHandle> cache_handle,
446 CacheStorageError error, 457 CacheStorageError error,
447 std::unique_ptr<CacheStorageCache::Responses> responses, 458 std::unique_ptr<CacheStorageCache::Responses> responses,
448 std::unique_ptr<CacheStorageCache::BlobDataHandles> blob_data_handles) { 459 std::unique_ptr<CacheStorageCache::BlobDataHandles> blob_data_handles) {
449 if (error != CACHE_STORAGE_OK && error != CACHE_STORAGE_ERROR_NOT_FOUND) { 460 if (error != CACHE_STORAGE_OK && error != CACHE_STORAGE_ERROR_NOT_FOUND) {
450 Send(new CacheStorageMsg_CacheMatchAllError( 461 Send(new CacheStorageMsg_CacheMatchAllError(
451 thread_id, request_id, ToWebServiceWorkerCacheError(error))); 462 thread_id, request_id, ToWebServiceWorkerCacheError(error)));
452 return; 463 return;
453 } 464 }
454 465
455 for (const storage::BlobDataHandle& handle : *blob_data_handles) 466 for (const storage::BlobDataHandle& handle : *blob_data_handles)
456 StoreBlobDataHandle(handle); 467 StoreBlobDataHandle(handle);
457 468
458 Send(new CacheStorageMsg_CacheMatchAllSuccess(thread_id, request_id, 469 Send(new CacheStorageMsg_CacheMatchAllSuccess(thread_id, request_id,
459 *responses)); 470 *responses));
460 } 471 }
461 472
462 void CacheStorageDispatcherHost::OnCacheKeysCallback( 473 void CacheStorageDispatcherHost::OnCacheKeysCallback(
463 int thread_id, 474 int thread_id,
464 int request_id, 475 int request_id,
465 scoped_refptr<CacheStorageCache> cache, 476 std::unique_ptr<CacheStorageCacheHandle> cache_handle,
466 CacheStorageError error, 477 CacheStorageError error,
467 std::unique_ptr<CacheStorageCache::Requests> requests) { 478 std::unique_ptr<CacheStorageCache::Requests> requests) {
468 if (error != CACHE_STORAGE_OK) { 479 if (error != CACHE_STORAGE_OK) {
469 Send(new CacheStorageMsg_CacheKeysError( 480 Send(new CacheStorageMsg_CacheKeysError(
470 thread_id, request_id, ToWebServiceWorkerCacheError(error))); 481 thread_id, request_id, ToWebServiceWorkerCacheError(error)));
471 return; 482 return;
472 } 483 }
473 484
474 CacheStorageCache::Requests out; 485 CacheStorageCache::Requests out;
475 486
476 for (CacheStorageCache::Requests::const_iterator it = requests->begin(); 487 for (CacheStorageCache::Requests::const_iterator it = requests->begin();
477 it != requests->end(); ++it) { 488 it != requests->end(); ++it) {
478 ServiceWorkerFetchRequest request(it->url, it->method, it->headers, 489 ServiceWorkerFetchRequest request(it->url, it->method, it->headers,
479 it->referrer, it->is_reload); 490 it->referrer, it->is_reload);
480 out.push_back(request); 491 out.push_back(request);
481 } 492 }
482 493
483 Send(new CacheStorageMsg_CacheKeysSuccess(thread_id, request_id, out)); 494 Send(new CacheStorageMsg_CacheKeysSuccess(thread_id, request_id, out));
484 } 495 }
485 496
486 void CacheStorageDispatcherHost::OnCacheBatchCallback( 497 void CacheStorageDispatcherHost::OnCacheBatchCallback(
487 int thread_id, 498 int thread_id,
488 int request_id, 499 int request_id,
489 scoped_refptr<CacheStorageCache> cache, 500 std::unique_ptr<CacheStorageCacheHandle> cache_handle,
490 CacheStorageError error) { 501 CacheStorageError error) {
491 if (error != CACHE_STORAGE_OK) { 502 if (error != CACHE_STORAGE_OK) {
492 Send(new CacheStorageMsg_CacheBatchError( 503 Send(new CacheStorageMsg_CacheBatchError(
493 thread_id, request_id, ToWebServiceWorkerCacheError(error))); 504 thread_id, request_id, ToWebServiceWorkerCacheError(error)));
494 return; 505 return;
495 } 506 }
496 507
497 Send(new CacheStorageMsg_CacheBatchSuccess(thread_id, request_id)); 508 Send(new CacheStorageMsg_CacheBatchSuccess(thread_id, request_id));
498 } 509 }
499 510
500 CacheStorageDispatcherHost::CacheID 511 CacheStorageDispatcherHost::CacheID
501 CacheStorageDispatcherHost::StoreCacheReference( 512 CacheStorageDispatcherHost::StoreCacheReference(
502 scoped_refptr<CacheStorageCache> cache) { 513 std::unique_ptr<CacheStorageCacheHandle> cache_handle) {
503 int cache_id = next_cache_id_++; 514 int cache_id = next_cache_id_++;
504 id_to_cache_map_[cache_id] = std::move(cache); 515 id_to_cache_map_[cache_id] = std::move(cache_handle);
505 return cache_id; 516 return cache_id;
506 } 517 }
507 518
508 void CacheStorageDispatcherHost::DropCacheReference(CacheID cache_id) { 519 void CacheStorageDispatcherHost::DropCacheReference(CacheID cache_id) {
509 id_to_cache_map_.erase(cache_id); 520 id_to_cache_map_.erase(cache_id);
510 } 521 }
511 522
512 void CacheStorageDispatcherHost::StoreBlobDataHandle( 523 void CacheStorageDispatcherHost::StoreBlobDataHandle(
513 const storage::BlobDataHandle& blob_data_handle) { 524 const storage::BlobDataHandle& blob_data_handle) {
514 std::pair<UUIDToBlobDataHandleList::iterator, bool> rv = 525 std::pair<UUIDToBlobDataHandleList::iterator, bool> rv =
515 blob_handle_store_.insert(std::make_pair( 526 blob_handle_store_.insert(std::make_pair(
516 blob_data_handle.uuid(), std::list<storage::BlobDataHandle>())); 527 blob_data_handle.uuid(), std::list<storage::BlobDataHandle>()));
517 rv.first->second.push_front(storage::BlobDataHandle(blob_data_handle)); 528 rv.first->second.push_front(storage::BlobDataHandle(blob_data_handle));
518 } 529 }
519 530
520 void CacheStorageDispatcherHost::DropBlobDataHandle(const std::string& uuid) { 531 void CacheStorageDispatcherHost::DropBlobDataHandle(const std::string& uuid) {
521 UUIDToBlobDataHandleList::iterator it = blob_handle_store_.find(uuid); 532 UUIDToBlobDataHandleList::iterator it = blob_handle_store_.find(uuid);
522 if (it == blob_handle_store_.end()) 533 if (it == blob_handle_store_.end())
523 return; 534 return;
524 DCHECK(!it->second.empty()); 535 DCHECK(!it->second.empty());
525 it->second.pop_front(); 536 it->second.pop_front();
526 if (it->second.empty()) 537 if (it->second.empty())
527 blob_handle_store_.erase(it); 538 blob_handle_store_.erase(it);
528 } 539 }
529 540
530 } // namespace content 541 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698