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

Side by Side Diff: extensions/browser/api/hid/hid_device_manager.cc

Issue 597853003: extensions: Explicitly ignore result of CalledOnValidThread(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding DCHECK to thread_checker_.CalledOnValidThread() Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "extensions/browser/api/hid/hid_device_manager.h" 5 #include "extensions/browser/api/hid/hid_device_manager.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 u2f_filter.SetUsagePage(0xF1D0); 136 u2f_filter.SetUsagePage(0xF1D0);
137 if (u2f_filter.Matches(device_info)) { 137 if (u2f_filter.Matches(device_info)) {
138 return true; 138 return true;
139 } 139 }
140 } 140 }
141 141
142 return false; 142 return false;
143 } 143 }
144 144
145 void HidDeviceManager::UpdateDevices() { 145 void HidDeviceManager::UpdateDevices() {
146 thread_checker_.CalledOnValidThread(); 146 DCHECK(thread_checker_.CalledOnValidThread());
147 HidService* hid_service = device::DeviceClient::Get()->GetHidService(); 147 HidService* hid_service = device::DeviceClient::Get()->GetHidService();
148 DCHECK(hid_service); 148 DCHECK(hid_service);
149 149
150 std::vector<device::HidDeviceInfo> devices; 150 std::vector<device::HidDeviceInfo> devices;
151 hid_service->GetDevices(&devices); 151 hid_service->GetDevices(&devices);
152 152
153 // Build an updated bidi mapping between resource ID and underlying device ID. 153 // Build an updated bidi mapping between resource ID and underlying device ID.
154 DeviceIdToResourceIdMap new_resource_ids; 154 DeviceIdToResourceIdMap new_resource_ids;
155 ResourceIdToDeviceIdMap new_device_ids; 155 ResourceIdToDeviceIdMap new_device_ids;
156 for (std::vector<device::HidDeviceInfo>::const_iterator iter = 156 for (std::vector<device::HidDeviceInfo>::const_iterator iter =
(...skipping 11 matching lines...) Expand all
168 new_id = next_resource_id_++; 168 new_id = next_resource_id_++;
169 } 169 }
170 new_resource_ids[device_info.device_id] = new_id; 170 new_resource_ids[device_info.device_id] = new_id;
171 new_device_ids[new_id] = device_info.device_id; 171 new_device_ids[new_id] = device_info.device_id;
172 } 172 }
173 device_ids_.swap(new_device_ids); 173 device_ids_.swap(new_device_ids);
174 resource_ids_.swap(new_resource_ids); 174 resource_ids_.swap(new_resource_ids);
175 } 175 }
176 176
177 } // namespace extensions 177 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698