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 // |diagnostics| contains information about the underlying database |
| 117 // which can help in identifying the cause of the profile error. |
| 118 virtual void NotifyProfileError(sql::InitStatus init_status, |
| 119 const std::string& diagnostics) = 0; |
117 | 120 |
118 // Sets the in-memory history backend. The in-memory backend is created by | 121 // 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 | 122 // 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 | 123 // 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. | 124 // it to the history service. Unit tests can override this behavior. |
122 // | 125 // |
123 // This function is NOT guaranteed to be called. If there is an error, | 126 // This function is NOT guaranteed to be called. If there is an error, |
124 // there may be no in-memory database. | 127 // there may be no in-memory database. |
125 virtual void SetInMemoryBackend( | 128 virtual void SetInMemoryBackend( |
126 std::unique_ptr<InMemoryHistoryBackend> backend) = 0; | 129 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). | 875 // of inheritance from base::SupportsUserData). |
873 std::unique_ptr<HistoryBackendHelper> supports_user_data_helper_; | 876 std::unique_ptr<HistoryBackendHelper> supports_user_data_helper_; |
874 | 877 |
875 // Used to manage syncing of the typed urls datatype. This will be null before | 878 // Used to manage syncing of the typed urls datatype. This will be null before |
876 // Init is called. | 879 // Init is called. |
877 std::unique_ptr<TypedUrlSyncableService> typed_url_syncable_service_; | 880 std::unique_ptr<TypedUrlSyncableService> typed_url_syncable_service_; |
878 | 881 |
879 // Listens for the system being under memory pressure. | 882 // Listens for the system being under memory pressure. |
880 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; | 883 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
881 | 884 |
| 885 // Contains diagnostic information about the sql database that is non-empty |
| 886 // when a catastrophic error occurs. |
| 887 std::string db_diagnostics_; |
| 888 |
882 // Map from host to index in the TopHosts list. It is updated only by | 889 // Map from host to index in the TopHosts list. It is updated only by |
883 // TopHosts(), so it's usually stale. | 890 // TopHosts(), so it's usually stale. |
884 mutable base::hash_map<std::string, int> host_ranks_; | 891 mutable base::hash_map<std::string, int> host_ranks_; |
885 | 892 |
886 // List of observers | 893 // List of observers |
887 base::ObserverList<HistoryBackendObserver> observers_; | 894 base::ObserverList<HistoryBackendObserver> observers_; |
888 | 895 |
889 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 896 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
890 }; | 897 }; |
891 | 898 |
892 } // namespace history | 899 } // namespace history |
893 | 900 |
894 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ | 901 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ |
OLD | NEW |