Chromium Code Reviews| Index: base/path_service.cc |
| diff --git a/base/path_service.cc b/base/path_service.cc |
| index a3b882c2a9e8f76f668ed71b8549706059aecf51..3dbeed54eb3bb165d5e56a176c6b7d14856c6aa4 100644 |
| --- a/base/path_service.cc |
| +++ b/base/path_service.cc |
| @@ -221,11 +221,13 @@ bool PathService::Get(int key, FilePath* result) { |
| return true; |
| } |
| +// static |
|
jar (doing other things)
2012/09/15 02:01:20
I personally like this style... but it is a gratui
pastarmovj
2012/09/17 16:30:40
Actually the file is already mixed style (see line
|
| bool PathService::Override(int key, const FilePath& path) { |
| // Just call the full function with true for the value of |create|. |
| return OverrideAndCreateIfNeeded(key, path, true); |
| } |
| +// static |
| bool PathService::OverrideAndCreateIfNeeded(int key, |
| const FilePath& path, |
| bool create) { |
| @@ -264,6 +266,26 @@ bool PathService::OverrideAndCreateIfNeeded(int key, |
| return true; |
| } |
| +// static |
| +bool PathService::RemoveOverride(int key) { |
| + PathData* path_data = GetPathData(); |
| + DCHECK(path_data); |
| + |
| + base::AutoLock scoped_lock(path_data->lock); |
| + |
| + if (path_data->overrides.find(key) == path_data->overrides.end()) |
| + return false; |
| + |
| + // Clear the cache now. Some of its entries could have depended on the value |
| + // we are going to remove, and are now out of sync. |
| + path_data->cache.clear(); |
| + |
| + path_data->overrides.erase(key); |
| + |
| + return true; |
| +} |
| + |
| +// static |
| void PathService::RegisterProvider(ProviderFunc func, int key_start, |
| int key_end) { |
| PathData* path_data = GetPathData(); |