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

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

Issue 2913323003: Settings: Network: Merge Tether networks into Mobile subpage (Closed)
Patch Set: Fix browser_tests 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
« no previous file with comments | « chrome/app/settings_strings.grdp ('k') | chrome/browser/chromeos/tether/tether_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..9f1dc318a641ab66f0916b8c0e510c44be61a8b1 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() {}
@@ -230,6 +236,8 @@ TetherService::GetTetherTechnologyState() {
void TetherService::OnBluetoothAdapterFetched(
scoped_refptr<device::BluetoothAdapter> adapter) {
+ if (shut_down_)
+ return;
adapter_ = adapter;
adapter_->AddObserver(this);
UpdateTetherTechnologyState();
« no previous file with comments | « chrome/app/settings_strings.grdp ('k') | chrome/browser/chromeos/tether/tether_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698