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

Side by Side Diff: webkit/appcache/appcache_thread.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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_APPCACHE_APPCACHE_THREAD_H_
6 #define WEBKIT_APPCACHE_APPCACHE_THREAD_H_
7
8 #include "base/task.h"
9
10 namespace tracked_objects {
11 class Location;
12 }
13
14 namespace appcache {
15
16 // 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
18 // providing them to the appcache library by providing a concrete
19 // implementation of the PostTask and CurrentlyOn methods declared here,
20 // and by calling the Init method prior to using the appcache library.
21 class AppCacheThread {
22 public:
23 static void Init(int db, int io) {
24 db_ = db;
25 io_ = io;
26 }
27 static int db() { return db_; }
28 static int io() { return io_; }
29
30 static bool PostTask(int id,
31 const tracked_objects::Location& from_here,
32 Task* task);
33 static bool CurrentlyOn(int id);
34
35 template <class T>
36 static bool DeleteSoon(int id,
37 const tracked_objects::Location& from_here,
38 T* object) {
39 return PostTask(id, from_here, new DeleteTask<T>(object));
40 }
41
42 private:
43 AppCacheThread();
44 ~AppCacheThread();
45
46 static int db_;
47 static int io_;
48 };
49
50 } // namespace appcache
51
52 #endif // WEBKIT_APPCACHE_APPCACHE_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698