OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "modules/geofencing/ServiceWorkerRegistrationGeofencing.h" |
| 7 |
| 8 #include "modules/geofencing/Geofencing.h" |
| 9 #include "modules/serviceworkers/ServiceWorkerRegistration.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 ServiceWorkerRegistrationGeofencing::ServiceWorkerRegistrationGeofencing(Service
WorkerRegistration* registration) |
| 14 : m_registration(registration) |
| 15 { |
| 16 } |
| 17 |
| 18 ServiceWorkerRegistrationGeofencing::~ServiceWorkerRegistrationGeofencing() |
| 19 { |
| 20 } |
| 21 |
| 22 const char* ServiceWorkerRegistrationGeofencing::supplementName() |
| 23 { |
| 24 return "ServiceWorkerRegistrationGeofencing"; |
| 25 } |
| 26 |
| 27 ServiceWorkerRegistrationGeofencing& ServiceWorkerRegistrationGeofencing::from(S
erviceWorkerRegistration& registration) |
| 28 { |
| 29 ServiceWorkerRegistrationGeofencing* supplement = static_cast<ServiceWorkerR
egistrationGeofencing*>(HeapSupplement<ServiceWorkerRegistration>::from(registra
tion, supplementName())); |
| 30 if (!supplement) { |
| 31 supplement = new ServiceWorkerRegistrationGeofencing(®istration); |
| 32 provideTo(registration, supplementName(), supplement); |
| 33 } |
| 34 return *supplement; |
| 35 } |
| 36 |
| 37 Geofencing* ServiceWorkerRegistrationGeofencing::geofencing(ServiceWorkerRegistr
ation& registration) |
| 38 { |
| 39 return ServiceWorkerRegistrationGeofencing::from(registration).geofencing(); |
| 40 } |
| 41 |
| 42 Geofencing* ServiceWorkerRegistrationGeofencing::geofencing() |
| 43 { |
| 44 if (!m_geofencing) |
| 45 m_geofencing = Geofencing::create(m_registration); |
| 46 return m_geofencing.get(); |
| 47 } |
| 48 |
| 49 void ServiceWorkerRegistrationGeofencing::trace(Visitor* visitor) |
| 50 { |
| 51 visitor->trace(m_registration); |
| 52 visitor->trace(m_geofencing); |
| 53 HeapSupplement<ServiceWorkerRegistration>::trace(visitor); |
| 54 } |
| 55 |
| 56 } // namespace blink |
OLD | NEW |