| Index: net/disk_cache/blockfile/stress_cache.cc
|
| diff --git a/net/disk_cache/blockfile/stress_cache.cc b/net/disk_cache/blockfile/stress_cache.cc
|
| index 66f84db9c10d30f20e04ba3d83b38b019d4fd429..5c0879e68d5c6e5bfd4346269a65c869f4f49dd8 100644
|
| --- a/net/disk_cache/blockfile/stress_cache.cc
|
| +++ b/net/disk_cache/blockfile/stress_cache.cc
|
| @@ -102,7 +102,7 @@ std::string GenerateStressKey() {
|
| // to know which instance of the application wrote them.
|
| void StressTheCache(int iteration) {
|
| int cache_size = 0x2000000; // 32MB.
|
| - uint32 mask = 0xfff; // 4096 entries.
|
| + uint32 mask = 0xfff; // 4096 entries.
|
|
|
| base::FilePath path;
|
| PathService::Get(base::DIR_TEMP, &path);
|
| @@ -113,10 +113,8 @@ void StressTheCache(int iteration) {
|
| base::Thread::Options(base::MessageLoop::TYPE_IO, 0)))
|
| return;
|
|
|
| - disk_cache::BackendImpl* cache =
|
| - new disk_cache::BackendImpl(path, mask,
|
| - cache_thread.message_loop_proxy().get(),
|
| - NULL);
|
| + disk_cache::BackendImpl* cache = new disk_cache::BackendImpl(
|
| + path, mask, cache_thread.message_loop_proxy().get(), NULL);
|
| cache->SetMaxSize(cache_size);
|
| cache->SetFlags(disk_cache::kNoLoadProtection);
|
|
|
| @@ -127,14 +125,14 @@ void StressTheCache(int iteration) {
|
| printf("Unable to initialize cache.\n");
|
| return;
|
| }
|
| - printf("Iteration %d, initial entries: %d\n", iteration,
|
| - cache->GetEntryCount());
|
| + printf(
|
| + "Iteration %d, initial entries: %d\n", iteration, cache->GetEntryCount());
|
|
|
| int seed = static_cast<int>(Time::Now().ToInternalValue());
|
| srand(seed);
|
|
|
| - // kNumKeys is meant to be enough to have about 3x or 4x iterations before
|
| - // the process crashes.
|
| +// kNumKeys is meant to be enough to have about 3x or 4x iterations before
|
| +// the process crashes.
|
| #ifdef NDEBUG
|
| const int kNumKeys = 4000;
|
| #else
|
| @@ -168,11 +166,15 @@ void StressTheCache(int iteration) {
|
| CHECK_EQ(net::OK, cb.GetResult(rv));
|
| }
|
|
|
| - base::snprintf(buffer->data(), kSize,
|
| - "i: %d iter: %d, size: %d, truncate: %d ", i, iteration,
|
| - size, truncate ? 1 : 0);
|
| - rv = entries[slot]->WriteData(0, 0, buffer.get(), size, cb.callback(),
|
| - truncate);
|
| + base::snprintf(buffer->data(),
|
| + kSize,
|
| + "i: %d iter: %d, size: %d, truncate: %d ",
|
| + i,
|
| + iteration,
|
| + size,
|
| + truncate ? 1 : 0);
|
| + rv = entries[slot]->WriteData(
|
| + 0, 0, buffer.get(), size, cb.callback(), truncate);
|
| CHECK_EQ(size, cb.GetResult(rv));
|
|
|
| if (rand() % 100 > 80) {
|
| @@ -235,8 +237,11 @@ void CrashHandler(const std::string& str) {
|
| base::debug::BreakDebugger();
|
| }
|
|
|
| -bool MessageHandler(int severity, const char* file, int line,
|
| - size_t message_start, const std::string& str) {
|
| +bool MessageHandler(int severity,
|
| + const char* file,
|
| + int line,
|
| + size_t message_start,
|
| + const std::string& str) {
|
| const size_t kMaxMessageLen = 48;
|
| char message[kMaxMessageLen];
|
| size_t len = std::min(str.length() - message_start, kMaxMessageLen - 1);
|
| @@ -254,8 +259,10 @@ bool MessageHandler(int severity, const char* file, int line,
|
| #if defined(OS_WIN)
|
| // {B9A153D4-31C3-48e4-9ABF-D54383F14A0D}
|
| const GUID kStressCacheTraceProviderName = {
|
| - 0xb9a153d4, 0x31c3, 0x48e4,
|
| - { 0x9a, 0xbf, 0xd5, 0x43, 0x83, 0xf1, 0x4a, 0xd } };
|
| + 0xb9a153d4,
|
| + 0x31c3,
|
| + 0x48e4,
|
| + {0x9a, 0xbf, 0xd5, 0x43, 0x83, 0xf1, 0x4a, 0xd}};
|
| #endif
|
|
|
| int main(int argc, const char* argv[]) {
|
|
|