1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/ipc/ChildAsyncCall.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,49 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * vim: sw=2 ts=8 et : 1.6 + */ 1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.10 + 1.11 +#include "ChildAsyncCall.h" 1.12 +#include "PluginInstanceChild.h" 1.13 + 1.14 +namespace mozilla { 1.15 +namespace plugins { 1.16 + 1.17 +ChildAsyncCall::ChildAsyncCall(PluginInstanceChild* instance, 1.18 + PluginThreadCallback aFunc, void* aUserData) 1.19 + : mInstance(instance) 1.20 + , mFunc(aFunc) 1.21 + , mData(aUserData) 1.22 +{ 1.23 +} 1.24 + 1.25 +void 1.26 +ChildAsyncCall::Cancel() 1.27 +{ 1.28 + mInstance = nullptr; 1.29 + mFunc = nullptr; 1.30 + mData = nullptr; 1.31 +} 1.32 + 1.33 +void 1.34 +ChildAsyncCall::RemoveFromAsyncList() 1.35 +{ 1.36 + if (mInstance) { 1.37 + MutexAutoLock lock(mInstance->mAsyncCallMutex); 1.38 + mInstance->mPendingAsyncCalls.RemoveElement(this); 1.39 + } 1.40 +} 1.41 + 1.42 +void 1.43 +ChildAsyncCall::Run() 1.44 +{ 1.45 + RemoveFromAsyncList(); 1.46 + 1.47 + if (mFunc) 1.48 + mFunc(mData); 1.49 +} 1.50 + 1.51 +} // namespace plugins 1.52 +} // namespace mozilla