2014-05-18 07:05:46 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* 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 GMPPlatform_h_
|
|
|
|
#define GMPPlatform_h_
|
|
|
|
|
|
|
|
#include "mozilla/Mutex.h"
|
|
|
|
#include "gmp-platform.h"
|
|
|
|
#include "base/thread.h"
|
2014-09-16 12:38:21 +04:00
|
|
|
#include "mozilla/ReentrantMonitor.h"
|
2014-05-18 07:05:46 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gmp {
|
|
|
|
|
2014-07-11 07:35:56 +04:00
|
|
|
class GMPChild;
|
|
|
|
|
2014-08-05 11:56:05 +04:00
|
|
|
void InitPlatformAPI(GMPPlatformAPI& aPlatformAPI, GMPChild* aChild);
|
|
|
|
|
|
|
|
GMPErr RunOnMainThread(GMPTask* aTask);
|
2014-05-18 07:05:46 +04:00
|
|
|
|
|
|
|
class GMPThreadImpl : public GMPThread
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GMPThreadImpl();
|
|
|
|
virtual ~GMPThreadImpl();
|
|
|
|
|
|
|
|
// GMPThread
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void Post(GMPTask* aTask) override;
|
|
|
|
virtual void Join() override;
|
2014-05-18 07:05:46 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
Mutex mMutex;
|
|
|
|
base::Thread mThread;
|
|
|
|
};
|
|
|
|
|
|
|
|
class GMPMutexImpl : public GMPMutex
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GMPMutexImpl();
|
|
|
|
virtual ~GMPMutexImpl();
|
|
|
|
|
|
|
|
// GMPMutex
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void Acquire() override;
|
|
|
|
virtual void Release() override;
|
|
|
|
virtual void Destroy() override;
|
2014-05-18 07:05:46 +04:00
|
|
|
|
|
|
|
private:
|
2014-09-16 12:38:21 +04:00
|
|
|
ReentrantMonitor mMonitor;
|
2014-05-18 07:05:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace gmp
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // GMPPlatform_h_
|