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/memory/ptr_util.h" | 7 #include "base/memory/ptr_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" |
| 11 #include "content/public/browser/browser_thread.h" |
| 12 #include "content/public/common/browser_side_navigation_policy.h" |
11 | 13 |
12 namespace content { | 14 namespace content { |
13 | 15 |
14 AppCacheBackendImpl::AppCacheBackendImpl() | 16 AppCacheBackendImpl::AppCacheBackendImpl() |
15 : service_(NULL), | 17 : service_(NULL), |
16 frontend_(NULL), | 18 frontend_(NULL), |
17 process_id_(0) { | 19 process_id_(0) { |
18 } | 20 } |
19 | 21 |
20 AppCacheBackendImpl::~AppCacheBackendImpl() { | 22 AppCacheBackendImpl::~AppCacheBackendImpl() { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 auto found = hosts_.find(new_host_id); | 161 auto found = hosts_.find(new_host_id); |
160 if (found == hosts_.end()) { | 162 if (found == hosts_.end()) { |
161 NOTREACHED(); | 163 NOTREACHED(); |
162 return; | 164 return; |
163 } | 165 } |
164 | 166 |
165 host->CompleteTransfer(new_host_id, frontend_); | 167 host->CompleteTransfer(new_host_id, frontend_); |
166 found->second = std::move(host); | 168 found->second = std::move(host); |
167 } | 169 } |
168 | 170 |
| 171 void AppCacheBackendImpl::RegisterPrecreatedHost( |
| 172 std::unique_ptr<AppCacheHost> host) { |
| 173 DCHECK(IsBrowserSideNavigationEnabled()); |
| 174 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 175 |
| 176 DCHECK(host.get()); |
| 177 DCHECK(hosts_.find(host->host_id()) == hosts_.end()); |
| 178 // Switch the frontend proxy so that the host can make IPC calls from |
| 179 // here on. |
| 180 host->set_frontend(frontend_); |
| 181 hosts_[host->host_id()] = std::move(host); |
| 182 } |
| 183 |
169 } // namespace content | 184 } // namespace content |
OLD | NEW |