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

Side by Side Diff: base/file_util.cc

Issue 2096005: page cycler: Use buffer-cache priming code on all systems. (Closed)
Patch Set: simpler Created 10 years, 7 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 | « base/file_util.h ('k') | chrome/test/page_cycler/page_cycler_test.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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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_util.h" 5 #include "base/file_util.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <io.h> 8 #include <io.h>
9 #endif 9 #endif
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 bool ReadFileToString(const FilePath& path, std::string* contents) { 180 bool ReadFileToString(const FilePath& path, std::string* contents) {
181 FILE* file = OpenFile(path, "rb"); 181 FILE* file = OpenFile(path, "rb");
182 if (!file) { 182 if (!file) {
183 return false; 183 return false;
184 } 184 }
185 185
186 char buf[1 << 16]; 186 char buf[1 << 16];
187 size_t len; 187 size_t len;
188 while ((len = fread(buf, 1, sizeof(buf), file)) > 0) { 188 while ((len = fread(buf, 1, sizeof(buf), file)) > 0) {
189 contents->append(buf, len); 189 if (contents)
jorlow 2010/05/19 10:41:50 This feels dirty to me. I understand what you're
Mark Mentovai 2010/05/19 14:00:27 This does not feel dirty to me at all.
190 contents->append(buf, len);
190 } 191 }
191 CloseFile(file); 192 CloseFile(file);
192 193
193 return true; 194 return true;
194 } 195 }
195 196
196 FILE* CreateAndOpenTemporaryFile(FilePath* path) { 197 FILE* CreateAndOpenTemporaryFile(FilePath* path) {
197 FilePath directory; 198 FilePath directory;
198 if (!GetTempDir(&directory)) 199 if (!GetTempDir(&directory))
199 return false; 200 return false;
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 // FileEnumerator 423 // FileEnumerator
423 // 424 //
424 // Note: the main logic is in file_util_<platform>.cc 425 // Note: the main logic is in file_util_<platform>.cc
425 426
426 bool FileEnumerator::ShouldSkip(const FilePath& path) { 427 bool FileEnumerator::ShouldSkip(const FilePath& path) {
427 FilePath::StringType basename = path.BaseName().value(); 428 FilePath::StringType basename = path.BaseName().value();
428 return IsDot(path) || (IsDotDot(path) && !(INCLUDE_DOT_DOT & file_type_)); 429 return IsDot(path) || (IsDotDot(path) && !(INCLUDE_DOT_DOT & file_type_));
429 } 430 }
430 431
431 } // namespace 432 } // namespace
OLDNEW
« no previous file with comments | « base/file_util.h ('k') | chrome/test/page_cycler/page_cycler_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698