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

Side by Side Diff: webrtc/base/thread.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 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
« no previous file with comments | « webrtc/base/thread.h ('k') | webrtc/base/thread_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 378
379 bool Thread::IsOwned() { 379 bool Thread::IsOwned() {
380 return owned_; 380 return owned_;
381 } 381 }
382 382
383 void Thread::Stop() { 383 void Thread::Stop() {
384 MessageQueue::Quit(); 384 MessageQueue::Quit();
385 Join(); 385 Join();
386 } 386 }
387 387
388 void Thread::Send(MessageHandler *phandler, uint32 id, MessageData *pdata) { 388 void Thread::Send(MessageHandler* phandler, uint32_t id, MessageData* pdata) {
389 if (fStop_) 389 if (fStop_)
390 return; 390 return;
391 391
392 // Sent messages are sent to the MessageHandler directly, in the context 392 // Sent messages are sent to the MessageHandler directly, in the context
393 // of "thread", like Win32 SendMessage. If in the right context, 393 // of "thread", like Win32 SendMessage. If in the right context,
394 // call the handler directly. 394 // call the handler directly.
395 Message msg; 395 Message msg;
396 msg.phandler = phandler; 396 msg.phandler = phandler;
397 msg.message_id = id; 397 msg.message_id = id;
398 msg.pdata = pdata; 398 msg.pdata = pdata;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 } 488 }
489 489
490 void Thread::InvokeBegin() { 490 void Thread::InvokeBegin() {
491 TRACE_EVENT_BEGIN0("webrtc", "Thread::Invoke"); 491 TRACE_EVENT_BEGIN0("webrtc", "Thread::Invoke");
492 } 492 }
493 493
494 void Thread::InvokeEnd() { 494 void Thread::InvokeEnd() {
495 TRACE_EVENT_END0("webrtc", "Thread::Invoke"); 495 TRACE_EVENT_END0("webrtc", "Thread::Invoke");
496 } 496 }
497 497
498 void Thread::Clear(MessageHandler *phandler, uint32 id, 498 void Thread::Clear(MessageHandler* phandler,
499 uint32_t id,
499 MessageList* removed) { 500 MessageList* removed) {
500 CritScope cs(&crit_); 501 CritScope cs(&crit_);
501 502
502 // Remove messages on sendlist_ with phandler 503 // Remove messages on sendlist_ with phandler
503 // Object target cleared: remove from send list, wakeup/set ready 504 // Object target cleared: remove from send list, wakeup/set ready
504 // if sender not NULL. 505 // if sender not NULL.
505 506
506 std::list<_SendMessage>::iterator iter = sendlist_.begin(); 507 std::list<_SendMessage>::iterator iter = sendlist_.begin();
507 while (iter != sendlist_.end()) { 508 while (iter != sendlist_.end()) {
508 _SendMessage smsg = *iter; 509 _SendMessage smsg = *iter;
509 if (smsg.msg.Match(phandler, id)) { 510 if (smsg.msg.Match(phandler, id)) {
510 if (removed) { 511 if (removed) {
511 removed->push_back(smsg.msg); 512 removed->push_back(smsg.msg);
512 } else { 513 } else {
513 delete smsg.msg.pdata; 514 delete smsg.msg.pdata;
514 } 515 }
515 iter = sendlist_.erase(iter); 516 iter = sendlist_.erase(iter);
516 *smsg.ready = true; 517 *smsg.ready = true;
517 smsg.thread->socketserver()->WakeUp(); 518 smsg.thread->socketserver()->WakeUp();
518 continue; 519 continue;
519 } 520 }
520 ++iter; 521 ++iter;
521 } 522 }
522 523
523 MessageQueue::Clear(phandler, id, removed); 524 MessageQueue::Clear(phandler, id, removed);
524 } 525 }
525 526
526 bool Thread::ProcessMessages(int cmsLoop) { 527 bool Thread::ProcessMessages(int cmsLoop) {
527 uint32 msEnd = (kForever == cmsLoop) ? 0 : TimeAfter(cmsLoop); 528 uint32_t msEnd = (kForever == cmsLoop) ? 0 : TimeAfter(cmsLoop);
528 int cmsNext = cmsLoop; 529 int cmsNext = cmsLoop;
529 530
530 while (true) { 531 while (true) {
531 #if __has_feature(objc_arc) 532 #if __has_feature(objc_arc)
532 @autoreleasepool 533 @autoreleasepool
533 #elif defined(WEBRTC_MAC) 534 #elif defined(WEBRTC_MAC)
534 // see: http://developer.apple.com/library/mac/#documentation/Cocoa/Referenc e/Foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html 535 // see: http://developer.apple.com/library/mac/#documentation/Cocoa/Referenc e/Foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html
535 // Each thread is supposed to have an autorelease pool. Also for event loops 536 // Each thread is supposed to have an autorelease pool. Also for event loops
536 // like this, autorelease pool needs to be created and drained/released 537 // like this, autorelease pool needs to be created and drained/released
537 // for each cycle. 538 // for each cycle.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 if (SUCCEEDED(hr)) { 599 if (SUCCEEDED(hr)) {
599 Thread::Run(); 600 Thread::Run();
600 CoUninitialize(); 601 CoUninitialize();
601 } else { 602 } else {
602 LOG(LS_ERROR) << "CoInitialize failed, hr=" << hr; 603 LOG(LS_ERROR) << "CoInitialize failed, hr=" << hr;
603 } 604 }
604 } 605 }
605 #endif 606 #endif
606 607
607 } // namespace rtc 608 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/thread.h ('k') | webrtc/base/thread_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698