mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 908031 - Remove Geolocation::PendingRequest. r=jdm
This commit is contained in:
parent
e005e6184b
commit
2c9908315e
@ -1011,26 +1011,11 @@ NS_INTERFACE_MAP_END
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(Geolocation)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(Geolocation)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(Geolocation)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Geolocation)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCachedPosition)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
tmp->mPendingRequests.Clear();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPendingCallbacks)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWatchingCallbacks)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Geolocation)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCachedPosition)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
for (uint32_t i = 0; i < tmp->mPendingRequests.Length(); ++i)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPendingRequests[i].request)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPendingCallbacks)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWatchingCallbacks)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(Geolocation)
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_4(Geolocation,
|
||||
mCachedPosition,
|
||||
mPendingCallbacks,
|
||||
mWatchingCallbacks,
|
||||
mPendingRequests)
|
||||
|
||||
Geolocation::Geolocation()
|
||||
: mLastWatchId(0)
|
||||
@ -1248,8 +1233,7 @@ Geolocation::GetCurrentPosition(GeoPositionCallback& callback,
|
||||
}
|
||||
|
||||
if (sGeoInitPending) {
|
||||
PendingRequest req = { request, PendingRequest::GetCurrentPosition };
|
||||
mPendingRequests.AppendElement(req);
|
||||
mPendingRequests.AppendElement(request);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1342,8 +1326,7 @@ Geolocation::WatchPosition(GeoPositionCallback& aCallback,
|
||||
}
|
||||
|
||||
if (sGeoInitPending) {
|
||||
PendingRequest req = { request, PendingRequest::WatchPosition };
|
||||
mPendingRequests.AppendElement(req);
|
||||
mPendingRequests.AppendElement(request);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1387,9 +1370,9 @@ Geolocation::ClearWatch(int32_t aWatchId)
|
||||
// make sure we also search through the pending requests lists for
|
||||
// watches to clear...
|
||||
for (uint32_t i = 0, length = mPendingRequests.Length(); i < length; ++i) {
|
||||
if ((mPendingRequests[i].type == PendingRequest::WatchPosition) &&
|
||||
(mPendingRequests[i].request->WatchId() == aWatchId)) {
|
||||
mPendingRequests[i].request->Shutdown();
|
||||
if (mPendingRequests[i]->IsWatch() &&
|
||||
(mPendingRequests[i]->WatchId() == aWatchId)) {
|
||||
mPendingRequests[i]->Shutdown();
|
||||
mPendingRequests.RemoveElementAt(i);
|
||||
break;
|
||||
}
|
||||
@ -1402,14 +1385,10 @@ void
|
||||
Geolocation::ServiceReady()
|
||||
{
|
||||
for (uint32_t length = mPendingRequests.Length(); length > 0; --length) {
|
||||
switch (mPendingRequests[0].type) {
|
||||
case PendingRequest::GetCurrentPosition:
|
||||
GetCurrentPositionReady(mPendingRequests[0].request);
|
||||
break;
|
||||
|
||||
case PendingRequest::WatchPosition:
|
||||
WatchPositionReady(mPendingRequests[0].request);
|
||||
break;
|
||||
if (mPendingRequests[0]->IsWatch()) {
|
||||
WatchPositionReady(mPendingRequests[0]);
|
||||
} else {
|
||||
GetCurrentPositionReady(mPendingRequests[0]);
|
||||
}
|
||||
|
||||
mPendingRequests.RemoveElementAt(0);
|
||||
|
@ -209,18 +209,8 @@ private:
|
||||
// Watch ID
|
||||
uint32_t mLastWatchId;
|
||||
|
||||
// Pending requests are used when the service is not ready:
|
||||
class PendingRequest
|
||||
{
|
||||
public:
|
||||
nsRefPtr<nsGeolocationRequest> request;
|
||||
enum {
|
||||
GetCurrentPosition,
|
||||
WatchPosition
|
||||
} type;
|
||||
};
|
||||
|
||||
nsTArray<PendingRequest> mPendingRequests;
|
||||
// Pending requests are used when the service is not ready
|
||||
nsTArray<nsRefPtr<nsGeolocationRequest> > mPendingRequests;
|
||||
};
|
||||
|
||||
class PositionError MOZ_FINAL : public nsIDOMGeoPositionError,
|
||||
|
Loading…
Reference in New Issue
Block a user