Index: media/base/user_input_monitor.h |
diff --git a/media/base/user_input_monitor.h b/media/base/user_input_monitor.h |
index 567907c76f8fc2cbad0554e060fff22a13c6dcf9..a4bf8781b8317fd41812573f22096b5df4b79b76 100644 |
--- a/media/base/user_input_monitor.h |
+++ b/media/base/user_input_monitor.h |
@@ -5,6 +5,7 @@ |
#ifndef MEDIA_BASE_USER_INPUT_MONITOR_H_ |
#define MEDIA_BASE_USER_INPUT_MONITOR_H_ |
+#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/observer_list.h" |
#include "base/synchronization/lock.h" |
@@ -24,7 +25,8 @@ namespace media { |
// it might be called on the browser UI/IO threads. |
// The object must outlive the browser UI/IO threads to make sure the callbacks |
// will not access a deleted object. |
-class MEDIA_EXPORT UserInputMonitor { |
+class MEDIA_EXPORT UserInputMonitor |
+ : public base::RefCountedThreadSafe<UserInputMonitor> { |
public: |
// The interface to receive mouse movement events. |
class MEDIA_EXPORT MouseEventListener { |
@@ -37,12 +39,11 @@ class MEDIA_EXPORT UserInputMonitor { |
}; |
UserInputMonitor(); |
- virtual ~UserInputMonitor(); |
// Creates a platform-specific instance of UserInputMonitor. |
// |io_task_runner| is the task runner for an IO thread. |
// |ui_task_runner| is the task runner for a UI thread. |
- static scoped_ptr<UserInputMonitor> Create( |
+ static scoped_refptr<UserInputMonitor> Create( |
const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner); |
@@ -66,6 +67,9 @@ class MEDIA_EXPORT UserInputMonitor { |
virtual size_t GetKeyPressCount() const = 0; |
protected: |
+ friend class base::RefCountedThreadSafe<UserInputMonitor>; |
+ virtual ~UserInputMonitor(); |
+ |
// Called by the platform-specific sub-classes to propagate the events to the |
// listeners. |
void OnMouseEvent(const SkIPoint& position); |