| 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 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/bind.h" | 16 #include "base/bind.h" |
| 17 #include "base/callback.h" | 17 #include "base/callback.h" |
| 18 #include "base/callback_list.h" | 18 #include "base/callback_list.h" |
| 19 #include "base/files/file_path.h" | 19 #include "base/files/file_path.h" |
| 20 #include "base/logging.h" | 20 #include "base/logging.h" |
| 21 #include "base/macros.h" | 21 #include "base/macros.h" |
| 22 #include "base/memory/ref_counted.h" | 22 #include "base/memory/ref_counted.h" |
| 23 #include "base/memory/weak_ptr.h" | 23 #include "base/memory/weak_ptr.h" |
| 24 #include "base/observer_list.h" | 24 #include "base/observer_list.h" |
| 25 #include "base/sequenced_task_runner.h" |
| 25 #include "base/strings/string16.h" | 26 #include "base/strings/string16.h" |
| 26 #include "base/task/cancelable_task_tracker.h" | 27 #include "base/task/cancelable_task_tracker.h" |
| 27 #include "base/threading/thread_checker.h" | 28 #include "base/threading/thread_checker.h" |
| 28 #include "base/time/time.h" | 29 #include "base/time/time.h" |
| 29 #include "build/build_config.h" | 30 #include "build/build_config.h" |
| 30 #include "components/favicon_base/favicon_callback.h" | 31 #include "components/favicon_base/favicon_callback.h" |
| 31 #include "components/favicon_base/favicon_usage_data.h" | 32 #include "components/favicon_base/favicon_usage_data.h" |
| 32 #include "components/history/core/browser/delete_directive_handler.h" | 33 #include "components/history/core/browser/delete_directive_handler.h" |
| 33 #include "components/history/core/browser/history_types.h" | 34 #include "components/history/core/browser/history_types.h" |
| 34 #include "components/history/core/browser/keyword_id.h" | 35 #include "components/history/core/browser/keyword_id.h" |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 // Called when the favicons for the given page URLs (e.g. | 789 // Called when the favicons for the given page URLs (e.g. |
| 789 // http://www.google.com) and the given icon URL (e.g. | 790 // http://www.google.com) and the given icon URL (e.g. |
| 790 // http://www.google.com/favicon.ico) have changed. It is valid to call | 791 // http://www.google.com/favicon.ico) have changed. It is valid to call |
| 791 // NotifyFaviconsChanged() with non-empty |page_urls| and an empty |icon_url| | 792 // NotifyFaviconsChanged() with non-empty |page_urls| and an empty |icon_url| |
| 792 // and vice versa. | 793 // and vice versa. |
| 793 void NotifyFaviconsChanged(const std::set<GURL>& page_urls, | 794 void NotifyFaviconsChanged(const std::set<GURL>& page_urls, |
| 794 const GURL& icon_url); | 795 const GURL& icon_url); |
| 795 | 796 |
| 796 base::ThreadChecker thread_checker_; | 797 base::ThreadChecker thread_checker_; |
| 797 | 798 |
| 798 // The thread used by the history service to run complicated operations. | 799 // The thread used by the history service to run HistoryBackend operations. |
| 799 // |thread_| is null once Cleanup() is called. | 800 // Intentionally not a BrowserThread because the sync integration unit tests |
| 800 base::Thread* thread_; | 801 // need to create multiple HistoryServices which each have their own thread. |
| 802 // Nullptr if TaskScheduler is used for HistoryBackend operations. |
| 803 std::unique_ptr<base::Thread> thread_; |
| 804 |
| 805 // The TaskRunner to which HistoryBackend tasks are posted. Nullptr once |
| 806 // Cleanup() is called. |
| 807 scoped_refptr<base::SequencedTaskRunner> backend_task_runner_; |
| 801 | 808 |
| 802 // This class has most of the implementation and runs on the 'thread_'. | 809 // This class has most of the implementation and runs on the 'thread_'. |
| 803 // You MUST communicate with this class ONLY through the thread_'s | 810 // You MUST communicate with this class ONLY through the thread_'s |
| 804 // message_loop(). | 811 // message_loop(). |
| 805 // | 812 // |
| 806 // This pointer will be null once Cleanup() has been called, meaning no | 813 // This pointer will be null once Cleanup() has been called, meaning no |
| 807 // more calls should be made to the history thread. | 814 // more calls should be made to the history thread. |
| 808 scoped_refptr<HistoryBackend> history_backend_; | 815 scoped_refptr<HistoryBackend> history_backend_; |
| 809 | 816 |
| 810 // A cache of the user-typed URLs kept in memory that is used by the | 817 // A cache of the user-typed URLs kept in memory that is used by the |
| (...skipping 21 matching lines...) Expand all Loading... |
| 832 | 839 |
| 833 // All vended weak pointers are invalidated in Cleanup(). | 840 // All vended weak pointers are invalidated in Cleanup(). |
| 834 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; | 841 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; |
| 835 | 842 |
| 836 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 843 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
| 837 }; | 844 }; |
| 838 | 845 |
| 839 } // namespace history | 846 } // namespace history |
| 840 | 847 |
| 841 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ | 848 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ |
| OLD | NEW |