| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/leveldb_wrapper_impl.h" | 5 #include "content/browser/leveldb_wrapper_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "components/leveldb/public/cpp/util.h" | 10 #include "components/leveldb/public/cpp/util.h" |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 all.push_back(std::move(kv)); | 243 all.push_back(std::move(kv)); |
| 244 } | 244 } |
| 245 callback.Run(leveldb::mojom::DatabaseError::OK, std::move(all)); | 245 callback.Run(leveldb::mojom::DatabaseError::OK, std::move(all)); |
| 246 if (complete_callback.is_valid()) { | 246 if (complete_callback.is_valid()) { |
| 247 mojom::LevelDBWrapperGetAllCallbackAssociatedPtr complete_ptr; | 247 mojom::LevelDBWrapperGetAllCallbackAssociatedPtr complete_ptr; |
| 248 complete_ptr.Bind(std::move(complete_callback)); | 248 complete_ptr.Bind(std::move(complete_callback)); |
| 249 complete_ptr->Complete(true); | 249 complete_ptr->Complete(true); |
| 250 } | 250 } |
| 251 } | 251 } |
| 252 | 252 |
| 253 void LevelDBWrapperImpl::Sync(const SyncCallback& callback) { |
| 254 callback.Run(); |
| 255 } |
| 256 |
| 253 void LevelDBWrapperImpl::OnConnectionError() { | 257 void LevelDBWrapperImpl::OnConnectionError() { |
| 254 if (!bindings_.empty()) | 258 if (!bindings_.empty()) |
| 255 return; | 259 return; |
| 256 // If any tasks are waiting for load to complete, delay calling the | 260 // If any tasks are waiting for load to complete, delay calling the |
| 257 // no_bindings_callback_ until all those tasks have completed. | 261 // no_bindings_callback_ until all those tasks have completed. |
| 258 if (!on_load_complete_tasks_.empty()) | 262 if (!on_load_complete_tasks_.empty()) |
| 259 return; | 263 return; |
| 260 delegate_->OnNoBindings(); | 264 delegate_->OnNoBindings(); |
| 261 } | 265 } |
| 262 | 266 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 weak_ptr_factory_.GetWeakPtr())); | 427 weak_ptr_factory_.GetWeakPtr())); |
| 424 } | 428 } |
| 425 | 429 |
| 426 void LevelDBWrapperImpl::OnCommitComplete(leveldb::mojom::DatabaseError error) { | 430 void LevelDBWrapperImpl::OnCommitComplete(leveldb::mojom::DatabaseError error) { |
| 427 --commit_batches_in_flight_; | 431 --commit_batches_in_flight_; |
| 428 StartCommitTimer(); | 432 StartCommitTimer(); |
| 429 delegate_->DidCommit(error); | 433 delegate_->DidCommit(error); |
| 430 } | 434 } |
| 431 | 435 |
| 432 } // namespace content | 436 } // namespace content |
| OLD | NEW |