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

Unified Diff: content/browser/appcache/appcache_navigation_handle.cc

Issue 2501343003: PlzNavigate: AppCache support. (Closed)
Patch Set: Address review comments Created 4 years 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/browser/appcache/appcache_navigation_handle.cc
diff --git a/content/browser/appcache/appcache_navigation_handle.cc b/content/browser/appcache/appcache_navigation_handle.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a5de291e2be15385019d6f46187c53d907f1da9f
--- /dev/null
+++ b/content/browser/appcache/appcache_navigation_handle.cc
@@ -0,0 +1,41 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/appcache/appcache_navigation_handle.h"
+
+#include "base/bind.h"
+#include "content/browser/appcache/appcache_navigation_handle_core.h"
+#include "content/browser/appcache/chrome_appcache_service.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/common/appcache_info.h"
+
+namespace {
+// PlzNavigate: Used to generate the host id for a navigation initiated by the
+// browser. Starts at -2 and keeps going down.
+static int g_next_appcache_host_id = -1;
+}
+
+namespace content {
+
+AppCacheNavigationHandle::AppCacheNavigationHandle(
+ ChromeAppCacheService* appcache_service)
+ : appcache_host_id_(kAppCacheNoHostId),
+ core_(nullptr),
+ weak_factory_(this) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ appcache_host_id_ = g_next_appcache_host_id--;
+ core_.reset(new AppCacheNavigationHandleCore(
+ weak_factory_.GetWeakPtr(), appcache_service, appcache_host_id_));
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ base::Bind(&AppCacheNavigationHandleCore::Initialize,
+ base::Unretained(core_.get())));
+}
+
+AppCacheNavigationHandle::~AppCacheNavigationHandle() {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ // Delete the AppCacheNavigationHandleCore on the IO thread.
+ BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, core_.release());
+}
+
+} // namespace content
« no previous file with comments | « content/browser/appcache/appcache_navigation_handle.h ('k') | content/browser/appcache/appcache_navigation_handle_core.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698