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

Side by Side Diff: chrome/browser/media_galleries/fileapi/mtp_device_map_service.cc

Issue 2230203002: chrome: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed accidental components/ change Created 4 years, 4 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 "chrome/browser/media_galleries/fileapi/mtp_device_map_service.h" 5 #include "chrome/browser/media_galleries/fileapi/mtp_device_map_service.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 15 matching lines...) Expand all
26 26
27 void MTPDeviceMapService::RegisterMTPFileSystem( 27 void MTPDeviceMapService::RegisterMTPFileSystem(
28 const base::FilePath::StringType& device_location, 28 const base::FilePath::StringType& device_location,
29 const std::string& filesystem_id, 29 const std::string& filesystem_id,
30 const bool read_only) { 30 const bool read_only) {
31 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 31 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
32 DCHECK(!device_location.empty()); 32 DCHECK(!device_location.empty());
33 DCHECK(!filesystem_id.empty()); 33 DCHECK(!filesystem_id.empty());
34 34
35 const AsyncDelegateKey key = GetAsyncDelegateKey(device_location, read_only); 35 const AsyncDelegateKey key = GetAsyncDelegateKey(device_location, read_only);
36 if (!ContainsKey(mtp_device_usage_map_, key)) { 36 if (!base::ContainsKey(mtp_device_usage_map_, key)) {
37 // Note that this initializes the delegate asynchronously, but since 37 // Note that this initializes the delegate asynchronously, but since
38 // the delegate will only be used from the IO thread, it is guaranteed 38 // the delegate will only be used from the IO thread, it is guaranteed
39 // to be created before use of it expects it to be there. 39 // to be created before use of it expects it to be there.
40 CreateMTPDeviceAsyncDelegate( 40 CreateMTPDeviceAsyncDelegate(
41 device_location, read_only, 41 device_location, read_only,
42 base::Bind(&MTPDeviceMapService::AddAsyncDelegate, 42 base::Bind(&MTPDeviceMapService::AddAsyncDelegate,
43 base::Unretained(this), device_location, read_only)); 43 base::Unretained(this), device_location, read_only));
44 mtp_device_usage_map_[key] = 0; 44 mtp_device_usage_map_[key] = 0;
45 } 45 }
46 46
(...skipping 28 matching lines...) Expand all
75 75
76 void MTPDeviceMapService::AddAsyncDelegate( 76 void MTPDeviceMapService::AddAsyncDelegate(
77 const base::FilePath::StringType& device_location, 77 const base::FilePath::StringType& device_location,
78 const bool read_only, 78 const bool read_only,
79 MTPDeviceAsyncDelegate* delegate) { 79 MTPDeviceAsyncDelegate* delegate) {
80 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 80 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
81 DCHECK(delegate); 81 DCHECK(delegate);
82 DCHECK(!device_location.empty()); 82 DCHECK(!device_location.empty());
83 83
84 const AsyncDelegateKey key = GetAsyncDelegateKey(device_location, read_only); 84 const AsyncDelegateKey key = GetAsyncDelegateKey(device_location, read_only);
85 if (ContainsKey(async_delegate_map_, key)) 85 if (base::ContainsKey(async_delegate_map_, key))
86 return; 86 return;
87 async_delegate_map_[key] = delegate; 87 async_delegate_map_[key] = delegate;
88 } 88 }
89 89
90 void MTPDeviceMapService::RemoveAsyncDelegate( 90 void MTPDeviceMapService::RemoveAsyncDelegate(
91 const base::FilePath::StringType& device_location, 91 const base::FilePath::StringType& device_location,
92 const bool read_only) { 92 const bool read_only) {
93 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 93 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
94 DCHECK(!device_location.empty()); 94 DCHECK(!device_location.empty());
95 95
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 ? async_delegate_map_it->second 144 ? async_delegate_map_it->second
145 : NULL; 145 : NULL;
146 } 146 }
147 147
148 MTPDeviceMapService::MTPDeviceMapService() { 148 MTPDeviceMapService::MTPDeviceMapService() {
149 } 149 }
150 150
151 MTPDeviceMapService::~MTPDeviceMapService() { 151 MTPDeviceMapService::~MTPDeviceMapService() {
152 DCHECK(mtp_device_usage_map_.empty()); 152 DCHECK(mtp_device_usage_map_.empty());
153 } 153 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698