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

Side by Side Diff: ui/events/ozone/device/device_manager_manual.cc

Issue 2862673002: Use constexpr TaskTraits constructor in ui. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/events/ozone/device/device_manager_manual.h" 5 #include "ui/events/ozone/device/device_manager_manual.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file_enumerator.h" 9 #include "base/files/file_enumerator.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 base::Bind(&DeviceManagerManual::OnWatcherEvent, 57 base::Bind(&DeviceManagerManual::OnWatcherEvent,
58 weak_ptr_factory_.GetWeakPtr()))) { 58 weak_ptr_factory_.GetWeakPtr()))) {
59 LOG(ERROR) << "Failed to start FilePathWatcher"; 59 LOG(ERROR) << "Failed to start FilePathWatcher";
60 } 60 }
61 } 61 }
62 62
63 void DeviceManagerManual::InitiateScanDevices() { 63 void DeviceManagerManual::InitiateScanDevices() {
64 std::vector<base::FilePath>* result = new std::vector<base::FilePath>(); 64 std::vector<base::FilePath>* result = new std::vector<base::FilePath>();
65 base::PostTaskWithTraitsAndReply( 65 base::PostTaskWithTraitsAndReply(
66 FROM_HERE, 66 FROM_HERE,
67 base::TaskTraits() 67 {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
68 .WithShutdownBehavior(
69 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
70 .MayBlock(),
71 base::Bind(&ScanDevicesOnWorkerThread, result), 68 base::Bind(&ScanDevicesOnWorkerThread, result),
72 base::Bind(&DeviceManagerManual::OnDevicesScanned, 69 base::Bind(&DeviceManagerManual::OnDevicesScanned,
73 weak_ptr_factory_.GetWeakPtr(), base::Owned(result))); 70 weak_ptr_factory_.GetWeakPtr(), base::Owned(result)));
74 } 71 }
75 72
76 void DeviceManagerManual::OnDevicesScanned( 73 void DeviceManagerManual::OnDevicesScanned(
77 std::vector<base::FilePath>* result) { 74 std::vector<base::FilePath>* result) {
78 std::set<base::FilePath> new_devices; 75 std::set<base::FilePath> new_devices;
79 76
80 // Reported newly added devices. 77 // Reported newly added devices.
(...skipping 26 matching lines...) Expand all
107 void DeviceManagerManual::OnWatcherEvent(const base::FilePath& path, 104 void DeviceManagerManual::OnWatcherEvent(const base::FilePath& path,
108 bool error) { 105 bool error) {
109 // We need to restart watching if there's an error. 106 // We need to restart watching if there's an error.
110 if (error) { 107 if (error) {
111 StartWatching(); 108 StartWatching();
112 } 109 }
113 InitiateScanDevices(); 110 InitiateScanDevices();
114 } 111 }
115 112
116 } // namespace ui 113 } // namespace ui
OLDNEW
« no previous file with comments | « ui/arc/notification/arc_notification_item.cc ('k') | ui/events/ozone/evdev/libgestures_glue/gesture_feedback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698