| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_APPCACHE_APPCACHE_STORAGE_IMPL_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_STORAGE_IMPL_H_ |
| 6 #define WEBKIT_APPCACHE_APPCACHE_STORAGE_IMPL_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_STORAGE_IMPL_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/message_loop_proxy.h" |
| 14 #include "base/task.h" | 15 #include "base/task.h" |
| 15 #include "webkit/appcache/appcache_database.h" | 16 #include "webkit/appcache/appcache_database.h" |
| 16 #include "webkit/appcache/appcache_disk_cache.h" | 17 #include "webkit/appcache/appcache_disk_cache.h" |
| 17 #include "webkit/appcache/appcache_storage.h" | 18 #include "webkit/appcache/appcache_storage.h" |
| 18 | 19 |
| 19 namespace appcache { | 20 namespace appcache { |
| 20 | 21 |
| 21 class AppCacheStorageImpl : public AppCacheStorage { | 22 class AppCacheStorageImpl : public AppCacheStorage { |
| 22 public: | 23 public: |
| 23 explicit AppCacheStorageImpl(AppCacheService* service); | 24 explicit AppCacheStorageImpl(AppCacheService* service); |
| 24 virtual ~AppCacheStorageImpl(); | 25 virtual ~AppCacheStorageImpl(); |
| 25 | 26 |
| 26 void Initialize(const FilePath& cache_directory); | 27 void Initialize(const FilePath& cache_directory, |
| 28 base::MessageLoopProxy* cache_thread); |
| 27 void Disable(); | 29 void Disable(); |
| 28 bool is_disabled() const { return is_disabled_; } | 30 bool is_disabled() const { return is_disabled_; } |
| 29 | 31 |
| 30 // AppCacheStorage methods, see the base class for doc comments. | 32 // AppCacheStorage methods, see the base class for doc comments. |
| 31 virtual void GetAllInfo(Delegate* delegate); | 33 virtual void GetAllInfo(Delegate* delegate); |
| 32 virtual void LoadCache(int64 id, Delegate* delegate); | 34 virtual void LoadCache(int64 id, Delegate* delegate); |
| 33 virtual void LoadOrCreateGroup(const GURL& manifest_url, Delegate* delegate); | 35 virtual void LoadOrCreateGroup(const GURL& manifest_url, Delegate* delegate); |
| 34 virtual void StoreGroupAndNewestCache( | 36 virtual void StoreGroupAndNewestCache( |
| 35 AppCacheGroup* group, AppCache* newest_cache, Delegate* delegate); | 37 AppCacheGroup* group, AppCache* newest_cache, Delegate* delegate); |
| 36 virtual void FindResponseForMainRequest(const GURL& url, Delegate* delegate); | 38 virtual void FindResponseForMainRequest(const GURL& url, Delegate* delegate); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 108 |
| 107 void CheckPolicyAndCallOnMainResponseFound( | 109 void CheckPolicyAndCallOnMainResponseFound( |
| 108 DelegateReferenceVector* delegates, const GURL& url, | 110 DelegateReferenceVector* delegates, const GURL& url, |
| 109 const AppCacheEntry& entry, const AppCacheEntry& fallback_entry, | 111 const AppCacheEntry& entry, const AppCacheEntry& fallback_entry, |
| 110 int64 cache_id, const GURL& manifest_url); | 112 int64 cache_id, const GURL& manifest_url); |
| 111 | 113 |
| 112 AppCacheDiskCache* disk_cache(); | 114 AppCacheDiskCache* disk_cache(); |
| 113 | 115 |
| 114 // The directory in which we place files in the file system. | 116 // The directory in which we place files in the file system. |
| 115 FilePath cache_directory_; | 117 FilePath cache_directory_; |
| 118 scoped_refptr<base::MessageLoopProxy> cache_thread_; |
| 116 bool is_incognito_; | 119 bool is_incognito_; |
| 117 | 120 |
| 118 // Structures to keep track of DatabaseTasks that are in-flight. | 121 // Structures to keep track of DatabaseTasks that are in-flight. |
| 119 DatabaseTaskQueue scheduled_database_tasks_; | 122 DatabaseTaskQueue scheduled_database_tasks_; |
| 120 PendingCacheLoads pending_cache_loads_; | 123 PendingCacheLoads pending_cache_loads_; |
| 121 PendingGroupLoads pending_group_loads_; | 124 PendingGroupLoads pending_group_loads_; |
| 122 PendingForeignMarkings pending_foreign_markings_; | 125 PendingForeignMarkings pending_foreign_markings_; |
| 123 | 126 |
| 124 // Structures to keep track of lazy response deletion. | 127 // Structures to keep track of lazy response deletion. |
| 125 std::deque<int64> deletable_response_ids_; | 128 std::deque<int64> deletable_response_ids_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 145 // Used to short-circuit certain operations without having to schedule | 148 // Used to short-circuit certain operations without having to schedule |
| 146 // any tasks on the background database thread. | 149 // any tasks on the background database thread. |
| 147 std::set<GURL> origins_with_groups_; | 150 std::set<GURL> origins_with_groups_; |
| 148 std::deque<Task*> pending_simple_tasks_; | 151 std::deque<Task*> pending_simple_tasks_; |
| 149 ScopedRunnableMethodFactory<AppCacheStorageImpl> method_factory_; | 152 ScopedRunnableMethodFactory<AppCacheStorageImpl> method_factory_; |
| 150 }; | 153 }; |
| 151 | 154 |
| 152 } // namespace appcache | 155 } // namespace appcache |
| 153 | 156 |
| 154 #endif // WEBKIT_APPCACHE_APPCACHE_STORAGE_IMPL_H_ | 157 #endif // WEBKIT_APPCACHE_APPCACHE_STORAGE_IMPL_H_ |
| OLD | NEW |