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

Unified Diff: base/path_service.cc

Issue 258743005: Enable Enterprise enrollment on desktop builds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linkage visibility of policy protobufs Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: base/path_service.cc
diff --git a/base/path_service.cc b/base/path_service.cc
index 61488d6f75ff4acd8becef175e353a8496b6a421..feaf4f3e7ddb51e181e39730c43ac61944cbad27 100644
--- a/base/path_service.cc
+++ b/base/path_service.cc
@@ -241,10 +241,6 @@ bool PathService::Override(int key, const FilePath& path) {
bool PathService::OverrideAndCreateIfNeeded(int key,
const FilePath& path,
bool create) {
- PathData* path_data = GetPathData();
- DCHECK(path_data);
- DCHECK_GT(key, base::DIR_CURRENT) << "invalid path key";
-
FilePath file_path = path;
// For some locations this will fail if called from inside the sandbox there-
@@ -263,15 +259,25 @@ bool PathService::OverrideAndCreateIfNeeded(int key,
if (file_path.empty())
return false;
+ OverrideWithAbsolutePath(key, file_path);
+ return true;
+}
+
+// static
+void PathService::OverrideWithAbsolutePath(int key, const FilePath& path) {
+ DCHECK_GT(key, base::DIR_CURRENT) << "invalid path key";
+ DCHECK(path.IsAbsolute());
+
+ PathData* path_data = GetPathData();
+ DCHECK(path_data);
+
base::AutoLock scoped_lock(path_data->lock);
// Clear the cache now. Some of its entries could have depended
// on the value we are overriding, and are now out of sync with reality.
path_data->cache.clear();
- path_data->overrides[key] = file_path;
-
- return true;
+ path_data->overrides[key] = path;
}
// static

Powered by Google App Engine
This is Rietveld 408576698