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

Side by Side Diff: storage/browser/database/database_tracker.h

Issue 1120553002: [storage] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Review Nits Created 5 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 STORAGE_BROWSER_DATABASE_DATABASE_TRACKER_H_ 5 #ifndef STORAGE_BROWSER_DATABASE_DATABASE_TRACKER_H_
6 #define STORAGE_BROWSER_DATABASE_DATABASE_TRACKER_H_ 6 #define STORAGE_BROWSER_DATABASE_DATABASE_TRACKER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/files/file.h" 12 #include "base/files/file.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/observer_list.h" 17 #include "base/observer_list.h"
18 #include "base/strings/string16.h" 18 #include "base/strings/string16.h"
19 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
20 #include "base/time/time.h" 20 #include "base/time/time.h"
21 #include "net/base/completion_callback.h" 21 #include "net/base/completion_callback.h"
22 #include "storage/browser/storage_browser_export.h" 22 #include "storage/browser/storage_browser_export.h"
23 #include "storage/common/database/database_connections.h" 23 #include "storage/common/database/database_connections.h"
24 24
25 namespace base { 25 namespace base {
26 class MessageLoopProxy; 26 class SingleThreadTaskRunner;
27 } 27 }
28 28
29 namespace content { 29 namespace content {
30 class DatabaseTracker_TestHelper_Test; 30 class DatabaseTracker_TestHelper_Test;
31 class MockDatabaseTracker; 31 class MockDatabaseTracker;
32 } 32 }
33 33
34 namespace sql { 34 namespace sql {
35 class Connection; 35 class Connection;
36 class MetaTable; 36 class MetaTable;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 const base::string16& database_name) = 0; 98 const base::string16& database_name) = 0;
99 99
100 protected: 100 protected:
101 virtual ~Observer() {} 101 virtual ~Observer() {}
102 }; 102 };
103 103
104 DatabaseTracker(const base::FilePath& profile_path, 104 DatabaseTracker(const base::FilePath& profile_path,
105 bool is_incognito, 105 bool is_incognito,
106 storage::SpecialStoragePolicy* special_storage_policy, 106 storage::SpecialStoragePolicy* special_storage_policy,
107 storage::QuotaManagerProxy* quota_manager_proxy, 107 storage::QuotaManagerProxy* quota_manager_proxy,
108 base::MessageLoopProxy* db_tracker_thread); 108 base::SingleThreadTaskRunner* db_tracker_thread);
109 109
110 void DatabaseOpened(const std::string& origin_identifier, 110 void DatabaseOpened(const std::string& origin_identifier,
111 const base::string16& database_name, 111 const base::string16& database_name,
112 const base::string16& database_details, 112 const base::string16& database_details,
113 int64 estimated_size, 113 int64 estimated_size,
114 int64* database_size); 114 int64* database_size);
115 void DatabaseModified(const std::string& origin_identifier, 115 void DatabaseModified(const std::string& origin_identifier,
116 const base::string16& database_name); 116 const base::string16& database_name);
117 void DatabaseClosed(const std::string& origin_identifier, 117 void DatabaseClosed(const std::string& origin_identifier,
118 const base::string16& database_name); 118 const base::string16& database_name);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 // The set of databases that should be deleted but are still opened 288 // The set of databases that should be deleted but are still opened
289 DatabaseSet dbs_to_be_deleted_; 289 DatabaseSet dbs_to_be_deleted_;
290 PendingDeletionCallbacks deletion_callbacks_; 290 PendingDeletionCallbacks deletion_callbacks_;
291 291
292 // Apps and Extensions can have special rights. 292 // Apps and Extensions can have special rights.
293 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_; 293 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_;
294 294
295 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_; 295 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_;
296 296
297 // The database tracker thread we're supposed to run file IO on. 297 // The database tracker thread we're supposed to run file IO on.
298 scoped_refptr<base::MessageLoopProxy> db_tracker_thread_; 298 scoped_refptr<base::SingleThreadTaskRunner> db_tracker_thread_;
299 299
300 // When in incognito mode, store a DELETE_ON_CLOSE handle to each 300 // When in incognito mode, store a DELETE_ON_CLOSE handle to each
301 // main DB and journal file that was accessed. When the incognito profile 301 // main DB and journal file that was accessed. When the incognito profile
302 // goes away (or when the browser crashes), all these handles will be 302 // goes away (or when the browser crashes), all these handles will be
303 // closed, and the files will be deleted. 303 // closed, and the files will be deleted.
304 FileHandlesMap incognito_file_handles_; 304 FileHandlesMap incognito_file_handles_;
305 305
306 // In a non-incognito profile, all DBs in an origin are stored in a directory 306 // In a non-incognito profile, all DBs in an origin are stored in a directory
307 // named after the origin. In an incognito profile though, we do not want the 307 // named after the origin. In an incognito profile though, we do not want the
308 // directory structure to reveal the origins visited by the user (in case the 308 // directory structure to reveal the origins visited by the user (in case the
309 // browser process crashes and those directories are not deleted). So we use 309 // browser process crashes and those directories are not deleted). So we use
310 // this map to assign directory names that do not reveal this information. 310 // this map to assign directory names that do not reveal this information.
311 OriginDirectoriesMap incognito_origin_directories_; 311 OriginDirectoriesMap incognito_origin_directories_;
312 int incognito_origin_directories_generator_; 312 int incognito_origin_directories_generator_;
313 313
314 FRIEND_TEST_ALL_PREFIXES(DatabaseTracker, TestHelper); 314 FRIEND_TEST_ALL_PREFIXES(DatabaseTracker, TestHelper);
315 }; 315 };
316 316
317 } // namespace storage 317 } // namespace storage
318 318
319 #endif // STORAGE_BROWSER_DATABASE_DATABASE_TRACKER_H_ 319 #endif // STORAGE_BROWSER_DATABASE_DATABASE_TRACKER_H_
OLDNEW
« no previous file with comments | « storage/browser/database/database_quota_client.cc ('k') | storage/browser/database/database_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698