| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "modules/geolocation/GeolocationController.h" | 28 #include "modules/geolocation/GeolocationController.h" |
| 29 #include "modules/geolocation/GeolocationError.h" | 29 #include "modules/geolocation/GeolocationError.h" |
| 30 #include "modules/geolocation/GeolocationPosition.h" | 30 #include "modules/geolocation/GeolocationPosition.h" |
| 31 #include "platform/heap/Handle.h" | 31 #include "platform/heap/Handle.h" |
| 32 #include "public/web/WebGeolocationError.h" | 32 #include "public/web/WebGeolocationError.h" |
| 33 #include "public/web/WebGeolocationPosition.h" | 33 #include "public/web/WebGeolocationPosition.h" |
| 34 #include "wtf/RefCounted.h" | 34 #include "wtf/RefCounted.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 // TODO(Oilpan): once GeolocationController is always on the heap, | |
| 39 // shorten out this GeolocationControllerPrivate intermediary. | |
| 40 class GeolocationControllerPrivate final : public GarbageCollected<GeolocationCo
ntrollerPrivate> { | |
| 41 public: | |
| 42 static GeolocationControllerPrivate* create(GeolocationController* controlle
r) | |
| 43 { | |
| 44 return new GeolocationControllerPrivate(controller); | |
| 45 } | |
| 46 | |
| 47 static GeolocationController& controller(const WebPrivatePtr<GeolocationCont
rollerPrivate>& controller) | |
| 48 { | |
| 49 DCHECK(!controller.isNull()); | |
| 50 DCHECK(controller->m_controller); | |
| 51 return *controller->m_controller; | |
| 52 } | |
| 53 | |
| 54 DEFINE_INLINE_TRACE() | |
| 55 { | |
| 56 visitor->trace(m_controller); | |
| 57 } | |
| 58 | |
| 59 private: | |
| 60 explicit GeolocationControllerPrivate(GeolocationController* controller) | |
| 61 : m_controller(controller) | |
| 62 { | |
| 63 } | |
| 64 | |
| 65 // Non-Oilpan, this bare pointer is owned as a supplement and kept alive | |
| 66 // by the frame of the WebLocalFrame which creates the WebGeolocationControl
ler | |
| 67 // object that wraps it all up. | |
| 68 Member<GeolocationController> m_controller; | |
| 69 }; | |
| 70 | |
| 71 WebGeolocationController::WebGeolocationController(GeolocationController* contro
ller) | 38 WebGeolocationController::WebGeolocationController(GeolocationController* contro
ller) |
| 72 : m_private(GeolocationControllerPrivate::create(controller)) | 39 : m_private(controller) |
| 73 { | 40 { |
| 74 } | 41 } |
| 75 | 42 |
| 76 void WebGeolocationController::reset() | 43 void WebGeolocationController::reset() |
| 77 { | 44 { |
| 78 m_private.reset(); | 45 m_private.reset(); |
| 79 } | 46 } |
| 80 | 47 |
| 81 void WebGeolocationController::positionChanged(const WebGeolocationPosition& web
Position) | 48 void WebGeolocationController::positionChanged(const WebGeolocationPosition& web
Position) |
| 82 { | 49 { |
| 83 GeolocationControllerPrivate::controller(m_private).positionChanged(static_c
ast<GeolocationPosition*>(webPosition)); | 50 m_private->positionChanged(static_cast<GeolocationPosition*>(webPosition)); |
| 84 } | 51 } |
| 85 | 52 |
| 86 void WebGeolocationController::errorOccurred(const WebGeolocationError& webError
) | 53 void WebGeolocationController::errorOccurred(const WebGeolocationError& webError
) |
| 87 { | 54 { |
| 88 GeolocationControllerPrivate::controller(m_private).errorOccurred(static_cas
t<GeolocationError*>(webError)); | 55 m_private->errorOccurred(static_cast<GeolocationError*>(webError)); |
| 89 } | 56 } |
| 90 | 57 |
| 91 } // namespace blink | 58 } // namespace blink |
| OLD | NEW |