diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-23 20:40:57 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-23 20:40:57 +0000 |
commit | 8a4892d8d5ef84d8be7c47ac5e1b5e601f2a77b7 (patch) | |
tree | dd56c3b7fb32d93154b58616e4e8368cc2702341 /webkit/appcache/appcache_thread.h | |
parent | d6b7266a83b8fffe30fd79c9ebe7c155cb5b687d (diff) | |
download | chromium_src-8a4892d8d5ef84d8be7c47ac5e1b5e601f2a77b7.zip chromium_src-8a4892d8d5ef84d8be7c47ac5e1b5e601f2a77b7.tar.gz chromium_src-8a4892d8d5ef84d8be7c47ac5e1b5e601f2a77b7.tar.bz2 |
The appcache system uses two threads, an IO thread and a DB thread.
It does not create these threads, the embedder is responsible for
providing them to the appcache library by implementing the class
declared in appcache_thread.h.
Also in this CL are two implementations, one for Chrome and another for test_shell.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/409005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32846 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_thread.h')
-rw-r--r-- | webkit/appcache/appcache_thread.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/webkit/appcache/appcache_thread.h b/webkit/appcache/appcache_thread.h new file mode 100644 index 0000000..9f14b1c --- /dev/null +++ b/webkit/appcache/appcache_thread.h @@ -0,0 +1,44 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_APPCACHE_APPCACHE_THREAD_H_ +#define WEBKIT_APPCACHE_APPCACHE_THREAD_H_ + +namespace tracked_objects { +class Location; +} +class Task; + +namespace appcache { + +// The appcache system uses two threads, an IO thread and a DB thread. +// It does not create these threads, the embedder is responsible for +// providing them to the appcache library by providing a concrete +// implementation of the PostTask and CurrentlyOn methods declared here, +// and by calling the InitIDs method prior to using the appcache library. +class AppCacheThread { + public: + static void InitIDs(int db, int io) { + db_ = db; + io_ = io; + } + static int db() { return db_; } + static int io() { return io_; } + + static bool PostTask(int id, + const tracked_objects::Location& from_here, + Task* task); + static bool CurrentlyOn(int id); + + private: + AppCacheThread(); + ~AppCacheThread(); + + static int db_; + static int io_; +}; + +} // namespace appcache + +#endif // WEBKIT_APPCACHE_APPCACHE_THREAD_H_ |