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

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

Issue 4192012: Convert implicit scoped_refptr constructor calls to explicit ones, part 1 (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: fix presubmit Created 10 years, 1 month 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/backend_unittest.cc ('k') | net/disk_cache/entry_unittest.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-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 26 matching lines...) Expand all
37 }; 37 };
38 typedef std::vector<TestEntry> TestEntries; 38 typedef std::vector<TestEntry> TestEntries;
39 39
40 const int kMaxSize = 16 * 1024 - 1; 40 const int kMaxSize = 16 * 1024 - 1;
41 41
42 // Creates num_entries on the cache, and writes 200 bytes of metadata and up 42 // Creates num_entries on the cache, and writes 200 bytes of metadata and up
43 // to kMaxSize of data to each entry. 43 // to kMaxSize of data to each entry.
44 int TimeWrite(int num_entries, disk_cache::Backend* cache, 44 int TimeWrite(int num_entries, disk_cache::Backend* cache,
45 TestEntries* entries) { 45 TestEntries* entries) {
46 const int kSize1 = 200; 46 const int kSize1 = 200;
47 scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize1); 47 scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize1));
48 scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kMaxSize); 48 scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kMaxSize));
49 49
50 CacheTestFillBuffer(buffer1->data(), kSize1, false); 50 CacheTestFillBuffer(buffer1->data(), kSize1, false);
51 CacheTestFillBuffer(buffer2->data(), kMaxSize, false); 51 CacheTestFillBuffer(buffer2->data(), kMaxSize, false);
52 52
53 CallbackTest callback(true); 53 CallbackTest callback(true);
54 g_cache_tests_error = false; 54 g_cache_tests_error = false;
55 g_cache_tests_received = 0; 55 g_cache_tests_received = 0;
56 int expected = 0; 56 int expected = 0;
57 57
58 MessageLoopHelper helper; 58 MessageLoopHelper helper;
(...skipping 29 matching lines...) Expand all
88 helper.WaitUntilCacheIoFinished(expected); 88 helper.WaitUntilCacheIoFinished(expected);
89 timer.Done(); 89 timer.Done();
90 90
91 return expected; 91 return expected;
92 } 92 }
93 93
94 // Reads the data and metadata from each entry listed on |entries|. 94 // Reads the data and metadata from each entry listed on |entries|.
95 int TimeRead(int num_entries, disk_cache::Backend* cache, 95 int TimeRead(int num_entries, disk_cache::Backend* cache,
96 const TestEntries& entries, bool cold) { 96 const TestEntries& entries, bool cold) {
97 const int kSize1 = 200; 97 const int kSize1 = 200;
98 scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize1); 98 scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize1));
99 scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kMaxSize); 99 scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kMaxSize));
100 100
101 CacheTestFillBuffer(buffer1->data(), kSize1, false); 101 CacheTestFillBuffer(buffer1->data(), kSize1, false);
102 CacheTestFillBuffer(buffer2->data(), kMaxSize, false); 102 CacheTestFillBuffer(buffer2->data(), kMaxSize, false);
103 103
104 CallbackTest callback(true); 104 CallbackTest callback(true);
105 g_cache_tests_error = false; 105 g_cache_tests_error = false;
106 g_cache_tests_received = 0; 106 g_cache_tests_received = 0;
107 int expected = 0; 107 int expected = 0;
108 108
109 MessageLoopHelper helper; 109 MessageLoopHelper helper;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 files.DeleteBlock(address[entry], false); 249 files.DeleteBlock(address[entry], false);
250 EXPECT_TRUE(files.CreateBlock(disk_cache::RANKINGS, BlockSize(), 250 EXPECT_TRUE(files.CreateBlock(disk_cache::RANKINGS, BlockSize(),
251 &address[entry])); 251 &address[entry]));
252 } 252 }
253 253
254 timer2.Done(); 254 timer2.Done();
255 MessageLoop::current()->RunAllPending(); 255 MessageLoop::current()->RunAllPending();
256 delete[] address; 256 delete[] address;
257 } 257 }
OLDNEW
« no previous file with comments | « net/disk_cache/backend_unittest.cc ('k') | net/disk_cache/entry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698