OLD | NEW |
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/callback_forward.h" |
16 #include "base/file_path.h" | 16 #include "base/file_path.h" |
17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "base/shared_memory.h" | 19 #include "base/shared_memory.h" |
20 #include "base/threading/sequenced_worker_pool.h" | 20 #include "base/threading/sequenced_worker_pool.h" |
21 #include "chrome/browser/history/history.h" | 21 #include "chrome/browser/history/history.h" |
22 #include "chrome/browser/history/history_types.h" | |
23 #include "chrome/common/visitedlink_common.h" | 22 #include "chrome/common/visitedlink_common.h" |
24 | 23 |
25 class GURL; | 24 class GURL; |
26 class Profile; | 25 class Profile; |
27 | 26 |
28 // Controls the link coloring database. The master controls all writing to the | 27 // Controls the link coloring database. The master controls all writing to the |
29 // database as well as disk I/O. There should be only one master. | 28 // database as well as disk I/O. There should be only one master. |
30 // | 29 // |
31 // This class will defer writing operations to the file thread. This means that | 30 // This class will defer writing operations to the file thread. This means that |
32 // class destruction, the file may still be open since operations are pending on | 31 // class destruction, the file may still be open since operations are pending on |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 bool Init(); | 82 bool Init(); |
84 | 83 |
85 base::SharedMemory* shared_memory() { return shared_memory_; } | 84 base::SharedMemory* shared_memory() { return shared_memory_; } |
86 | 85 |
87 // Adds a URL to the table. | 86 // Adds a URL to the table. |
88 void AddURL(const GURL& url); | 87 void AddURL(const GURL& url); |
89 | 88 |
90 // Adds a set of URLs to the table. | 89 // Adds a set of URLs to the table. |
91 void AddURLs(const std::vector<GURL>& url); | 90 void AddURLs(const std::vector<GURL>& url); |
92 | 91 |
93 // Deletes the specified URLs from |rows| from the table. | 92 // Deletes the specified URLs from the table. |
94 void DeleteURLs(const history::URLRows& rows); | 93 void DeleteURLs(const std::set<GURL>& urls); |
95 | 94 |
96 // Clears the visited links table by deleting the file from disk. Used as | 95 // Clears the visited links table by deleting the file from disk. Used as |
97 // part of history clearing. | 96 // part of history clearing. |
98 void DeleteAllURLs(); | 97 void DeleteAllURLs(); |
99 | 98 |
100 #if defined(UNIT_TEST) || !defined(NDEBUG) || defined(PERF_TEST) | 99 #if defined(UNIT_TEST) || !defined(NDEBUG) || defined(PERF_TEST) |
101 // This is a debugging function that can be called to double-check internal | 100 // This is a debugging function that can be called to double-check internal |
102 // data structures. It will assert if the check fails. | 101 // data structures. It will assert if the check fails. |
103 void DebugValidate(); | 102 void DebugValidate(); |
104 | 103 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 int32 used_count = 0; | 388 int32 used_count = 0; |
390 for (int32 i = 0; i < table_length_; i++) { | 389 for (int32 i = 0; i < table_length_; i++) { |
391 if (hash_table_[i]) | 390 if (hash_table_[i]) |
392 used_count++; | 391 used_count++; |
393 } | 392 } |
394 DCHECK_EQ(used_count, used_items_); | 393 DCHECK_EQ(used_count, used_items_); |
395 } | 394 } |
396 #endif | 395 #endif |
397 | 396 |
398 #endif // CHROME_BROWSER_VISITEDLINK_VISITEDLINK_MASTER_H_ | 397 #endif // CHROME_BROWSER_VISITEDLINK_VISITEDLINK_MASTER_H_ |
OLD | NEW |