The android timer class was not generating timer events correctly. This caused renewal and expiration events not to be sent. A strong pointer to the timer thread was not held and this caused the android util timer thread to exit after firing once. This is now addressed. Bug: 8736545 Merge of https://widevine-internal-review.googlesource.com/#/c/5353/ from the Widevine CDM repository. Change-Id: I2d904e55d4d10eacc1a51f1c6b5c1a267c92c8d8
51 lines
1.1 KiB
C++
51 lines
1.1 KiB
C++
// Copyright 2013 Google Inc. All Rights Reserved.
|
|
//
|
|
// Timer - Platform independent interface for a Timer class
|
|
//
|
|
#ifndef CDM_BASE_TIMER_H_
|
|
#define CDM_BASE_TIMER_H_
|
|
|
|
#include "wv_cdm_types.h"
|
|
|
|
namespace wvcdm {
|
|
|
|
// Timer Handler class.
|
|
//
|
|
// Derive from this class if you wish to receive events when the timer
|
|
// expires. Provide the handler when setting up a new Timer.
|
|
|
|
class TimerHandler {
|
|
public:
|
|
TimerHandler() {};
|
|
virtual ~TimerHandler() {};
|
|
|
|
virtual void OnTimerEvent() = 0;
|
|
};
|
|
|
|
// Timer class. The implementation is platform dependent.
|
|
//
|
|
// This class provides a simple recurring timer API. The class receiving
|
|
// timer expiry events should derive from TimerHandler.
|
|
// Specify the receiver class and the periodicty of timer events when
|
|
// the timer is initiated by calling Start.
|
|
|
|
class Timer {
|
|
public:
|
|
Timer();
|
|
~Timer();
|
|
|
|
bool Start(TimerHandler *handler, uint32_t time_in_secs);
|
|
void Stop();
|
|
bool IsRunning();
|
|
|
|
private:
|
|
class Impl;
|
|
Impl *impl_;
|
|
|
|
CORE_DISALLOW_COPY_AND_ASSIGN(Timer);
|
|
};
|
|
|
|
}; // namespace wvcdm
|
|
|
|
#endif // CDM_BASE_TIMER_H_
|