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

Side by Side Diff: device/bluetooth/bluetooth_task_manager_win.cc

Issue 2423793002: Remove usage of FOR_EACH_OBSERVER macro in device/ (Closed)
Patch Set: rebase Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "device/bluetooth/bluetooth_task_manager_win.h" 5 #include "device/bluetooth/bluetooth_task_manager_win.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <winsock2.h> 8 #include <winsock2.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 // Log the message 354 // Log the message
355 if (win32_error == 0) 355 if (win32_error == 0)
356 LOG(WARNING) << message; 356 LOG(WARNING) << message;
357 else 357 else
358 LOG(WARNING) << message << ": " 358 LOG(WARNING) << message << ": "
359 << logging::SystemErrorCodeToString(win32_error); 359 << logging::SystemErrorCodeToString(win32_error);
360 } 360 }
361 361
362 void BluetoothTaskManagerWin::OnAdapterStateChanged(const AdapterState* state) { 362 void BluetoothTaskManagerWin::OnAdapterStateChanged(const AdapterState* state) {
363 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); 363 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
364 FOR_EACH_OBSERVER(BluetoothTaskManagerWin::Observer, observers_, 364 for (auto& observer : observers_)
365 AdapterStateChanged(*state)); 365 observer.AdapterStateChanged(*state);
366 } 366 }
367 367
368 void BluetoothTaskManagerWin::OnDiscoveryStarted(bool success) { 368 void BluetoothTaskManagerWin::OnDiscoveryStarted(bool success) {
369 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); 369 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
370 FOR_EACH_OBSERVER(BluetoothTaskManagerWin::Observer, observers_, 370 for (auto& observer : observers_)
371 DiscoveryStarted(success)); 371 observer.DiscoveryStarted(success);
372 } 372 }
373 373
374 void BluetoothTaskManagerWin::OnDiscoveryStopped() { 374 void BluetoothTaskManagerWin::OnDiscoveryStopped() {
375 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); 375 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
376 FOR_EACH_OBSERVER(BluetoothTaskManagerWin::Observer, observers_, 376 for (auto& observer : observers_)
377 DiscoveryStopped()); 377 observer.DiscoveryStopped();
378 } 378 }
379 379
380 void BluetoothTaskManagerWin::OnDevicesPolled( 380 void BluetoothTaskManagerWin::OnDevicesPolled(
381 const ScopedVector<DeviceState>* devices) { 381 const ScopedVector<DeviceState>* devices) {
382 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); 382 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
383 FOR_EACH_OBSERVER( 383 for (auto& observer : observers_)
384 BluetoothTaskManagerWin::Observer, observers_, DevicesPolled(*devices)); 384 observer.DevicesPolled(*devices);
385 } 385 }
386 386
387 void BluetoothTaskManagerWin::PollAdapter() { 387 void BluetoothTaskManagerWin::PollAdapter() {
388 DCHECK(bluetooth_task_runner_->RunsTasksOnCurrentThread()); 388 DCHECK(bluetooth_task_runner_->RunsTasksOnCurrentThread());
389 389
390 // Skips updating the adapter info if the adapter is in discovery mode. 390 // Skips updating the adapter info if the adapter is in discovery mode.
391 if (!discovering_) { 391 if (!discovering_) {
392 const BLUETOOTH_FIND_RADIO_PARAMS adapter_param = 392 const BLUETOOTH_FIND_RADIO_PARAMS adapter_param =
393 { sizeof(BLUETOOTH_FIND_RADIO_PARAMS) }; 393 { sizeof(BLUETOOTH_FIND_RADIO_PARAMS) };
394 HANDLE temp_adapter_handle; 394 HANDLE temp_adapter_handle;
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 void BluetoothTaskManagerWin::PostUnregisterGattCharacteristicValueChangedEvent( 1034 void BluetoothTaskManagerWin::PostUnregisterGattCharacteristicValueChangedEvent(
1035 PVOID event_handle) { 1035 PVOID event_handle) {
1036 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); 1036 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
1037 bluetooth_task_runner_->PostTask( 1037 bluetooth_task_runner_->PostTask(
1038 FROM_HERE, base::Bind(&BluetoothTaskManagerWin:: 1038 FROM_HERE, base::Bind(&BluetoothTaskManagerWin::
1039 UnregisterGattCharacteristicValueChangedEvent, 1039 UnregisterGattCharacteristicValueChangedEvent,
1040 this, event_handle)); 1040 this, event_handle));
1041 } 1041 }
1042 1042
1043 } // namespace device 1043 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_adapter_win.cc ('k') | device/bluetooth/bluez/bluetooth_adapter_bluez.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698