Commit 6c439d5d authored by sigbjornf@opera.com's avatar sigbjornf@opera.com

Oilpan: have GeolocationInspectorAgent persistently track its controllers.

With GeolocationController (now back) on the heap, maintain a persistent
set of them from GeolocationInspectorAgent.

R=haraken@chromium.org,ager@chromium.org,zerny@chromium.org
BUG=304341

Review URL: https://codereview.chromium.org/332153002

git-svn-id: svn://svn.chromium.org/blink/trunk@176202 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 4cf1628c
......@@ -62,7 +62,7 @@ void GeolocationInspectorAgent::setGeolocationOverride(ErrorString* error, const
else
m_geolocationPosition.clear();
for (WTF::HashSet<GeolocationController*>::iterator it = m_controllers.begin(); it != m_controllers.end(); ++it)
for (GeolocationControllers::iterator it = m_controllers.begin(); it != m_controllers.end(); ++it)
(*it)->positionChanged(0); // Kick location update.
}
......@@ -73,9 +73,9 @@ void GeolocationInspectorAgent::clearGeolocationOverride(ErrorString*)
m_geolocationOverridden = false;
m_geolocationPosition.clear();
if (m_platformGeolocationPosition.get()) {
for (WTF::HashSet<GeolocationController*>::iterator it = m_controllers.begin(); it != m_controllers.end(); ++it)
(*it)->positionChanged(m_platformGeolocationPosition.get());
if (GeolocationPosition* platformPosition = m_platformGeolocationPosition.get()) {
for (GeolocationControllers::iterator it = m_controllers.begin(); it != m_controllers.end(); ++it)
(*it)->positionChanged(platformPosition);
}
}
......
......@@ -61,7 +61,8 @@ public:
private:
GeolocationInspectorAgent();
WTF::HashSet<GeolocationController*> m_controllers;
typedef WillBeHeapHashSet<RawPtrWillBeMember<GeolocationController> > GeolocationControllers;
WillBePersistentHeapHashSet<RawPtrWillBeMember<GeolocationController> > m_controllers;
bool m_geolocationOverridden;
Persistent<GeolocationPosition> m_geolocationPosition;
Persistent<GeolocationPosition> m_platformGeolocationPosition;
......
......@@ -167,13 +167,13 @@ void GeolocationClientMock::controllerTimerFired(Timer<GeolocationClientMock>* t
ASSERT_UNUSED(timer, timer == &m_controllerTimer);
// Make a copy of the set of controllers since it might be modified while iterating.
HashSet<GeolocationController*> controllers = m_controllers;
GeolocationControllers controllers = m_controllers;
if (m_lastPosition.get()) {
ASSERT(!m_hasError);
for (HashSet<GeolocationController*>::iterator it = controllers.begin(); it != controllers.end(); ++it)
for (GeolocationControllers::iterator it = controllers.begin(); it != controllers.end(); ++it)
(*it)->positionChanged(m_lastPosition.get());
} else if (m_hasError) {
for (HashSet<GeolocationController*>::iterator it = controllers.begin(); it != controllers.end(); ++it)
for (GeolocationControllers::iterator it = controllers.begin(); it != controllers.end(); ++it)
(*it)->errorOccurred(GeolocationError::create(GeolocationError::PositionUnavailable, m_errorMessage));
}
}
......
......@@ -74,7 +74,8 @@ private:
void clearError();
HashSet<GeolocationController*> m_controllers;
typedef WillBeHeapHashSet<RawPtrWillBeMember<GeolocationController> > GeolocationControllers;
WillBePersistentHeapHashSet<RawPtrWillBeMember<GeolocationController> > m_controllers;
Persistent<GeolocationPosition> m_lastPosition;
bool m_hasError;
String m_errorMessage;
......@@ -89,8 +90,8 @@ private:
};
PermissionState m_permissionState;
typedef PersistentHeapHashSet<Member<Geolocation> > GeolocationSet;
GeolocationSet m_pendingPermissions;
typedef HeapHashSet<Member<Geolocation> > GeolocationSet;
PersistentHeapHashSet<Member<Geolocation> > m_pendingPermissions;
};
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment