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

Side by Side Diff: third_party/libjingle/overrides/talk/base/messagequeue.h

Issue 9455070: Remove the dependency to ws2_32.dll from talk_base::ThreadManager and talk_base::Thread. (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 9 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 * libjingle 2 * libjingle
3 * Copyright 2004--2005, Google Inc. 3 * Copyright 2004--2005, Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 164 }
165 165
166 int cmsDelay_; // for debugging 166 int cmsDelay_; // for debugging
167 uint32 msTrigger_; 167 uint32 msTrigger_;
168 uint32 num_; 168 uint32 num_;
169 Message msg_; 169 Message msg_;
170 }; 170 };
171 171
172 class MessageQueue { 172 class MessageQueue {
173 public: 173 public:
174 explicit MessageQueue(SocketServer* ss = NULL); 174 // A phiscal socket server will be created for this ctor.
175 MessageQueue();
176 // If |ss| is NULL, a dummy socket server will be created.
177 explicit MessageQueue(SocketServer* ss);
175 virtual ~MessageQueue(); 178 virtual ~MessageQueue();
176 179
180 void Construct();
181
177 SocketServer* socketserver() { return ss_; } 182 SocketServer* socketserver() { return ss_; }
178 void set_socketserver(SocketServer* ss); 183 void set_socketserver(SocketServer* ss);
179 184
180 // Note: The behavior of MessageQueue has changed. When a MQ is stopped, 185 // Note: The behavior of MessageQueue has changed. When a MQ is stopped,
181 // futher Posts and Sends will fail. However, any pending Sends and *ready* 186 // futher Posts and Sends will fail. However, any pending Sends and *ready*
182 // Posts (as opposed to unexpired delayed Posts) will be delivered before 187 // Posts (as opposed to unexpired delayed Posts) will be delivered before
183 // Get (or Peek) returns false. By guaranteeing delivery of those messages, 188 // Get (or Peek) returns false. By guaranteeing delivery of those messages,
184 // we eliminate the race condition when an MessageHandler and MessageQueue 189 // we eliminate the race condition when an MessageHandler and MessageQueue
185 // may be destroyed independently of each other. 190 // may be destroyed independently of each other.
186 virtual void Quit(); 191 virtual void Quit();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 void reheap() { make_heap(c.begin(), c.end(), comp); } 238 void reheap() { make_heap(c.begin(), c.end(), comp); }
234 }; 239 };
235 240
236 void EnsureActive(); 241 void EnsureActive();
237 void DoDelayPost(int cmsDelay, uint32 tstamp, MessageHandler *phandler, 242 void DoDelayPost(int cmsDelay, uint32 tstamp, MessageHandler *phandler,
238 uint32 id, MessageData* pdata); 243 uint32 id, MessageData* pdata);
239 244
240 // The SocketServer is not owned by MessageQueue. 245 // The SocketServer is not owned by MessageQueue.
241 SocketServer* ss_; 246 SocketServer* ss_;
242 // If a server isn't supplied in the constructor, use this one. 247 // If a server isn't supplied in the constructor, use this one.
243 scoped_ptr<SocketServer> default_ss_; 248 scoped_ptr<SocketServer> owned_ss_;
244 bool fStop_; 249 bool fStop_;
245 bool fPeekKeep_; 250 bool fPeekKeep_;
246 Message msgPeek_; 251 Message msgPeek_;
247 // A message queue is active if it has ever had a message posted to it. 252 // A message queue is active if it has ever had a message posted to it.
248 // This also corresponds to being in MessageQueueManager's global list. 253 // This also corresponds to being in MessageQueueManager's global list.
249 bool active_; 254 bool active_;
250 MessageList msgq_; 255 MessageList msgq_;
251 PriorityQueue dmsgq_; 256 PriorityQueue dmsgq_;
252 uint32 dmsgq_next_num_; 257 uint32 dmsgq_next_num_;
253 CriticalSection crit_; 258 CriticalSection crit_;
254 259
255 private: 260 private:
256 DISALLOW_COPY_AND_ASSIGN(MessageQueue); 261 DISALLOW_COPY_AND_ASSIGN(MessageQueue);
257 }; 262 };
258 263
259 } // namespace talk_base 264 } // namespace talk_base
260 265
261 #endif // TALK_BASE_MESSAGEQUEUE_H_ 266 #endif // TALK_BASE_MESSAGEQUEUE_H_
OLDNEW
« no previous file with comments | « third_party/libjingle/overrides/talk/base/byteorder.h ('k') | third_party/libjingle/overrides/talk/base/messagequeue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698