| 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 |
| 7 #include <stddef.h> |
| 8 |
| 6 #include "base/bind.h" | 9 #include "base/bind.h" |
| 7 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| 8 #include "base/logging.h" | 11 #include "base/logging.h" |
| 9 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 10 #include "chrome/browser/android/history_report/delta_file_commons.h" | 13 #include "chrome/browser/android/history_report/delta_file_commons.h" |
| 11 #include "chrome/browser/android/history_report/delta_file_service.h" | 14 #include "chrome/browser/android/history_report/delta_file_service.h" |
| 12 #include "chrome/browser/android/history_report/get_all_urls_from_history_task.h
" | 15 #include "chrome/browser/android/history_report/get_all_urls_from_history_task.h
" |
| 13 #include "chrome/browser/android/history_report/historic_visits_migration_task.h
" | 16 #include "chrome/browser/android/history_report/historic_visits_migration_task.h
" |
| 14 #include "chrome/browser/android/history_report/usage_reports_buffer_service.h" | 17 #include "chrome/browser/android/history_report/usage_reports_buffer_service.h" |
| 15 #include "chrome/browser/history/history_service_factory.h" | 18 #include "chrome/browser/history/history_service_factory.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 DeltaFileService* delta_file_service, | 101 DeltaFileService* delta_file_service, |
| 99 BookmarkModel* bookmark_model) | 102 BookmarkModel* bookmark_model) |
| 100 : bookmark_model_(bookmark_model), | 103 : bookmark_model_(bookmark_model), |
| 101 delta_file_service_(delta_file_service) { | 104 delta_file_service_(delta_file_service) { |
| 102 history_service_ = HistoryServiceFactory::GetForProfile( | 105 history_service_ = HistoryServiceFactory::GetForProfile( |
| 103 profile, ServiceAccessType::EXPLICIT_ACCESS); | 106 profile, ServiceAccessType::EXPLICIT_ACCESS); |
| 104 } | 107 } |
| 105 | 108 |
| 106 DataProvider::~DataProvider() {} | 109 DataProvider::~DataProvider() {} |
| 107 | 110 |
| 108 scoped_ptr<std::vector<DeltaFileEntryWithData> > DataProvider::Query( | 111 scoped_ptr<std::vector<DeltaFileEntryWithData>> DataProvider::Query( |
| 109 int64 last_seq_no, | 112 int64_t last_seq_no, |
| 110 int32 limit) { | 113 int32_t limit) { |
| 111 if (last_seq_no == 0) | 114 if (last_seq_no == 0) |
| 112 RecreateLog(); | 115 RecreateLog(); |
| 113 scoped_ptr<std::vector<DeltaFileEntryWithData> > entries; | 116 scoped_ptr<std::vector<DeltaFileEntryWithData> > entries; |
| 114 scoped_ptr<std::vector<DeltaFileEntryWithData> > valid_entries; | 117 scoped_ptr<std::vector<DeltaFileEntryWithData> > valid_entries; |
| 115 do { | 118 do { |
| 116 entries = delta_file_service_->Query(last_seq_no, limit); | 119 entries = delta_file_service_->Query(last_seq_no, limit); |
| 117 if (!entries->empty()) { | 120 if (!entries->empty()) { |
| 118 Context context(history_service_, | 121 Context context(history_service_, |
| 119 &history_task_tracker_); | 122 &history_task_tracker_); |
| 120 content::BrowserThread::PostTask( | 123 content::BrowserThread::PostTask( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 bookmark_model_->BlockTillLoaded(); | 189 bookmark_model_->BlockTillLoaded(); |
| 187 bookmark_model_->GetBookmarks(&bookmarks); | 190 bookmark_model_->GetBookmarks(&bookmarks); |
| 188 urls.reserve(urls.size() + bookmarks.size()); | 191 urls.reserve(urls.size() + bookmarks.size()); |
| 189 for (size_t i = 0; i < bookmarks.size(); i++) { | 192 for (size_t i = 0; i < bookmarks.size(); i++) { |
| 190 urls.push_back(bookmarks[i].url.spec()); | 193 urls.push_back(bookmarks[i].url.spec()); |
| 191 } | 194 } |
| 192 delta_file_service_->Recreate(urls); | 195 delta_file_service_->Recreate(urls); |
| 193 } | 196 } |
| 194 | 197 |
| 195 } // namespace history_report | 198 } // namespace history_report |
| OLD | NEW |