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

Side by Side Diff: base/file_path.cc

Issue 9447084: Refactor Pickle Read methods to use higher performance PickleIterator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile (racing with incoming CLs) Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « base/file_path.h ('k') | base/metrics/histogram.h » ('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 #include "base/file_path.h" 5 #include "base/file_path.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 #endif 579 #endif
580 580
581 void FilePath::WriteToPickle(Pickle* pickle) { 581 void FilePath::WriteToPickle(Pickle* pickle) {
582 #if defined(OS_WIN) 582 #if defined(OS_WIN)
583 pickle->WriteString16(path_); 583 pickle->WriteString16(path_);
584 #else 584 #else
585 pickle->WriteString(path_); 585 pickle->WriteString(path_);
586 #endif 586 #endif
587 } 587 }
588 588
589 bool FilePath::ReadFromPickle(Pickle* pickle, void** iter) { 589 bool FilePath::ReadFromPickle(PickleIterator* iter) {
590 #if defined(OS_WIN) 590 #if defined(OS_WIN)
591 if (!pickle->ReadString16(iter, &path_)) 591 if (!iter->ReadString16(&path_))
592 return false; 592 return false;
593 #else 593 #else
594 if (!pickle->ReadString(iter, &path_)) 594 if (!iter->ReadString(&path_))
595 return false; 595 return false;
596 #endif 596 #endif
597 597
598 return true; 598 return true;
599 } 599 }
600 600
601 #if defined(OS_WIN) 601 #if defined(OS_WIN)
602 // Windows specific implementation of file string comparisons 602 // Windows specific implementation of file string comparisons
603 603
604 int FilePath::CompareIgnoreCase(const StringType& string1, 604 int FilePath::CompareIgnoreCase(const StringType& string1,
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 #if defined(FILE_PATH_USES_WIN_SEPARATORS) 1214 #if defined(FILE_PATH_USES_WIN_SEPARATORS)
1215 StringType copy = path_; 1215 StringType copy = path_;
1216 for (size_t i = 1; i < arraysize(kSeparators); ++i) { 1216 for (size_t i = 1; i < arraysize(kSeparators); ++i) {
1217 std::replace(copy.begin(), copy.end(), kSeparators[i], kSeparators[0]); 1217 std::replace(copy.begin(), copy.end(), kSeparators[i], kSeparators[0]);
1218 } 1218 }
1219 return FilePath(copy); 1219 return FilePath(copy);
1220 #else 1220 #else
1221 return *this; 1221 return *this;
1222 #endif 1222 #endif
1223 } 1223 }
OLDNEW
« no previous file with comments | « base/file_path.h ('k') | base/metrics/histogram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698