Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Side by Side Diff: content/browser/indexed_db/leveldb/leveldb_database.cc

Issue 936073003: Remove unused errno parsing for leveldb status codes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
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,
184 const leveldb::Status& s) { 184 const leveldb::Status& s) {
185 leveldb_env::MethodID method; 185 leveldb_env::MethodID method;
186 int error = -1; 186 base::File::Error error = base::File::FILE_OK;
187 leveldb_env::ErrorParsingResult result = 187 leveldb_env::ErrorParsingResult result =
188 leveldb_env::ParseMethodAndError(s, &method, &error); 188 leveldb_env::ParseMethodAndError(s, &method, &error);
189 if (result == leveldb_env::NONE) 189 if (result == leveldb_env::NONE)
190 return; 190 return;
191 std::string method_histogram_name(histogram_name); 191 std::string method_histogram_name(histogram_name);
192 method_histogram_name.append(".EnvMethod"); 192 method_histogram_name.append(".EnvMethod");
193 base::LinearHistogram::FactoryGet( 193 base::LinearHistogram::FactoryGet(
194 method_histogram_name, 194 method_histogram_name,
195 1, 195 1,
196 leveldb_env::kNumEntries, 196 leveldb_env::kNumEntries,
197 leveldb_env::kNumEntries + 1, 197 leveldb_env::kNumEntries + 1,
198 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(method); 198 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(method);
199 199
200 std::string error_histogram_name(histogram_name); 200 std::string error_histogram_name(histogram_name);
201 201
202 if (result == leveldb_env::METHOD_AND_PFE) { 202 if (result == leveldb_env::METHOD_AND_PFE) {
203 DCHECK_LT(error, 0); 203 DCHECK_LT(error, 0);
204 error_histogram_name.append(std::string(".PFE.") + 204 error_histogram_name.append(std::string(".PFE.") +
205 leveldb_env::MethodIDToString(method)); 205 leveldb_env::MethodIDToString(method));
206 base::LinearHistogram::FactoryGet( 206 base::LinearHistogram::FactoryGet(
207 error_histogram_name, 207 error_histogram_name,
208 1, 208 1,
209 -base::File::FILE_ERROR_MAX, 209 -base::File::FILE_ERROR_MAX,
210 -base::File::FILE_ERROR_MAX + 1, 210 -base::File::FILE_ERROR_MAX + 1,
211 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(-error); 211 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(-error);
212 } else if (result == leveldb_env::METHOD_AND_ERRNO) {
213 error_histogram_name.append(std::string(".Errno.") +
214 leveldb_env::MethodIDToString(method));
215 base::LinearHistogram::FactoryGet(
216 error_histogram_name,
217 1,
218 ERANGE + 1,
219 ERANGE + 2,
220 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(error);
221 } 212 }
222 } 213 }
223 214
224 static void ParseAndHistogramCorruptionDetails( 215 static void ParseAndHistogramCorruptionDetails(
225 const std::string& histogram_name, 216 const std::string& histogram_name,
226 const leveldb::Status& status) { 217 const leveldb::Status& status) {
227 int error = leveldb_env::GetCorruptionCode(status); 218 int error = leveldb_env::GetCorruptionCode(status);
228 DCHECK_GE(error, 0); 219 DCHECK_GE(error, 0);
229 std::string corruption_histogram_name(histogram_name); 220 std::string corruption_histogram_name(histogram_name);
230 corruption_histogram_name.append(".Corruption"); 221 corruption_histogram_name.append(".Corruption");
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 const leveldb::Slice start_slice = MakeSlice(start); 420 const leveldb::Slice start_slice = MakeSlice(start);
430 const leveldb::Slice stop_slice = MakeSlice(stop); 421 const leveldb::Slice stop_slice = MakeSlice(stop);
431 // NULL batch means just wait for earlier writes to be done 422 // NULL batch means just wait for earlier writes to be done
432 db_->Write(leveldb::WriteOptions(), NULL); 423 db_->Write(leveldb::WriteOptions(), NULL);
433 db_->CompactRange(&start_slice, &stop_slice); 424 db_->CompactRange(&start_slice, &stop_slice);
434 } 425 }
435 426
436 void LevelDBDatabase::CompactAll() { db_->CompactRange(NULL, NULL); } 427 void LevelDBDatabase::CompactAll() { db_->CompactRange(NULL, NULL); }
437 428
438 } // namespace content 429 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | third_party/leveldatabase/env_chromium.h » ('j') | third_party/leveldatabase/env_chromium_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698