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

Side by Side Diff: components/safe_browsing_db/v4_database.h

Issue 2649643002: [S] Use a weak_factory for V4Database callbacks + test (Closed)
Patch Set: Nit: s/weak_factory_/weak_factory_on_io_ Created 3 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
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_database.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 COMPONENTS_SAFE_BROWSING_DB_V4_DATABASE_H_ 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_DATABASE_H_
6 #define COMPONENTS_SAFE_BROWSING_DB_V4_DATABASE_H_ 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_DATABASE_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/weak_ptr.h"
11 #include "base/sequenced_task_runner.h" 12 #include "base/sequenced_task_runner.h"
12 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
13 #include "components/safe_browsing_db/v4_protocol_manager_util.h" 14 #include "components/safe_browsing_db/v4_protocol_manager_util.h"
14 #include "components/safe_browsing_db/v4_store.h" 15 #include "components/safe_browsing_db/v4_store.h"
15 16
16 namespace safe_browsing { 17 namespace safe_browsing {
17 18
18 class V4Database; 19 class V4Database;
19 20
20 // Scheduled when the database has been read from disk and is ready to process 21 // Scheduled when the database has been read from disk and is ready to process
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 199
199 // The factory that controls the creation of V4Store objects. 200 // The factory that controls the creation of V4Store objects.
200 static V4StoreFactory* factory_; 201 static V4StoreFactory* factory_;
201 202
202 // The number of stores for which the update request is pending. When this 203 // The number of stores for which the update request is pending. When this
203 // goes down to 0, that indicates that the database has updated all the stores 204 // goes down to 0, that indicates that the database has updated all the stores
204 // that needed updating and is ready for the next update. It should only be 205 // that needed updating and is ready for the next update. It should only be
205 // accessed on the IO thread. 206 // accessed on the IO thread.
206 int pending_store_updates_; 207 int pending_store_updates_;
207 208
209 // Only meant to be dereferenced and invalidated on the IO thread and hence
210 // named. For details, see the comment at the top of weak_ptr.h
211 base::WeakPtrFactory<V4Database> weak_factory_on_io_;
212
208 DISALLOW_COPY_AND_ASSIGN(V4Database); 213 DISALLOW_COPY_AND_ASSIGN(V4Database);
209 }; 214 };
210 215
211 } // namespace safe_browsing 216 } // namespace safe_browsing
212 217
213 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_DATABASE_H_ 218 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_DATABASE_H_
OLDNEW
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698