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

Side by Side Diff: content/browser/geolocation/geolocation_provider.cc

Issue 14335017: content: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/geolocation/geolocation_provider.h" 5 #include "content/browser/geolocation/geolocation_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 GeolocationProvider::~GeolocationProvider() { 90 GeolocationProvider::~GeolocationProvider() {
91 // All observers should have unregistered before this singleton is destructed. 91 // All observers should have unregistered before this singleton is destructed.
92 DCHECK(observers_.empty()); 92 DCHECK(observers_.empty());
93 Stop(); 93 Stop();
94 DCHECK(!arbitrator_); 94 DCHECK(!arbitrator_);
95 } 95 }
96 96
97 bool GeolocationProvider::OnGeolocationThread() const { 97 bool GeolocationProvider::OnGeolocationThread() const {
98 return MessageLoop::current() == message_loop(); 98 return base::MessageLoop::current() == message_loop();
99 } 99 }
100 100
101 void GeolocationProvider::OnClientsChanged() { 101 void GeolocationProvider::OnClientsChanged() {
102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
103 base::Closure task; 103 base::Closure task;
104 if (observers_.empty() && callbacks_.empty()) { 104 if (observers_.empty() && callbacks_.empty()) {
105 DCHECK(IsRunning()); 105 DCHECK(IsRunning());
106 // We have no more observers, so we clear the cached geoposition so that 106 // We have no more observers, so we clear the cached geoposition so that
107 // when the next observer is added we will not provide a stale position. 107 // when the next observer is added we will not provide a stale position.
108 position_ = Geoposition(); 108 position_ = Geoposition();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 DCHECK(OnGeolocationThread()); 193 DCHECK(OnGeolocationThread());
194 delete arbitrator_; 194 delete arbitrator_;
195 arbitrator_ = NULL; 195 arbitrator_ = NULL;
196 } 196 }
197 197
198 GeolocationArbitrator* GeolocationProvider::CreateArbitrator() { 198 GeolocationArbitrator* GeolocationProvider::CreateArbitrator() {
199 return new GeolocationArbitratorImpl(this); 199 return new GeolocationArbitratorImpl(this);
200 } 200 }
201 201
202 } // namespace content 202 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698