OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/indexed_db/leveldb/leveldb_database.h" | 5 #include "content/browser/indexed_db/leveldb/leveldb_database.h" |
6 | 6 |
7 #include <cerrno> | 7 #include <cerrno> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 1, | 163 1, |
164 2 /*boundary*/, | 164 2 /*boundary*/, |
165 2 /*boundary*/ + 1, | 165 2 /*boundary*/ + 1, |
166 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(1 /*sample*/); | 166 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(1 /*sample*/); |
167 return -1; | 167 return -1; |
168 } | 168 } |
169 int clamped_disk_space_k_bytes = free_disk_space_in_k_bytes > INT_MAX | 169 int clamped_disk_space_k_bytes = free_disk_space_in_k_bytes > INT_MAX |
170 ? INT_MAX | 170 ? INT_MAX |
171 : free_disk_space_in_k_bytes; | 171 : free_disk_space_in_k_bytes; |
172 const uint64 histogram_max = static_cast<uint64>(1e9); | 172 const uint64 histogram_max = static_cast<uint64>(1e9); |
173 COMPILE_ASSERT(histogram_max <= INT_MAX, histogram_max_too_big); | 173 static_assert(histogram_max <= INT_MAX, "histogram_max too big"); |
174 base::Histogram::FactoryGet(name, | 174 base::Histogram::FactoryGet(name, |
175 1, | 175 1, |
176 histogram_max, | 176 histogram_max, |
177 11 /*buckets*/, | 177 11 /*buckets*/, |
178 base::HistogramBase::kUmaTargetedHistogramFlag) | 178 base::HistogramBase::kUmaTargetedHistogramFlag) |
179 ->Add(clamped_disk_space_k_bytes); | 179 ->Add(clamped_disk_space_k_bytes); |
180 return clamped_disk_space_k_bytes; | 180 return clamped_disk_space_k_bytes; |
181 } | 181 } |
182 | 182 |
183 static void ParseAndHistogramIOErrorDetails(const std::string& histogram_name, | 183 static void ParseAndHistogramIOErrorDetails(const std::string& histogram_name, |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 const leveldb::Slice start_slice = MakeSlice(start); | 429 const leveldb::Slice start_slice = MakeSlice(start); |
430 const leveldb::Slice stop_slice = MakeSlice(stop); | 430 const leveldb::Slice stop_slice = MakeSlice(stop); |
431 // NULL batch means just wait for earlier writes to be done | 431 // NULL batch means just wait for earlier writes to be done |
432 db_->Write(leveldb::WriteOptions(), NULL); | 432 db_->Write(leveldb::WriteOptions(), NULL); |
433 db_->CompactRange(&start_slice, &stop_slice); | 433 db_->CompactRange(&start_slice, &stop_slice); |
434 } | 434 } |
435 | 435 |
436 void LevelDBDatabase::CompactAll() { db_->CompactRange(NULL, NULL); } | 436 void LevelDBDatabase::CompactAll() { db_->CompactRange(NULL, NULL); } |
437 | 437 |
438 } // namespace content | 438 } // namespace content |
OLD | NEW |