summaryrefslogtreecommitdiffstats
path: root/chrome/plugin
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/plugin
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/plugin')
-rw-r--r--chrome/plugin/chrome_plugin_host.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/chrome/plugin/chrome_plugin_host.cc b/chrome/plugin/chrome_plugin_host.cc
index ecc9418..bcc397a 100644
--- a/chrome/plugin/chrome_plugin_host.cc
+++ b/chrome/plugin/chrome_plugin_host.cc
@@ -515,6 +515,18 @@ CPError STDCALL CPB_SendSyncMessage(CPID id, const void *data, uint32 data_len,
return CPERR_SUCCESS;
}
+CPError STDCALL CPB_PluginThreadAsyncCall(CPID id,
+ void (*func)(void *),
+ void *user_data) {
+ MessageLoop *message_loop = PluginThread::GetPluginThread()->message_loop();
+ if (!message_loop) {
+ return CPERR_FAILURE;
+ }
+ message_loop->PostTask(FROM_HERE, NewRunnableFunction(func, user_data));
+
+ return CPERR_SUCCESS;
+}
+
} // namespace
CPBrowserFuncs* GetCPBrowserFuncsForPlugin() {
@@ -544,6 +556,7 @@ CPBrowserFuncs* GetCPBrowserFuncsForPlugin() {
browser_funcs.add_ui_command = CPB_AddUICommand;
browser_funcs.handle_command = CPB_HandleCommand;
browser_funcs.send_sync_message = CPB_SendSyncMessage;
+ browser_funcs.plugin_thread_async_call = CPB_PluginThreadAsyncCall;
browser_funcs.request_funcs = &request_funcs;
browser_funcs.response_funcs = &response_funcs;