diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-12 00:03:19 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-12 00:03:19 +0000 |
commit | 74a85ce422d6b52a79b3cf159203ec7fa35c15ee (patch) | |
tree | e35947baf74dd4325b926bf44a3364ed3cfe4038 /net/disk_cache/stress_cache.cc | |
parent | 39008c0d7c9f627b6eeef41bd7ddb78b7ebe086d (diff) | |
download | chromium_src-74a85ce422d6b52a79b3cf159203ec7fa35c15ee.zip chromium_src-74a85ce422d6b52a79b3cf159203ec7fa35c15ee.tar.gz chromium_src-74a85ce422d6b52a79b3cf159203ec7fa35c15ee.tar.bz2 |
Extend the IOBuffer to the disk cache.
This is cleanup from bug 5325.
Original code review: http://codereview.chromium.org/20134/show
Review URL: http://codereview.chromium.org/20251
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9626 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/stress_cache.cc')
-rw-r--r-- | net/disk_cache/stress_cache.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/net/disk_cache/stress_cache.cc b/net/disk_cache/stress_cache.cc index a7fb144..e35a195 100644 --- a/net/disk_cache/stress_cache.cc +++ b/net/disk_cache/stress_cache.cc @@ -23,6 +23,7 @@ #include "base/process_util.h" #include "base/string_util.h" #include "base/thread.h" +#include "net/base/io_buffer.h" #include "net/disk_cache/disk_cache.h" #include "net/disk_cache/disk_cache_test_util.h" @@ -96,9 +97,9 @@ void StressTheCache(int iteration) { keys[i] = GenerateKey(true); } - const int kDataLen = 4000; - char data[kDataLen]; - memset(data, 'k', kDataLen); + const int kSize = 4000; + scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kSize); + memset(buffer->data(), 'k', kSize); for (int i = 0;; i++) { int slot = rand() % kNumEntries; @@ -110,9 +111,8 @@ void StressTheCache(int iteration) { if (!cache->OpenEntry(keys[key], &entries[slot])) CHECK(cache->CreateEntry(keys[key], &entries[slot])); - base::snprintf(data, kDataLen, "%d %d", iteration, i); - CHECK(kDataLen == entries[slot]->WriteData(0, 0, data, kDataLen, NULL, - false)); + base::snprintf(buffer->data(), kSize, "%d %d", iteration, i); + CHECK(kSize == entries[slot]->WriteData(0, 0, buffer, kSize, NULL, false)); if (rand() % 100 > 80) { key = rand() % kNumKeys; @@ -188,7 +188,7 @@ int main(int argc, const char* argv[]) { // Some time for the memory manager to flush stuff. PlatformThread::Sleep(3000); - MessageLoop message_loop; + MessageLoop message_loop(MessageLoop::TYPE_IO); char* end; long int iteration = strtol(argv[1], &end, 0); |