mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-31 22:25:30 +00:00
8876f7e142
The ipc/chromium/src/base/ changes here (except those mentioned below) are the majority of the base/ changes (excluding those that patch code that does not exist yet in our copy) in: > From: jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> > Date: Sat, 6 Nov 2010 22:23:29 +0000 (+0000) > Subject: Switch to using TimeTicks rather than Time in message loops > X-Git-Url: http://git.chromium.org/gitweb/?p=chromium.git;a=commitdiff_plain;h=f592c218c18bd1f8308489aaef2e329244ced330 > > Switch to using TimeTicks rather than Time in message loops > > Switch to using TimeTicks rather than Time so that we > are not dependent on changes in the system clock. > > r=mbelshe,darin > Review URL: http://codereview.chromium.org/3884001 > > git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65322 0039d316-1c4b-4281-b951-d872f2087c98 The ipc/glue changes, and the message_pump_android.* and message_pump_qt.* changes in ipc/chromium/src/base/, change signatures to match.
78 lines
1.6 KiB
C++
78 lines
1.6 KiB
C++
/* 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/. */
|
|
|
|
#ifndef __IPC_GLUE_MESSAGEPUMP_H__
|
|
#define __IPC_GLUE_MESSAGEPUMP_H__
|
|
|
|
#include "base/basictypes.h"
|
|
#include "base/message_pump_default.h"
|
|
#include "base/time.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIRunnable.h"
|
|
#include "nsIThread.h"
|
|
#include "nsITimer.h"
|
|
#include "mozilla/Attributes.h"
|
|
|
|
namespace mozilla {
|
|
namespace ipc {
|
|
|
|
class MessagePump;
|
|
|
|
class DoWorkRunnable MOZ_FINAL : public nsIRunnable,
|
|
public nsITimerCallback
|
|
{
|
|
public:
|
|
DoWorkRunnable(MessagePump* aPump)
|
|
: mPump(aPump) { }
|
|
|
|
NS_DECL_ISUPPORTS
|
|
NS_DECL_NSIRUNNABLE
|
|
NS_DECL_NSITIMERCALLBACK
|
|
|
|
private:
|
|
MessagePump* mPump;
|
|
};
|
|
|
|
class MessagePump : public base::MessagePumpDefault
|
|
{
|
|
|
|
public:
|
|
MessagePump();
|
|
|
|
virtual void Run(base::MessagePump::Delegate* aDelegate);
|
|
virtual void ScheduleWork();
|
|
virtual void ScheduleWorkForNestedLoop();
|
|
virtual void ScheduleDelayedWork(const base::TimeTicks& delayed_work_time);
|
|
|
|
void DoDelayedWork(base::MessagePump::Delegate* aDelegate);
|
|
|
|
private:
|
|
nsRefPtr<DoWorkRunnable> mDoWorkEvent;
|
|
nsCOMPtr<nsITimer> mDelayedWorkTimer;
|
|
|
|
// Weak!
|
|
nsIThread* mThread;
|
|
};
|
|
|
|
class MessagePumpForChildProcess : public MessagePump
|
|
{
|
|
public:
|
|
MessagePumpForChildProcess()
|
|
: mFirstRun(true)
|
|
{ }
|
|
|
|
virtual void Run(base::MessagePump::Delegate* aDelegate);
|
|
|
|
private:
|
|
bool mFirstRun;
|
|
};
|
|
|
|
} /* namespace ipc */
|
|
} /* namespace mozilla */
|
|
|
|
#endif /* __IPC_GLUE_MESSAGEPUMP_H__ */
|