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

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

Issue 5743005: Revert 68893 - Consider PlatformThread::Join() to be blocking IO.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years 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
« no previous file with comments | « chrome/browser/browser_process_impl.cc ('k') | chrome/browser/printing/printer_query.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/geolocation/geolocation_provider.h" 5 #include "chrome/browser/geolocation/geolocation_provider.h"
6 6
7 #include "base/singleton.h" 7 #include "base/singleton.h"
8 #include "base/thread_restrictions.h"
9 #include "chrome/browser/geolocation/location_arbitrator.h" 8 #include "chrome/browser/geolocation/location_arbitrator.h"
10 9
11 // This class is guaranteed to outlive its internal thread, so ref counting 10 // This class is guaranteed to outlive its internal thread, so ref counting
12 // is not required. 11 // is not required.
13 DISABLE_RUNNABLE_METHOD_REFCOUNT(GeolocationProvider); 12 DISABLE_RUNNABLE_METHOD_REFCOUNT(GeolocationProvider);
14 13
15 GeolocationProvider* GeolocationProvider::GetInstance() { 14 GeolocationProvider* GeolocationProvider::GetInstance() {
16 return Singleton<GeolocationProvider>::get(); 15 return Singleton<GeolocationProvider>::get();
17 } 16 }
18 17
(...skipping 22 matching lines...) Expand all
41 bool GeolocationProvider::RemoveObserver(GeolocationObserver* observer) { 40 bool GeolocationProvider::RemoveObserver(GeolocationObserver* observer) {
42 DCHECK(OnClientThread()); 41 DCHECK(OnClientThread());
43 size_t remove = observers_.erase(observer); 42 size_t remove = observers_.erase(observer);
44 OnObserversChanged(); 43 OnObserversChanged();
45 return remove > 0; 44 return remove > 0;
46 } 45 }
47 46
48 void GeolocationProvider::OnObserversChanged() { 47 void GeolocationProvider::OnObserversChanged() {
49 DCHECK(OnClientThread()); 48 DCHECK(OnClientThread());
50 if (observers_.empty()) { 49 if (observers_.empty()) {
51 // http://crbug.com/66077: This is a bug. The geolocation thread may
52 // transitively (via other threads it joins) block on long-running tasks /
53 // IO.
54 base::ThreadRestrictions::ScopedAllowIO allow_io;
55 Stop(); 50 Stop();
56 } else { 51 } else {
57 if (!IsRunning()) { 52 if (!IsRunning()) {
58 Start(); 53 Start();
59 if (HasPermissionBeenGranted()) 54 if (HasPermissionBeenGranted())
60 InformProvidersPermissionGranted(most_recent_authorized_frame_); 55 InformProvidersPermissionGranted(most_recent_authorized_frame_);
61 } 56 }
62 // The high accuracy requirement may have changed. 57 // The high accuracy requirement may have changed.
63 Task* task = NewRunnableMethod(this, 58 Task* task = NewRunnableMethod(this,
64 &GeolocationProvider::SetObserverOptions, 59 &GeolocationProvider::SetObserverOptions,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 return most_recent_authorized_frame_.is_valid(); 131 return most_recent_authorized_frame_.is_valid();
137 } 132 }
138 133
139 bool GeolocationProvider::OnClientThread() const { 134 bool GeolocationProvider::OnClientThread() const {
140 return client_loop_->BelongsToCurrentThread(); 135 return client_loop_->BelongsToCurrentThread();
141 } 136 }
142 137
143 bool GeolocationProvider::OnGeolocationThread() const { 138 bool GeolocationProvider::OnGeolocationThread() const {
144 return MessageLoop::current() == message_loop(); 139 return MessageLoop::current() == message_loop();
145 } 140 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_process_impl.cc ('k') | chrome/browser/printing/printer_query.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698