| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/http/infinite_cache.h" | 5 #include "net/http/infinite_cache.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 uint32 headers_hash; | 78 uint32 headers_hash; |
| 79 uint32 response_hash; | 79 uint32 response_hash; |
| 80 }; | 80 }; |
| 81 const size_t kRecordSize = sizeof(Key) + sizeof(Details); | 81 const size_t kRecordSize = sizeof(Key) + sizeof(Details); |
| 82 | 82 |
| 83 // Some constants related to the database file. | 83 // Some constants related to the database file. |
| 84 uint32 kMagicSignature = 0x1f00cace; | 84 uint32 kMagicSignature = 0x1f00cace; |
| 85 uint32 kCurrentVersion = 0x10002; | 85 uint32 kCurrentVersion = 0x10002; |
| 86 | 86 |
| 87 // Basic limits for the experiment. | 87 // Basic limits for the experiment. |
| 88 int kMaxNumEntries = 200 * 1000; | 88 int kMaxNumEntries = 500 * 1000; |
| 89 int kMaxTrackingSize = 40 * 1024 * 1024; | 89 int kMaxTrackingSize = 40 * 1024 * 1024; |
| 90 | 90 |
| 91 // Settings that control how we generate histograms. | 91 // Settings that control how we generate histograms. |
| 92 int kTimerMinutes = 5; | 92 int kTimerMinutes = 5; |
| 93 int kReportSizeStep = 100 * 1024 * 1024; | 93 int kReportSizeStep = 100 * 1024 * 1024; |
| 94 | 94 |
| 95 // Buffer to read and write the file. | 95 // Buffer to read and write the file. |
| 96 const size_t kBufferSize = 1024 * 1024; | 96 const size_t kBufferSize = 1024 * 1024; |
| 97 const size_t kMaxRecordsToRead = kBufferSize / kRecordSize; | 97 const size_t kMaxRecordsToRead = kBufferSize / kRecordSize; |
| 98 COMPILE_ASSERT(kRecordSize * kMaxRecordsToRead < kBufferSize, wrong_buffer); | 98 COMPILE_ASSERT(kRecordSize * kMaxRecordsToRead < kBufferSize, wrong_buffer); |
| (...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 int InfiniteCache::FlushDataForTest(const CompletionCallback& callback) { | 1164 int InfiniteCache::FlushDataForTest(const CompletionCallback& callback) { |
| 1165 DCHECK(worker_); | 1165 DCHECK(worker_); |
| 1166 int* result = new int; | 1166 int* result = new int; |
| 1167 task_runner_->PostTaskAndReply( | 1167 task_runner_->PostTaskAndReply( |
| 1168 FROM_HERE, base::Bind(&InfiniteCache::Worker::Flush, worker_, result), | 1168 FROM_HERE, base::Bind(&InfiniteCache::Worker::Flush, worker_, result), |
| 1169 base::Bind(&OnComplete, callback, base::Owned(result))); | 1169 base::Bind(&OnComplete, callback, base::Owned(result))); |
| 1170 return net::ERR_IO_PENDING; | 1170 return net::ERR_IO_PENDING; |
| 1171 } | 1171 } |
| 1172 | 1172 |
| 1173 } // namespace net | 1173 } // namespace net |
| OLD | NEW |