OLD | NEW |
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 "base/path_service.h" | 5 #include "base/path_service.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // moot, but we should keep this in mind for the future. | 180 // moot, but we should keep this in mind for the future. |
181 // static | 181 // static |
182 bool PathService::Get(int key, FilePath* result) { | 182 bool PathService::Get(int key, FilePath* result) { |
183 PathData* path_data = GetPathData(); | 183 PathData* path_data = GetPathData(); |
184 DCHECK(path_data); | 184 DCHECK(path_data); |
185 DCHECK(result); | 185 DCHECK(result); |
186 DCHECK_GE(key, base::DIR_CURRENT); | 186 DCHECK_GE(key, base::DIR_CURRENT); |
187 | 187 |
188 // special case the current directory because it can never be cached | 188 // special case the current directory because it can never be cached |
189 if (key == base::DIR_CURRENT) | 189 if (key == base::DIR_CURRENT) |
190 return file_util::GetCurrentDirectory(result); | 190 return base::GetCurrentDirectory(result); |
191 | 191 |
192 Provider* provider = NULL; | 192 Provider* provider = NULL; |
193 { | 193 { |
194 base::AutoLock scoped_lock(path_data->lock); | 194 base::AutoLock scoped_lock(path_data->lock); |
195 if (LockedGetFromCache(key, path_data, result)) | 195 if (LockedGetFromCache(key, path_data, result)) |
196 return true; | 196 return true; |
197 | 197 |
198 if (LockedGetFromOverrides(key, path_data, result)) | 198 if (LockedGetFromOverrides(key, path_data, result)) |
199 return true; | 199 return true; |
200 | 200 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 327 |
328 // static | 328 // static |
329 void PathService::DisableCache() { | 329 void PathService::DisableCache() { |
330 PathData* path_data = GetPathData(); | 330 PathData* path_data = GetPathData(); |
331 DCHECK(path_data); | 331 DCHECK(path_data); |
332 | 332 |
333 base::AutoLock scoped_lock(path_data->lock); | 333 base::AutoLock scoped_lock(path_data->lock); |
334 path_data->cache.clear(); | 334 path_data->cache.clear(); |
335 path_data->cache_disabled = true; | 335 path_data->cache_disabled = true; |
336 } | 336 } |
OLD | NEW |