| 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 CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_IMPL_H_ | 6 #define CONTENT_BROWSER_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> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 class SingleThreadTaskRunner; | 24 class SingleThreadTaskRunner; |
| 25 } // namespace base | 25 } // namespace base |
| 26 | 26 |
| 27 namespace content { | 27 namespace content { |
| 28 class AppCacheStorageImplTest; | 28 class AppCacheStorageImplTest; |
| 29 class ChromeAppCacheServiceTest; | 29 class ChromeAppCacheServiceTest; |
| 30 | 30 |
| 31 class AppCacheStorageImpl : public AppCacheStorage { | 31 class AppCacheStorageImpl : public AppCacheStorage { |
| 32 public: | 32 public: |
| 33 explicit AppCacheStorageImpl(AppCacheServiceImpl* service); | 33 explicit AppCacheStorageImpl(AppCacheServiceImpl* service); |
| 34 virtual ~AppCacheStorageImpl(); | 34 ~AppCacheStorageImpl() override; |
| 35 | 35 |
| 36 void Initialize( | 36 void Initialize( |
| 37 const base::FilePath& cache_directory, | 37 const base::FilePath& cache_directory, |
| 38 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, | 38 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, |
| 39 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread); | 39 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread); |
| 40 void Disable(); | 40 void Disable(); |
| 41 bool is_disabled() const { return is_disabled_; } | 41 bool is_disabled() const { return is_disabled_; } |
| 42 | 42 |
| 43 // AppCacheStorage methods, see the base class for doc comments. | 43 // AppCacheStorage methods, see the base class for doc comments. |
| 44 virtual void GetAllInfo(Delegate* delegate) override; | 44 void GetAllInfo(Delegate* delegate) override; |
| 45 virtual void LoadCache(int64 id, Delegate* delegate) override; | 45 void LoadCache(int64 id, Delegate* delegate) override; |
| 46 virtual void LoadOrCreateGroup(const GURL& manifest_url, | 46 void LoadOrCreateGroup(const GURL& manifest_url, Delegate* delegate) override; |
| 47 Delegate* delegate) override; | 47 void StoreGroupAndNewestCache(AppCacheGroup* group, |
| 48 virtual void StoreGroupAndNewestCache(AppCacheGroup* group, | 48 AppCache* newest_cache, |
| 49 AppCache* newest_cache, | 49 Delegate* delegate) override; |
| 50 Delegate* delegate) override; | 50 void FindResponseForMainRequest(const GURL& url, |
| 51 virtual void FindResponseForMainRequest(const GURL& url, | 51 const GURL& preferred_manifest_url, |
| 52 const GURL& preferred_manifest_url, | 52 Delegate* delegate) override; |
| 53 Delegate* delegate) override; | 53 void FindResponseForSubRequest(AppCache* cache, |
| 54 virtual void FindResponseForSubRequest( | 54 const GURL& url, |
| 55 AppCache* cache, const GURL& url, | 55 AppCacheEntry* found_entry, |
| 56 AppCacheEntry* found_entry, AppCacheEntry* found_fallback_entry, | 56 AppCacheEntry* found_fallback_entry, |
| 57 bool* found_network_namespace) override; | 57 bool* found_network_namespace) override; |
| 58 virtual void MarkEntryAsForeign(const GURL& entry_url, | 58 void MarkEntryAsForeign(const GURL& entry_url, int64 cache_id) override; |
| 59 int64 cache_id) override; | 59 void MakeGroupObsolete(AppCacheGroup* group, |
| 60 virtual void MakeGroupObsolete(AppCacheGroup* group, | 60 Delegate* delegate, |
| 61 Delegate* delegate, | 61 int response_code) override; |
| 62 int response_code) override; | 62 AppCacheResponseReader* CreateResponseReader(const GURL& manifest_url, |
| 63 virtual AppCacheResponseReader* CreateResponseReader( | 63 int64 group_id, |
| 64 const GURL& manifest_url, int64 group_id, int64 response_id) override; | 64 int64 response_id) override; |
| 65 virtual AppCacheResponseWriter* CreateResponseWriter( | 65 AppCacheResponseWriter* CreateResponseWriter(const GURL& manifest_url, |
| 66 const GURL& manifest_url, int64 group_id) override; | 66 int64 group_id) override; |
| 67 virtual void DoomResponses(const GURL& manifest_url, | 67 void DoomResponses(const GURL& manifest_url, |
| 68 const std::vector<int64>& response_ids) override; | 68 const std::vector<int64>& response_ids) override; |
| 69 virtual void DeleteResponses(const GURL& manifest_url, | 69 void DeleteResponses(const GURL& manifest_url, |
| 70 const std::vector<int64>& response_ids) override; | 70 const std::vector<int64>& response_ids) override; |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 // The AppCacheStorageImpl class methods and datamembers may only be | 73 // The AppCacheStorageImpl class methods and datamembers may only be |
| 74 // accessed on the IO thread. This class manufactures seperate DatabaseTasks | 74 // accessed on the IO thread. This class manufactures seperate DatabaseTasks |
| 75 // which access the DB on a seperate background thread. | 75 // which access the DB on a seperate background thread. |
| 76 class DatabaseTask; | 76 class DatabaseTask; |
| 77 class InitTask; | 77 class InitTask; |
| 78 class DisableDatabaseTask; | 78 class DisableDatabaseTask; |
| 79 class GetAllInfoTask; | 79 class GetAllInfoTask; |
| 80 class StoreOrLoadTask; | 80 class StoreOrLoadTask; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 std::deque<base::Closure> pending_simple_tasks_; | 174 std::deque<base::Closure> pending_simple_tasks_; |
| 175 base::WeakPtrFactory<AppCacheStorageImpl> weak_factory_; | 175 base::WeakPtrFactory<AppCacheStorageImpl> weak_factory_; |
| 176 | 176 |
| 177 friend class content::AppCacheStorageImplTest; | 177 friend class content::AppCacheStorageImplTest; |
| 178 friend class content::ChromeAppCacheServiceTest; | 178 friend class content::ChromeAppCacheServiceTest; |
| 179 }; | 179 }; |
| 180 | 180 |
| 181 } // namespace content | 181 } // namespace content |
| 182 | 182 |
| 183 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_IMPL_H_ | 183 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_IMPL_H_ |
| OLD | NEW |