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

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

Issue 10829154: Coverity: Fix a pass-by-value. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/visitedlink_master.h" 5 #include "chrome/browser/visitedlink/visitedlink_master.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <io.h> 9 #include <io.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // Fills the given salt structure with some quasi-random values 58 // Fills the given salt structure with some quasi-random values
59 // It is not necessary to generate a cryptographically strong random string, 59 // It is not necessary to generate a cryptographically strong random string,
60 // only that it be reasonably different for different users. 60 // only that it be reasonably different for different users.
61 void GenerateSalt(uint8 salt[LINK_SALT_LENGTH]) { 61 void GenerateSalt(uint8 salt[LINK_SALT_LENGTH]) {
62 DCHECK_EQ(LINK_SALT_LENGTH, 8) << "This code assumes the length of the salt"; 62 DCHECK_EQ(LINK_SALT_LENGTH, 8) << "This code assumes the length of the salt";
63 uint64 randval = base::RandUint64(); 63 uint64 randval = base::RandUint64();
64 memcpy(salt, &randval, 8); 64 memcpy(salt, &randval, 8);
65 } 65 }
66 66
67 // Opens file on a background thread to not block UI thread. 67 // Opens file on a background thread to not block UI thread.
68 void AsyncOpen(FILE** file, FilePath filename) { 68 void AsyncOpen(FILE** file, const FilePath& filename) {
69 *file = OpenFile(filename, "wb+"); 69 *file = OpenFile(filename, "wb+");
70 DLOG_IF(ERROR, !(*file)) << "Failed to open file " << filename.value(); 70 DLOG_IF(ERROR, !(*file)) << "Failed to open file " << filename.value();
71 } 71 }
72 72
73 // Returns true if the write was complete. 73 // Returns true if the write was complete.
74 static bool WriteToFile(FILE* file, 74 static bool WriteToFile(FILE* file,
75 off_t offset, 75 off_t offset,
76 const void* data, 76 const void* data,
77 size_t data_len) { 77 size_t data_len) {
78 if (fseek(file, offset, SEEK_SET) != 0) 78 if (fseek(file, offset, SEEK_SET) != 0)
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 } 972 }
973 973
974 void VisitedLinkMaster::TableBuilder::OnCompleteMainThread() { 974 void VisitedLinkMaster::TableBuilder::OnCompleteMainThread() {
975 if (master_) 975 if (master_)
976 master_->OnTableRebuildComplete(success_, fingerprints_); 976 master_->OnTableRebuildComplete(success_, fingerprints_);
977 977
978 // WILL (generally) DELETE THIS! This balances the AddRef in 978 // WILL (generally) DELETE THIS! This balances the AddRef in
979 // VisitedLinkMaster::RebuildTableFromHistory. 979 // VisitedLinkMaster::RebuildTableFromHistory.
980 Release(); 980 Release();
981 } 981 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698