| 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/safe_browsing/safe_browsing_database_bloom.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_database_bloom.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 } | 531 } |
| 532 } else { | 532 } else { |
| 533 // We have prefixes. | 533 // We have prefixes. |
| 534 int count = entry->prefix_count(); | 534 int count = entry->prefix_count(); |
| 535 if (count == 0) { | 535 if (count == 0) { |
| 536 encoded_add = EncodeChunkId(entry->chunk_id(), entry->list_id()); | 536 encoded_add = EncodeChunkId(entry->chunk_id(), entry->list_id()); |
| 537 InsertSubPrefix(host, encoded, encoded_add); | 537 InsertSubPrefix(host, encoded, encoded_add); |
| 538 } else { | 538 } else { |
| 539 for (int i = 0; i < count; i++) { | 539 for (int i = 0; i < count; i++) { |
| 540 SBPrefix prefix = entry->PrefixAt(i); | 540 SBPrefix prefix = entry->PrefixAt(i); |
| 541 encoded_add = EncodeChunkId(entry->ChunkIdAtPrefix(i), entry->list_id())
; | 541 encoded_add = EncodeChunkId(entry->ChunkIdAtPrefix(i), |
| 542 entry->list_id()); |
| 542 InsertSubPrefix(prefix, encoded, encoded_add); | 543 InsertSubPrefix(prefix, encoded, encoded_add); |
| 543 } | 544 } |
| 544 } | 545 } |
| 545 } | 546 } |
| 546 } | 547 } |
| 547 | 548 |
| 548 void SafeBrowsingDatabaseBloom::InsertSubPrefix(SBPrefix prefix, | 549 void SafeBrowsingDatabaseBloom::InsertSubPrefix(SBPrefix prefix, |
| 549 int encoded_chunk, | 550 int encoded_chunk, |
| 550 int encoded_add_chunk) { | 551 int encoded_add_chunk) { |
| 551 STATS_COUNTER("SB.PrefixSub", 1); | 552 STATS_COUNTER("SB.PrefixSub", 1); |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1487 if (did_resume_) { | 1488 if (did_resume_) { |
| 1488 PlatformThread::Sleep(kOnResumeHoldupMs); | 1489 PlatformThread::Sleep(kOnResumeHoldupMs); |
| 1489 did_resume_ = false; | 1490 did_resume_ = false; |
| 1490 } | 1491 } |
| 1491 } | 1492 } |
| 1492 | 1493 |
| 1493 // This database is always synchronous since we don't need to worry about | 1494 // This database is always synchronous since we don't need to worry about |
| 1494 // blocking any incoming reads. | 1495 // blocking any incoming reads. |
| 1495 void SafeBrowsingDatabaseBloom::SetSynchronous() { | 1496 void SafeBrowsingDatabaseBloom::SetSynchronous() { |
| 1496 } | 1497 } |
| OLD | NEW |