diff options
author | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-27 17:13:02 +0000 |
---|---|---|
committer | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-27 17:13:02 +0000 |
commit | 6e01dae641ad11e7600dec30de45b506b8d21c0c (patch) | |
tree | bc27f693251a8e602fbdf65c50fd4379cd48959c /chrome/browser/visitedlink_master.h | |
parent | 25fa78c2ffe3e98231cfb22f4005452da85b201c (diff) | |
download | chromium_src-6e01dae641ad11e7600dec30de45b506b8d21c0c.zip chromium_src-6e01dae641ad11e7600dec30de45b506b8d21c0c.tar.gz chromium_src-6e01dae641ad11e7600dec30de45b506b8d21c0c.tar.bz2 |
First step of porting VisitedLinkMaster to POSIX:
* Use POSIX file access APIs rather than HANDLEs.
* Add stubs so that VisitedLinkMaster compiles on POSIX.
Still to be done:
* Bring up Surrounding infrastructure to turn on unit tests.
Review URL: http://codereview.chromium.org/18530
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8721 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/visitedlink_master.h')
-rw-r--r-- | chrome/browser/visitedlink_master.h | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/chrome/browser/visitedlink_master.h b/chrome/browser/visitedlink_master.h index ac99634..c68e4c7 100644 --- a/chrome/browser/visitedlink_master.h +++ b/chrome/browser/visitedlink_master.h @@ -5,13 +5,22 @@ #ifndef CHROME_BROWSER_VISITEDLINK_MASTER_H__ #define CHROME_BROWSER_VISITEDLINK_MASTER_H__ +#if defined(OS_WIN) +#include <windows.h> +#endif #include <set> #include <string> #include <vector> +#include "base/file_path.h" #include "base/ref_counted.h" #include "base/shared_memory.h" +#if defined(OS_WIN) #include "chrome/browser/history/history.h" +#else +// TODO(port): remove scaffolding, use history.h for both POSIX and WIN. +#include "chrome/common/temp_scaffolding_stubs.h" +#endif // !defined(OS_WIN) #include "chrome/common/visitedlink_common.h" #include "testing/gtest/include/gtest/gtest_prod.h" @@ -53,7 +62,7 @@ class VisitedLinkMaster : public VisitedLinkCommon { PostNewTableEvent* poster, HistoryService* history_service, bool suppress_rebuild, - const std::wstring& filename, + const FilePath& filename, int32 default_table_size); virtual ~VisitedLinkMaster(); @@ -141,7 +150,7 @@ class VisitedLinkMaster : public VisitedLinkCommon { // When the user is deleting a boatload of URLs, we don't really want to do // individual writes for each of them. When the count exceeds this threshold, // we will write the whole table to disk at once instead of individual items. - static const int32 kBigDeleteThreshold; + static const size_t kBigDeleteThreshold; // Backend for the constructors initializing the members. void InitMembers(base::Thread* file_thread, @@ -171,15 +180,15 @@ class VisitedLinkMaster : public VisitedLinkCommon { // Returns true on success and places the size of the table in num_entries // and the number of nonzero fingerprints in used_count. This will fail if // the version of the file is not the current version of the database. - bool ReadFileHeader(HANDLE hfile, int32* num_entries, int32* used_count, + bool ReadFileHeader(FILE* hfile, int32* num_entries, int32* used_count, uint8 salt[LINK_SALT_LENGTH]); // Fills *filename with the name of the link database filename - bool GetDatabaseFileName(std::wstring* filename); + bool GetDatabaseFileName(FilePath* filename); // Wrapper around Window's WriteFile using asynchronous I/O. This will proxy // the write to a background thread. - void WriteToFile(HANDLE hfile, int32 offset, void* data, int32 data_size); + void WriteToFile(FILE* hfile, off_t offset, void* data, int32 data_size); // Helper function to schedule and asynchronous write of the used count to // disk (this is a common operation). @@ -192,7 +201,7 @@ class VisitedLinkMaster : public VisitedLinkCommon { // Synchronous read from the file. Assumes there are no pending asynchronous // I/O functions. Returns true if the entire buffer was successfully filled. - bool ReadFromFile(HANDLE hfile, int32 offset, void* data, int32 data_size); + bool ReadFromFile(FILE* hfile, off_t offset, void* data, size_t data_size); // General table handling // ---------------------- @@ -326,7 +335,7 @@ class VisitedLinkMaster : public VisitedLinkCommon { // The currently open file with the table in it. This may be NULL if we're // rebuilding and haven't written a new version yet. Writing to the file may // be safely ignored in this case. - HANDLE file_; + FILE* file_; // Shared memory consists of a SharedHeader followed by the table. base::SharedMemory *shared_memory_; @@ -347,7 +356,7 @@ class VisitedLinkMaster : public VisitedLinkCommon { // in release builds that give "regular" behavior. // Overridden database file name for testing - std::wstring database_name_override_; + FilePath database_name_override_; // When nonzero, overrides the table size for new databases for testing int32 table_size_override_; |