OLD | NEW |
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 // Any tasks that communicates with the portable device may take >100ms to | 5 // Any tasks that communicates with the portable device may take >100ms to |
6 // complete. Those tasks should be run on an blocking thread instead of the | 6 // complete. Those tasks should be run on an blocking thread instead of the |
7 // UI thread. | 7 // UI thread. |
8 | 8 |
9 #include "components/storage_monitor/portable_device_watcher_win.h" | 9 #include "components/storage_monitor/portable_device_watcher_win.h" |
10 | 10 |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 void PortableDeviceWatcherWin::OnDidHandleDeviceAttachEvent( | 619 void PortableDeviceWatcherWin::OnDidHandleDeviceAttachEvent( |
620 const DeviceDetails* device_details, const bool result) { | 620 const DeviceDetails* device_details, const bool result) { |
621 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 621 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
622 DCHECK(device_details); | 622 DCHECK(device_details); |
623 if (!result) | 623 if (!result) |
624 return; | 624 return; |
625 | 625 |
626 const StorageObjects& storage_objects = device_details->storage_objects; | 626 const StorageObjects& storage_objects = device_details->storage_objects; |
627 const base::string16& name = device_details->name; | 627 const base::string16& name = device_details->name; |
628 const base::string16& location = device_details->location; | 628 const base::string16& location = device_details->location; |
629 DCHECK(!ContainsKey(device_map_, location)); | 629 DCHECK(!base::ContainsKey(device_map_, location)); |
630 for (StorageObjects::const_iterator storage_iter = storage_objects.begin(); | 630 for (StorageObjects::const_iterator storage_iter = storage_objects.begin(); |
631 storage_iter != storage_objects.end(); ++storage_iter) { | 631 storage_iter != storage_objects.end(); ++storage_iter) { |
632 const std::string& storage_id = storage_iter->object_persistent_id; | 632 const std::string& storage_id = storage_iter->object_persistent_id; |
633 DCHECK(!ContainsKey(storage_map_, storage_id)); | 633 DCHECK(!base::ContainsKey(storage_map_, storage_id)); |
634 | 634 |
635 // Keep track of storage id and storage name to see how often we receive | 635 // Keep track of storage id and storage name to see how often we receive |
636 // empty values. | 636 // empty values. |
637 MediaStorageUtil::RecordDeviceInfoHistogram(false, storage_id, name); | 637 MediaStorageUtil::RecordDeviceInfoHistogram(false, storage_id, name); |
638 if (storage_id.empty() || name.empty()) | 638 if (storage_id.empty() || name.empty()) |
639 return; | 639 return; |
640 | 640 |
641 // Device can have several data partitions. Therefore, add the | 641 // Device can have several data partitions. Therefore, add the |
642 // partition identifier to the model name. E.g.: "Nexus 7 (s10001)" | 642 // partition identifier to the model name. E.g.: "Nexus 7 (s10001)" |
643 base::string16 model_name(name + L" (" + | 643 base::string16 model_name(name + L" (" + |
(...skipping 26 matching lines...) Expand all Loading... |
670 if (storage_notifications_) { | 670 if (storage_notifications_) { |
671 storage_notifications_->ProcessDetach( | 671 storage_notifications_->ProcessDetach( |
672 storage_map_iter->second.device_id()); | 672 storage_map_iter->second.device_id()); |
673 } | 673 } |
674 storage_map_.erase(storage_map_iter); | 674 storage_map_.erase(storage_map_iter); |
675 } | 675 } |
676 device_map_.erase(device_iter); | 676 device_map_.erase(device_iter); |
677 } | 677 } |
678 | 678 |
679 } // namespace storage_monitor | 679 } // namespace storage_monitor |
OLD | NEW |