| OLD | NEW |
| 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 WEBKIT_SUPPORT_SIMPLE_DATABASE_SYSTEM_H_ | 5 #ifndef WEBKIT_SUPPORT_SIMPLE_DATABASE_SYSTEM_H_ |
| 6 #define WEBKIT_SUPPORT_SIMPLE_DATABASE_SYSTEM_H_ | 6 #define WEBKIT_SUPPORT_SIMPLE_DATABASE_SYSTEM_H_ |
| 7 | 7 |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 virtual void databaseOpened(const WebKit::WebDatabase& database); | 37 virtual void databaseOpened(const WebKit::WebDatabase& database); |
| 38 virtual void databaseModified(const WebKit::WebDatabase& database); | 38 virtual void databaseModified(const WebKit::WebDatabase& database); |
| 39 virtual void databaseClosed(const WebKit::WebDatabase& database); | 39 virtual void databaseClosed(const WebKit::WebDatabase& database); |
| 40 | 40 |
| 41 // SQLite VFS related methods, these are called on webcore's | 41 // SQLite VFS related methods, these are called on webcore's |
| 42 // background database threads via the WebKitClient impl. | 42 // background database threads via the WebKitClient impl. |
| 43 base::PlatformFile OpenFile(const string16& vfs_file_name, int desired_flags); | 43 base::PlatformFile OpenFile(const string16& vfs_file_name, int desired_flags); |
| 44 int DeleteFile(const string16& vfs_file_name, bool sync_dir); | 44 int DeleteFile(const string16& vfs_file_name, bool sync_dir); |
| 45 uint32 GetFileAttributes(const string16& vfs_file_name); | 45 uint32 GetFileAttributes(const string16& vfs_file_name); |
| 46 int64 GetFileSize(const string16& vfs_file_name); | 46 int64 GetFileSize(const string16& vfs_file_name); |
| 47 int64 GetSpaceAvailable(const string16& origin_identifier); |
| 47 | 48 |
| 48 // For use by LayoutTestController, called on the main thread. | 49 // For use by LayoutTestController, called on the main thread. |
| 49 void ClearAllDatabases(); | 50 void ClearAllDatabases(); |
| 50 void SetDatabaseQuota(int64 quota); | 51 void SetDatabaseQuota(int64 quota); |
| 51 | 52 |
| 52 private: | 53 private: |
| 53 // Used by our WebDatabaseObserver impl, only called on the db_thread | 54 // Used by our WebDatabaseObserver impl, only called on the db_thread |
| 54 void DatabaseOpened(const string16& origin_identifier, | 55 void DatabaseOpened(const string16& origin_identifier, |
| 55 const string16& database_name, | 56 const string16& database_name, |
| 56 const string16& description, | 57 const string16& description, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 70 | 71 |
| 71 // Used by our public SQLite VFS methods, only called on the db_thread. | 72 // Used by our public SQLite VFS methods, only called on the db_thread. |
| 72 void VfsOpenFile(const string16& vfs_file_name, int desired_flags, | 73 void VfsOpenFile(const string16& vfs_file_name, int desired_flags, |
| 73 base::PlatformFile* result, base::WaitableEvent* done_event); | 74 base::PlatformFile* result, base::WaitableEvent* done_event); |
| 74 void VfsDeleteFile(const string16& vfs_file_name, bool sync_dir, | 75 void VfsDeleteFile(const string16& vfs_file_name, bool sync_dir, |
| 75 int* result, base::WaitableEvent* done_event); | 76 int* result, base::WaitableEvent* done_event); |
| 76 void VfsGetFileAttributes(const string16& vfs_file_name, | 77 void VfsGetFileAttributes(const string16& vfs_file_name, |
| 77 uint32* result, base::WaitableEvent* done_event); | 78 uint32* result, base::WaitableEvent* done_event); |
| 78 void VfsGetFileSize(const string16& vfs_file_name, | 79 void VfsGetFileSize(const string16& vfs_file_name, |
| 79 int64* result, base::WaitableEvent* done_event); | 80 int64* result, base::WaitableEvent* done_event); |
| 81 void VfsGetSpaceAvailable(const string16& origin_identifier, |
| 82 int64* result, base::WaitableEvent* done_event); |
| 80 | 83 |
| 81 FilePath GetFullFilePathForVfsFile(const string16& vfs_file_name); | 84 FilePath GetFullFilePathForVfsFile(const string16& vfs_file_name); |
| 82 | 85 |
| 83 void ResetTracker(); | 86 void ResetTracker(); |
| 84 void ThreadCleanup(base::WaitableEvent* done_event); | 87 void ThreadCleanup(base::WaitableEvent* done_event); |
| 85 | 88 |
| 86 // Where the tracker database file and per origin database files reside. | 89 // Where the tracker database file and per origin database files reside. |
| 87 ScopedTempDir temp_dir_; | 90 ScopedTempDir temp_dir_; |
| 88 | 91 |
| 89 // All access to the db_tracker (except for its construction) and | 92 // All access to the db_tracker (except for its construction) and |
| 90 // vfs operations are serialized on a background thread. | 93 // vfs operations are serialized on a background thread. |
| 91 base::Thread db_thread_; | 94 base::Thread db_thread_; |
| 92 scoped_refptr<base::MessageLoopProxy> db_thread_proxy_; | 95 scoped_refptr<base::MessageLoopProxy> db_thread_proxy_; |
| 93 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_; | 96 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_; |
| 97 int64 quota_per_origin_; |
| 94 | 98 |
| 95 // Data members to support waiting for all connections to be closed. | 99 // Data members to support waiting for all connections to be closed. |
| 96 scoped_refptr<webkit_database::DatabaseConnectionsWrapper> open_connections_; | 100 scoped_refptr<webkit_database::DatabaseConnectionsWrapper> open_connections_; |
| 97 | 101 |
| 98 static SimpleDatabaseSystem* instance_; | 102 static SimpleDatabaseSystem* instance_; |
| 99 }; | 103 }; |
| 100 | 104 |
| 101 DISABLE_RUNNABLE_METHOD_REFCOUNT(SimpleDatabaseSystem); | 105 DISABLE_RUNNABLE_METHOD_REFCOUNT(SimpleDatabaseSystem); |
| 102 | 106 |
| 103 #endif // WEBKIT_SUPPORT_SIMPLE_DATABASE_SYSTEM_H_ | 107 #endif // WEBKIT_SUPPORT_SIMPLE_DATABASE_SYSTEM_H_ |
| OLD | NEW |