ExtensionInstallDialogView: fix scrolling behavior on Views (Win,Linux)
[chromium-blink-merge.git] / remoting / client / plugin / pepper_plugin_thread_delegate.cc
blobe14a93cc2839d295976b47c19ab1f5b88116ecb2
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "remoting/client/plugin/pepper_plugin_thread_delegate.h"
7 #include "ppapi/cpp/completion_callback.h"
8 #include "ppapi/cpp/module.h"
10 namespace remoting {
12 PepperPluginThreadDelegate::PepperPluginThreadDelegate()
13 : core_(pp::Module::Get()->core()) {
16 PepperPluginThreadDelegate::~PepperPluginThreadDelegate() { }
18 bool PepperPluginThreadDelegate::RunOnPluginThread(
19 base::TimeDelta delay, void(CDECL function)(void*), void* data) {
20 // It is safe to cast |function| to PP_CompletionCallback_Func,
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
23 // with VS when default calling convention is set to __stdcall, but
24 // this code will not typecheck in that case.
25 core_->CallOnMainThread(
26 delay.InMilliseconds(), pp::CompletionCallback(
27 reinterpret_cast<PP_CompletionCallback_Func>(function), data), 0);
28 return true;
31 } // namespace remoting