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

Unified Diff: net/disk_cache/stress_cache.cc

Issue 20134: Extend the IOBuffer to the disk cache. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
Index: net/disk_cache/stress_cache.cc
===================================================================
--- net/disk_cache/stress_cache.cc (revision 9323)
+++ net/disk_cache/stress_cache.cc (working copy)
@@ -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 @@
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 @@
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 @@
// 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);

Powered by Google App Engine
This is Rietveld 408576698