Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Unified Diff: content/child/appcache/web_application_cache_host_impl.cc

Issue 2501343003: PlzNavigate: AppCache support. (Closed)
Patch Set: Add DCHECKs for PlzNavigate and fix a double Release problem which caused one unit_test to fail wit… Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/child/appcache/web_application_cache_host_impl.cc
diff --git a/content/child/appcache/web_application_cache_host_impl.cc b/content/child/appcache/web_application_cache_host_impl.cc
index 3442fc0b78dfc40349ac408c479b3cfae077c697..e737127add00ee3c31188e2a0e89010097c48a8a 100644
--- a/content/child/appcache/web_application_cache_host_impl.cc
+++ b/content/child/appcache/web_application_cache_host_impl.cc
@@ -10,6 +10,7 @@
#include "base/id_map.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
+#include "content/public/common/browser_side_navigation_policy.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h"
@@ -57,16 +58,25 @@ WebApplicationCacheHostImpl* WebApplicationCacheHostImpl::FromId(int id) {
WebApplicationCacheHostImpl::WebApplicationCacheHostImpl(
WebApplicationCacheHostClient* client,
- AppCacheBackend* backend)
+ AppCacheBackend* backend,
+ int appcache_host_id)
: client_(client),
backend_(backend),
- host_id_(all_hosts()->Add(this)),
status_(APPCACHE_STATUS_UNCACHED),
is_scheme_supported_(false),
is_get_method_(false),
is_new_master_entry_(MAYBE),
was_select_cache_called_(false) {
- DCHECK(client && backend && (host_id_ != kAppCacheNoHostId));
+ DCHECK(client && backend);
+ // PlzNavigate: The browser passes the ID to be used.
+ if (appcache_host_id != kAppCacheNoHostId) {
+ DCHECK(IsBrowserSideNavigationEnabled());
+ all_hosts()->AddWithID(this, appcache_host_id);
+ host_id_ = appcache_host_id;
+ } else {
+ host_id_ = all_hosts()->Add(this);
+ }
+ DCHECK(host_id_ != kAppCacheNoHostId);
backend_->RegisterHost(host_id_);
}

Powered by Google App Engine
This is Rietveld 408576698