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

Side by Side Diff: net/disk_cache/disk_cache_test_util.cc

Issue 18834003: Revert "Updating the mapped_file_avoid_mmap_posix implementation." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | « net/disk_cache/disk_cache_test_util.h ('k') | net/disk_cache/mapped_file.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) 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 "net/disk_cache/disk_cache_test_util.h" 5 #include "net/disk_cache/disk_cache_test_util.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 24 matching lines...) Expand all
35 for (size_t i = 0; i < len; i++) { 35 for (size_t i = 0; i < len; i++) {
36 buffer[i] = static_cast<char>(rand()); 36 buffer[i] = static_cast<char>(rand());
37 if (!buffer[i] && no_nulls) 37 if (!buffer[i] && no_nulls)
38 buffer[i] = 'g'; 38 buffer[i] = 'g';
39 } 39 }
40 if (len && !buffer[0]) 40 if (len && !buffer[0])
41 buffer[0] = 'g'; 41 buffer[0] = 'g';
42 } 42 }
43 43
44 bool CreateCacheTestFile(const base::FilePath& name) { 44 bool CreateCacheTestFile(const base::FilePath& name) {
45 return CreateCacheTestFileWithSize(name, 4 * 1024 * 1024);
46 }
47
48 bool CreateCacheTestFileWithSize(const base::FilePath& name, size_t size){
49 int flags = base::PLATFORM_FILE_CREATE_ALWAYS | 45 int flags = base::PLATFORM_FILE_CREATE_ALWAYS |
50 base::PLATFORM_FILE_READ | 46 base::PLATFORM_FILE_READ |
51 base::PLATFORM_FILE_WRITE; 47 base::PLATFORM_FILE_WRITE;
52 48
53 scoped_refptr<disk_cache::File> file(new disk_cache::File( 49 scoped_refptr<disk_cache::File> file(new disk_cache::File(
54 base::CreatePlatformFile(name, flags, NULL, NULL))); 50 base::CreatePlatformFile(name, flags, NULL, NULL)));
55 if (!file->IsValid()) 51 if (!file->IsValid())
56 return false; 52 return false;
57 53
58 file->SetLength(size); 54 file->SetLength(4 * 1024 * 1024);
59 return true; 55 return true;
60 } 56 }
61 57
62 bool DeleteCache(const base::FilePath& path) { 58 bool DeleteCache(const base::FilePath& path) {
63 disk_cache::DeleteCache(path, false); 59 disk_cache::DeleteCache(path, false);
64 return true; 60 return true;
65 } 61 }
66 62
67 bool CheckCacheIntegrity(const base::FilePath& path, bool new_eviction, 63 bool CheckCacheIntegrity(const base::FilePath& path, bool new_eviction,
68 uint32 mask) { 64 uint32 mask) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 137
142 if (reuse_) { 138 if (reuse_) {
143 DCHECK_EQ(1, reuse_); 139 DCHECK_EQ(1, reuse_);
144 if (2 == reuse_) 140 if (2 == reuse_)
145 helper_->set_callback_reused_error(true); 141 helper_->set_callback_reused_error(true);
146 reuse_++; 142 reuse_++;
147 } 143 }
148 144
149 helper_->CallbackWasCalled(); 145 helper_->CallbackWasCalled();
150 } 146 }
OLDNEW
« no previous file with comments | « net/disk_cache/disk_cache_test_util.h ('k') | net/disk_cache/mapped_file.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698