OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/geofencing/WorkerNavigatorGeofencing.h" | 5 #include "modules/geofencing/WorkerNavigatorGeofencing.h" |
6 | 6 |
7 #include "core/workers/WorkerNavigator.h" | 7 #include "core/workers/WorkerNavigator.h" |
8 #include "modules/geofencing/Geofencing.h" | 8 #include "modules/geofencing/Geofencing.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 WorkerNavigatorGeofencing::WorkerNavigatorGeofencing() | 12 WorkerNavigatorGeofencing::WorkerNavigatorGeofencing() |
13 { | 13 { |
14 } | 14 } |
15 | 15 |
16 WorkerNavigatorGeofencing::~WorkerNavigatorGeofencing() | 16 WorkerNavigatorGeofencing::~WorkerNavigatorGeofencing() |
17 { | 17 { |
18 } | 18 } |
19 | 19 |
20 const char* WorkerNavigatorGeofencing::supplementName() | 20 const char* WorkerNavigatorGeofencing::supplementName() |
21 { | 21 { |
22 return "WorkerNavigatorGeofencing"; | 22 return "WorkerNavigatorGeofencing"; |
23 } | 23 } |
24 | 24 |
25 WorkerNavigatorGeofencing& WorkerNavigatorGeofencing::from(WorkerNavigator& navi
gator) | 25 WorkerNavigatorGeofencing& WorkerNavigatorGeofencing::from(WorkerNavigator& navi
gator) |
26 { | 26 { |
27 WorkerNavigatorGeofencing* supplement = static_cast<WorkerNavigatorGeofencin
g*>(HeapSupplement<WorkerNavigator>::from(navigator, supplementName())); | 27 WorkerNavigatorGeofencing* supplement = static_cast<WorkerNavigatorGeofencin
g*>(Supplement<WorkerNavigator>::from(navigator, supplementName())); |
28 if (!supplement) { | 28 if (!supplement) { |
29 supplement = new WorkerNavigatorGeofencing(); | 29 supplement = new WorkerNavigatorGeofencing(); |
30 provideTo(navigator, supplementName(), supplement); | 30 provideTo(navigator, supplementName(), supplement); |
31 } | 31 } |
32 return *supplement; | 32 return *supplement; |
33 } | 33 } |
34 | 34 |
35 Geofencing* WorkerNavigatorGeofencing::geofencing(WorkerNavigator& navigator) | 35 Geofencing* WorkerNavigatorGeofencing::geofencing(WorkerNavigator& navigator) |
36 { | 36 { |
37 return WorkerNavigatorGeofencing::from(navigator).geofencing(); | 37 return WorkerNavigatorGeofencing::from(navigator).geofencing(); |
38 } | 38 } |
39 | 39 |
40 Geofencing* WorkerNavigatorGeofencing::geofencing() | 40 Geofencing* WorkerNavigatorGeofencing::geofencing() |
41 { | 41 { |
42 if (!m_geofencing) | 42 if (!m_geofencing) |
43 m_geofencing = Geofencing::create(nullptr); | 43 m_geofencing = Geofencing::create(nullptr); |
44 return m_geofencing.get(); | 44 return m_geofencing.get(); |
45 } | 45 } |
46 | 46 |
47 DEFINE_TRACE(WorkerNavigatorGeofencing) | 47 DEFINE_TRACE(WorkerNavigatorGeofencing) |
48 { | 48 { |
49 visitor->trace(m_geofencing); | 49 visitor->trace(m_geofencing); |
50 HeapSupplement<WorkerNavigator>::trace(visitor); | 50 Supplement<WorkerNavigator>::trace(visitor); |
51 } | 51 } |
52 | 52 |
53 } // namespace blink | 53 } // namespace blink |
OLD | NEW |