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

Side by Side Diff: chrome/browser/visitedlink/visitedlink_master.h

Issue 8892023: Eliminated the last few uses of MessageLoop::QuitTask in chrome/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: One more... Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_VISITEDLINK_VISITEDLINK_MASTER_H_ 5 #ifndef CHROME_BROWSER_VISITEDLINK_VISITEDLINK_MASTER_H_
6 #define CHROME_BROWSER_VISITEDLINK_VISITEDLINK_MASTER_H_ 6 #define CHROME_BROWSER_VISITEDLINK_VISITEDLINK_MASTER_H_
7 #pragma once 7 #pragma once
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
11 #endif 11 #endif
12 #include <set> 12 #include <set>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/callback_forward.h"
15 #include "base/file_path.h" 16 #include "base/file_path.h"
16 #include "base/gtest_prod_util.h" 17 #include "base/gtest_prod_util.h"
17 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
18 #include "base/shared_memory.h" 19 #include "base/shared_memory.h"
19 #include "chrome/browser/history/history.h" 20 #include "chrome/browser/history/history.h"
20 #include "chrome/common/visitedlink_common.h" 21 #include "chrome/common/visitedlink_common.h"
21 22
22 class GURL; 23 class GURL;
23 class Profile; 24 class Profile;
24 25
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 void DeleteAllURLs(); 96 void DeleteAllURLs();
96 97
97 #if defined(UNIT_TEST) || !defined(NDEBUG) || defined(PERF_TEST) 98 #if defined(UNIT_TEST) || !defined(NDEBUG) || defined(PERF_TEST)
98 // This is a debugging function that can be called to double-check internal 99 // This is a debugging function that can be called to double-check internal
99 // data structures. It will assert if the check fails. 100 // data structures. It will assert if the check fails.
100 void DebugValidate(); 101 void DebugValidate();
101 102
102 // Sets a task to execute when the next rebuild from history is complete. 103 // Sets a task to execute when the next rebuild from history is complete.
103 // This is used by unit tests to wait for the rebuild to complete before 104 // This is used by unit tests to wait for the rebuild to complete before
104 // they continue. The pointer will be owned by this object after the call. 105 // they continue. The pointer will be owned by this object after the call.
105 void set_rebuild_complete_task(Task* task) { 106 void set_rebuild_complete_task(const base::Closure& task) {
106 DCHECK(!rebuild_complete_task_.get()); 107 DCHECK(rebuild_complete_task_.is_null());
107 rebuild_complete_task_.reset(task); 108 rebuild_complete_task_ = task;
108 } 109 }
109 110
110 // returns the number of items in the table for testing verification 111 // returns the number of items in the table for testing verification
111 int32 GetUsedCount() const { 112 int32 GetUsedCount() const {
112 return used_items_; 113 return used_items_;
113 } 114 }
114 115
115 // Call to cause the entire database file to be re-written from scratch 116 // Call to cause the entire database file to be re-written from scratch
116 // to disk. Used by the performance tester. 117 // to disk. Used by the performance tester.
117 bool RewriteFile() { 118 bool RewriteFile() {
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 // Overridden database file name for testing 353 // Overridden database file name for testing
353 FilePath database_name_override_; 354 FilePath database_name_override_;
354 355
355 // When nonzero, overrides the table size for new databases for testing 356 // When nonzero, overrides the table size for new databases for testing
356 int32 table_size_override_; 357 int32 table_size_override_;
357 358
358 // When non-NULL, overrides the history service to use rather than as the 359 // When non-NULL, overrides the history service to use rather than as the
359 // BrowserProcess. This is provided for unit tests. 360 // BrowserProcess. This is provided for unit tests.
360 HistoryService* history_service_override_; 361 HistoryService* history_service_override_;
361 362
362 // When non-NULL, indicates the task that should be run after the next 363 // When set, indicates the task that should be run after the next rebuild from
363 // rebuild from history is complete. 364 // history is complete.
364 scoped_ptr<Task> rebuild_complete_task_; 365 base::Closure rebuild_complete_task_;
365 366
366 // Set to prevent us from attempting to rebuild the database from global 367 // Set to prevent us from attempting to rebuild the database from global
367 // history if we have an error opening the file. This is used for testing, 368 // history if we have an error opening the file. This is used for testing,
368 // will be false in production. 369 // will be false in production.
369 bool suppress_rebuild_; 370 bool suppress_rebuild_;
370 371
371 DISALLOW_COPY_AND_ASSIGN(VisitedLinkMaster); 372 DISALLOW_COPY_AND_ASSIGN(VisitedLinkMaster);
372 }; 373 };
373 374
374 // NOTE: These methods are defined inline here, so we can share the compilation 375 // NOTE: These methods are defined inline here, so we can share the compilation
375 // of visitedlink_master.cc between the browser and the unit/perf tests. 376 // of visitedlink_master.cc between the browser and the unit/perf tests.
376 377
377 #if defined(UNIT_TEST) || defined(PERF_TEST) || !defined(NDEBUG) 378 #if defined(UNIT_TEST) || defined(PERF_TEST) || !defined(NDEBUG)
378 inline void VisitedLinkMaster::DebugValidate() { 379 inline void VisitedLinkMaster::DebugValidate() {
379 int32 used_count = 0; 380 int32 used_count = 0;
380 for (int32 i = 0; i < table_length_; i++) { 381 for (int32 i = 0; i < table_length_; i++) {
381 if (hash_table_[i]) 382 if (hash_table_[i])
382 used_count++; 383 used_count++;
383 } 384 }
384 DCHECK_EQ(used_count, used_items_); 385 DCHECK_EQ(used_count, used_items_);
385 } 386 }
386 #endif 387 #endif
387 388
388 #endif // CHROME_BROWSER_VISITEDLINK_VISITEDLINK_MASTER_H_ 389 #endif // CHROME_BROWSER_VISITEDLINK_VISITEDLINK_MASTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/history/history_unittest.cc ('k') | chrome/browser/visitedlink/visitedlink_master.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698