| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/android/history_report/delta_file_service.h" | 5 #include "chrome/browser/android/history_report/delta_file_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "chrome/browser/android/history_report/delta_file_backend_leveldb.h" | 10 #include "chrome/browser/android/history_report/delta_file_backend_leveldb.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 *result = backend->Trim(lower_bound); | 29 *result = backend->Trim(lower_bound); |
| 30 finished->Signal(); | 30 finished->Signal(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void DoQuery( | 33 void DoQuery( |
| 34 history_report::DeltaFileBackend* backend, | 34 history_report::DeltaFileBackend* backend, |
| 35 int64_t last_seq_no, | 35 int64_t last_seq_no, |
| 36 int32_t limit, | 36 int32_t limit, |
| 37 base::WaitableEvent* finished, | 37 base::WaitableEvent* finished, |
| 38 scoped_ptr<std::vector<history_report::DeltaFileEntryWithData>>* result) { | 38 scoped_ptr<std::vector<history_report::DeltaFileEntryWithData>>* result) { |
| 39 *result = backend->Query(last_seq_no, limit).Pass(); | 39 *result = backend->Query(last_seq_no, limit); |
| 40 finished->Signal(); | 40 finished->Signal(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void DoRecreate(history_report::DeltaFileBackend* backend, | 43 void DoRecreate(history_report::DeltaFileBackend* backend, |
| 44 const std::vector<std::string>& urls, | 44 const std::vector<std::string>& urls, |
| 45 base::WaitableEvent* finished, | 45 base::WaitableEvent* finished, |
| 46 bool* result) { | 46 bool* result) { |
| 47 *result = backend->Recreate(urls); | 47 *result = backend->Recreate(urls); |
| 48 finished->Signal(); | 48 finished->Signal(); |
| 49 } | 49 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 worker_pool_token_, | 121 worker_pool_token_, |
| 122 FROM_HERE, | 122 FROM_HERE, |
| 123 base::Bind(&DoQuery, | 123 base::Bind(&DoQuery, |
| 124 base::Unretained(delta_file_backend_.get()), | 124 base::Unretained(delta_file_backend_.get()), |
| 125 last_seq_no, | 125 last_seq_no, |
| 126 limit, | 126 limit, |
| 127 base::Unretained(&finished), | 127 base::Unretained(&finished), |
| 128 base::Unretained(&result)), | 128 base::Unretained(&result)), |
| 129 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | 129 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); |
| 130 finished.Wait(); | 130 finished.Wait(); |
| 131 return result.Pass(); | 131 return result; |
| 132 } | 132 } |
| 133 | 133 |
| 134 bool DeltaFileService::Recreate(const std::vector<std::string>& urls) { | 134 bool DeltaFileService::Recreate(const std::vector<std::string>& urls) { |
| 135 bool result = false; | 135 bool result = false; |
| 136 base::WaitableEvent finished(false, false); | 136 base::WaitableEvent finished(false, false); |
| 137 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); | 137 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); |
| 138 pool->PostSequencedWorkerTaskWithShutdownBehavior( | 138 pool->PostSequencedWorkerTaskWithShutdownBehavior( |
| 139 worker_pool_token_, | 139 worker_pool_token_, |
| 140 FROM_HERE, | 140 FROM_HERE, |
| 141 base::Bind(&DoRecreate, | 141 base::Bind(&DoRecreate, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 168 base::Bind(&DoDump, | 168 base::Bind(&DoDump, |
| 169 base::Unretained(delta_file_backend_.get()), | 169 base::Unretained(delta_file_backend_.get()), |
| 170 base::Unretained(&finished), | 170 base::Unretained(&finished), |
| 171 base::Unretained(&dump)), | 171 base::Unretained(&dump)), |
| 172 base::SequencedWorkerPool::BLOCK_SHUTDOWN); | 172 base::SequencedWorkerPool::BLOCK_SHUTDOWN); |
| 173 finished.Wait(); | 173 finished.Wait(); |
| 174 return dump; | 174 return dump; |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace history_report | 177 } // namespace history_report |
| OLD | NEW |