| 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 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ |
| 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 // Add a callback to the list. The callback will remain registered until the | 474 // Add a callback to the list. The callback will remain registered until the |
| 475 // returned Subscription is destroyed. The Subscription must be destroyed | 475 // returned Subscription is destroyed. The Subscription must be destroyed |
| 476 // before HistoryService is destroyed. | 476 // before HistoryService is destroyed. |
| 477 std::unique_ptr<base::CallbackList<void(const std::set<GURL>&, | 477 std::unique_ptr<base::CallbackList<void(const std::set<GURL>&, |
| 478 const GURL&)>::Subscription> | 478 const GURL&)>::Subscription> |
| 479 AddFaviconsChangedCallback(const OnFaviconsChangedCallback& callback) | 479 AddFaviconsChangedCallback(const OnFaviconsChangedCallback& callback) |
| 480 WARN_UNUSED_RESULT; | 480 WARN_UNUSED_RESULT; |
| 481 | 481 |
| 482 // Testing ------------------------------------------------------------------- | 482 // Testing ------------------------------------------------------------------- |
| 483 | 483 |
| 484 // Similar to Init() but uses the provided |task_runner| for the backend. |
| 485 bool InitForTest(const HistoryDatabaseParams& history_database_params, |
| 486 scoped_refptr<base::SequencedTaskRunner> task_runner); |
| 487 |
| 484 // Runs |flushed| after bouncing off the history thread. | 488 // Runs |flushed| after bouncing off the history thread. |
| 485 void FlushForTest(const base::Closure& flushed); | 489 void FlushForTest(const base::Closure& flushed); |
| 486 | 490 |
| 487 // Designed for unit tests, this passes the given task on to the history | 491 // Designed for unit tests, this passes the given task on to the history |
| 488 // backend to be called once the history backend has terminated. This allows | 492 // backend to be called once the history backend has terminated. This allows |
| 489 // callers to know when the history thread is complete and the database files | 493 // callers to know when the history thread is complete and the database files |
| 490 // can be deleted and the next test run. Otherwise, the history thread may | 494 // can be deleted and the next test run. Otherwise, the history thread may |
| 491 // still be running, causing problems in subsequent tests. | 495 // still be running, causing problems in subsequent tests. |
| 492 // | 496 // |
| 493 // There can be only one closing task, so this will override any previously | 497 // There can be only one closing task, so this will override any previously |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 // In practice, this will be called by the service manager (BrowserProcess) | 570 // In practice, this will be called by the service manager (BrowserProcess) |
| 567 // when it is being destroyed. Because that reference is being destroyed, it | 571 // when it is being destroyed. Because that reference is being destroyed, it |
| 568 // should be impossible for anybody else to call the service, even if it is | 572 // should be impossible for anybody else to call the service, even if it is |
| 569 // still in memory (pending requests may be holding a reference to us). | 573 // still in memory (pending requests may be holding a reference to us). |
| 570 void Cleanup(); | 574 void Cleanup(); |
| 571 | 575 |
| 572 // Low-level Init(). Same as the public version, but adds a |no_db| parameter | 576 // Low-level Init(). Same as the public version, but adds a |no_db| parameter |
| 573 // that is only set by unittests which causes the backend to not init its DB. | 577 // that is only set by unittests which causes the backend to not init its DB. |
| 574 bool Init(bool no_db, const HistoryDatabaseParams& history_database_params); | 578 bool Init(bool no_db, const HistoryDatabaseParams& history_database_params); |
| 575 | 579 |
| 580 // Similar to Init() but uses the provided |task_runner| for the backend. |
| 581 bool InitWithTaskRunner(bool no_db, |
| 582 const HistoryDatabaseParams& history_database_params, |
| 583 scoped_refptr<base::SequencedTaskRunner> task_runner); |
| 584 |
| 576 // Called by the HistoryURLProvider class to schedule an autocomplete, it | 585 // Called by the HistoryURLProvider class to schedule an autocomplete, it |
| 577 // will be called back on the internal history thread with the history | 586 // will be called back on the internal history thread with the history |
| 578 // database so it can query. See history_url_provider.h for a diagram. | 587 // database so it can query. See history_url_provider.h for a diagram. |
| 579 void ScheduleAutocomplete( | 588 void ScheduleAutocomplete( |
| 580 const base::Callback<void(HistoryBackend*, URLDatabase*)>& callback); | 589 const base::Callback<void(HistoryBackend*, URLDatabase*)>& callback); |
| 581 | 590 |
| 582 // Notification from the backend that it has finished loading. Sends | 591 // Notification from the backend that it has finished loading. Sends |
| 583 // notification (NOTIFY_HISTORY_LOADED) and sets backend_loaded_ to true. | 592 // notification (NOTIFY_HISTORY_LOADED) and sets backend_loaded_ to true. |
| 584 void OnDBLoaded(); | 593 void OnDBLoaded(); |
| 585 | 594 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 | 845 |
| 837 // All vended weak pointers are invalidated in Cleanup(). | 846 // All vended weak pointers are invalidated in Cleanup(). |
| 838 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; | 847 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; |
| 839 | 848 |
| 840 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 849 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
| 841 }; | 850 }; |
| 842 | 851 |
| 843 } // namespace history | 852 } // namespace history |
| 844 | 853 |
| 845 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ | 854 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ |
| OLD | NEW |