| 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/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
| 9 #include "components/leveldb/public/cpp/util.h" | 9 #include "components/leveldb/public/cpp/util.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 all.push_back(std::move(kv)); | 237 all.push_back(std::move(kv)); |
| 238 } | 238 } |
| 239 callback.Run(leveldb::mojom::DatabaseError::OK, std::move(all)); | 239 callback.Run(leveldb::mojom::DatabaseError::OK, std::move(all)); |
| 240 if (complete_callback.is_valid()) { | 240 if (complete_callback.is_valid()) { |
| 241 mojom::LevelDBWrapperGetAllCallbackAssociatedPtr complete_ptr; | 241 mojom::LevelDBWrapperGetAllCallbackAssociatedPtr complete_ptr; |
| 242 complete_ptr.Bind(std::move(complete_callback)); | 242 complete_ptr.Bind(std::move(complete_callback)); |
| 243 complete_ptr->Complete(true); | 243 complete_ptr->Complete(true); |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 void LevelDBWrapperImpl::FlushPipe(const FlushPipeCallback& callback) { |
| 248 callback.Run(); |
| 249 } |
| 250 |
| 247 void LevelDBWrapperImpl::OnConnectionError() { | 251 void LevelDBWrapperImpl::OnConnectionError() { |
| 248 if (!bindings_.empty()) | 252 if (!bindings_.empty()) |
| 249 return; | 253 return; |
| 250 // If any tasks are waiting for load to complete, delay calling the | 254 // If any tasks are waiting for load to complete, delay calling the |
| 251 // no_bindings_callback_ until all those tasks have completed. | 255 // no_bindings_callback_ until all those tasks have completed. |
| 252 if (!on_load_complete_tasks_.empty()) | 256 if (!on_load_complete_tasks_.empty()) |
| 253 return; | 257 return; |
| 254 no_bindings_callback_.Run(); | 258 no_bindings_callback_.Run(); |
| 255 } | 259 } |
| 256 | 260 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 weak_ptr_factory_.GetWeakPtr())); | 395 weak_ptr_factory_.GetWeakPtr())); |
| 392 } | 396 } |
| 393 | 397 |
| 394 void LevelDBWrapperImpl::OnCommitComplete(leveldb::mojom::DatabaseError error) { | 398 void LevelDBWrapperImpl::OnCommitComplete(leveldb::mojom::DatabaseError error) { |
| 395 // TODO(michaeln): What if it fails, uma here or in the DB class? | 399 // TODO(michaeln): What if it fails, uma here or in the DB class? |
| 396 --commit_batches_in_flight_; | 400 --commit_batches_in_flight_; |
| 397 StartCommitTimer(); | 401 StartCommitTimer(); |
| 398 } | 402 } |
| 399 | 403 |
| 400 } // namespace content | 404 } // namespace content |
| OLD | NEW |