Index: content/browser/appcache/appcache_backend_impl.cc |
diff --git a/content/browser/appcache/appcache_backend_impl.cc b/content/browser/appcache/appcache_backend_impl.cc |
index 7f29c3e97a713cb7a13924b6cc27a7fb9113627a..ef9b2c7ec458b61c079362433fea7d345a7bbf2a 100644 |
--- a/content/browser/appcache/appcache_backend_impl.cc |
+++ b/content/browser/appcache/appcache_backend_impl.cc |
@@ -8,29 +8,40 @@ |
#include "content/browser/appcache/appcache.h" |
#include "content/browser/appcache/appcache_group.h" |
#include "content/browser/appcache/appcache_service_impl.h" |
+#include "content/public/common/browser_side_navigation_policy.h" |
namespace content { |
AppCacheBackendImpl::AppCacheBackendImpl() |
- : service_(NULL), |
- frontend_(NULL), |
- process_id_(0) { |
-} |
+ : service_(NULL), frontend_(NULL), process_id_(0), frame_id_(-1) {} |
AppCacheBackendImpl::~AppCacheBackendImpl() { |
hosts_.clear(); |
- if (service_) |
- service_->UnregisterBackend(this); |
+ if (service_) { |
+ if (process_id_ != -1) { |
michaeln
2016/11/22 00:17:27
are there constants defined for these -1 values an
ananta
2016/11/23 04:05:14
Reverted
|
+ service_->UnregisterBackend(this); |
+ } else { |
+ DCHECK(frame_id_ != -1); |
+ service_->UnregisterBackendForFrame(this); |
+ } |
+ } |
} |
void AppCacheBackendImpl::Initialize(AppCacheServiceImpl* service, |
AppCacheFrontend* frontend, |
- int process_id) { |
+ int process_id, |
+ int frame_id) { |
DCHECK(!service_ && !frontend_ && frontend && service); |
service_ = service; |
frontend_ = frontend; |
process_id_ = process_id; |
- service_->RegisterBackend(this); |
+ frame_id_ = frame_id; |
+ if (frame_id != -1) { |
michaeln
2016/11/22 00:17:27
are frame_id and process_id mutually exclusive
ananta
2016/11/23 04:05:14
Reverted
|
+ DCHECK(IsBrowserSideNavigationEnabled()); |
+ service_->RegisterBackendForFrame(this); |
+ } else { |
+ service_->RegisterBackend(this); |
+ } |
} |
bool AppCacheBackendImpl::RegisterHost(int id) { |
@@ -166,4 +177,30 @@ void AppCacheBackendImpl::TransferHostIn(int new_host_id, |
found->second = std::move(host); |
} |
+void AppCacheBackendImpl::FrameNavigationCommitted( |
+ AppCacheFrontend* frontend, |
+ AppCacheServiceImpl* service) { |
+ DCHECK(frontend); |
+ DCHECK(service); |
+ DCHECK(IsBrowserSideNavigationEnabled()); |
+ |
+ frontend_ = frontend; |
+ service_ = service; |
+ |
+ HostMap::iterator host_index; |
+ for (host_index = hosts_.begin(); host_index != hosts_.end(); ++host_index) |
michaeln
2016/11/22 00:17:27
for (auto& iter : backend->hosts_)
ananta
2016/11/23 04:05:14
Reverted
|
+ host_index->second->FrameNavigationCommitted(frontend, service); |
+} |
+ |
+void AppCacheBackendImpl::CopyExistingHosts(AppCacheBackendImpl* backend) { |
+ DCHECK(IsBrowserSideNavigationEnabled()); |
+ |
+ HostMap::iterator host_index; |
+ for (host_index = backend->hosts_.begin(); |
michaeln
2016/11/22 00:17:27
iter might be a better name, i got tripped seeing
ananta
2016/11/23 04:05:14
Reverted
|
+ host_index != backend->hosts_.end(); ++host_index) { |
+ DCHECK(hosts_.find(host_index->first) == hosts_.end()); |
+ hosts_[host_index->first] = std::move(host_index->second); |
+ } |
+} |
+ |
} // namespace content |