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