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

Side by Side Diff: webkit/appcache/appcache_storage_impl.h

Issue 7863009: Replace ancient crufty AppCacheThread with much improved MessageLoopProxy usage. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « webkit/appcache/appcache_service.cc ('k') | webkit/appcache/appcache_storage_impl.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 (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_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/message_loop_proxy.h"
15 #include "base/task.h" 15 #include "base/task.h"
16 #include "webkit/appcache/appcache_database.h" 16 #include "webkit/appcache/appcache_database.h"
17 #include "webkit/appcache/appcache_disk_cache.h" 17 #include "webkit/appcache/appcache_disk_cache.h"
18 #include "webkit/appcache/appcache_storage.h" 18 #include "webkit/appcache/appcache_storage.h"
19 19
20 namespace appcache { 20 namespace appcache {
21 21
22 class AppCacheStorageImpl : public AppCacheStorage { 22 class AppCacheStorageImpl : public AppCacheStorage {
23 public: 23 public:
24 explicit AppCacheStorageImpl(AppCacheService* service); 24 explicit AppCacheStorageImpl(AppCacheService* service);
25 virtual ~AppCacheStorageImpl(); 25 virtual ~AppCacheStorageImpl();
26 26
27 void Initialize(const FilePath& cache_directory, 27 void Initialize(const FilePath& cache_directory,
28 base::MessageLoopProxy* db_thread,
28 base::MessageLoopProxy* cache_thread); 29 base::MessageLoopProxy* cache_thread);
29 void Disable(); 30 void Disable();
30 bool is_disabled() const { return is_disabled_; } 31 bool is_disabled() const { return is_disabled_; }
31 32
32 // AppCacheStorage methods, see the base class for doc comments. 33 // AppCacheStorage methods, see the base class for doc comments.
33 virtual void GetAllInfo(Delegate* delegate); 34 virtual void GetAllInfo(Delegate* delegate);
34 virtual void LoadCache(int64 id, Delegate* delegate); 35 virtual void LoadCache(int64 id, Delegate* delegate);
35 virtual void LoadOrCreateGroup(const GURL& manifest_url, Delegate* delegate); 36 virtual void LoadOrCreateGroup(const GURL& manifest_url, Delegate* delegate);
36 virtual void StoreGroupAndNewestCache( 37 virtual void StoreGroupAndNewestCache(
37 AppCacheGroup* group, AppCache* newest_cache, Delegate* delegate); 38 AppCacheGroup* group, AppCache* newest_cache, Delegate* delegate);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 void CallOnMainResponseFound( 116 void CallOnMainResponseFound(
116 DelegateReferenceVector* delegates, 117 DelegateReferenceVector* delegates,
117 const GURL& url, const AppCacheEntry& entry, 118 const GURL& url, const AppCacheEntry& entry,
118 const GURL& fallback_url, const AppCacheEntry& fallback_entry, 119 const GURL& fallback_url, const AppCacheEntry& fallback_entry,
119 int64 cache_id, const GURL& manifest_url); 120 int64 cache_id, const GURL& manifest_url);
120 121
121 AppCacheDiskCache* disk_cache(); 122 AppCacheDiskCache* disk_cache();
122 123
123 // The directory in which we place files in the file system. 124 // The directory in which we place files in the file system.
124 FilePath cache_directory_; 125 FilePath cache_directory_;
126 bool is_incognito_;
127
128 // This class operates primarily on the io thread, but schedules
129 // its DatabaseTasks on the db thread. Seperately, the disk_cache uses
130 // the cache_thread.
131 scoped_refptr<base::MessageLoopProxy> db_thread_;
125 scoped_refptr<base::MessageLoopProxy> cache_thread_; 132 scoped_refptr<base::MessageLoopProxy> cache_thread_;
126 bool is_incognito_;
127 133
128 // Structures to keep track of DatabaseTasks that are in-flight. 134 // Structures to keep track of DatabaseTasks that are in-flight.
129 DatabaseTaskQueue scheduled_database_tasks_; 135 DatabaseTaskQueue scheduled_database_tasks_;
130 PendingCacheLoads pending_cache_loads_; 136 PendingCacheLoads pending_cache_loads_;
131 PendingGroupLoads pending_group_loads_; 137 PendingGroupLoads pending_group_loads_;
132 PendingForeignMarkings pending_foreign_markings_; 138 PendingForeignMarkings pending_foreign_markings_;
133 PendingQuotaQueries pending_quota_queries_; 139 PendingQuotaQueries pending_quota_queries_;
134 140
135 // Structures to keep track of lazy response deletion. 141 // Structures to keep track of lazy response deletion.
136 std::deque<int64> deletable_response_ids_; 142 std::deque<int64> deletable_response_ids_;
(...skipping 20 matching lines...) Expand all
157 // any tasks on the background database thread. 163 // any tasks on the background database thread.
158 std::deque<Task*> pending_simple_tasks_; 164 std::deque<Task*> pending_simple_tasks_;
159 ScopedRunnableMethodFactory<AppCacheStorageImpl> method_factory_; 165 ScopedRunnableMethodFactory<AppCacheStorageImpl> method_factory_;
160 166
161 friend class ChromeAppCacheServiceTest; 167 friend class ChromeAppCacheServiceTest;
162 }; 168 };
163 169
164 } // namespace appcache 170 } // namespace appcache
165 171
166 #endif // WEBKIT_APPCACHE_APPCACHE_STORAGE_IMPL_H_ 172 #endif // WEBKIT_APPCACHE_APPCACHE_STORAGE_IMPL_H_
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_service.cc ('k') | webkit/appcache/appcache_storage_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698