summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chrome_plugin_host.cc
diff options
context:
space:
mode:
authorzork@google.com <zork@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-19 18:42:46 +0000
committerzork@google.com <zork@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-19 18:42:46 +0000
commit0cb21b0739018fbc095dd0f1a47aacde20b79ec1 (patch)
tree0b417fa9623f4a1783ea7e850e5302cb43dcfa0c /chrome/browser/chrome_plugin_host.cc
parent848cd05ed947f5939df4cd6028aad4e068484c23 (diff)
downloadchromium_src-0cb21b0739018fbc095dd0f1a47aacde20b79ec1.zip
chromium_src-0cb21b0739018fbc095dd0f1a47aacde20b79ec1.tar.gz
chromium_src-0cb21b0739018fbc095dd0f1a47aacde20b79ec1.tar.bz2
Adding a CPAPI function to make a function call asynchonously on the plugin thread.
Review URL: http://codereview.chromium.org/2969 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2414 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chrome_plugin_host.cc')
-rw-r--r--chrome/browser/chrome_plugin_host.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/chrome/browser/chrome_plugin_host.cc b/chrome/browser/chrome_plugin_host.cc
index 37d8b80..702e300 100644
--- a/chrome/browser/chrome_plugin_host.cc
+++ b/chrome/browser/chrome_plugin_host.cc
@@ -679,6 +679,18 @@ CPError STDCALL CPB_SendSyncMessage(CPID id, const void *data, uint32 data_len,
return CPERR_FAILURE;
}
+CPError STDCALL CPB_PluginThreadAsyncCall(CPID id,
+ void (*func)(void *),
+ void *user_data) {
+ MessageLoop *message_loop = ChromeThread::GetMessageLoop(ChromeThread::IO);
+ if (!message_loop) {
+ return CPERR_FAILURE;
+ }
+ message_loop->PostTask(FROM_HERE, NewRunnableFunction(func, user_data));
+
+ return CPERR_SUCCESS;
+}
+
}
CPBrowserFuncs* GetCPBrowserFuncsForBrowser() {
@@ -711,6 +723,7 @@ CPBrowserFuncs* GetCPBrowserFuncsForBrowser() {
browser_funcs.request_funcs = &request_funcs;
browser_funcs.response_funcs = &response_funcs;
browser_funcs.send_sync_message = CPB_SendSyncMessage;
+ browser_funcs.plugin_thread_async_call = CPB_PluginThreadAsyncCall;
request_funcs.size = sizeof(request_funcs);
request_funcs.start_request = CPR_StartRequest;