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

Side by Side Diff: components/visitedlink/common/visitedlink_common.cc

Issue 11825011: Componentize visitedlinks to src/components/visitedlink (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Final rebase Created 7 years, 11 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
OLDNEW
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 #include "chrome/common/visitedlink_common.h" 5 #include "components/visitedlink/common/visitedlink_common.h"
6 6
7 #include <string.h> // for memset() 7 #include <string.h> // for memset()
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/md5.h" 10 #include "base/md5.h"
11 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
12 12
13 namespace components {
14
13 const VisitedLinkCommon::Fingerprint VisitedLinkCommon::null_fingerprint_ = 0; 15 const VisitedLinkCommon::Fingerprint VisitedLinkCommon::null_fingerprint_ = 0;
14 const VisitedLinkCommon::Hash VisitedLinkCommon::null_hash_ = -1; 16 const VisitedLinkCommon::Hash VisitedLinkCommon::null_hash_ = -1;
15 17
16 VisitedLinkCommon::VisitedLinkCommon() 18 VisitedLinkCommon::VisitedLinkCommon()
17 : hash_table_(NULL), 19 : hash_table_(NULL),
18 table_length_(0) { 20 table_length_(0) {
19 memset(salt_, 0, sizeof(salt_)); 21 memset(salt_, 0, sizeof(salt_));
20 } 22 }
21 23
22 VisitedLinkCommon::~VisitedLinkCommon() { 24 VisitedLinkCommon::~VisitedLinkCommon() {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 base::MD5Final(&digest, &ctx); 91 base::MD5Final(&digest, &ctx);
90 92
91 // This is the same as "return *(Fingerprint*)&digest.a;" but if we do that 93 // This is the same as "return *(Fingerprint*)&digest.a;" but if we do that
92 // direct cast the alignment could be wrong, and we can't access a 64-bit int 94 // direct cast the alignment could be wrong, and we can't access a 64-bit int
93 // on arbitrary alignment on some processors. This reinterpret_casts it 95 // on arbitrary alignment on some processors. This reinterpret_casts it
94 // down to a char array of the same size as fingerprint, and then does the 96 // down to a char array of the same size as fingerprint, and then does the
95 // bit cast, which amounts to a memcpy. This does not handle endian issues. 97 // bit cast, which amounts to a memcpy. This does not handle endian issues.
96 return bit_cast<Fingerprint, uint8[8]>( 98 return bit_cast<Fingerprint, uint8[8]>(
97 *reinterpret_cast<uint8(*)[8]>(&digest.a)); 99 *reinterpret_cast<uint8(*)[8]>(&digest.a));
98 } 100 }
101
102 } // namespace components
OLDNEW
« no previous file with comments | « components/visitedlink/common/visitedlink_common.h ('k') | components/visitedlink/common/visitedlink_message_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698