OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_BACKEND_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_BACKEND_IMPL_H_ |
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_BACKEND_IMPL_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_BACKEND_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 int64_t cache_document_was_loaded_from); | 46 int64_t cache_document_was_loaded_from); |
47 bool GetStatusWithCallback(int host_id, const GetStatusCallback& callback, | 47 bool GetStatusWithCallback(int host_id, const GetStatusCallback& callback, |
48 void* callback_param); | 48 void* callback_param); |
49 bool StartUpdateWithCallback(int host_id, const StartUpdateCallback& callback, | 49 bool StartUpdateWithCallback(int host_id, const StartUpdateCallback& callback, |
50 void* callback_param); | 50 void* callback_param); |
51 bool SwapCacheWithCallback(int host_id, const SwapCacheCallback& callback, | 51 bool SwapCacheWithCallback(int host_id, const SwapCacheCallback& callback, |
52 void* callback_param); | 52 void* callback_param); |
53 | 53 |
54 // Returns a pointer to a registered host. The backend retains ownership. | 54 // Returns a pointer to a registered host. The backend retains ownership. |
55 AppCacheHost* GetHost(int host_id) { | 55 AppCacheHost* GetHost(int host_id) { |
56 HostMap::iterator it = hosts_.find(host_id); | 56 auto it = hosts_.find(host_id); |
57 return (it != hosts_.end()) ? (it->second) : NULL; | 57 return (it != hosts_.end()) ? (it->second.get()) : nullptr; |
58 } | 58 } |
59 | 59 |
60 typedef base::hash_map<int, AppCacheHost*> HostMap; | 60 typedef base::hash_map<int, std::unique_ptr<AppCacheHost>> HostMap; |
61 const HostMap& hosts() { return hosts_; } | 61 const HostMap& hosts() { return hosts_; } |
62 | 62 |
63 // Methods to support cross site navigations. Hosts are transferred | 63 // Methods to support cross site navigations. Hosts are transferred |
64 // from process to process accordingly, deparented from the old | 64 // from process to process accordingly, deparented from the old |
65 // processes backend and reparented to the new. | 65 // processes backend and reparented to the new. |
66 std::unique_ptr<AppCacheHost> TransferHostOut(int host_id); | 66 std::unique_ptr<AppCacheHost> TransferHostOut(int host_id); |
67 void TransferHostIn(int new_host_id, std::unique_ptr<AppCacheHost> host); | 67 void TransferHostIn(int new_host_id, std::unique_ptr<AppCacheHost> host); |
68 | 68 |
69 private: | 69 private: |
70 AppCacheServiceImpl* service_; | 70 AppCacheServiceImpl* service_; |
71 AppCacheFrontend* frontend_; | 71 AppCacheFrontend* frontend_; |
72 int process_id_; | 72 int process_id_; |
73 HostMap hosts_; | 73 HostMap hosts_; |
| 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(AppCacheBackendImpl); |
74 }; | 76 }; |
75 | 77 |
76 } // namespace | 78 } // namespace |
77 | 79 |
78 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_BACKEND_IMPL_H_ | 80 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_BACKEND_IMPL_H_ |
OLD | NEW |