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

Side by Side Diff: content/browser/appcache/appcache_navigation_handle.cc

Issue 2501343003: PlzNavigate: AppCache support. (Closed)
Patch Set: Rebase to tip correctly 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/appcache/appcache_navigation_handle.h"
6
7 #include "base/bind.h"
8 #include "content/browser/appcache/appcache_navigation_handle_core.h"
9 #include "content/browser/appcache/chrome_appcache_service.h"
10 #include "content/public/browser/browser_thread.h"
11 #include "content/public/common/appcache_info.h"
12
13 namespace {
14 // PlzNavigate: Used to generate the host id for a navigation initiated by the
15 // browser. Starts at -2 and keeps going down.
16 static int g_next_appcache_host_id = -1;
17 }
18
19 namespace content {
20
21 AppCacheNavigationHandle::AppCacheNavigationHandle(
22 ChromeAppCacheService* appcache_service)
23 : appcache_host_id_(kAppCacheNoHostId),
24 core_(nullptr),
25 weak_factory_(this) {
26 DCHECK_CURRENTLY_ON(BrowserThread::UI);
27 appcache_host_id_ = g_next_appcache_host_id--;
28 core_ = new AppCacheNavigationHandleCore(weak_factory_.GetWeakPtr(),
29 appcache_service, appcache_host_id_);
30 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
31 base::Bind(&AppCacheNavigationHandleCore::Initialize,
32 base::Unretained(core_)));
33 }
34
35 AppCacheNavigationHandle::~AppCacheNavigationHandle() {
36 DCHECK_CURRENTLY_ON(BrowserThread::UI);
37 // Delete the AppCacheNavigationHandleCore on the IO thread.
38 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, core_);
39 }
40
41 void AppCacheNavigationHandle::CommitNavigation(int process_id) {
42 BrowserThread::PostTask(
43 BrowserThread::IO, FROM_HERE,
44 base::Bind(&AppCacheNavigationHandleCore::CommitNavigation,
45 base::Unretained(core_), process_id));
46 }
47
48 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698