| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/browser/indexed_db/leveldb/leveldb_iterator_impl.h" | 8 #include "content/browser/indexed_db/leveldb/leveldb_iterator_impl.h" |
| 9 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" | 9 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" |
| 10 #include "content/browser/indexed_db/mock_browsertest_indexed_db_class_factory.h
" | 10 #include "content/browser/indexed_db/mock_browsertest_indexed_db_class_factory.h
" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 get_tracer_.log_call(); | 92 get_tracer_.log_call(); |
| 93 return LevelDBTransaction::Get(key, value, found); | 93 return LevelDBTransaction::Get(key, value, found); |
| 94 } | 94 } |
| 95 | 95 |
| 96 virtual leveldb::Status Commit() OVERRIDE { | 96 virtual leveldb::Status Commit() OVERRIDE { |
| 97 commit_tracer_.log_call(); | 97 commit_tracer_.log_call(); |
| 98 return LevelDBTransaction::Commit(); | 98 return LevelDBTransaction::Commit(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 private: | 101 private: |
| 102 static const std::string s_class_name; |
| 103 |
| 102 virtual ~LevelDBTraceTansaction() {} | 104 virtual ~LevelDBTraceTansaction() {} |
| 103 | 105 |
| 104 static const std::string s_class_name; | |
| 105 | |
| 106 FunctionTracer commit_tracer_; | 106 FunctionTracer commit_tracer_; |
| 107 FunctionTracer get_tracer_; | 107 FunctionTracer get_tracer_; |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 const std::string LevelDBTraceTansaction::s_class_name = "LevelDBTransaction"; | 110 const std::string LevelDBTraceTansaction::s_class_name = "LevelDBTransaction"; |
| 111 | 111 |
| 112 class LevelDBTraceIteratorImpl : public LevelDBIteratorImpl { | 112 class LevelDBTraceIteratorImpl : public LevelDBIteratorImpl { |
| 113 public: | 113 public: |
| 114 LevelDBTraceIteratorImpl(scoped_ptr<leveldb::Iterator> iterator, int inst_num) | 114 LevelDBTraceIteratorImpl(scoped_ptr<leveldb::Iterator> iterator, int inst_num) |
| 115 : LevelDBIteratorImpl(iterator.Pass()), | 115 : LevelDBIteratorImpl(iterator.Pass()), |
| 116 is_valid_tracer_(s_class_name, "IsValid", inst_num), | 116 is_valid_tracer_(s_class_name, "IsValid", inst_num), |
| 117 seek_to_last_tracer_(s_class_name, "SeekToLast", inst_num), | 117 seek_to_last_tracer_(s_class_name, "SeekToLast", inst_num), |
| 118 seek_tracer_(s_class_name, "Seek", inst_num), | 118 seek_tracer_(s_class_name, "Seek", inst_num), |
| 119 next_tracer_(s_class_name, "Next", inst_num), | 119 next_tracer_(s_class_name, "Next", inst_num), |
| 120 prev_tracer_(s_class_name, "Prev", inst_num), | 120 prev_tracer_(s_class_name, "Prev", inst_num), |
| 121 key_tracer_(s_class_name, "Key", inst_num), | 121 key_tracer_(s_class_name, "Key", inst_num), |
| 122 value_tracer_(s_class_name, "Value", inst_num) {} | 122 value_tracer_(s_class_name, "Value", inst_num) {} |
| 123 virtual ~LevelDBTraceIteratorImpl() {} | 123 virtual ~LevelDBTraceIteratorImpl() {} |
| 124 | 124 |
| 125 private: | 125 private: |
| 126 static const std::string s_class_name; |
| 127 |
| 126 virtual bool IsValid() const OVERRIDE { | 128 virtual bool IsValid() const OVERRIDE { |
| 127 is_valid_tracer_.log_call(); | 129 is_valid_tracer_.log_call(); |
| 128 return LevelDBIteratorImpl::IsValid(); | 130 return LevelDBIteratorImpl::IsValid(); |
| 129 } | 131 } |
| 130 virtual leveldb::Status SeekToLast() OVERRIDE { | 132 virtual leveldb::Status SeekToLast() OVERRIDE { |
| 131 seek_to_last_tracer_.log_call(); | 133 seek_to_last_tracer_.log_call(); |
| 132 return LevelDBIteratorImpl::SeekToLast(); | 134 return LevelDBIteratorImpl::SeekToLast(); |
| 133 } | 135 } |
| 134 virtual leveldb::Status Seek(const base::StringPiece& target) OVERRIDE { | 136 virtual leveldb::Status Seek(const base::StringPiece& target) OVERRIDE { |
| 135 seek_tracer_.log_call(); | 137 seek_tracer_.log_call(); |
| 136 return LevelDBIteratorImpl::Seek(target); | 138 return LevelDBIteratorImpl::Seek(target); |
| 137 } | 139 } |
| 138 virtual leveldb::Status Next() OVERRIDE { | 140 virtual leveldb::Status Next() OVERRIDE { |
| 139 next_tracer_.log_call(); | 141 next_tracer_.log_call(); |
| 140 return LevelDBIteratorImpl::Next(); | 142 return LevelDBIteratorImpl::Next(); |
| 141 } | 143 } |
| 142 virtual leveldb::Status Prev() OVERRIDE { | 144 virtual leveldb::Status Prev() OVERRIDE { |
| 143 prev_tracer_.log_call(); | 145 prev_tracer_.log_call(); |
| 144 return LevelDBIteratorImpl::Prev(); | 146 return LevelDBIteratorImpl::Prev(); |
| 145 } | 147 } |
| 146 virtual base::StringPiece Key() const OVERRIDE { | 148 virtual base::StringPiece Key() const OVERRIDE { |
| 147 key_tracer_.log_call(); | 149 key_tracer_.log_call(); |
| 148 return LevelDBIteratorImpl::Key(); | 150 return LevelDBIteratorImpl::Key(); |
| 149 } | 151 } |
| 150 virtual base::StringPiece Value() const OVERRIDE { | 152 virtual base::StringPiece Value() const OVERRIDE { |
| 151 value_tracer_.log_call(); | 153 value_tracer_.log_call(); |
| 152 return LevelDBIteratorImpl::Value(); | 154 return LevelDBIteratorImpl::Value(); |
| 153 } | 155 } |
| 154 | 156 |
| 155 static const std::string s_class_name; | |
| 156 | |
| 157 mutable FunctionTracer is_valid_tracer_; | 157 mutable FunctionTracer is_valid_tracer_; |
| 158 mutable FunctionTracer seek_to_last_tracer_; | 158 mutable FunctionTracer seek_to_last_tracer_; |
| 159 mutable FunctionTracer seek_tracer_; | 159 mutable FunctionTracer seek_tracer_; |
| 160 mutable FunctionTracer next_tracer_; | 160 mutable FunctionTracer next_tracer_; |
| 161 mutable FunctionTracer prev_tracer_; | 161 mutable FunctionTracer prev_tracer_; |
| 162 mutable FunctionTracer key_tracer_; | 162 mutable FunctionTracer key_tracer_; |
| 163 mutable FunctionTracer value_tracer_; | 163 mutable FunctionTracer value_tracer_; |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 const std::string LevelDBTraceIteratorImpl::s_class_name = "LevelDBIterator"; | 166 const std::string LevelDBTraceIteratorImpl::s_class_name = "LevelDBIterator"; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 261 |
| 262 void MockBrowserTestIndexedDBClassFactory::Reset() { | 262 void MockBrowserTestIndexedDBClassFactory::Reset() { |
| 263 failure_class_ = FAIL_CLASS_NOTHING; | 263 failure_class_ = FAIL_CLASS_NOTHING; |
| 264 failure_method_ = FAIL_METHOD_NOTHING; | 264 failure_method_ = FAIL_METHOD_NOTHING; |
| 265 instance_count_.clear(); | 265 instance_count_.clear(); |
| 266 fail_on_instance_num_.clear(); | 266 fail_on_instance_num_.clear(); |
| 267 fail_on_call_num_.clear(); | 267 fail_on_call_num_.clear(); |
| 268 } | 268 } |
| 269 | 269 |
| 270 } // namespace content | 270 } // namespace content |
| OLD | NEW |