diff options
author | ortuno <ortuno@chromium.org> | 2015-04-06 11:30:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-06 18:36:20 +0000 |
commit | 8a72921779123fbd7a7f756f9683f4df8944ea9d (patch) | |
tree | 1dc4a267cd9fec3de8ee7348ccaf64bafab5617f | |
parent | c4d260fa056a03e61d452eea43ee35714f187729 (diff) | |
download | chromium_src-8a72921779123fbd7a7f756f9683f4df8944ea9d.zip chromium_src-8a72921779123fbd7a7f756f9683f4df8944ea9d.tar.gz chromium_src-8a72921779123fbd7a7f756f9683f4df8944ea9d.tar.bz2 |
bluetooth: Move requestDevice() to UI thread.
BluetoothAdapter is not thread safe, this change moves the requestDevice() call to it onto the UI thread.
BUG=420284
Review URL: https://codereview.chromium.org/1058373002
Cr-Commit-Position: refs/heads/master@{#323919}
-rw-r--r-- | content/browser/bluetooth/bluetooth_dispatcher_host.cc | 10 | ||||
-rw-r--r-- | content/browser/bluetooth/bluetooth_dispatcher_host.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/content/browser/bluetooth/bluetooth_dispatcher_host.cc b/content/browser/bluetooth/bluetooth_dispatcher_host.cc index c054e14..2af1e89 100644 --- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc +++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc @@ -66,6 +66,16 @@ void BluetoothDispatcherHost::set_adapter( void BluetoothDispatcherHost::OnRequestDevice(int thread_id, int request_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); + BrowserThread::PostTask(BrowserThread::UI, + FROM_HERE, + base::Bind( + &BluetoothDispatcherHost::OnRequestDeviceOnUI, + this, thread_id, request_id)); +} + +void BluetoothDispatcherHost::OnRequestDeviceOnUI(int thread_id, + int request_id) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); // TODO(scheib) Extend this very simple mock implementation by using // device/bluetooth/test mock adapter and related classes. switch (bluetooth_mock_data_set_) { diff --git a/content/browser/bluetooth/bluetooth_dispatcher_host.h b/content/browser/bluetooth/bluetooth_dispatcher_host.h index 8d96af7..d5f8c2b 100644 --- a/content/browser/bluetooth/bluetooth_dispatcher_host.h +++ b/content/browser/bluetooth/bluetooth_dispatcher_host.h @@ -38,6 +38,7 @@ class BluetoothDispatcherHost : public BrowserMessageFilter, // IPC Handlers, see definitions in bluetooth_messages.h. void OnRequestDevice(int thread_id, int request_id); + void OnRequestDeviceOnUI(int thread_id, int request_id); void OnSetBluetoothMockDataSetForTesting(const std::string& name); // A BluetoothAdapter instance representing an adapter of the system. |