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 "ChildTimer.h" michael@0: #include "PluginInstanceChild.h" michael@0: #include "nsComponentManagerUtils.h" michael@0: michael@0: namespace mozilla { michael@0: namespace plugins { michael@0: michael@0: ChildTimer::ChildTimer(PluginInstanceChild* instance, michael@0: uint32_t interval, michael@0: bool repeat, michael@0: TimerFunc func) michael@0: : mInstance(instance) michael@0: , mFunc(func) michael@0: , mRepeating(repeat) michael@0: , mID(gNextTimerID++) michael@0: { michael@0: mTimer.Start(base::TimeDelta::FromMilliseconds(interval), michael@0: this, &ChildTimer::Run); michael@0: } michael@0: michael@0: uint32_t michael@0: ChildTimer::gNextTimerID = 1; michael@0: michael@0: void michael@0: ChildTimer::Run() michael@0: { michael@0: if (!mRepeating) michael@0: mTimer.Stop(); michael@0: mFunc(mInstance->GetNPP(), mID); michael@0: } michael@0: michael@0: } // namespace plugins michael@0: } // namespace mozilla