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 "content/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 "content/browser/appcache/appcache.h" | 8 #include "content/browser/appcache/appcache.h" |
9 #include "content/browser/appcache/appcache_group.h" | 9 #include "content/browser/appcache/appcache_group.h" |
10 #include "content/browser/appcache/appcache_service_impl.h" | 10 #include "content/browser/appcache/appcache_service_impl.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 void AppCacheBackendImpl::GetResourceList( | 137 void AppCacheBackendImpl::GetResourceList( |
138 int host_id, std::vector<AppCacheResourceInfo>* resource_infos) { | 138 int host_id, std::vector<AppCacheResourceInfo>* resource_infos) { |
139 AppCacheHost* host = GetHost(host_id); | 139 AppCacheHost* host = GetHost(host_id); |
140 if (!host) | 140 if (!host) |
141 return; | 141 return; |
142 | 142 |
143 host->GetResourceList(resource_infos); | 143 host->GetResourceList(resource_infos); |
144 } | 144 } |
145 | 145 |
146 scoped_ptr<AppCacheHost> AppCacheBackendImpl::TransferHostOut(int host_id) { | 146 std::unique_ptr<AppCacheHost> AppCacheBackendImpl::TransferHostOut( |
| 147 int host_id) { |
147 HostMap::iterator found = hosts_.find(host_id); | 148 HostMap::iterator found = hosts_.find(host_id); |
148 if (found == hosts_.end()) { | 149 if (found == hosts_.end()) { |
149 NOTREACHED(); | 150 NOTREACHED(); |
150 return scoped_ptr<AppCacheHost>(); | 151 return std::unique_ptr<AppCacheHost>(); |
151 } | 152 } |
152 | 153 |
153 AppCacheHost* transferree = found->second; | 154 AppCacheHost* transferree = found->second; |
154 | 155 |
155 // Put a new empty host in its place. | 156 // Put a new empty host in its place. |
156 found->second = new AppCacheHost(host_id, frontend_, service_); | 157 found->second = new AppCacheHost(host_id, frontend_, service_); |
157 | 158 |
158 // We give up ownership. | 159 // We give up ownership. |
159 transferree->PrepareForTransfer(); | 160 transferree->PrepareForTransfer(); |
160 return scoped_ptr<AppCacheHost>(transferree); | 161 return std::unique_ptr<AppCacheHost>(transferree); |
161 } | 162 } |
162 | 163 |
163 void AppCacheBackendImpl::TransferHostIn( | 164 void AppCacheBackendImpl::TransferHostIn(int new_host_id, |
164 int new_host_id, scoped_ptr<AppCacheHost> host) { | 165 std::unique_ptr<AppCacheHost> host) { |
165 HostMap::iterator found = hosts_.find(new_host_id); | 166 HostMap::iterator found = hosts_.find(new_host_id); |
166 if (found == hosts_.end()) { | 167 if (found == hosts_.end()) { |
167 NOTREACHED(); | 168 NOTREACHED(); |
168 return; | 169 return; |
169 } | 170 } |
170 | 171 |
171 delete found->second; | 172 delete found->second; |
172 | 173 |
173 // We take onwership. | 174 // We take onwership. |
174 host->CompleteTransfer(new_host_id, frontend_); | 175 host->CompleteTransfer(new_host_id, frontend_); |
175 found->second = host.release(); | 176 found->second = host.release(); |
176 } | 177 } |
177 | 178 |
178 } // namespace content | 179 } // namespace content |
OLD | NEW |