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

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

Issue 2869005: Disk Cache: Remove deprecated methods from the disk cache interface.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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.h ('k') | net/disk_cache/entry_impl.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) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 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 <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/perftimer.h" 10 #include "base/perftimer.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 PerfTimeLogger timer("Write disk cache entries"); 60 PerfTimeLogger timer("Write disk cache entries");
61 61
62 for (int i = 0; i < num_entries; i++) { 62 for (int i = 0; i < num_entries; i++) {
63 TestEntry entry; 63 TestEntry entry;
64 entry.key = GenerateKey(true); 64 entry.key = GenerateKey(true);
65 entry.data_len = rand() % kMaxSize; 65 entry.data_len = rand() % kMaxSize;
66 entries->push_back(entry); 66 entries->push_back(entry);
67 67
68 disk_cache::Entry* cache_entry; 68 disk_cache::Entry* cache_entry;
69 if (!cache->CreateEntry(entry.key, &cache_entry)) 69 TestCompletionCallback cb;
70 int rv = cache->CreateEntry(entry.key, &cache_entry, &cb);
71 if (net::OK != cb.GetResult(rv))
70 break; 72 break;
71 int ret = cache_entry->WriteData(0, 0, buffer1, kSize1, &callback, false); 73 int ret = cache_entry->WriteData(0, 0, buffer1, kSize1, &callback, false);
72 if (net::ERR_IO_PENDING == ret) 74 if (net::ERR_IO_PENDING == ret)
73 expected++; 75 expected++;
74 else if (kSize1 != ret) 76 else if (kSize1 != ret)
75 break; 77 break;
76 78
77 ret = cache_entry->WriteData(1, 0, buffer2, entry.data_len, &callback, 79 ret = cache_entry->WriteData(1, 0, buffer2, entry.data_len, &callback,
78 false); 80 false);
79 if (net::ERR_IO_PENDING == ret) 81 if (net::ERR_IO_PENDING == ret)
(...skipping 25 matching lines...) Expand all
105 int expected = 0; 107 int expected = 0;
106 108
107 MessageLoopHelper helper; 109 MessageLoopHelper helper;
108 110
109 const char* message = cold ? "Read disk cache entries (cold)" : 111 const char* message = cold ? "Read disk cache entries (cold)" :
110 "Read disk cache entries (warm)"; 112 "Read disk cache entries (warm)";
111 PerfTimeLogger timer(message); 113 PerfTimeLogger timer(message);
112 114
113 for (int i = 0; i < num_entries; i++) { 115 for (int i = 0; i < num_entries; i++) {
114 disk_cache::Entry* cache_entry; 116 disk_cache::Entry* cache_entry;
115 if (!cache->OpenEntry(entries[i].key, &cache_entry)) 117 TestCompletionCallback cb;
118 int rv = cache->OpenEntry(entries[i].key, &cache_entry, &cb);
119 if (net::OK != cb.GetResult(rv))
116 break; 120 break;
117 int ret = cache_entry->ReadData(0, 0, buffer1, kSize1, &callback); 121 int ret = cache_entry->ReadData(0, 0, buffer1, kSize1, &callback);
118 if (net::ERR_IO_PENDING == ret) 122 if (net::ERR_IO_PENDING == ret)
119 expected++; 123 expected++;
120 else if (kSize1 != ret) 124 else if (kSize1 != ret)
121 break; 125 break;
122 126
123 ret = cache_entry->ReadData(1, 0, buffer2, entries[i].data_len, &callback); 127 ret = cache_entry->ReadData(1, 0, buffer2, entries[i].data_len, &callback);
124 if (net::ERR_IO_PENDING == ret) 128 if (net::ERR_IO_PENDING == ret)
125 expected++; 129 expected++;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 248
245 files.DeleteBlock(address[entry], false); 249 files.DeleteBlock(address[entry], false);
246 EXPECT_TRUE(files.CreateBlock(disk_cache::RANKINGS, BlockSize(), 250 EXPECT_TRUE(files.CreateBlock(disk_cache::RANKINGS, BlockSize(),
247 &address[entry])); 251 &address[entry]));
248 } 252 }
249 253
250 timer2.Done(); 254 timer2.Done();
251 MessageLoop::current()->RunAllPending(); 255 MessageLoop::current()->RunAllPending();
252 delete[] address; 256 delete[] address;
253 } 257 }
OLDNEW
« no previous file with comments | « net/disk_cache/disk_cache.h ('k') | net/disk_cache/entry_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698