| 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 "config.h" | 5 #include "config.h" |
| 6 #include "modules/geofencing/Geofencing.h" | 6 #include "modules/geofencing/Geofencing.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "wtf/OwnPtr.h" | 21 #include "wtf/OwnPtr.h" |
| 22 #include "wtf/PassOwnPtr.h" | 22 #include "wtf/PassOwnPtr.h" |
| 23 | 23 |
| 24 namespace blink { | 24 namespace blink { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 // For CallbackPromiseAdapter to convert a WebVector of regions to a HeapVector. | 28 // For CallbackPromiseAdapter to convert a WebVector of regions to a HeapVector. |
| 29 class RegionArray { | 29 class RegionArray { |
| 30 public: | 30 public: |
| 31 using WebType = OwnPtr<WebVector<WebGeofencingRegistration>>; | 31 using WebType = const WebVector<WebGeofencingRegistration>&; |
| 32 static HeapVector<Member<GeofencingRegion>> take(ScriptPromiseResolver* reso
lver, PassOwnPtr<WebVector<WebGeofencingRegistration>> webRegions) | 32 static HeapVector<Member<GeofencingRegion>> take(ScriptPromiseResolver* reso
lver, const WebVector<WebGeofencingRegistration>& webRegions) |
| 33 { | 33 { |
| 34 HeapVector<Member<GeofencingRegion>> regions; | 34 HeapVector<Member<GeofencingRegion>> regions; |
| 35 for (size_t i = 0; i < webRegions->size(); ++i) | 35 for (size_t i = 0; i < webRegions.size(); ++i) |
| 36 regions.append(CircularGeofencingRegion::create((*webRegions)[i].id,
(*webRegions)[i].region)); | 36 regions.append(CircularGeofencingRegion::create(webRegions[i].id, we
bRegions[i].region)); |
| 37 return regions; | 37 return regions; |
| 38 } | 38 } |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 RegionArray(); | 41 RegionArray(); |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 } // namespace | 44 } // namespace |
| 45 | 45 |
| 46 Geofencing::Geofencing(ServiceWorkerRegistration* registration) | 46 Geofencing::Geofencing(ServiceWorkerRegistration* registration) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 provider->getRegisteredRegions(serviceWorkerRegistration, callbacks); | 95 provider->getRegisteredRegions(serviceWorkerRegistration, callbacks); |
| 96 return promise; | 96 return promise; |
| 97 } | 97 } |
| 98 | 98 |
| 99 DEFINE_TRACE(Geofencing) | 99 DEFINE_TRACE(Geofencing) |
| 100 { | 100 { |
| 101 visitor->trace(m_registration); | 101 visitor->trace(m_registration); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace blink | 104 } // namespace blink |
| OLD | NEW |