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

Side by Side Diff: base/message_pump_libevent.h

Issue 7995: Move Time, TimeDelta and TimeTicks into namespace base. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_MESSAGE_PUMP_LIBEVENT_H_ 5 #ifndef BASE_MESSAGE_PUMP_LIBEVENT_H_
6 #define BASE_MESSAGE_PUMP_LIBEVENT_H_ 6 #define BASE_MESSAGE_PUMP_LIBEVENT_H_
7 7
8 #include "base/message_pump.h" 8 #include "base/message_pump.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 10
(...skipping 29 matching lines...) Expand all
40 void WatchSocket(int socket, short interest_mask, event* e, Watcher*); 40 void WatchSocket(int socket, short interest_mask, event* e, Watcher*);
41 41
42 // Stop watching a socket. 42 // Stop watching a socket.
43 // Event was previously initialized by WatchSocket. 43 // Event was previously initialized by WatchSocket.
44 void UnwatchSocket(event* e); 44 void UnwatchSocket(event* e);
45 45
46 // MessagePump methods: 46 // MessagePump methods:
47 virtual void Run(Delegate* delegate); 47 virtual void Run(Delegate* delegate);
48 virtual void Quit(); 48 virtual void Quit();
49 virtual void ScheduleWork(); 49 virtual void ScheduleWork();
50 virtual void ScheduleDelayedWork(const Time& delayed_work_time); 50 virtual void ScheduleDelayedWork(const base::Time& delayed_work_time);
51 51
52 private: 52 private:
53 53
54 // Risky part of constructor. Returns true on success. 54 // Risky part of constructor. Returns true on success.
55 bool Init(); 55 bool Init();
56 56
57 // This flag is set to false when Run should return. 57 // This flag is set to false when Run should return.
58 bool keep_running_; 58 bool keep_running_;
59 59
60 // This flag is set when inside Run. 60 // This flag is set when inside Run.
61 bool in_run_; 61 bool in_run_;
62 62
63 // The time at which we should call DoDelayedWork. 63 // The time at which we should call DoDelayedWork.
64 Time delayed_work_time_; 64 base::Time delayed_work_time_;
65 65
66 // Libevent dispatcher. Watches all sockets registered with it, and sends 66 // Libevent dispatcher. Watches all sockets registered with it, and sends
67 // readiness callbacks when a socket is ready for I/O. 67 // readiness callbacks when a socket is ready for I/O.
68 event_base* event_base_; 68 event_base* event_base_;
69 69
70 // Called by libevent to tell us a registered socket is ready 70 // Called by libevent to tell us a registered socket is ready
71 static void OnReadinessNotification(int socket, short flags, void* context); 71 static void OnReadinessNotification(int socket, short flags, void* context);
72 72
73 // Unix pipe used to implement ScheduleWork() 73 // Unix pipe used to implement ScheduleWork()
74 // ... callback; called by libevent inside Run() when pipe is ready to read 74 // ... callback; called by libevent inside Run() when pipe is ready to read
75 static void OnWakeup(int socket, short flags, void* context); 75 static void OnWakeup(int socket, short flags, void* context);
76 // ... write end; ScheduleWork() writes a single byte to it 76 // ... write end; ScheduleWork() writes a single byte to it
77 int wakeup_pipe_in_; 77 int wakeup_pipe_in_;
78 // ... read end; OnWakeup reads it and then breaks Run() out of its sleep 78 // ... read end; OnWakeup reads it and then breaks Run() out of its sleep
79 int wakeup_pipe_out_; 79 int wakeup_pipe_out_;
80 // ... libevent wrapper for read end 80 // ... libevent wrapper for read end
81 event* wakeup_event_; 81 event* wakeup_event_;
82 82
83 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent); 83 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent);
84 }; 84 };
85 85
86 } // namespace base 86 } // namespace base
87 87
88 #endif // BASE_MESSAGE_PUMP_LIBEVENT_H_ 88 #endif // BASE_MESSAGE_PUMP_LIBEVENT_H_
89 89
OLDNEW
« no previous file with comments | « base/message_pump_glib.cc ('k') | base/message_pump_libevent.cc » ('j') | base/time_format.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698