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

Side by Side Diff: base/test/test_file_util_mac.cc

Issue 12286020: Replace FilePath with base::FilePath. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « base/test/test_file_util_linux.cc ('k') | base/test/test_file_util_posix.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/test/test_file_util.h" 5 #include "base/test/test_file_util.h"
6 6
7 #include <sys/mman.h> 7 #include <sys/mman.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 11
12 namespace file_util { 12 namespace file_util {
13 13
14 bool EvictFileFromSystemCache(const FilePath& file) { 14 bool EvictFileFromSystemCache(const base::FilePath& file) {
15 // There aren't any really direct ways to purge a file from the UBC. From 15 // There aren't any really direct ways to purge a file from the UBC. From
16 // talking with Amit Singh, the safest is to mmap the file with MAP_FILE (the 16 // talking with Amit Singh, the safest is to mmap the file with MAP_FILE (the
17 // default) + MAP_SHARED, then do an msync to invalidate the memory. The next 17 // default) + MAP_SHARED, then do an msync to invalidate the memory. The next
18 // open should then have to load the file from disk. 18 // open should then have to load the file from disk.
19 19
20 int64 length; 20 int64 length;
21 if (!file_util::GetFileSize(file, &length)) { 21 if (!file_util::GetFileSize(file, &length)) {
22 DLOG(ERROR) << "failed to get size of " << file.value(); 22 DLOG(ERROR) << "failed to get size of " << file.value();
23 return false; 23 return false;
24 } 24 }
(...skipping 15 matching lines...) Expand all
40 MS_INVALIDATE) != 0) { 40 MS_INVALIDATE) != 0) {
41 DLOG(WARNING) << "failed to invalidate memory map of " << file.value() 41 DLOG(WARNING) << "failed to invalidate memory map of " << file.value()
42 << ", errno: " << errno; 42 << ", errno: " << errno;
43 return false; 43 return false;
44 } 44 }
45 45
46 return true; 46 return true;
47 } 47 }
48 48
49 } // namespace file_util 49 } // namespace file_util
OLDNEW
« no previous file with comments | « base/test/test_file_util_linux.cc ('k') | base/test/test_file_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698