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/logging.h" | 11 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
13 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
14 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
15 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
17 #include "base/sys_info.h" | 18 #include "base/sys_info.h" |
18 #include "content/browser/indexed_db/leveldb/leveldb_comparator.h" | 19 #include "content/browser/indexed_db/leveldb/leveldb_comparator.h" |
19 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" | 20 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 191 |
191 std::string error_histogram_name(histogram_name); | 192 std::string error_histogram_name(histogram_name); |
192 | 193 |
193 if (result == leveldb_env::METHOD_AND_PFE) { | 194 if (result == leveldb_env::METHOD_AND_PFE) { |
194 DCHECK(error < 0); | 195 DCHECK(error < 0); |
195 error_histogram_name.append(std::string(".PFE.") + | 196 error_histogram_name.append(std::string(".PFE.") + |
196 leveldb_env::MethodIDToString(method)); | 197 leveldb_env::MethodIDToString(method)); |
197 base::LinearHistogram::FactoryGet( | 198 base::LinearHistogram::FactoryGet( |
198 error_histogram_name, | 199 error_histogram_name, |
199 1, | 200 1, |
200 -base::PLATFORM_FILE_ERROR_MAX, | 201 -base::File::FILE_ERROR_MAX, |
201 -base::PLATFORM_FILE_ERROR_MAX + 1, | 202 -base::File::FILE_ERROR_MAX + 1, |
202 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(-error); | 203 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(-error); |
203 } else if (result == leveldb_env::METHOD_AND_ERRNO) { | 204 } else if (result == leveldb_env::METHOD_AND_ERRNO) { |
204 error_histogram_name.append(std::string(".Errno.") + | 205 error_histogram_name.append(std::string(".Errno.") + |
205 leveldb_env::MethodIDToString(method)); | 206 leveldb_env::MethodIDToString(method)); |
206 base::LinearHistogram::FactoryGet( | 207 base::LinearHistogram::FactoryGet( |
207 error_histogram_name, | 208 error_histogram_name, |
208 1, | 209 1, |
209 ERANGE + 1, | 210 ERANGE + 1, |
210 ERANGE + 2, | 211 ERANGE + 2, |
211 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(error); | 212 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(error); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 } | 460 } |
460 | 461 |
461 void LevelDBDatabase::Compact(const base::StringPiece& start, | 462 void LevelDBDatabase::Compact(const base::StringPiece& start, |
462 const base::StringPiece& stop) { | 463 const base::StringPiece& stop) { |
463 const leveldb::Slice start_slice = MakeSlice(start); | 464 const leveldb::Slice start_slice = MakeSlice(start); |
464 const leveldb::Slice stop_slice = MakeSlice(stop); | 465 const leveldb::Slice stop_slice = MakeSlice(stop); |
465 db_->CompactRange(&start_slice, &stop_slice); | 466 db_->CompactRange(&start_slice, &stop_slice); |
466 } | 467 } |
467 | 468 |
468 } // namespace content | 469 } // namespace content |
OLD | NEW |