| OLD | NEW |
| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 private: | 86 private: |
| 87 const LevelDBComparator* m_comparator; | 87 const LevelDBComparator* m_comparator; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 LevelDBDatabase::LevelDBDatabase() | 90 LevelDBDatabase::LevelDBDatabase() |
| 91 { | 91 { |
| 92 } | 92 } |
| 93 | 93 |
| 94 LevelDBDatabase::~LevelDBDatabase() | 94 LevelDBDatabase::~LevelDBDatabase() |
| 95 { | 95 { |
| 96 // m_db's destructor uses m_comparatorAdapter; order of deletion is importan
t. |
| 97 m_db.clear(); |
| 98 m_comparatorAdapter.clear(); |
| 96 } | 99 } |
| 97 | 100 |
| 98 PassOwnPtr<LevelDBDatabase> LevelDBDatabase::open(const String& fileName, const
LevelDBComparator* comparator) | 101 PassOwnPtr<LevelDBDatabase> LevelDBDatabase::open(const String& fileName, const
LevelDBComparator* comparator) |
| 99 { | 102 { |
| 100 OwnPtr<ComparatorAdapter> comparatorAdapter = adoptPtr(new ComparatorAdapter
(comparator)); | 103 OwnPtr<ComparatorAdapter> comparatorAdapter = adoptPtr(new ComparatorAdapter
(comparator)); |
| 101 | 104 |
| 102 leveldb::Options options; | 105 leveldb::Options options; |
| 103 options.comparator = comparatorAdapter.get(); | 106 options.comparator = comparatorAdapter.get(); |
| 104 options.create_if_missing = true; | 107 options.create_if_missing = true; |
| 105 options.paranoid_checks = true; | 108 options.paranoid_checks = true; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } | 265 } |
| 263 | 266 |
| 264 const LevelDBComparator* LevelDBDatabase::comparator() const | 267 const LevelDBComparator* LevelDBDatabase::comparator() const |
| 265 { | 268 { |
| 266 return m_comparator; | 269 return m_comparator; |
| 267 } | 270 } |
| 268 | 271 |
| 269 } | 272 } |
| 270 | 273 |
| 271 #endif | 274 #endif |
| OLD | NEW |