| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/media_galleries/win/portable_device_map_service.h" | 5 #include "chrome/browser/media_galleries/win/portable_device_map_service.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 device_map_.erase(it); | 51 device_map_.erase(it); |
| 52 } | 52 } |
| 53 | 53 |
| 54 IPortableDevice* PortableDeviceMapService::GetPortableDevice( | 54 IPortableDevice* PortableDeviceMapService::GetPortableDevice( |
| 55 const base::string16& device_location) { | 55 const base::string16& device_location) { |
| 56 base::ThreadRestrictions::AssertIOAllowed(); | 56 base::ThreadRestrictions::AssertIOAllowed(); |
| 57 DCHECK(!device_location.empty()); | 57 DCHECK(!device_location.empty()); |
| 58 base::AutoLock lock(lock_); | 58 base::AutoLock lock(lock_); |
| 59 PortableDeviceMap::const_iterator it = device_map_.find(device_location); | 59 PortableDeviceMap::const_iterator it = device_map_.find(device_location); |
| 60 return (it == device_map_.end() || it->second.scheduled_to_delete) ? | 60 return (it == device_map_.end() || it->second.scheduled_to_delete) ? |
| 61 NULL : it->second.portable_device.get(); | 61 NULL : it->second.portable_device.Get(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 PortableDeviceMapService::PortableDeviceInfo::PortableDeviceInfo() | 64 PortableDeviceMapService::PortableDeviceInfo::PortableDeviceInfo() |
| 65 : scheduled_to_delete(false) { | 65 : scheduled_to_delete(false) { |
| 66 } | 66 } |
| 67 | 67 |
| 68 PortableDeviceMapService::PortableDeviceInfo::PortableDeviceInfo( | 68 PortableDeviceMapService::PortableDeviceInfo::PortableDeviceInfo( |
| 69 IPortableDevice* device) | 69 IPortableDevice* device) |
| 70 : portable_device(device), | 70 : portable_device(device), |
| 71 scheduled_to_delete(false) { | 71 scheduled_to_delete(false) { |
| 72 } | 72 } |
| 73 | 73 |
| 74 PortableDeviceMapService::PortableDeviceInfo::~PortableDeviceInfo() { | 74 PortableDeviceMapService::PortableDeviceInfo::~PortableDeviceInfo() { |
| 75 } | 75 } |
| 76 | 76 |
| 77 PortableDeviceMapService::PortableDeviceMapService() { | 77 PortableDeviceMapService::PortableDeviceMapService() { |
| 78 } | 78 } |
| 79 | 79 |
| 80 PortableDeviceMapService::~PortableDeviceMapService() { | 80 PortableDeviceMapService::~PortableDeviceMapService() { |
| 81 } | 81 } |
| OLD | NEW |