Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: Source/modules/geolocation/GeolocationController.cpp

Issue 490143002: Move GeolocationClient to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Provide default empty impl of WebGeolocationClient::geolocationDestroyed() virtual Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 { 79 {
80 if (!m_isClientUpdating) 80 if (!m_isClientUpdating)
81 return; 81 return;
82 m_isClientUpdating = false; 82 m_isClientUpdating = false;
83 m_client->stopUpdating(); 83 m_client->stopUpdating();
84 } 84 }
85 85
86 GeolocationController::~GeolocationController() 86 GeolocationController::~GeolocationController()
87 { 87 {
88 ASSERT(m_observers.isEmpty()); 88 ASSERT(m_observers.isEmpty());
89 detach();
90 }
91
92 void GeolocationController::detach()
93 {
94 #if !ENABLE(OILPAN) 89 #if !ENABLE(OILPAN)
95 if (page() && m_inspectorAgent) { 90 if (page() && m_inspectorAgent) {
96 m_inspectorAgent->removeController(this); 91 m_inspectorAgent->removeController(this);
97 m_inspectorAgent = nullptr; 92 m_inspectorAgent = nullptr;
98 } 93 }
99 #endif
100 94
101 if (m_hasClientForTest) { 95 if (m_hasClientForTest) {
102 m_client->controllerForTestRemoved(this); 96 m_client->controllerForTestRemoved(this);
103 m_hasClientForTest = false; 97 m_hasClientForTest = false;
104 } 98 }
105 } 99 #endif
106
107 // FIXME: Oilpan: Once GeolocationClient is on-heap m_client should be a strong
108 // pointer and |willBeDestroyed| can potentially be removed from Supplement.
109 void GeolocationController::willBeDestroyed()
110 {
111 detach();
112 if (m_client) {
113 m_client->geolocationDestroyed();
114 m_client = 0;
115 }
116 } 100 }
117 101
118 void GeolocationController::persistentHostHasBeenDestroyed() 102 void GeolocationController::persistentHostHasBeenDestroyed()
119 { 103 {
120 observeContext(0); 104 observeContext(0);
121 } 105 }
122 106
123 PassOwnPtrWillBeRawPtr<GeolocationController> GeolocationController::create(Loca lFrame& frame, GeolocationClient* client) 107 PassOwnPtrWillBeRawPtr<GeolocationController> GeolocationController::create(Loca lFrame& frame, GeolocationClient* client)
124 { 108 {
125 return adoptPtrWillBeNoop(new GeolocationController(frame, client)); 109 return adoptPtrWillBeNoop(new GeolocationController(frame, client));
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 stopUpdatingIfNeeded(); 208 stopUpdatingIfNeeded();
225 } 209 }
226 210
227 const char* GeolocationController::supplementName() 211 const char* GeolocationController::supplementName()
228 { 212 {
229 return "GeolocationController"; 213 return "GeolocationController";
230 } 214 }
231 215
232 void GeolocationController::trace(Visitor* visitor) 216 void GeolocationController::trace(Visitor* visitor)
233 { 217 {
218 visitor->trace(m_client);
234 visitor->trace(m_lastPosition); 219 visitor->trace(m_lastPosition);
235 visitor->trace(m_observers); 220 visitor->trace(m_observers);
236 visitor->trace(m_highAccuracyObservers); 221 visitor->trace(m_highAccuracyObservers);
237 visitor->trace(m_inspectorAgent); 222 visitor->trace(m_inspectorAgent);
238 WillBeHeapSupplement<LocalFrame>::trace(visitor); 223 WillBeHeapSupplement<LocalFrame>::trace(visitor);
239 } 224 }
240 225
241 void provideGeolocationTo(LocalFrame& frame, GeolocationClient* client) 226 void provideGeolocationTo(LocalFrame& frame, GeolocationClient* client)
242 { 227 {
243 WillBeHeapSupplement<LocalFrame>::provideTo(frame, GeolocationController::su pplementName(), GeolocationController::create(frame, client)); 228 WillBeHeapSupplement<LocalFrame>::provideTo(frame, GeolocationController::su pplementName(), GeolocationController::create(frame, client));
244 } 229 }
245 230
246 } // namespace blink 231 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698