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

Side by Side Diff: third_party/WebKit/Source/modules/geolocation/Geolocation.cpp

Issue 2657443005: Migrate WTF::HashSet::add() to ::insert() [part 1 of N] (Closed)
Patch Set: Created 3 years, 10 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) 2008, 2009, 2010, 2011 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009 Torch Mobile, Inc. 3 * Copyright (C) 2009 Torch Mobile, Inc.
4 * Copyright 2010, The Android Open Source Project 4 * Copyright 2010, The Android Open Source Project
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 void Geolocation::getCurrentPosition(PositionCallback* successCallback, 164 void Geolocation::getCurrentPosition(PositionCallback* successCallback,
165 PositionErrorCallback* errorCallback, 165 PositionErrorCallback* errorCallback,
166 const PositionOptions& options) { 166 const PositionOptions& options) {
167 if (!frame()) 167 if (!frame())
168 return; 168 return;
169 169
170 GeoNotifier* notifier = 170 GeoNotifier* notifier =
171 GeoNotifier::create(this, successCallback, errorCallback, options); 171 GeoNotifier::create(this, successCallback, errorCallback, options);
172 startRequest(notifier); 172 startRequest(notifier);
173 173
174 m_oneShots.add(notifier); 174 m_oneShots.insert(notifier);
175 } 175 }
176 176
177 int Geolocation::watchPosition(PositionCallback* successCallback, 177 int Geolocation::watchPosition(PositionCallback* successCallback,
178 PositionErrorCallback* errorCallback, 178 PositionErrorCallback* errorCallback,
179 const PositionOptions& options) { 179 const PositionOptions& options) {
180 if (!frame()) 180 if (!frame())
181 return 0; 181 return 0;
182 182
183 GeoNotifier* notifier = 183 GeoNotifier* notifier =
184 GeoNotifier::create(this, successCallback, errorCallback, options); 184 GeoNotifier::create(this, successCallback, errorCallback, options);
(...skipping 24 matching lines...) Expand all
209 if (isDenied()) 209 if (isDenied())
210 notifier->setFatalError(PositionError::create( 210 notifier->setFatalError(PositionError::create(
211 PositionError::kPermissionDenied, permissionDeniedErrorMessage)); 211 PositionError::kPermissionDenied, permissionDeniedErrorMessage));
212 else if (haveSuitableCachedPosition(notifier->options())) 212 else if (haveSuitableCachedPosition(notifier->options()))
213 notifier->setUseCachedPosition(); 213 notifier->setUseCachedPosition();
214 else if (!notifier->options().timeout()) 214 else if (!notifier->options().timeout())
215 notifier->startTimer(); 215 notifier->startTimer();
216 else if (!isAllowed()) { 216 else if (!isAllowed()) {
217 // If we don't yet have permission, request for permission before calling 217 // If we don't yet have permission, request for permission before calling
218 // startUpdating() 218 // startUpdating()
219 m_pendingForPermissionNotifiers.add(notifier); 219 m_pendingForPermissionNotifiers.insert(notifier);
220 requestPermission(); 220 requestPermission();
221 } else { 221 } else {
222 startUpdating(notifier); 222 startUpdating(notifier);
223 notifier->startTimer(); 223 notifier->startTimer();
224 } 224 }
225 } 225 }
226 226
227 void Geolocation::fatalErrorOccurred(GeoNotifier* notifier) { 227 void Geolocation::fatalErrorOccurred(GeoNotifier* notifier) {
228 // This request has failed fatally. Remove it from our lists. 228 // This request has failed fatally. Remove it from our lists.
229 m_oneShots.remove(notifier); 229 m_oneShots.remove(notifier);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 cached->push_back(notifier); 368 cached->push_back(notifier);
369 } else 369 } else
370 nonCached.push_back(notifier); 370 nonCached.push_back(notifier);
371 } 371 }
372 notifiers.swap(nonCached); 372 notifiers.swap(nonCached);
373 } 373 }
374 374
375 void Geolocation::copyToSet(const GeoNotifierVector& src, 375 void Geolocation::copyToSet(const GeoNotifierVector& src,
376 GeoNotifierSet& dest) { 376 GeoNotifierSet& dest) {
377 for (GeoNotifier* notifier : src) 377 for (GeoNotifier* notifier : src)
378 dest.add(notifier); 378 dest.insert(notifier);
379 } 379 }
380 380
381 void Geolocation::handleError(PositionError* error) { 381 void Geolocation::handleError(PositionError* error) {
382 DCHECK(error); 382 DCHECK(error);
383 383
384 GeoNotifierVector oneShotsCopy; 384 GeoNotifierVector oneShotsCopy;
385 copyToVector(m_oneShots, oneShotsCopy); 385 copyToVector(m_oneShots, oneShotsCopy);
386 386
387 GeoNotifierVector watchersCopy; 387 GeoNotifierVector watchersCopy;
388 m_watchers.getNotifiersVector(watchersCopy); 388 m_watchers.getNotifiersVector(watchersCopy);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // be called. In that case, blink has already shut down so do nothing. 548 // be called. In that case, blink has already shut down so do nothing.
549 // 549 //
550 // TODO(sammc): Remove this once renderer shutdown is no longer graceful. 550 // TODO(sammc): Remove this once renderer shutdown is no longer graceful.
551 if (!Platform::current()) 551 if (!Platform::current())
552 return; 552 return;
553 553
554 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED); 554 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED);
555 } 555 }
556 556
557 } // namespace blink 557 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/Response.cpp ('k') | third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698