OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/visitedlink_master.h" | 5 #include "chrome/browser/visitedlink_master.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <shlobj.h> | 8 #include <shlobj.h> |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 const int32 VisitedLinkMaster::kBigDeleteThreshold = 64; | 39 const int32 VisitedLinkMaster::kBigDeleteThreshold = 64; |
40 | 40 |
41 namespace { | 41 namespace { |
42 | 42 |
43 // Fills the given salt structure with some quasi-random values | 43 // Fills the given salt structure with some quasi-random values |
44 // It is not necessary to generate a cryptographically strong random string, | 44 // It is not necessary to generate a cryptographically strong random string, |
45 // only that it be reasonably different for different users. | 45 // only that it be reasonably different for different users. |
46 void GenerateSalt(uint8 salt[LINK_SALT_LENGTH]) { | 46 void GenerateSalt(uint8 salt[LINK_SALT_LENGTH]) { |
47 DCHECK_EQ(LINK_SALT_LENGTH, 8) << "This code assumes the length of the salt"; | 47 DCHECK_EQ(LINK_SALT_LENGTH, 8) << "This code assumes the length of the salt"; |
48 uint64 randval = base::RandUInt64(); | 48 uint64 randval = base::RandUint64(); |
49 memcpy(salt, &randval, 8); | 49 memcpy(salt, &randval, 8); |
50 } | 50 } |
51 // AsyncWriter ---------------------------------------------------------------- | 51 // AsyncWriter ---------------------------------------------------------------- |
52 | 52 |
53 // This task executes on a background thread and executes a write. This | 53 // This task executes on a background thread and executes a write. This |
54 // prevents us from blocking the UI thread doing I/O. | 54 // prevents us from blocking the UI thread doing I/O. |
55 class AsyncWriter : public Task { | 55 class AsyncWriter : public Task { |
56 public: | 56 public: |
57 AsyncWriter(HANDLE hfile, int32 offset, const void* data, int32 data_len) | 57 AsyncWriter(HANDLE hfile, int32 offset, const void* data, int32 data_len) |
58 : hfile_(hfile), | 58 : hfile_(hfile), |
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 } | 1002 } |
1003 | 1003 |
1004 void VisitedLinkMaster::TableBuilder::OnCompleteMainThread() { | 1004 void VisitedLinkMaster::TableBuilder::OnCompleteMainThread() { |
1005 if (master_) | 1005 if (master_) |
1006 master_->OnTableRebuildComplete(success_, fingerprints_); | 1006 master_->OnTableRebuildComplete(success_, fingerprints_); |
1007 | 1007 |
1008 // WILL (generally) DELETE THIS! This balances the AddRef in | 1008 // WILL (generally) DELETE THIS! This balances the AddRef in |
1009 // VisitedLinkMaster::RebuildTableFromHistory. | 1009 // VisitedLinkMaster::RebuildTableFromHistory. |
1010 Release(); | 1010 Release(); |
1011 } | 1011 } |
OLD | NEW |