| 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 <inttypes.h> | 7 #include <inttypes.h> | 
| 8 #include <stdint.h> | 8 #include <stdint.h> | 
| 9 | 9 | 
| 10 #include <algorithm> | 10 #include <algorithm> | 
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 71   leveldb::Env* env_; | 71   leveldb::Env* env_; | 
| 72   leveldb::FileLock* lock_; | 72   leveldb::FileLock* lock_; | 
| 73 | 73 | 
| 74   DISALLOW_COPY_AND_ASSIGN(LockImpl); | 74   DISALLOW_COPY_AND_ASSIGN(LockImpl); | 
| 75 }; | 75 }; | 
| 76 | 76 | 
| 77 leveldb::Slice MakeSlice(const StringPiece& s) { | 77 leveldb::Slice MakeSlice(const StringPiece& s) { | 
| 78   return leveldb::Slice(s.begin(), s.size()); | 78   return leveldb::Slice(s.begin(), s.size()); | 
| 79 } | 79 } | 
| 80 | 80 | 
| 81 StringPiece MakeStringPiece(const leveldb::Slice& s) { | 81 // Identical function in indexed_db/indexed_db_tombstone_sweeper.cc. | 
|  | 82 StringPiece LevelDB_MakeStringPiece(const leveldb::Slice& s) { | 
| 82   return StringPiece(s.data(), s.size()); | 83   return StringPiece(s.data(), s.size()); | 
| 83 } | 84 } | 
| 84 | 85 | 
| 85 class ComparatorAdapter : public leveldb::Comparator { | 86 class ComparatorAdapter : public leveldb::Comparator { | 
| 86  public: | 87  public: | 
| 87   explicit ComparatorAdapter(const LevelDBComparator* comparator) | 88   explicit ComparatorAdapter(const LevelDBComparator* comparator) | 
| 88       : comparator_(comparator) {} | 89       : comparator_(comparator) {} | 
| 89 | 90 | 
| 90   int Compare(const leveldb::Slice& a, const leveldb::Slice& b) const override { | 91   int Compare(const leveldb::Slice& a, const leveldb::Slice& b) const override { | 
| 91     return comparator_->Compare(MakeStringPiece(a), MakeStringPiece(b)); | 92     return comparator_->Compare(LevelDB_MakeStringPiece(a), LevelDB_MakeStringPi
     ece(b)); | 
| 92   } | 93   } | 
| 93 | 94 | 
| 94   const char* Name() const override { return comparator_->Name(); } | 95   const char* Name() const override { return comparator_->Name(); } | 
| 95 | 96 | 
| 96   // TODO(jsbell): Support the methods below in the future. | 97   // TODO(jsbell): Support the methods below in the future. | 
| 97   void FindShortestSeparator(std::string* start, | 98   void FindShortestSeparator(std::string* start, | 
| 98                              const leveldb::Slice& limit) const override {} | 99                              const leveldb::Slice& limit) const override {} | 
| 99 | 100 | 
| 100   void FindShortSuccessor(std::string* key) const override {} | 101   void FindShortSuccessor(std::string* key) const override {} | 
| 101 | 102 | 
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 529 void LevelDBDatabase::OnIteratorDestroyed(LevelDBIterator* iter) { | 530 void LevelDBDatabase::OnIteratorDestroyed(LevelDBIterator* iter) { | 
| 530   DCHECK_GT(num_iterators_, 0u); | 531   DCHECK_GT(num_iterators_, 0u); | 
| 531   --num_iterators_; | 532   --num_iterators_; | 
| 532   auto it = iterator_lru_.Peek(iter); | 533   auto it = iterator_lru_.Peek(iter); | 
| 533   if (it == iterator_lru_.end()) | 534   if (it == iterator_lru_.end()) | 
| 534     return; | 535     return; | 
| 535   iterator_lru_.Erase(it); | 536   iterator_lru_.Erase(it); | 
| 536 } | 537 } | 
| 537 | 538 | 
| 538 }  // namespace content | 539 }  // namespace content | 
| OLD | NEW | 
|---|