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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 base::HistogramBase::kUmaTargetedHistogramFlag) | 177 base::HistogramBase::kUmaTargetedHistogramFlag) |
178 ->Add(clamped_disk_space_k_bytes); | 178 ->Add(clamped_disk_space_k_bytes); |
179 return clamped_disk_space_k_bytes; | 179 return clamped_disk_space_k_bytes; |
180 } | 180 } |
181 | 181 |
182 static void ParseAndHistogramIOErrorDetails(const std::string& histogram_name, | 182 static void ParseAndHistogramIOErrorDetails(const std::string& histogram_name, |
183 const leveldb::Status& s) { | 183 const leveldb::Status& s) { |
184 leveldb_env::MethodID method; | 184 leveldb_env::MethodID method; |
185 int error = -1; | 185 int error = -1; |
186 leveldb_env::ErrorParsingResult result = | 186 leveldb_env::ErrorParsingResult result = |
187 leveldb_env::ParseMethodAndError(s.ToString().c_str(), &method, &error); | 187 leveldb_env::ParseMethodAndError(s, &method, &error); |
188 if (result == leveldb_env::NONE) | 188 if (result == leveldb_env::NONE) |
189 return; | 189 return; |
190 std::string method_histogram_name(histogram_name); | 190 std::string method_histogram_name(histogram_name); |
191 method_histogram_name.append(".EnvMethod"); | 191 method_histogram_name.append(".EnvMethod"); |
192 base::LinearHistogram::FactoryGet( | 192 base::LinearHistogram::FactoryGet( |
193 method_histogram_name, | 193 method_histogram_name, |
194 1, | 194 1, |
195 leveldb_env::kNumEntries, | 195 leveldb_env::kNumEntries, |
196 leveldb_env::kNumEntries + 1, | 196 leveldb_env::kNumEntries + 1, |
197 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(method); | 197 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(method); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 const leveldb::Slice start_slice = MakeSlice(start); | 428 const leveldb::Slice start_slice = MakeSlice(start); |
429 const leveldb::Slice stop_slice = MakeSlice(stop); | 429 const leveldb::Slice stop_slice = MakeSlice(stop); |
430 // NULL batch means just wait for earlier writes to be done | 430 // NULL batch means just wait for earlier writes to be done |
431 db_->Write(leveldb::WriteOptions(), NULL); | 431 db_->Write(leveldb::WriteOptions(), NULL); |
432 db_->CompactRange(&start_slice, &stop_slice); | 432 db_->CompactRange(&start_slice, &stop_slice); |
433 } | 433 } |
434 | 434 |
435 void LevelDBDatabase::CompactAll() { db_->CompactRange(NULL, NULL); } | 435 void LevelDBDatabase::CompactAll() { db_->CompactRange(NULL, NULL); } |
436 | 436 |
437 } // namespace content | 437 } // namespace content |
OLD | NEW |