Chromium Code Reviews| Index: base/files/file_path.cc |
| diff --git a/base/files/file_path.cc b/base/files/file_path.cc |
| index 0b06493c8831f485a06e169167dfb802fc188dd5..cff862ae19da14bd59cffe64724027a3f2c16ed6 100644 |
| --- a/base/files/file_path.cc |
| +++ b/base/files/file_path.cc |
| @@ -560,6 +560,12 @@ FilePath FilePath::StripTrailingSeparators() const { |
| } |
| bool FilePath::ReferencesParent() const { |
| + if (path_.find(kParentDirectory) == StringType::npos) { |
| + // GetComponents is quite expensive, so avoid calling it in the majority |
| + // of cases where there isn't a kParentDirectory anywhere in the path. |
| + return false; |
| + } |
| + |
| std::vector<StringType> components; |
|
danakj
2016/11/11 19:17:40
This is great!
Question tho: We should probably u
jkarlin
2016/11/11 19:38:24
Are you suggesting that GetComponents should take
danakj
2016/11/11 19:57:27
Ah ok, it's not trivial at all np. This LGTM!
|
| GetComponents(&components); |