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

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

Issue 1115002: Plumbing for providing a cache thread MessageLoop to the DiskCache backend.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 9 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 | « chrome/browser/appcache/chrome_appcache_service.cc ('k') | webkit/appcache/appcache_thread.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_THREAD_H_ 5 #ifndef WEBKIT_APPCACHE_APPCACHE_THREAD_H_
6 #define WEBKIT_APPCACHE_APPCACHE_THREAD_H_ 6 #define WEBKIT_APPCACHE_APPCACHE_THREAD_H_
7 7
8 #include "base/task.h" 8 #include "base/task.h"
9 9
10 namespace tracked_objects { 10 namespace tracked_objects {
11 class Location; 11 class Location;
12 } 12 }
13 13
14 class MessageLoop;
15
14 namespace appcache { 16 namespace appcache {
15 17
16 // The appcache system uses two threads, an IO thread and a DB thread. 18 // The appcache system uses two threads, an IO thread and a DB thread.
17 // It does not create these threads, the embedder is responsible for 19 // It does not create these threads, the embedder is responsible for
18 // providing them to the appcache library by providing a concrete 20 // providing them to the appcache library by providing a concrete
19 // implementation of the PostTask and CurrentlyOn methods declared here, 21 // implementation of the PostTask and CurrentlyOn methods declared here,
20 // and by calling the InitIDs method prior to using the appcache library. 22 // and by calling the Init method prior to using the appcache library.
23 // The disk_cache also requires the embedder to provide a thread message
24 // loop.
21 class AppCacheThread { 25 class AppCacheThread {
22 public: 26 public:
23 static void InitIDs(int db, int io) { 27 static void Init(int db, int io, MessageLoop* disk_cache_thread) {
rvargas (doing something else) 2010/03/18 22:17:07 I'm sad for the lack of symmetry but I see that th
24 db_ = db; 28 db_ = db;
25 io_ = io; 29 io_ = io;
30 disk_cache_thread_ = disk_cache_thread;
26 } 31 }
27 static int db() { return db_; } 32 static int db() { return db_; }
28 static int io() { return io_; } 33 static int io() { return io_; }
34 static MessageLoop* disk_cache_thread() { return disk_cache_thread_; }
29 35
30 static bool PostTask(int id, 36 static bool PostTask(int id,
31 const tracked_objects::Location& from_here, 37 const tracked_objects::Location& from_here,
32 Task* task); 38 Task* task);
33 static bool CurrentlyOn(int id); 39 static bool CurrentlyOn(int id);
34 40
35 template <class T> 41 template <class T>
36 static bool DeleteSoon(int id, 42 static bool DeleteSoon(int id,
37 const tracked_objects::Location& from_here, 43 const tracked_objects::Location& from_here,
38 T* object) { 44 T* object) {
39 return PostTask(id, from_here, new DeleteTask<T>(object)); 45 return PostTask(id, from_here, new DeleteTask<T>(object));
40 } 46 }
41 47
42 private: 48 private:
43 AppCacheThread(); 49 AppCacheThread();
44 ~AppCacheThread(); 50 ~AppCacheThread();
45 51
46 static int db_; 52 static int db_;
47 static int io_; 53 static int io_;
54 static MessageLoop* disk_cache_thread_;
48 }; 55 };
49 56
50 } // namespace appcache 57 } // namespace appcache
51 58
52 #endif // WEBKIT_APPCACHE_APPCACHE_THREAD_H_ 59 #endif // WEBKIT_APPCACHE_APPCACHE_THREAD_H_
OLDNEW
« no previous file with comments | « chrome/browser/appcache/chrome_appcache_service.cc ('k') | webkit/appcache/appcache_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698