| 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_BACKEND_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ |
| 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 public: | 106 public: |
| 107 // Interface implemented by the owner of the HistoryBackend object. Normally, | 107 // Interface implemented by the owner of the HistoryBackend object. Normally, |
| 108 // the history service implements this to send stuff back to the main thread. | 108 // the history service implements this to send stuff back to the main thread. |
| 109 // The unit tests can provide a different implementation if they don't have | 109 // The unit tests can provide a different implementation if they don't have |
| 110 // a history service object. | 110 // a history service object. |
| 111 class Delegate { | 111 class Delegate { |
| 112 public: | 112 public: |
| 113 virtual ~Delegate() {} | 113 virtual ~Delegate() {} |
| 114 | 114 |
| 115 // Called when the database cannot be read correctly for some reason. | 115 // Called when the database cannot be read correctly for some reason. |
| 116 virtual void NotifyProfileError(sql::InitStatus init_status) = 0; | 116 virtual void NotifyProfileError(sql::InitStatus init_status, |
| 117 const std::string& diagnostics) = 0; |
| 117 | 118 |
| 118 // Sets the in-memory history backend. The in-memory backend is created by | 119 // Sets the in-memory history backend. The in-memory backend is created by |
| 119 // the main backend. For non-unit tests, this happens on the background | 120 // the main backend. For non-unit tests, this happens on the background |
| 120 // thread. It is to be used on the main thread, so this would transfer | 121 // thread. It is to be used on the main thread, so this would transfer |
| 121 // it to the history service. Unit tests can override this behavior. | 122 // it to the history service. Unit tests can override this behavior. |
| 122 // | 123 // |
| 123 // This function is NOT guaranteed to be called. If there is an error, | 124 // This function is NOT guaranteed to be called. If there is an error, |
| 124 // there may be no in-memory database. | 125 // there may be no in-memory database. |
| 125 virtual void SetInMemoryBackend( | 126 virtual void SetInMemoryBackend( |
| 126 std::unique_ptr<InMemoryHistoryBackend> backend) = 0; | 127 std::unique_ptr<InMemoryHistoryBackend> backend) = 0; |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 // of inheritance from base::SupportsUserData). | 873 // of inheritance from base::SupportsUserData). |
| 873 std::unique_ptr<HistoryBackendHelper> supports_user_data_helper_; | 874 std::unique_ptr<HistoryBackendHelper> supports_user_data_helper_; |
| 874 | 875 |
| 875 // Used to manage syncing of the typed urls datatype. This will be null before | 876 // Used to manage syncing of the typed urls datatype. This will be null before |
| 876 // Init is called. | 877 // Init is called. |
| 877 std::unique_ptr<TypedUrlSyncableService> typed_url_syncable_service_; | 878 std::unique_ptr<TypedUrlSyncableService> typed_url_syncable_service_; |
| 878 | 879 |
| 879 // Listens for the system being under memory pressure. | 880 // Listens for the system being under memory pressure. |
| 880 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; | 881 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
| 881 | 882 |
| 883 // Contains diagnostic information about the sql database that will be filled |
| 884 // when a catastrophic error occurs. |
| 885 std::string db_diagnostics_; |
| 886 |
| 882 // Map from host to index in the TopHosts list. It is updated only by | 887 // Map from host to index in the TopHosts list. It is updated only by |
| 883 // TopHosts(), so it's usually stale. | 888 // TopHosts(), so it's usually stale. |
| 884 mutable base::hash_map<std::string, int> host_ranks_; | 889 mutable base::hash_map<std::string, int> host_ranks_; |
| 885 | 890 |
| 886 // List of observers | 891 // List of observers |
| 887 base::ObserverList<HistoryBackendObserver> observers_; | 892 base::ObserverList<HistoryBackendObserver> observers_; |
| 888 | 893 |
| 889 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 894 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
| 890 }; | 895 }; |
| 891 | 896 |
| 892 } // namespace history | 897 } // namespace history |
| 893 | 898 |
| 894 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ | 899 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ |
| OLD | NEW |