Files
ce_cdm/cdm/include/cdm_host_timer.h
Joey Parrish 66794025d4 Initial source release: v2.0.8-0-679
Change-Id: Idf6316a8faf4b4fdc54265aad12084e5aa60707a
2014-05-20 11:08:09 -07:00

46 lines
955 B
C++

// Copyright 2013 Google Inc. All Rights Reserved.
#ifndef WVCDM_CDM_CDM_HOST_TIMER_H_
#define WVCDM_CDM_CDM_HOST_TIMER_H_
#include <cstddef>
#include <string>
#include <vector>
#include "content_decryption_module.h"
#include "timer.h"
namespace wvcdm {
class ITimerFactory {
public:
virtual Timer::Impl* NewTimerImpl() = 0;
};
class Timer::Impl {
friend class wvcdm::Timer;
typedef enum {kIdle, kRunning} TimerState;
public:
static void RegisterTimerFactory(ITimerFactory* factory);
explicit Impl(cdm::Host* const host);
virtual ~Impl(){}
void Start(TimerHandler *handler, uint32_t time_in_secs);
void Stop();
bool IsRunning(){return state_ == kRunning;}
void OnTimerEvent();
private:
static ITimerFactory* factory_;
cdm::Host* const host_;
TimerHandler* handler_;
int64_t delay_ms_;
TimerState state_;
};
} // namespace wvcdm
#endif // WVCDM_CDM_CDM_HOST_TIMER_H_