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

Unified Diff: components/safe_browsing_db/v4_local_database_manager.h

Issue 2431433003: [Experimental Debug] Debugging ChromiumOS test failures.
Patch Set: Add changes from 2427863002 and 2421703002. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: components/safe_browsing_db/v4_local_database_manager.h
diff --git a/components/safe_browsing_db/v4_local_database_manager.h b/components/safe_browsing_db/v4_local_database_manager.h
index 6b9a997226d87cb4ea9fa702e746cb1abe0a3e07..a5bdef46ae48c68c2802c375f7d8703c4910e09b 100644
--- a/components/safe_browsing_db/v4_local_database_manager.h
+++ b/components/safe_browsing_db/v4_local_database_manager.h
@@ -10,6 +10,7 @@
#include <memory>
+#include "base/memory/weak_ptr.h"
#include "components/safe_browsing_db/database_manager.h"
#include "components/safe_browsing_db/hit_report.h"
#include "components/safe_browsing_db/v4_database.h"
@@ -70,6 +71,13 @@ class V4LocalDatabaseManager : public SafeBrowsingDatabaseManager {
// Must be initialized by calling StartOnIOThread() before using.
V4LocalDatabaseManager(const base::FilePath& base_path);
+ ~V4LocalDatabaseManager() override;
+
+ void SetTaskRunnerForTest(
+ const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
+ task_runner_ = task_runner;
+ }
+
enum class ClientCallbackType {
// This represents the case when we're trying to determine if a URL is
// unsafe from the following perspectives: Malware, Phishing, UwS.
@@ -120,10 +128,6 @@ class V4LocalDatabaseManager : public SafeBrowsingDatabaseManager {
private:
friend class V4LocalDatabaseManagerTest;
- void SetTaskRunnerForTest(
- const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
- task_runner_ = task_runner;
- }
FRIEND_TEST_ALL_PREFIXES(V4LocalDatabaseManagerTest,
TestGetSeverestThreatTypeAndMetadata);
@@ -131,8 +135,6 @@ class V4LocalDatabaseManager : public SafeBrowsingDatabaseManager {
// which clients have cancelled their outstanding request.
typedef std::unordered_set<Client*> PendingClients;
- ~V4LocalDatabaseManager() override;
-
// Called when all the stores managed by the database have been read from
// disk after startup and the database is ready for checking resource
// reputation.
@@ -170,9 +172,9 @@ class V4LocalDatabaseManager : public SafeBrowsingDatabaseManager {
const std::vector<FullHashInfo>& full_hash_infos);
// Performs the full hash checking of the URL in |check|.
- void PerformFullHashCheck(std::unique_ptr<PendingCheck> check,
- const FullHashToStoreAndHashPrefixesMap&
- full_hash_to_store_and_hash_prefixes);
+ virtual void PerformFullHashCheck(std::unique_ptr<PendingCheck> check,
+ const FullHashToStoreAndHashPrefixesMap&
+ full_hash_to_store_and_hash_prefixes);
// When the database is ready to use, process the checks that were queued
// while the database was loading from disk.
@@ -234,6 +236,8 @@ class V4LocalDatabaseManager : public SafeBrowsingDatabaseManager {
// The protocol manager that downloads the hash prefix updates.
std::unique_ptr<V4UpdateProtocolManager> v4_update_protocol_manager_;
+ base::WeakPtrFactory<V4LocalDatabaseManager> weak_factory_;
+
friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>;
DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager);
}; // class V4LocalDatabaseManager

Powered by Google App Engine
This is Rietveld 408576698