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

Side by Side Diff: base/path_service.cc

Issue 2691573003: base: Remove auto raw pointer deduction. (Closed)
Patch Set: Created 3 years, 10 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 "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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 providers = &base_provider_mac; 122 providers = &base_provider_mac;
123 #elif defined(OS_ANDROID) 123 #elif defined(OS_ANDROID)
124 providers = &base_provider_android; 124 providers = &base_provider_android;
125 #elif defined(OS_POSIX) 125 #elif defined(OS_POSIX)
126 providers = &base_provider_posix; 126 providers = &base_provider_posix;
127 #endif 127 #endif
128 } 128 }
129 }; 129 };
130 130
131 static PathData* GetPathData() { 131 static PathData* GetPathData() {
132 static auto path_data = new PathData(); 132 static auto* path_data = new PathData();
133 return path_data; 133 return path_data;
134 } 134 }
135 135
136 // Tries to find |key| in the cache. |path_data| should be locked by the caller! 136 // Tries to find |key| in the cache. |path_data| should be locked by the caller!
137 bool LockedGetFromCache(int key, const PathData* path_data, FilePath* result) { 137 bool LockedGetFromCache(int key, const PathData* path_data, FilePath* result) {
138 if (path_data->cache_disabled) 138 if (path_data->cache_disabled)
139 return false; 139 return false;
140 // check for a cached version 140 // check for a cached version
141 PathMap::const_iterator it = path_data->cache.find(key); 141 PathMap::const_iterator it = path_data->cache.find(key);
142 if (it != path_data->cache.end()) { 142 if (it != path_data->cache.end()) {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 void PathService::DisableCache() { 320 void PathService::DisableCache() {
321 PathData* path_data = GetPathData(); 321 PathData* path_data = GetPathData();
322 DCHECK(path_data); 322 DCHECK(path_data);
323 323
324 AutoLock scoped_lock(path_data->lock); 324 AutoLock scoped_lock(path_data->lock);
325 path_data->cache.clear(); 325 path_data->cache.clear();
326 path_data->cache_disabled = true; 326 path_data->cache_disabled = true;
327 } 327 }
328 328
329 } // namespace base 329 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698