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

Unified Diff: chrome/browser/chromeos/tether/tether_service.cc

Issue 2913323003: Settings: Network: Merge Tether networks into Mobile subpage (Closed)
Patch Set: Rebase Created 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/tether/tether_service.cc
diff --git a/chrome/browser/chromeos/tether/tether_service.cc b/chrome/browser/chromeos/tether/tether_service.cc
index 797e978e9493975084f819dd189998e74be0db0e..595d087d8dbf16c4adacdd67395a3f7dd1526d97 100644
--- a/chrome/browser/chromeos/tether/tether_service.cc
+++ b/chrome/browser/chromeos/tether/tether_service.cc
@@ -8,6 +8,7 @@
#include "base/command_line.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/chromeos/net/tether_notification_presenter.h"
#include "chrome/browser/chromeos/tether/tether_service_factory.h"
#include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h"
@@ -69,9 +70,14 @@ TetherService::TetherService(
base::Bind(&TetherService::OnPrefsChanged,
weak_ptr_factory_.GetWeakPtr()));
- device::BluetoothAdapterFactory::GetAdapter(
- base::Bind(&TetherService::OnBluetoothAdapterFetched,
- weak_ptr_factory_.GetWeakPtr()));
+ // GetAdapter may call OnBluetoothAdapterFetched immediately which can cause
+ // problems with the Fake implementation since the class is not fully
+ // constructed yet. Post the GetAdapter call to avoid this.
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE,
+ base::Bind(device::BluetoothAdapterFactory::GetAdapter,
+ base::Bind(&TetherService::OnBluetoothAdapterFetched,
+ weak_ptr_factory_.GetWeakPtr())));
}
TetherService::~TetherService() {}

Powered by Google App Engine
This is Rietveld 408576698