Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: chrome/browser/history/in_memory_history_backend.h

Issue 573553004: Eliminate NOTIFICATION_HISTORY_LOADED notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ScopedObserver to InMemoryHistoryBackend,PrerenderLocalPredictor,ChromeTemplateURLServiceClient Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // The InMemoryHistoryBackend is a wrapper around the in-memory URL database. 5 // The InMemoryHistoryBackend is a wrapper around the in-memory URL database.
6 // It maintains an in-memory cache of a subset of history that is required for 6 // It maintains an in-memory cache of a subset of history that is required for
7 // low-latency operations, such as in-line autocomplete. 7 // low-latency operations, such as in-line autocomplete.
8 // 8 //
9 // The in-memory cache provides the following guarantees: 9 // The in-memory cache provides the following guarantees:
10 // (1.) It will always contain URLRows that either have a |typed_count| > 0; or 10 // (1.) It will always contain URLRows that either have a |typed_count| > 0; or
11 // that have a corresponding search term, in which case information about 11 // that have a corresponding search term, in which case information about
12 // the search term is also stored. 12 // the search term is also stored.
13 // (2.) It will be an actual subset, i.e., it will contain verbatim data, and 13 // (2.) It will be an actual subset, i.e., it will contain verbatim data, and
14 // will never contain more data that can be found in the main database. 14 // will never contain more data that can be found in the main database.
15 // 15 //
16 // The InMemoryHistoryBackend is created on the history thread and passed to the 16 // The InMemoryHistoryBackend is created on the history thread and passed to the
17 // main thread where operations can be completed synchronously. It listens for 17 // main thread where operations can be completed synchronously. It listens for
18 // notifications from the "regular" history backend and keeps itself in sync. 18 // notifications from the "regular" history backend and keeps itself in sync.
19 19
20 #ifndef CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ 20 #ifndef CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_
21 #define CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ 21 #define CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_
22 22
23 #include <string> 23 #include <string>
24 24
25 #include "base/basictypes.h" 25 #include "base/basictypes.h"
26 #include "base/gtest_prod_util.h" 26 #include "base/gtest_prod_util.h"
27 #include "base/memory/scoped_ptr.h" 27 #include "base/memory/scoped_ptr.h"
28 #include "base/scoped_observer.h"
28 #include "components/history/core/browser/history_service_observer.h" 29 #include "components/history/core/browser/history_service_observer.h"
29 #include "components/history/core/browser/keyword_id.h" 30 #include "components/history/core/browser/keyword_id.h"
30 #include "content/public/browser/notification_observer.h" 31 #include "content/public/browser/notification_observer.h"
31 #include "content/public/browser/notification_registrar.h" 32 #include "content/public/browser/notification_registrar.h"
32 33
33 class HistoryService; 34 class HistoryService;
34 class Profile; 35 class Profile;
35 36
36 namespace base { 37 namespace base {
37 class FilePath; 38 class FilePath;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Handler for HISTORY_KEYWORD_SEARCH_TERM_DELETED. 103 // Handler for HISTORY_KEYWORD_SEARCH_TERM_DELETED.
103 void OnKeywordSearchTermDeleted(const KeywordSearchDeletedDetails& details); 104 void OnKeywordSearchTermDeleted(const KeywordSearchDeletedDetails& details);
104 105
105 content::NotificationRegistrar registrar_; 106 content::NotificationRegistrar registrar_;
106 107
107 scoped_ptr<InMemoryDatabase> db_; 108 scoped_ptr<InMemoryDatabase> db_;
108 109
109 // The profile that this object is attached. May be NULL before 110 // The profile that this object is attached. May be NULL before
110 // initialization. 111 // initialization.
111 Profile* profile_; 112 Profile* profile_;
113 ScopedObserver<HistoryService, HistoryServiceObserver>
114 history_service_observer_;
112 HistoryService* history_service_; 115 HistoryService* history_service_;
113 116
114 DISALLOW_COPY_AND_ASSIGN(InMemoryHistoryBackend); 117 DISALLOW_COPY_AND_ASSIGN(InMemoryHistoryBackend);
115 }; 118 };
116 119
117 } // namespace history 120 } // namespace history
118 121
119 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ 122 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698