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

Side by Side Diff: third_party/WebKit/Source/modules/background_fetch/ServiceWorkerRegistrationBackgroundFetch.cpp

Issue 2736943002: Exposing new BackgroundFetchManager on SWReg
Patch Set: Created 3 years, 9 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 2017 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 "modules/background_fetch/ServiceWorkerRegistrationBackgroundFetch.h"
6
7 #include "modules/background_fetch/BackgroundFetchManager.h"
8 #include "modules/serviceworkers/ServiceWorkerRegistration.h"
9
10 namespace blink {
11
12 ServiceWorkerRegistrationBackgroundFetch::
13 ServiceWorkerRegistrationBackgroundFetch(
14 ServiceWorkerRegistration* registration)
15 : m_registration(registration) {}
16
17 ServiceWorkerRegistrationBackgroundFetch::
18 ~ServiceWorkerRegistrationBackgroundFetch() {}
19
20 const char* ServiceWorkerRegistrationBackgroundFetch::supplementName() {
21 return "ServiceWorkerRegistrationBackgroundFetch";
22 }
23
24 ServiceWorkerRegistrationBackgroundFetch&
25 ServiceWorkerRegistrationBackgroundFetch::from(
26 ServiceWorkerRegistration& registration) {
27 ServiceWorkerRegistrationBackgroundFetch* supplement =
28 static_cast<ServiceWorkerRegistrationBackgroundFetch*>(
29 Supplement<ServiceWorkerRegistration>::from(registration,
30 supplementName()));
31 if (!supplement) {
32 supplement = new ServiceWorkerRegistrationBackgroundFetch(&registration);
33 provideTo(registration, supplementName(), supplement);
34 }
35 return *supplement;
36 }
37
38 // static
39 BackgroundFetchManager*
40 ServiceWorkerRegistrationBackgroundFetch::backgroundFetch(
41 ServiceWorkerRegistration& registration) {
42 return ServiceWorkerRegistrationBackgroundFetch::from(registration)
43 .backgroundFetch();
44 }
45
46 BackgroundFetchManager*
47 ServiceWorkerRegistrationBackgroundFetch::backgroundFetch() {
48 return m_backgroundFetch;
49 }
50
51 DEFINE_TRACE(ServiceWorkerRegistrationBackgroundFetch) {
52 visitor->trace(m_registration);
53 visitor->trace(m_backgroundFetch);
54 Supplement<ServiceWorkerRegistration>::trace(visitor);
55 }
56
57 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698