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

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

Issue 352913002: Port HistoryService::ScheduleDBTask to CancelableTaskTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix lifetime of base::CancelableTaskTracker for HistoryModelWorker Created 6 years, 5 months 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 | Annotate | Revision Log
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 #ifndef CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ 5 #ifndef CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_
6 #define CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ 6 #define CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_
7 7
8 #include <functional> 8 #include <functional>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/gtest_prod_util.h" 16 #include "base/gtest_prod_util.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/strings/string16.h" 19 #include "base/strings/string16.h"
20 #include "chrome/browser/common/cancelable_request.h" 20 #include "base/task/cancelable_task_tracker.h"
21 #include "chrome/browser/history/history_db_task.h" 21 #include "chrome/browser/history/history_db_task.h"
22 #include "chrome/browser/history/history_types.h" 22 #include "chrome/browser/history/history_types.h"
23 #include "chrome/browser/history/in_memory_url_index_types.h" 23 #include "chrome/browser/history/in_memory_url_index_types.h"
24 #include "chrome/browser/history/scored_history_match.h" 24 #include "chrome/browser/history/scored_history_match.h"
25 #include "content/public/browser/notification_observer.h" 25 #include "content/public/browser/notification_observer.h"
26 #include "content/public/browser/notification_registrar.h" 26 #include "content/public/browser/notification_registrar.h"
27 #include "sql/connection.h" 27 #include "sql/connection.h"
28 28
29 class HistoryQuickProviderTest; 29 class HistoryQuickProviderTest;
30 class Profile; 30 class Profile;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 243
244 // Sets the directory wherein the cache file will be maintained. 244 // Sets the directory wherein the cache file will be maintained.
245 // For unit test usage only. 245 // For unit test usage only.
246 void set_history_dir(const base::FilePath& dir_path) { 246 void set_history_dir(const base::FilePath& dir_path) {
247 history_dir_ = dir_path; 247 history_dir_ = dir_path;
248 } 248 }
249 249
250 // Returns a pointer to our private data. For unit testing only. 250 // Returns a pointer to our private data. For unit testing only.
251 URLIndexPrivateData* private_data() { return private_data_.get(); } 251 URLIndexPrivateData* private_data() { return private_data_.get(); }
252 252
253 // Returns a pointer to our private data cancelable request tracker. For
254 // unit testing only.
255 base::CancelableTaskTracker* private_data_tracker() {
256 return &private_data_tracker_;
257 }
258
253 // Returns the set of whitelisted schemes. For unit testing only. 259 // Returns the set of whitelisted schemes. For unit testing only.
254 const std::set<std::string>& scheme_whitelist() { return scheme_whitelist_; } 260 const std::set<std::string>& scheme_whitelist() { return scheme_whitelist_; }
255 261
256 // The profile, may be null when testing. 262 // The profile, may be null when testing.
257 Profile* profile_; 263 Profile* profile_;
258 264
259 // The HistoryClient; may be NULL when testing. 265 // The HistoryClient; may be NULL when testing.
260 HistoryClient* history_client_; 266 HistoryClient* history_client_;
261 267
262 // Directory where cache file resides. This is, except when unit testing, 268 // Directory where cache file resides. This is, except when unit testing,
263 // the same directory in which the profile's history database is found. It 269 // the same directory in which the profile's history database is found. It
264 // should never be empty. 270 // should never be empty.
265 base::FilePath history_dir_; 271 base::FilePath history_dir_;
266 272
267 // Languages used during the word-breaking process during indexing. 273 // Languages used during the word-breaking process during indexing.
268 std::string languages_; 274 std::string languages_;
269 275
270 // Only URLs with a whitelisted scheme are indexed. 276 // Only URLs with a whitelisted scheme are indexed.
271 std::set<std::string> scheme_whitelist_; 277 std::set<std::string> scheme_whitelist_;
272 278
273 // The index's durable private data. 279 // The index's durable private data.
274 scoped_refptr<URLIndexPrivateData> private_data_; 280 scoped_refptr<URLIndexPrivateData> private_data_;
275 281
276 // Observers to notify upon restoral or save of the private data cache. 282 // Observers to notify upon restoral or save of the private data cache.
277 RestoreCacheObserver* restore_cache_observer_; 283 RestoreCacheObserver* restore_cache_observer_;
278 SaveCacheObserver* save_cache_observer_; 284 SaveCacheObserver* save_cache_observer_;
279 285
280 CancelableRequestConsumer cache_reader_consumer_; 286 base::CancelableTaskTracker private_data_tracker_;
287 base::CancelableTaskTracker cache_reader_tracker_;
281 content::NotificationRegistrar registrar_; 288 content::NotificationRegistrar registrar_;
282 289
283 // Set to true once the shutdown process has begun. 290 // Set to true once the shutdown process has begun.
284 bool shutdown_; 291 bool shutdown_;
285 292
286 // Set to true once the index restoration is complete. 293 // Set to true once the index restoration is complete.
287 bool restored_; 294 bool restored_;
288 295
289 // Set to true when changes to the index have been made and the index needs 296 // Set to true when changes to the index have been made and the index needs
290 // to be cached. Set to false when the index has been cached. Used as a 297 // to be cached. Set to false when the index has been cached. Used as a
291 // temporary safety check to insure that the cache is saved before the 298 // temporary safety check to insure that the cache is saved before the
292 // index has been destructed. 299 // index has been destructed.
293 // TODO(mrossetti): Eliminate once the transition to SQLite has been done. 300 // TODO(mrossetti): Eliminate once the transition to SQLite has been done.
294 // http://crbug.com/83659 301 // http://crbug.com/83659
295 bool needs_to_be_cached_; 302 bool needs_to_be_cached_;
296 303
297 DISALLOW_COPY_AND_ASSIGN(InMemoryURLIndex); 304 DISALLOW_COPY_AND_ASSIGN(InMemoryURLIndex);
298 }; 305 };
299 306
300 } // namespace history 307 } // namespace history
301 308
302 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ 309 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_
OLDNEW
« no previous file with comments | « chrome/browser/history/history_unittest.cc ('k') | chrome/browser/history/in_memory_url_index.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698