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

Unified Diff: content/browser/geolocation/mock_location_provider.cc

Issue 1159623009: content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test build fix. Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/geolocation/mock_location_provider.cc
diff --git a/content/browser/geolocation/mock_location_provider.cc b/content/browser/geolocation/mock_location_provider.cc
index 2953ba1be174919df2da917b7ef262da902451ef..0bb760f06b165e1723976159f5908d472ded10a0 100644
--- a/content/browser/geolocation/mock_location_provider.cc
+++ b/content/browser/geolocation/mock_location_provider.cc
@@ -10,10 +10,10 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/compiler_specific.h"
+#include "base/location.h"
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
-#include "base/message_loop/message_loop.h"
-#include "base/message_loop/message_loop_proxy.h"
+#include "base/thread_task_runner_handle.h"
namespace content {
MockLocationProvider* MockLocationProvider::instance_ = NULL;
@@ -22,7 +22,7 @@ MockLocationProvider::MockLocationProvider(MockLocationProvider** self_ref)
: state_(STOPPED),
is_permission_granted_(false),
self_ref_(self_ref),
- provider_loop_(base::MessageLoopProxy::current()) {
+ provider_task_runner_(base::ThreadTaskRunnerHandle::Get()) {
CHECK(self_ref_);
CHECK(*self_ref_ == NULL);
*self_ref_ = this;
@@ -34,16 +34,15 @@ MockLocationProvider::~MockLocationProvider() {
}
void MockLocationProvider::HandlePositionChanged(const Geoposition& position) {
- if (provider_loop_->BelongsToCurrentThread()) {
+ if (provider_task_runner_->BelongsToCurrentThread()) {
// The location arbitrator unit tests rely on this method running
// synchronously.
position_ = position;
NotifyCallback(position_);
} else {
- provider_loop_->PostTask(
- FROM_HERE,
- base::Bind(&MockLocationProvider::HandlePositionChanged,
- base::Unretained(this), position));
+ provider_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&MockLocationProvider::HandlePositionChanged,
+ base::Unretained(this), position));
}
}
@@ -104,11 +103,9 @@ class AutoMockLocationProvider : public MockLocationProvider {
void UpdateListenersIfNeeded() {
if (!listeners_updated_) {
listeners_updated_ = true;
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&MockLocationProvider::HandlePositionChanged,
- weak_factory_.GetWeakPtr(),
- position_));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&MockLocationProvider::HandlePositionChanged,
+ weak_factory_.GetWeakPtr(), position_));
}
}
« no previous file with comments | « content/browser/geolocation/mock_location_provider.h ('k') | content/browser/geolocation/network_location_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698