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 "components/visitedlink/renderer/visitedlink_slave.h" | 5 #include "components/visitedlink/renderer/visitedlink_slave.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include "base/logging.h" | 10 #include "base/logging.h" |
8 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
9 #include "components/visitedlink/common/visitedlink_messages.h" | 12 #include "components/visitedlink/common/visitedlink_messages.h" |
10 #include "third_party/WebKit/public/web/WebView.h" | 13 #include "third_party/WebKit/public/web/WebView.h" |
11 | 14 |
12 using blink::WebView; | 15 using blink::WebView; |
13 | 16 |
14 namespace visitedlink { | 17 namespace visitedlink { |
15 | 18 |
16 VisitedLinkSlave::VisitedLinkSlave() : shared_memory_(NULL) {} | 19 VisitedLinkSlave::VisitedLinkSlave() : shared_memory_(NULL) {} |
(...skipping 28 matching lines...) Expand all Loading... |
45 if (!shared_memory_) | 48 if (!shared_memory_) |
46 return; | 49 return; |
47 | 50 |
48 // map the header into our process so we can see how long the rest is, | 51 // map the header into our process so we can see how long the rest is, |
49 // and set the salt | 52 // and set the salt |
50 if (!shared_memory_->Map(sizeof(SharedHeader))) | 53 if (!shared_memory_->Map(sizeof(SharedHeader))) |
51 return; | 54 return; |
52 SharedHeader* header = | 55 SharedHeader* header = |
53 static_cast<SharedHeader*>(shared_memory_->memory()); | 56 static_cast<SharedHeader*>(shared_memory_->memory()); |
54 DCHECK(header); | 57 DCHECK(header); |
55 int32 table_len = header->length; | 58 int32_t table_len = header->length; |
56 memcpy(salt_, header->salt, sizeof(salt_)); | 59 memcpy(salt_, header->salt, sizeof(salt_)); |
57 shared_memory_->Unmap(); | 60 shared_memory_->Unmap(); |
58 | 61 |
59 // now do the whole table because we know the length | 62 // now do the whole table because we know the length |
60 if (!shared_memory_->Map(sizeof(SharedHeader) + | 63 if (!shared_memory_->Map(sizeof(SharedHeader) + |
61 table_len * sizeof(Fingerprint))) { | 64 table_len * sizeof(Fingerprint))) { |
62 shared_memory_->Close(); | 65 shared_memory_->Close(); |
63 return; | 66 return; |
64 } | 67 } |
65 | 68 |
(...skipping 17 matching lines...) Expand all Loading... |
83 void VisitedLinkSlave::FreeTable() { | 86 void VisitedLinkSlave::FreeTable() { |
84 if (shared_memory_) { | 87 if (shared_memory_) { |
85 delete shared_memory_; | 88 delete shared_memory_; |
86 shared_memory_ = NULL; | 89 shared_memory_ = NULL; |
87 } | 90 } |
88 hash_table_ = NULL; | 91 hash_table_ = NULL; |
89 table_length_ = 0; | 92 table_length_ = 0; |
90 } | 93 } |
91 | 94 |
92 } // namespace visitedlink | 95 } // namespace visitedlink |
OLD | NEW |