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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "base/trace_event/trace_event.h" | 11 #include "base/trace_event/trace_event.h" |
| 12 #include "content/browser/bad_message.h" |
12 #include "content/browser/cache_storage/cache_storage_cache.h" | 13 #include "content/browser/cache_storage/cache_storage_cache.h" |
13 #include "content/browser/cache_storage/cache_storage_context_impl.h" | 14 #include "content/browser/cache_storage/cache_storage_context_impl.h" |
14 #include "content/browser/cache_storage/cache_storage_manager.h" | 15 #include "content/browser/cache_storage/cache_storage_manager.h" |
15 #include "content/common/cache_storage/cache_storage_messages.h" | 16 #include "content/common/cache_storage/cache_storage_messages.h" |
16 #include "content/public/browser/content_browser_client.h" | 17 #include "content/public/browser/content_browser_client.h" |
17 #include "storage/browser/blob/blob_data_handle.h" | 18 #include "storage/browser/blob/blob_data_handle.h" |
18 #include "third_party/WebKit/public/platform/WebServiceWorkerCacheError.h" | 19 #include "third_party/WebKit/public/platform/WebServiceWorkerCacheError.h" |
19 | 20 |
20 namespace content { | 21 namespace content { |
21 | 22 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 IPC_MESSAGE_HANDLER(CacheStorageHostMsg_CacheMatch, OnCacheMatch) | 81 IPC_MESSAGE_HANDLER(CacheStorageHostMsg_CacheMatch, OnCacheMatch) |
81 IPC_MESSAGE_HANDLER(CacheStorageHostMsg_CacheMatchAll, OnCacheMatchAll) | 82 IPC_MESSAGE_HANDLER(CacheStorageHostMsg_CacheMatchAll, OnCacheMatchAll) |
82 IPC_MESSAGE_HANDLER(CacheStorageHostMsg_CacheKeys, OnCacheKeys) | 83 IPC_MESSAGE_HANDLER(CacheStorageHostMsg_CacheKeys, OnCacheKeys) |
83 IPC_MESSAGE_HANDLER(CacheStorageHostMsg_CacheBatch, OnCacheBatch) | 84 IPC_MESSAGE_HANDLER(CacheStorageHostMsg_CacheBatch, OnCacheBatch) |
84 IPC_MESSAGE_HANDLER(CacheStorageHostMsg_CacheClosed, OnCacheClosed) | 85 IPC_MESSAGE_HANDLER(CacheStorageHostMsg_CacheClosed, OnCacheClosed) |
85 IPC_MESSAGE_HANDLER(CacheStorageHostMsg_BlobDataHandled, OnBlobDataHandled) | 86 IPC_MESSAGE_HANDLER(CacheStorageHostMsg_BlobDataHandled, OnBlobDataHandled) |
86 IPC_MESSAGE_UNHANDLED(handled = false) | 87 IPC_MESSAGE_UNHANDLED(handled = false) |
87 IPC_END_MESSAGE_MAP() | 88 IPC_END_MESSAGE_MAP() |
88 | 89 |
89 if (!handled) | 90 if (!handled) |
90 BadMessageReceived(); | 91 bad_message::ReceivedBadMessage(this, bad_message::CSDH_NOT_RECOGNIZED); |
91 return handled; | 92 return handled; |
92 } | 93 } |
93 | 94 |
94 void CacheStorageDispatcherHost::CreateCacheListener( | 95 void CacheStorageDispatcherHost::CreateCacheListener( |
95 CacheStorageContextImpl* context) { | 96 CacheStorageContextImpl* context) { |
96 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 97 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
97 context_ = context; | 98 context_ = context; |
98 } | 99 } |
99 | 100 |
100 void CacheStorageDispatcherHost::OnCacheStorageHas( | 101 void CacheStorageDispatcherHost::OnCacheStorageHas( |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 UUIDToBlobDataHandleList::iterator it = blob_handle_store_.find(uuid); | 425 UUIDToBlobDataHandleList::iterator it = blob_handle_store_.find(uuid); |
425 if (it == blob_handle_store_.end()) | 426 if (it == blob_handle_store_.end()) |
426 return; | 427 return; |
427 DCHECK(!it->second.empty()); | 428 DCHECK(!it->second.empty()); |
428 it->second.pop_front(); | 429 it->second.pop_front(); |
429 if (it->second.empty()) | 430 if (it->second.empty()) |
430 blob_handle_store_.erase(it); | 431 blob_handle_store_.erase(it); |
431 } | 432 } |
432 | 433 |
433 } // namespace content | 434 } // namespace content |
OLD | NEW |