Ref count Timer implementation
[ Merge of http://go/wvgerrit/78763 ] The android timer instance is held by a regular pointer rather than reference counted as all classes that derive from RefBase should be. This could result in a double deallocation, if the timer is ever passed to a strong pointer. Bug: 79364026 Test: WV unit/integration tests. GtsMediaTestCases. Play movies playback tests. Change-Id: I01f622bc045e1012f2240b3775a6d121f9415463
This commit is contained in:
@@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "utils/StrongPointer.h"
|
||||||
|
|
||||||
#include "disallow_copy_and_assign.h"
|
#include "disallow_copy_and_assign.h"
|
||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
@@ -45,7 +47,7 @@ class Timer {
|
|||||||
bool IsRunning();
|
bool IsRunning();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Impl *impl_;
|
android::sp<Impl> impl_;
|
||||||
|
|
||||||
CORE_DISALLOW_COPY_AND_ASSIGN(Timer);
|
CORE_DISALLOW_COPY_AND_ASSIGN(Timer);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -81,9 +81,6 @@ Timer::Timer() : impl_(new Timer::Impl()) {
|
|||||||
Timer::~Timer() {
|
Timer::~Timer() {
|
||||||
if (IsRunning())
|
if (IsRunning())
|
||||||
Stop();
|
Stop();
|
||||||
|
|
||||||
delete impl_;
|
|
||||||
impl_ = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Timer::Start(TimerHandler *handler, uint32_t time_in_secs) {
|
bool Timer::Start(TimerHandler *handler, uint32_t time_in_secs) {
|
||||||
|
|||||||
Reference in New Issue
Block a user