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

Unified Diff: chrome_frame/task_marshaller.h

Issue 8591009: ChromeFrame: Convert TaskMarshallerThroughMessageQueue to new Callback system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes. 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 | « chrome_frame/external_tab.cc ('k') | chrome_frame/task_marshaller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/task_marshaller.h
diff --git a/chrome_frame/task_marshaller.h b/chrome_frame/task_marshaller.h
index 75d945e0c597c76ba5110a751b41867f9b8ea6fa..20cf9bc13b9bc0cbec3eaeadfe7775e3e78aa27d 100644
--- a/chrome_frame/task_marshaller.h
+++ b/chrome_frame/task_marshaller.h
@@ -10,6 +10,8 @@
#include <deque>
#include <queue>
+#include "base/callback.h"
+#include "base/pending_task.h"
#include "base/synchronization/lock.h"
#include "base/threading/non_thread_safe.h"
#include "base/time.h"
@@ -26,7 +28,7 @@ namespace tracked_objects {
class TaskMarshallerThroughMessageQueue : public base::NonThreadSafe {
public:
TaskMarshallerThroughMessageQueue();
- ~TaskMarshallerThroughMessageQueue();
+ virtual ~TaskMarshallerThroughMessageQueue();
void SetWindow(HWND wnd, UINT msg) {
wnd_ = wnd;
@@ -34,35 +36,32 @@ class TaskMarshallerThroughMessageQueue : public base::NonThreadSafe {
}
virtual void PostTask(const tracked_objects::Location& from_here,
- Task* task);
+ const base::Closure& task);
virtual void PostDelayedTask(const tracked_objects::Location& source,
- Task* task,
+ const base::Closure& task,
base::TimeDelta& delay);
+
// Called by the owner of the HWND.
BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
LRESULT& lResult, DWORD dwMsgMapID = 0);
private:
- void DeleteAll();
- inline Task* PopTask();
+ void ClearTasks();
+ inline base::Closure PopTask();
inline void ExecuteQueuedTasks();
void ExecuteDelayedTasks();
- void RunTask(Task* task);
- struct DelayedTask {
- DelayedTask(Task* task, base::Time at) : run_at(at), task(task), seq(0) {}
- base::Time run_at;
- Task* task;
- int seq;
- // To support sorting based on time in priority_queue.
- bool operator<(const DelayedTask& other) const;
- };
+ // Shortest delays ordered at the top of the queue.
+ base::DelayedTaskQueue delayed_tasks_;
+
+ // A list of tasks that need to be processed by this instance.
+ std::queue<base::Closure> pending_tasks_;
- std::priority_queue<DelayedTask> delayed_tasks_;
- std::queue<Task*> pending_tasks_;
+ // Lock accesses to |pending_tasks_|.
base::Lock lock_;
+
+ // ::PostMessage parameters.
HWND wnd_;
UINT msg_;
- int invoke_task_;
};
#endif // CHROME_FRAME_TASK_MARSHALLER_H_
« no previous file with comments | « chrome_frame/external_tab.cc ('k') | chrome_frame/task_marshaller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698