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

Side by Side Diff: base/files/file_path.h

Issue 1655333002: Add message sizing to basic IPC traits and struct macros. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@with-pickles
Patch Set: include ArrayHeader in size (oops!) and ensure the buffer doesn't relocate Created 4 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
« no previous file with comments | « no previous file | base/files/file_path.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // FilePath is a container for pathnames stored in a platform's native string 5 // FilePath is a container for pathnames stored in a platform's native string
6 // type, providing containers for manipulation in according with the 6 // type, providing containers for manipulation in according with the
7 // platform's conventions for pathnames. It supports the following path 7 // platform's conventions for pathnames. It supports the following path
8 // types: 8 // types:
9 // 9 //
10 // POSIX Windows 10 // POSIX Windows
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 #if defined(OS_POSIX) 131 #if defined(OS_POSIX)
132 #define PRIsFP "s" 132 #define PRIsFP "s"
133 #elif defined(OS_WIN) 133 #elif defined(OS_WIN)
134 #define PRIsFP "ls" 134 #define PRIsFP "ls"
135 #endif // OS_WIN 135 #endif // OS_WIN
136 136
137 namespace base { 137 namespace base {
138 138
139 class Pickle; 139 class Pickle;
140 class PickleIterator; 140 class PickleIterator;
141 class PickleSizer;
141 142
142 // An abstraction to isolate users from the differences between native 143 // An abstraction to isolate users from the differences between native
143 // pathnames on different platforms. 144 // pathnames on different platforms.
144 class BASE_EXPORT FilePath { 145 class BASE_EXPORT FilePath {
145 public: 146 public:
146 #if defined(OS_POSIX) 147 #if defined(OS_POSIX)
147 // On most platforms, native pathnames are char arrays, and the encoding 148 // On most platforms, native pathnames are char arrays, and the encoding
148 // may or may not be specified. On Mac OS X, native pathnames are encoded 149 // may or may not be specified. On Mac OS X, native pathnames are encoded
149 // in UTF-8. 150 // in UTF-8.
150 typedef std::string StringType; 151 typedef std::string StringType;
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 // 371 //
371 // Like AsUTF8Unsafe(), this function is unsafe. This function 372 // Like AsUTF8Unsafe(), this function is unsafe. This function
372 // internally calls SysWideToNativeMB() on POSIX systems other than Mac 373 // internally calls SysWideToNativeMB() on POSIX systems other than Mac
373 // and Chrome OS, to mitigate the encoding issue. See the comment at 374 // and Chrome OS, to mitigate the encoding issue. See the comment at
374 // AsUTF8Unsafe() for details. 375 // AsUTF8Unsafe() for details.
375 static FilePath FromUTF8Unsafe(const std::string& utf8); 376 static FilePath FromUTF8Unsafe(const std::string& utf8);
376 377
377 // Similar to FromUTF8Unsafe, but accepts UTF-16 instead. 378 // Similar to FromUTF8Unsafe, but accepts UTF-16 instead.
378 static FilePath FromUTF16Unsafe(const string16& utf16); 379 static FilePath FromUTF16Unsafe(const string16& utf16);
379 380
381 void GetSizeForPickle(PickleSizer* sizer) const;
380 void WriteToPickle(Pickle* pickle) const; 382 void WriteToPickle(Pickle* pickle) const;
381 bool ReadFromPickle(PickleIterator* iter); 383 bool ReadFromPickle(PickleIterator* iter);
382 384
383 // Normalize all path separators to backslash on Windows 385 // Normalize all path separators to backslash on Windows
384 // (if FILE_PATH_USES_WIN_SEPARATORS is true), or do nothing on POSIX systems. 386 // (if FILE_PATH_USES_WIN_SEPARATORS is true), or do nothing on POSIX systems.
385 FilePath NormalizePathSeparators() const; 387 FilePath NormalizePathSeparators() const;
386 388
387 // Normalize all path separattors to given type on Windows 389 // Normalize all path separattors to given type on Windows
388 // (if FILE_PATH_USES_WIN_SEPARATORS is true), or do nothing on POSIX systems. 390 // (if FILE_PATH_USES_WIN_SEPARATORS is true), or do nothing on POSIX systems.
389 FilePath NormalizePathSeparatorsTo(CharType separator) const; 391 FilePath NormalizePathSeparatorsTo(CharType separator) const;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 template<> 470 template<>
469 struct hash<base::FilePath> { 471 struct hash<base::FilePath> {
470 size_t operator()(const base::FilePath& f) const { 472 size_t operator()(const base::FilePath& f) const {
471 return hash<base::FilePath::StringType>()(f.value()); 473 return hash<base::FilePath::StringType>()(f.value());
472 } 474 }
473 }; 475 };
474 476
475 } // namespace BASE_HASH_NAMESPACE 477 } // namespace BASE_HASH_NAMESPACE
476 478
477 #endif // BASE_FILES_FILE_PATH_H_ 479 #endif // BASE_FILES_FILE_PATH_H_
OLDNEW
« no previous file with comments | « no previous file | base/files/file_path.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698