OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/history/in_memory_url_index.h" | 5 #include "chrome/browser/history/in_memory_url_index.h" |
6 | 6 |
| 7 #include "base/debug/trace_event.h" |
7 #include "base/file_util.h" | 8 #include "base/file_util.h" |
8 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/api/bookmarks/bookmark_service.h" | 10 #include "chrome/browser/api/bookmarks/bookmark_service.h" |
10 #include "chrome/browser/bookmarks/bookmark_model.h" | 11 #include "chrome/browser/bookmarks/bookmark_model.h" |
11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
12 #include "chrome/browser/history/history_notifications.h" | 13 #include "chrome/browser/history/history_notifications.h" |
13 #include "chrome/browser/history/history_service.h" | 14 #include "chrome/browser/history/history_service.h" |
14 #include "chrome/browser/history/history_service_factory.h" | 15 #include "chrome/browser/history/history_service_factory.h" |
15 #include "chrome/browser/history/url_database.h" | 16 #include "chrome/browser/history/url_database.h" |
16 #include "chrome/browser/history/url_index_private_data.h" | 17 #include "chrome/browser/history/url_index_private_data.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 for (URLRows::const_iterator row = details->rows.begin(); | 220 for (URLRows::const_iterator row = details->rows.begin(); |
220 row != details->rows.end(); ++row) | 221 row != details->rows.end(); ++row) |
221 needs_to_be_cached_ |= private_data_->DeleteURL(row->url()); | 222 needs_to_be_cached_ |= private_data_->DeleteURL(row->url()); |
222 } | 223 } |
223 } | 224 } |
224 | 225 |
225 // Restoring from Cache -------------------------------------------------------- | 226 // Restoring from Cache -------------------------------------------------------- |
226 | 227 |
227 void InMemoryURLIndex::PostRestoreFromCacheFileTask() { | 228 void InMemoryURLIndex::PostRestoreFromCacheFileTask() { |
228 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 229 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 230 TRACE_EVENT0("browser", "InMemoryURLIndex::PostRestoreFromCacheFileTask"); |
229 | 231 |
230 base::FilePath path; | 232 base::FilePath path; |
231 if (!GetCacheFilePath(&path) || shutdown_) { | 233 if (!GetCacheFilePath(&path) || shutdown_) { |
232 restored_ = true; | 234 restored_ = true; |
233 if (restore_cache_observer_) | 235 if (restore_cache_observer_) |
234 restore_cache_observer_->OnCacheRestoreFinished(false); | 236 restore_cache_observer_->OnCacheRestoreFinished(false); |
235 return; | 237 return; |
236 } | 238 } |
237 | 239 |
238 scoped_refptr<URLIndexPrivateData> restored_private_data = | 240 scoped_refptr<URLIndexPrivateData> restored_private_data = |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 base::Bind(DeleteCacheFile, path)); | 334 base::Bind(DeleteCacheFile, path)); |
333 } | 335 } |
334 } | 336 } |
335 | 337 |
336 void InMemoryURLIndex::OnCacheSaveDone(bool succeeded) { | 338 void InMemoryURLIndex::OnCacheSaveDone(bool succeeded) { |
337 if (save_cache_observer_) | 339 if (save_cache_observer_) |
338 save_cache_observer_->OnCacheSaveFinished(succeeded); | 340 save_cache_observer_->OnCacheSaveFinished(succeeded); |
339 } | 341 } |
340 | 342 |
341 } // namespace history | 343 } // namespace history |
OLD | NEW |