| 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/data_provider.h" | 5 #include "chrome/browser/android/history_report/data_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 144 } |
| 145 | 145 |
| 146 valid_entries.reset(new std::vector<DeltaFileEntryWithData>()); | 146 valid_entries.reset(new std::vector<DeltaFileEntryWithData>()); |
| 147 valid_entries->reserve(entries->size()); | 147 valid_entries->reserve(entries->size()); |
| 148 for (size_t i = 0; i < entries->size(); ++i) { | 148 for (size_t i = 0; i < entries->size(); ++i) { |
| 149 const DeltaFileEntryWithData& entry = (*entries)[i]; | 149 const DeltaFileEntryWithData& entry = (*entries)[i]; |
| 150 if (entry.Valid()) valid_entries->push_back(entry); | 150 if (entry.Valid()) valid_entries->push_back(entry); |
| 151 if (entry.SeqNo() > last_seq_no) last_seq_no = entry.SeqNo(); | 151 if (entry.SeqNo() > last_seq_no) last_seq_no = entry.SeqNo(); |
| 152 } | 152 } |
| 153 } while (!entries->empty() && valid_entries->empty()); | 153 } while (!entries->empty() && valid_entries->empty()); |
| 154 return valid_entries.Pass(); | 154 return valid_entries; |
| 155 } | 155 } |
| 156 | 156 |
| 157 void DataProvider::StartVisitMigrationToUsageBuffer( | 157 void DataProvider::StartVisitMigrationToUsageBuffer( |
| 158 UsageReportsBufferService* buffer_service) { | 158 UsageReportsBufferService* buffer_service) { |
| 159 base::WaitableEvent finished(false, false); | 159 base::WaitableEvent finished(false, false); |
| 160 buffer_service->Clear(); | 160 buffer_service->Clear(); |
| 161 content::BrowserThread::PostTask( | 161 content::BrowserThread::PostTask( |
| 162 content::BrowserThread::UI, | 162 content::BrowserThread::UI, |
| 163 FROM_HERE, | 163 FROM_HERE, |
| 164 base::Bind(&StartVisitMigrationToUsageBufferUiThread, | 164 base::Bind(&StartVisitMigrationToUsageBufferUiThread, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 189 bookmark_model_->BlockTillLoaded(); | 189 bookmark_model_->BlockTillLoaded(); |
| 190 bookmark_model_->GetBookmarks(&bookmarks); | 190 bookmark_model_->GetBookmarks(&bookmarks); |
| 191 urls.reserve(urls.size() + bookmarks.size()); | 191 urls.reserve(urls.size() + bookmarks.size()); |
| 192 for (size_t i = 0; i < bookmarks.size(); i++) { | 192 for (size_t i = 0; i < bookmarks.size(); i++) { |
| 193 urls.push_back(bookmarks[i].url.spec()); | 193 urls.push_back(bookmarks[i].url.spec()); |
| 194 } | 194 } |
| 195 delta_file_service_->Recreate(urls); | 195 delta_file_service_->Recreate(urls); |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace history_report | 198 } // namespace history_report |
| OLD | NEW |