diff options
author | miket@chromium.org <miket@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-08 19:41:04 +0000 |
---|---|---|
committer | miket@chromium.org <miket@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-08 19:41:04 +0000 |
commit | 61994eb634db1c44e55607e619a05b0676f2d269 (patch) | |
tree | adf26407eaebeaf433629a9f8c2a9a548ada7a78 /chrome/browser/extensions/api/api_function.h | |
parent | cfcf49ae00c3b1777921b5edb8c46bb123d72c6e (diff) | |
download | chromium_src-61994eb634db1c44e55607e619a05b0676f2d269.zip chromium_src-61994eb634db1c44e55607e619a05b0676f2d269.tar.gz chromium_src-61994eb634db1c44e55607e619a05b0676f2d269.tar.bz2 |
Let developers get a list of valid serial ports, which is the same set of ports that we'll accept on a serial.open() call.
Refactored AsyncIOAPIFunction to AsyncAPIFunction, and let inheriting classes specify which thread the Work() operation should happen on (e.g., FILE rather than IO).
BUG=121466
TEST=added
Review URL: https://chromiumcodereview.appspot.com/10317032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135895 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/api/api_function.h')
-rw-r--r-- | chrome/browser/extensions/api/api_function.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/chrome/browser/extensions/api/api_function.h b/chrome/browser/extensions/api/api_function.h index 229d1c5..ad48a2d 100644 --- a/chrome/browser/extensions/api/api_function.h +++ b/chrome/browser/extensions/api/api_function.h @@ -8,6 +8,7 @@ #include "chrome/browser/extensions/extension_function.h" #include "chrome/browser/extensions/api/api_resource.h" +#include "content/public/browser/browser_thread.h" class ExtensionService; @@ -16,11 +17,12 @@ namespace extensions { class APIResourceController; class APIResourceEventNotifier; -// AsyncIOAPIFunction provides convenient thread management for APIs that -// need to do essentially all their work on the IO thread. -class AsyncIOAPIFunction : public AsyncExtensionFunction { +// AsyncAPIFunction provides convenient thread management for APIs that need to +// do essentially all their work on the IO or FILE thread. +class AsyncAPIFunction : public AsyncExtensionFunction { protected: - virtual ~AsyncIOAPIFunction() {} + AsyncAPIFunction(); + virtual ~AsyncAPIFunction() {} // Set up for work (e.g., validate arguments). Guaranteed to happen on UI // thread. @@ -48,11 +50,16 @@ class AsyncIOAPIFunction : public AsyncExtensionFunction { // Access to the controller singleton. APIResourceController* controller(); - // ExtensionFunction: + // ExtensionFunction::RunImpl() virtual bool RunImpl() OVERRIDE; + protected: + // If you don't want your Work() method to happen on the IO thread, then set + // this to the thread that you do want, preferably in Prepare(). + content::BrowserThread::ID work_thread_id_; + private: - void WorkOnIOThread(); + void WorkOnWorkThread(); void RespondOnUIThread(); ExtensionService* extension_service_; |