2010-01-20 03:13:24 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-01-20 03:13:24 +00:00
|
|
|
|
|
|
|
#include "ChildAsyncCall.h"
|
|
|
|
#include "PluginInstanceChild.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace plugins {
|
|
|
|
|
|
|
|
ChildAsyncCall::ChildAsyncCall(PluginInstanceChild* instance,
|
|
|
|
PluginThreadCallback aFunc, void* aUserData)
|
|
|
|
: mInstance(instance)
|
|
|
|
, mFunc(aFunc)
|
|
|
|
, mData(aUserData)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ChildAsyncCall::Cancel()
|
|
|
|
{
|
2013-10-23 20:34:46 +00:00
|
|
|
mInstance = nullptr;
|
|
|
|
mFunc = nullptr;
|
|
|
|
mData = nullptr;
|
2010-01-20 03:13:24 +00:00
|
|
|
}
|
|
|
|
|
2010-02-03 22:17:09 +00:00
|
|
|
void
|
2010-04-26 16:29:11 +00:00
|
|
|
ChildAsyncCall::RemoveFromAsyncList()
|
2010-01-20 03:13:24 +00:00
|
|
|
{
|
2010-04-26 16:29:11 +00:00
|
|
|
if (mInstance) {
|
2010-03-25 18:25:38 +00:00
|
|
|
MutexAutoLock lock(mInstance->mAsyncCallMutex);
|
2010-01-20 03:13:24 +00:00
|
|
|
mInstance->mPendingAsyncCalls.RemoveElement(this);
|
|
|
|
}
|
2010-04-26 16:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ChildAsyncCall::Run()
|
|
|
|
{
|
|
|
|
RemoveFromAsyncList();
|
|
|
|
|
2010-03-25 18:25:38 +00:00
|
|
|
if (mFunc)
|
|
|
|
mFunc(mData);
|
2010-01-20 03:13:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace plugins
|
|
|
|
} // namespace mozilla
|