OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 { | 76 { |
77 if (!m_isClientUpdating) | 77 if (!m_isClientUpdating) |
78 return; | 78 return; |
79 m_isClientUpdating = false; | 79 m_isClientUpdating = false; |
80 m_client->stopUpdating(); | 80 m_client->stopUpdating(); |
81 } | 81 } |
82 | 82 |
83 GeolocationController::~GeolocationController() | 83 GeolocationController::~GeolocationController() |
84 { | 84 { |
85 ASSERT(m_observers.isEmpty()); | 85 ASSERT(m_observers.isEmpty()); |
86 if (page()) | 86 detach(); |
87 } | |
88 | |
89 void GeolocationController::detach() | |
90 { | |
91 if (page() && m_inspectorAgent) { | |
87 m_inspectorAgent->RemoveController(this); | 92 m_inspectorAgent->RemoveController(this); |
haraken
2014/06/21 02:19:53
keishi@: I think you need to remove this code when
| |
93 m_inspectorAgent = 0; | |
94 } | |
88 | 95 |
89 if (m_hasClientForTest) | 96 if (m_hasClientForTest) { |
90 m_client->controllerForTestRemoved(this); | 97 m_client->controllerForTestRemoved(this); |
98 m_hasClientForTest = false; | |
99 } | |
91 } | 100 } |
92 | 101 |
93 // FIXME: Oilpan: Once GeolocationClient is on-heap m_client should be a strong | 102 // FIXME: Oilpan: Once GeolocationClient is on-heap m_client should be a strong |
haraken
2014/06/21 02:19:53
We might want to consider moving GeolocationClient
| |
94 // pointer and |willBeDestroyed| can potentially be removed from Supplement. | 103 // pointer and |willBeDestroyed| can potentially be removed from Supplement. |
95 void GeolocationController::willBeDestroyed() | 104 void GeolocationController::willBeDestroyed() |
96 { | 105 { |
97 if (m_client) | 106 detach(); |
107 if (m_client) { | |
98 m_client->geolocationDestroyed(); | 108 m_client->geolocationDestroyed(); |
109 m_client = 0; | |
110 } | |
99 } | 111 } |
100 | 112 |
101 void GeolocationController::persistentHostHasBeenDestroyed() | 113 void GeolocationController::persistentHostHasBeenDestroyed() |
102 { | 114 { |
103 observeContext(0); | 115 observeContext(0); |
104 } | 116 } |
105 | 117 |
106 PassOwnPtrWillBeRawPtr<GeolocationController> GeolocationController::create(Loca lFrame& frame, GeolocationClient* client) | 118 PassOwnPtrWillBeRawPtr<GeolocationController> GeolocationController::create(Loca lFrame& frame, GeolocationClient* client) |
107 { | 119 { |
108 return adoptPtrWillBeNoop(new GeolocationController(frame, client)); | 120 return adoptPtrWillBeNoop(new GeolocationController(frame, client)); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 visitor->trace(m_highAccuracyObservers); | 231 visitor->trace(m_highAccuracyObservers); |
220 WillBeHeapSupplement<LocalFrame>::trace(visitor); | 232 WillBeHeapSupplement<LocalFrame>::trace(visitor); |
221 } | 233 } |
222 | 234 |
223 void provideGeolocationTo(LocalFrame& frame, GeolocationClient* client) | 235 void provideGeolocationTo(LocalFrame& frame, GeolocationClient* client) |
224 { | 236 { |
225 WillBeHeapSupplement<LocalFrame>::provideTo(frame, GeolocationController::su pplementName(), GeolocationController::create(frame, client)); | 237 WillBeHeapSupplement<LocalFrame>::provideTo(frame, GeolocationController::su pplementName(), GeolocationController::create(frame, client)); |
226 } | 238 } |
227 | 239 |
228 } // namespace WebCore | 240 } // namespace WebCore |
OLD | NEW |