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 #include "webkit/browser/appcache/appcache_backend_impl.h" | 5 #include "content/browser/appcache/appcache_backend_impl.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "webkit/browser/appcache/appcache.h" | 8 #include "content/browser/appcache/appcache.h" |
9 #include "webkit/browser/appcache/appcache_group.h" | 9 #include "content/browser/appcache/appcache_group.h" |
10 #include "webkit/browser/appcache/appcache_service_impl.h" | 10 #include "content/browser/appcache/appcache_service_impl.h" |
11 | 11 |
12 namespace appcache { | 12 namespace content { |
13 | 13 |
14 AppCacheBackendImpl::AppCacheBackendImpl() | 14 AppCacheBackendImpl::AppCacheBackendImpl() |
15 : service_(NULL), | 15 : service_(NULL), |
16 frontend_(NULL), | 16 frontend_(NULL), |
17 process_id_(0) { | 17 process_id_(0) { |
18 } | 18 } |
19 | 19 |
20 AppCacheBackendImpl::~AppCacheBackendImpl() { | 20 AppCacheBackendImpl::~AppCacheBackendImpl() { |
21 STLDeleteValues(&hosts_); | 21 STLDeleteValues(&hosts_); |
22 if (service_) | 22 if (service_) |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 int host_id, const SwapCacheCallback& callback, void* callback_param) { | 132 int host_id, const SwapCacheCallback& callback, void* callback_param) { |
133 AppCacheHost* host = GetHost(host_id); | 133 AppCacheHost* host = GetHost(host_id); |
134 if (!host) | 134 if (!host) |
135 return false; | 135 return false; |
136 | 136 |
137 host->SwapCacheWithCallback(callback, callback_param); | 137 host->SwapCacheWithCallback(callback, callback_param); |
138 return true; | 138 return true; |
139 } | 139 } |
140 | 140 |
141 void AppCacheBackendImpl::GetResourceList( | 141 void AppCacheBackendImpl::GetResourceList( |
142 int host_id, std::vector<appcache::AppCacheResourceInfo>* resource_infos) { | 142 int host_id, std::vector<AppCacheResourceInfo>* resource_infos) { |
143 AppCacheHost* host = GetHost(host_id); | 143 AppCacheHost* host = GetHost(host_id); |
144 if (!host) | 144 if (!host) |
145 return; | 145 return; |
146 | 146 |
147 host->GetResourceList(resource_infos); | 147 host->GetResourceList(resource_infos); |
148 } | 148 } |
149 | 149 |
150 scoped_ptr<AppCacheHost> AppCacheBackendImpl::TransferHostOut(int host_id) { | 150 scoped_ptr<AppCacheHost> AppCacheBackendImpl::TransferHostOut(int host_id) { |
151 HostMap::iterator found = hosts_.find(host_id); | 151 HostMap::iterator found = hosts_.find(host_id); |
152 if (found == hosts_.end()) { | 152 if (found == hosts_.end()) { |
(...skipping 19 matching lines...) Expand all Loading... |
172 return; | 172 return; |
173 } | 173 } |
174 | 174 |
175 delete found->second; | 175 delete found->second; |
176 | 176 |
177 // We take onwership. | 177 // We take onwership. |
178 host->CompleteTransfer(new_host_id, frontend_); | 178 host->CompleteTransfer(new_host_id, frontend_); |
179 found->second = host.release(); | 179 found->second = host.release(); |
180 } | 180 } |
181 | 181 |
182 } // namespace appcache | 182 } // namespace content |
OLD | NEW |