| 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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 Send(new CacheStorageMsg_CacheStorageDeleteError( | 382 Send(new CacheStorageMsg_CacheStorageDeleteError( |
| 383 thread_id, request_id, ToWebServiceWorkerCacheError(error))); | 383 thread_id, request_id, ToWebServiceWorkerCacheError(error))); |
| 384 return; | 384 return; |
| 385 } | 385 } |
| 386 Send(new CacheStorageMsg_CacheStorageDeleteSuccess(thread_id, request_id)); | 386 Send(new CacheStorageMsg_CacheStorageDeleteSuccess(thread_id, request_id)); |
| 387 } | 387 } |
| 388 | 388 |
| 389 void CacheStorageDispatcherHost::OnCacheStorageKeysCallback( | 389 void CacheStorageDispatcherHost::OnCacheStorageKeysCallback( |
| 390 int thread_id, | 390 int thread_id, |
| 391 int request_id, | 391 int request_id, |
| 392 const std::vector<std::string>& strings) { | 392 const CacheStorageIndex& cache_index) { |
| 393 std::vector<base::string16> string16s; | 393 std::vector<base::string16> string16s; |
| 394 for (size_t i = 0, max = strings.size(); i < max; ++i) | 394 for (const auto& metadata : cache_index.ordered_cache_metadata()) |
| 395 string16s.push_back(base::UTF8ToUTF16(strings[i])); | 395 string16s.push_back(base::UTF8ToUTF16(metadata.name)); |
| 396 Send(new CacheStorageMsg_CacheStorageKeysSuccess(thread_id, request_id, | 396 Send(new CacheStorageMsg_CacheStorageKeysSuccess(thread_id, request_id, |
| 397 string16s)); | 397 string16s)); |
| 398 } | 398 } |
| 399 | 399 |
| 400 void CacheStorageDispatcherHost::OnCacheStorageMatchCallback( | 400 void CacheStorageDispatcherHost::OnCacheStorageMatchCallback( |
| 401 int thread_id, | 401 int thread_id, |
| 402 int request_id, | 402 int request_id, |
| 403 CacheStorageError error, | 403 CacheStorageError error, |
| 404 std::unique_ptr<ServiceWorkerResponse> response, | 404 std::unique_ptr<ServiceWorkerResponse> response, |
| 405 std::unique_ptr<storage::BlobDataHandle> blob_data_handle) { | 405 std::unique_ptr<storage::BlobDataHandle> blob_data_handle) { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 UUIDToBlobDataHandleList::iterator it = blob_handle_store_.find(uuid); | 531 UUIDToBlobDataHandleList::iterator it = blob_handle_store_.find(uuid); |
| 532 if (it == blob_handle_store_.end()) | 532 if (it == blob_handle_store_.end()) |
| 533 return; | 533 return; |
| 534 DCHECK(!it->second.empty()); | 534 DCHECK(!it->second.empty()); |
| 535 it->second.pop_front(); | 535 it->second.pop_front(); |
| 536 if (it->second.empty()) | 536 if (it->second.empty()) |
| 537 blob_handle_store_.erase(it); | 537 blob_handle_store_.erase(it); |
| 538 } | 538 } |
| 539 | 539 |
| 540 } // namespace content | 540 } // namespace content |
| OLD | NEW |