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

Side by Side Diff: content/browser/service_worker/service_worker_navigation_handle.cc

Issue 1399363004: PlzNavigate: Make ServiceWorker work with PlzNavigate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months 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 2015 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/service_worker/service_worker_navigation_handle.h"
6
7 #include "base/bind.h"
8 #include "content/browser/service_worker/service_worker_navigation_handle_core.h "
9 #include "content/common/service_worker/service_worker_types.h"
10 #include "content/public/browser/browser_thread.h"
11
12 namespace content {
13
14 ServiceWorkerNavigationHandle::ServiceWorkerNavigationHandle(
15 ServiceWorkerContextWrapper* context_wrapper)
16 : service_worker_provider_host_id_(kInvalidServiceWorkerProviderId),
17 weak_factory_(this) {
18 DCHECK_CURRENTLY_ON(BrowserThread::UI);
19 core_ = new ServiceWorkerNavigationHandleCore(weak_factory_.GetWeakPtr(),
20 context_wrapper);
21 }
22
23 ServiceWorkerNavigationHandle::~ServiceWorkerNavigationHandle() {
24 DCHECK_CURRENTLY_ON(BrowserThread::UI);
25 // Delete the ServiceWorkerNavigationHandleCore on the IO thread.
26 // It's safe to use base::Unretained since this is the only call to the
27 // destructor.
28 BrowserThread::PostTask(
29 BrowserThread::IO, FROM_HERE,
30 base::Bind(&ServiceWorkerNavigationHandleCore::Destroy,
31 base::Unretained(core_)));
kinuko 2015/10/20 14:46:07 nit: could this use BrowserThread::DeleteSoon() an
clamy 2015/10/21 16:33:48 Done.
32 }
33
34 void ServiceWorkerNavigationHandle::DidCreateServiceWorkerProviderHost(
35 int service_worker_provider_host_id) {
36 DCHECK_CURRENTLY_ON(BrowserThread::UI);
37 service_worker_provider_host_id_ = service_worker_provider_host_id;
38 }
39
40 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698