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

Side by Side Diff: remoting/client/plugin/pepper_plugin_thread_delegate.cc

Issue 9427023: Add functions to expand PostDelayedTask interface. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add fix to RunOnPluginThread() in host_plugin.cc Created 8 years, 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/client/plugin/pepper_plugin_thread_delegate.h" 5 #include "remoting/client/plugin/pepper_plugin_thread_delegate.h"
6 6
7 #include "ppapi/cpp/completion_callback.h" 7 #include "ppapi/cpp/completion_callback.h"
8 #include "ppapi/cpp/module.h" 8 #include "ppapi/cpp/module.h"
9 9
10 namespace remoting { 10 namespace remoting {
11 11
12 PepperPluginThreadDelegate::PepperPluginThreadDelegate() 12 PepperPluginThreadDelegate::PepperPluginThreadDelegate()
13 : core_(pp::Module::Get()->core()) { 13 : core_(pp::Module::Get()->core()) {
14 } 14 }
15 15
16 PepperPluginThreadDelegate::~PepperPluginThreadDelegate() { } 16 PepperPluginThreadDelegate::~PepperPluginThreadDelegate() { }
17 17
18 bool PepperPluginThreadDelegate::RunOnPluginThread( 18 bool PepperPluginThreadDelegate::RunOnPluginThread(
19 int delay_ms, void(CDECL function)(void*), void* data) { 19 base::TimeDelta delay, void(CDECL function)(void*), void* data) {
20 // It is safe to cast |function| to PP_CompletionCallback_Func, 20 // It is safe to cast |function| to PP_CompletionCallback_Func,
21 // which is defined as void(*)(void*, int). The callee will just 21 // which is defined as void(*)(void*, int). The callee will just
22 // ignore the last argument. The only case when it may be unsafe is 22 // ignore the last argument. The only case when it may be unsafe is
23 // with VS when default calling convention is set to __stdcall, but 23 // with VS when default calling convention is set to __stdcall, but
24 // this code will not typecheck in that case. 24 // this code will not typecheck in that case.
25 core_->CallOnMainThread( 25 core_->CallOnMainThread(
26 delay_ms, pp::CompletionCallback( 26 delay.InMilliseconds(), pp::CompletionCallback(
27 reinterpret_cast<PP_CompletionCallback_Func>(function), data), 0); 27 reinterpret_cast<PP_CompletionCallback_Func>(function), data), 0);
28 return true; 28 return true;
29 } 29 }
30 30
31 } // namespace remoting 31 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/plugin/pepper_plugin_thread_delegate.h ('k') | remoting/host/plugin/host_plugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698