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

Side by Side Diff: Source/WebCore/platform/leveldb/LevelDBDatabase.cpp

Issue 12779020: Merge 145824 "IndexedDB: Histogram leveldb open errors." (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 10 matching lines...) Expand all
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "LevelDBDatabase.h" 27 #include "LevelDBDatabase.h"
28 28
29 #if USE(LEVELDB) 29 #if USE(LEVELDB)
30 30
31 #include "HistogramSupport.h"
31 #include "LevelDBComparator.h" 32 #include "LevelDBComparator.h"
32 #include "LevelDBIterator.h" 33 #include "LevelDBIterator.h"
33 #include "LevelDBSlice.h" 34 #include "LevelDBSlice.h"
34 #include "LevelDBWriteBatch.h" 35 #include "LevelDBWriteBatch.h"
35 #include "Logging.h" 36 #include "Logging.h"
36 #include <helpers/memenv/memenv.h> 37 #include <helpers/memenv/memenv.h>
37 #include <leveldb/comparator.h> 38 #include <leveldb/comparator.h>
38 #include <leveldb/db.h> 39 #include <leveldb/db.h>
39 #include <leveldb/env.h> 40 #include <leveldb/env.h>
40 #include <leveldb/slice.h> 41 #include <leveldb/slice.h>
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 150 }
150 151
151 PassOwnPtr<LevelDBDatabase> LevelDBDatabase::open(const String& fileName, const LevelDBComparator* comparator) 152 PassOwnPtr<LevelDBDatabase> LevelDBDatabase::open(const String& fileName, const LevelDBComparator* comparator)
152 { 153 {
153 OwnPtr<ComparatorAdapter> comparatorAdapter = adoptPtr(new ComparatorAdapter (comparator)); 154 OwnPtr<ComparatorAdapter> comparatorAdapter = adoptPtr(new ComparatorAdapter (comparator));
154 155
155 leveldb::DB* db; 156 leveldb::DB* db;
156 const leveldb::Status s = openDB(comparatorAdapter.get(), leveldb::IDBEnv(), fileName, &db); 157 const leveldb::Status s = openDB(comparatorAdapter.get(), leveldb::IDBEnv(), fileName, &db);
157 158
158 if (!s.ok()) { 159 if (!s.ok()) {
160 enum {
161 LevelDBNotFound,
162 LevelDBCorruption,
163 LevelDBIOError,
164 LevelDBOther,
165 LevelDBMaxError
166 };
167 int levelDBError = LevelDBOther;
168 if (s.IsNotFound())
169 levelDBError = LevelDBNotFound;
170 else if (s.IsCorruption())
171 levelDBError = LevelDBCorruption;
172 else if (s.IsIOError())
173 levelDBError = LevelDBIOError;
174 HistogramSupport::histogramEnumeration("WebCore.IndexedDB.LevelDBOpenErr ors", levelDBError, LevelDBMaxError);
175
159 LOG_ERROR("Failed to open LevelDB database from %s: %s", fileName.ascii( ).data(), s.ToString().c_str()); 176 LOG_ERROR("Failed to open LevelDB database from %s: %s", fileName.ascii( ).data(), s.ToString().c_str());
160 return nullptr; 177 return nullptr;
161 } 178 }
162 179
163 OwnPtr<LevelDBDatabase> result = adoptPtr(new LevelDBDatabase); 180 OwnPtr<LevelDBDatabase> result = adoptPtr(new LevelDBDatabase);
164 result->m_db = adoptPtr(db); 181 result->m_db = adoptPtr(db);
165 result->m_comparatorAdapter = comparatorAdapter.release(); 182 result->m_comparatorAdapter = comparatorAdapter.release();
166 result->m_comparator = comparator; 183 result->m_comparator = comparator;
167 184
168 return result.release(); 185 return result.release();
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 } 354 }
338 355
339 const LevelDBComparator* LevelDBDatabase::comparator() const 356 const LevelDBComparator* LevelDBDatabase::comparator() const
340 { 357 {
341 return m_comparator; 358 return m_comparator;
342 } 359 }
343 360
344 } 361 }
345 362
346 #endif 363 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698