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

Side by Side Diff: webrtc/base/messagequeue.h

Issue 1835053002: Change default timestamp to 64 bits in all webrtc directories. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 Message() { 134 Message() {
135 memset(this, 0, sizeof(*this)); 135 memset(this, 0, sizeof(*this));
136 } 136 }
137 inline bool Match(MessageHandler* handler, uint32_t id) const { 137 inline bool Match(MessageHandler* handler, uint32_t id) const {
138 return (handler == NULL || handler == phandler) 138 return (handler == NULL || handler == phandler)
139 && (id == MQID_ANY || id == message_id); 139 && (id == MQID_ANY || id == message_id);
140 } 140 }
141 MessageHandler *phandler; 141 MessageHandler *phandler;
142 uint32_t message_id; 142 uint32_t message_id;
143 MessageData *pdata; 143 MessageData *pdata;
144 uint32_t ts_sensitive; 144 int64_t ts_sensitive;
145 }; 145 };
146 146
147 typedef std::list<Message> MessageList; 147 typedef std::list<Message> MessageList;
148 148
149 // DelayedMessage goes into a priority queue, sorted by trigger time. Messages 149 // DelayedMessage goes into a priority queue, sorted by trigger time. Messages
150 // with the same trigger time are processed in num_ (FIFO) order. 150 // with the same trigger time are processed in num_ (FIFO) order.
151 151
152 class DelayedMessage { 152 class DelayedMessage {
153 public: 153 public:
154 DelayedMessage(int delay, uint32_t trigger, uint32_t num, const Message& msg) 154 DelayedMessage(int delay, int64_t trigger, uint32_t num, const Message& msg)
155 : cmsDelay_(delay), msTrigger_(trigger), num_(num), msg_(msg) {} 155 : cmsDelay_(delay), msTrigger_(trigger), num_(num), msg_(msg) {}
156 156
157 bool operator< (const DelayedMessage& dmsg) const { 157 bool operator< (const DelayedMessage& dmsg) const {
158 return (dmsg.msTrigger_ < msTrigger_) 158 return (dmsg.msTrigger_ < msTrigger_)
159 || ((dmsg.msTrigger_ == msTrigger_) && (dmsg.num_ < num_)); 159 || ((dmsg.msTrigger_ == msTrigger_) && (dmsg.num_ < num_));
160 } 160 }
161 161
162 int cmsDelay_; // for debugging 162 int cmsDelay_; // for debugging
163 uint32_t msTrigger_; 163 int64_t msTrigger_;
164 uint32_t num_; 164 uint32_t num_;
165 Message msg_; 165 Message msg_;
166 }; 166 };
167 167
168 class MessageQueue { 168 class MessageQueue {
169 public: 169 public:
170 static const int kForever = -1; 170 static const int kForever = -1;
171 171
172 // Create a new MessageQueue and optionally assign it to the passed 172 // Create a new MessageQueue and optionally assign it to the passed
173 // SocketServer. Subclasses that override Clear should pass false for 173 // SocketServer. Subclasses that override Clear should pass false for
(...skipping 30 matching lines...) Expand all
204 bool process_io = true); 204 bool process_io = true);
205 virtual bool Peek(Message *pmsg, int cmsWait = 0); 205 virtual bool Peek(Message *pmsg, int cmsWait = 0);
206 virtual void Post(MessageHandler* phandler, 206 virtual void Post(MessageHandler* phandler,
207 uint32_t id = 0, 207 uint32_t id = 0,
208 MessageData* pdata = NULL, 208 MessageData* pdata = NULL,
209 bool time_sensitive = false); 209 bool time_sensitive = false);
210 virtual void PostDelayed(int cmsDelay, 210 virtual void PostDelayed(int cmsDelay,
211 MessageHandler* phandler, 211 MessageHandler* phandler,
212 uint32_t id = 0, 212 uint32_t id = 0,
213 MessageData* pdata = NULL); 213 MessageData* pdata = NULL);
214 virtual void PostAt(uint32_t tstamp, 214 virtual void PostAt(int64_t tstamp,
215 MessageHandler* phandler, 215 MessageHandler* phandler,
216 uint32_t id = 0, 216 uint32_t id = 0,
217 MessageData* pdata = NULL); 217 MessageData* pdata = NULL);
218 virtual void Clear(MessageHandler* phandler, 218 virtual void Clear(MessageHandler* phandler,
219 uint32_t id = MQID_ANY, 219 uint32_t id = MQID_ANY,
220 MessageList* removed = NULL); 220 MessageList* removed = NULL);
221 virtual void Dispatch(Message *pmsg); 221 virtual void Dispatch(Message *pmsg);
222 virtual void ReceiveSends(); 222 virtual void ReceiveSends();
223 223
224 // Amount of time until the next message can be retrieved 224 // Amount of time until the next message can be retrieved
(...skipping 17 matching lines...) Expand all
242 sigslot::signal0<> SignalQueueDestroyed; 242 sigslot::signal0<> SignalQueueDestroyed;
243 243
244 protected: 244 protected:
245 class PriorityQueue : public std::priority_queue<DelayedMessage> { 245 class PriorityQueue : public std::priority_queue<DelayedMessage> {
246 public: 246 public:
247 container_type& container() { return c; } 247 container_type& container() { return c; }
248 void reheap() { make_heap(c.begin(), c.end(), comp); } 248 void reheap() { make_heap(c.begin(), c.end(), comp); }
249 }; 249 };
250 250
251 void DoDelayPost(int cmsDelay, 251 void DoDelayPost(int cmsDelay,
252 uint32_t tstamp, 252 int64_t tstamp,
253 MessageHandler* phandler, 253 MessageHandler* phandler,
254 uint32_t id, 254 uint32_t id,
255 MessageData* pdata); 255 MessageData* pdata);
256 256
257 // Perform initialization, subclasses must call this from their constructor 257 // Perform initialization, subclasses must call this from their constructor
258 // if false was passed as init_queue to the MessageQueue constructor. 258 // if false was passed as init_queue to the MessageQueue constructor.
259 void DoInit(); 259 void DoInit();
260 260
261 // Perform cleanup, subclasses that override Clear must call this from the 261 // Perform cleanup, subclasses that override Clear must call this from the
262 // destructor. 262 // destructor.
(...skipping 17 matching lines...) Expand all
280 // If a server isn't supplied in the constructor, use this one. 280 // If a server isn't supplied in the constructor, use this one.
281 scoped_ptr<SocketServer> default_ss_; 281 scoped_ptr<SocketServer> default_ss_;
282 SharedExclusiveLock ss_lock_; 282 SharedExclusiveLock ss_lock_;
283 283
284 RTC_DISALLOW_COPY_AND_ASSIGN(MessageQueue); 284 RTC_DISALLOW_COPY_AND_ASSIGN(MessageQueue);
285 }; 285 };
286 286
287 } // namespace rtc 287 } // namespace rtc
288 288
289 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_ 289 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698