Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Unified Diff: webkit/glue/webthread_impl.h

Issue 8586038: Implement WebThread::{add,remove}TaskObserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move impl to WebThreadImpl Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webkit/glue/webthread_impl.cc » ('j') | webkit/glue/webthread_impl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webthread_impl.h
diff --git a/webkit/glue/webthread_impl.h b/webkit/glue/webthread_impl.h
index 842c8c6b0fdcfbaad01ea6694269c4e9b7d58e01..42fb08719540a482f9ec9f5bd48b0c63982d25ad 100644
--- a/webkit/glue/webthread_impl.h
+++ b/webkit/glue/webthread_impl.h
@@ -4,15 +4,31 @@
#ifndef WEBKIT_GLUE_WEBTHREAD_IMPL_H_
#define WEBKIT_GLUE_WEBTHREAD_IMPL_H_
+#include <map>
+
#include "base/threading/thread.h"
#include "base/memory/scoped_ptr.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebThread.h"
namespace webkit_glue {
-class WebThreadImpl : public WebKit::WebThread {
+class WebThreadBase : public WebKit::WebThread {
public:
- WebThreadImpl(const char* name);
+ virtual void addTaskObserver(TaskObserver* observer);
+ virtual void removeTaskObserver(TaskObserver* observer);
+
+ protected:
+ virtual bool IsCurrentThread() const = 0;
+
+ private:
+ class TaskObserverAdapter;
+ typedef std::map<TaskObserver*, TaskObserverAdapter*> TaskObserverMap;
+ TaskObserverMap task_observer_map_;
+};
+
+class WebThreadImpl : public WebThreadBase {
+ public:
+ explicit WebThreadImpl(const char* name);
virtual ~WebThreadImpl();
virtual void postTask(Task* task) OVERRIDE;
@@ -21,18 +37,24 @@ class WebThreadImpl : public WebKit::WebThread {
MessageLoop* message_loop() const { return thread_->message_loop(); }
protected:
+ virtual bool IsCurrentThread() const;
+
+ private:
scoped_ptr<base::Thread> thread_;
};
-class WebThreadImplForMessageLoop : public WebKit::WebThread {
+class WebThreadImplForMessageLoop : public WebThreadBase {
public:
- WebThreadImplForMessageLoop(base::MessageLoopProxy* message_loop);
+ explicit WebThreadImplForMessageLoop(base::MessageLoopProxy* message_loop);
virtual ~WebThreadImplForMessageLoop();
virtual void postTask(Task* task) OVERRIDE;
virtual void postDelayedTask(Task* task, long long delay_ms) OVERRIDE;
protected:
+ virtual bool IsCurrentThread() const;
+
+ private:
scoped_refptr<base::MessageLoopProxy> message_loop_;
};
« no previous file with comments | « no previous file | webkit/glue/webthread_impl.cc » ('j') | webkit/glue/webthread_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698