michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * vim: sw=2 ts=8 et : michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "ChildAsyncCall.h" michael@0: #include "PluginInstanceChild.h" michael@0: michael@0: namespace mozilla { michael@0: namespace plugins { michael@0: michael@0: ChildAsyncCall::ChildAsyncCall(PluginInstanceChild* instance, michael@0: PluginThreadCallback aFunc, void* aUserData) michael@0: : mInstance(instance) michael@0: , mFunc(aFunc) michael@0: , mData(aUserData) michael@0: { michael@0: } michael@0: michael@0: void michael@0: ChildAsyncCall::Cancel() michael@0: { michael@0: mInstance = nullptr; michael@0: mFunc = nullptr; michael@0: mData = nullptr; michael@0: } michael@0: michael@0: void michael@0: ChildAsyncCall::RemoveFromAsyncList() michael@0: { michael@0: if (mInstance) { michael@0: MutexAutoLock lock(mInstance->mAsyncCallMutex); michael@0: mInstance->mPendingAsyncCalls.RemoveElement(this); michael@0: } michael@0: } michael@0: michael@0: void michael@0: ChildAsyncCall::Run() michael@0: { michael@0: RemoveFromAsyncList(); michael@0: michael@0: if (mFunc) michael@0: mFunc(mData); michael@0: } michael@0: michael@0: } // namespace plugins michael@0: } // namespace mozilla