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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_database.h

Issue 744183002: More explicit thread checking in SafeBrowsingDatabase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a3_deadcode
Patch Set: Created 6 years 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
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 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ 6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/synchronization/lock.h" 18 #include "base/synchronization/lock.h"
19 #include "base/threading/thread_checker.h"
19 #include "base/time/time.h" 20 #include "base/time/time.h"
20 #include "chrome/browser/safe_browsing/safe_browsing_store.h" 21 #include "chrome/browser/safe_browsing/safe_browsing_store.h"
21 22
22 namespace base {
23 class MessageLoop;
24 }
25
26 namespace safe_browsing { 23 namespace safe_browsing {
27 class PrefixSet; 24 class PrefixSet;
28 } 25 }
29 26
30 class GURL; 27 class GURL;
31 class SafeBrowsingDatabase; 28 class SafeBrowsingDatabase;
32 29
33 // Factory for creating SafeBrowsingDatabase. Tests implement this factory 30 // Factory for creating SafeBrowsingDatabase. Tests implement this factory
34 // to create fake Databases for testing. 31 // to create fake Databases for testing.
35 class SafeBrowsingDatabaseFactory { 32 class SafeBrowsingDatabaseFactory {
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 scoped_ptr<safe_browsing::PrefixSet>* prefix_set, 459 scoped_ptr<safe_browsing::PrefixSet>* prefix_set,
463 FailureType failure_type); 460 FailureType failure_type);
464 461
465 void UpdateSideEffectFreeWhitelistStore(); 462 void UpdateSideEffectFreeWhitelistStore();
466 void UpdateWhitelistStore(const base::FilePath& store_filename, 463 void UpdateWhitelistStore(const base::FilePath& store_filename,
467 SafeBrowsingStore* store, 464 SafeBrowsingStore* store,
468 SBWhitelist* whitelist); 465 SBWhitelist* whitelist);
469 void UpdateIpBlacklistStore(); 466 void UpdateIpBlacklistStore();
470 467
471 // Used to verify that various calls are made from the thread the 468 // Used to verify that various calls are made from the thread the
472 // object was created on. 469 // object was created on (i.e., the safe_browsing_thread).
473 base::MessageLoop* creation_loop_; 470 base::ThreadChecker thread_checker_;
474 471
475 // The base filename passed to Init(), used to generate the store and prefix 472 // The base filename passed to Init(), used to generate the store and prefix
476 // set filenames used to store data on disk. 473 // set filenames used to store data on disk.
477 base::FilePath filename_base_; 474 base::FilePath filename_base_;
478 475
479 // Underlying persistent store for chunk data. 476 // Underlying persistent store for chunk data.
480 // For browsing related (phishing and malware URLs) chunks and prefixes. 477 // For browsing related (phishing and malware URLs) chunks and prefixes.
481 scoped_ptr<SafeBrowsingStore> browse_store_; 478 scoped_ptr<SafeBrowsingStore> browse_store_;
482 479
483 // For download related (download URL and binary hash) chunks and prefixes. 480 // For download related (download URL and binary hash) chunks and prefixes.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 scoped_ptr<safe_browsing::PrefixSet> side_effect_free_whitelist_prefix_set_; 533 scoped_ptr<safe_browsing::PrefixSet> side_effect_free_whitelist_prefix_set_;
537 534
538 // Used to check if a prexfix was in the unwanted software database. 535 // Used to check if a prexfix was in the unwanted software database.
539 scoped_ptr<safe_browsing::PrefixSet> unwanted_software_prefix_set_; 536 scoped_ptr<safe_browsing::PrefixSet> unwanted_software_prefix_set_;
540 537
541 // Used to schedule resetting the database because of corruption. 538 // Used to schedule resetting the database because of corruption.
542 base::WeakPtrFactory<SafeBrowsingDatabaseNew> reset_factory_; 539 base::WeakPtrFactory<SafeBrowsingDatabaseNew> reset_factory_;
543 }; 540 };
544 541
545 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ 542 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698