diff --git a/talk/app/webrtc/proxy.h b/talk/app/webrtc/proxy.h index 6cf92cbf8..78245fc4d 100644 --- a/talk/app/webrtc/proxy.h +++ b/talk/app/webrtc/proxy.h @@ -119,7 +119,7 @@ class SynchronousMethodCall } else { e_.reset(new rtc::Event(false, false)); t->Post(this, 0); - e_->Wait(rtc::kForever); + e_->Wait(rtc::Event::kForever); } } diff --git a/talk/media/devices/devicemanager.cc b/talk/media/devices/devicemanager.cc index 04ea82f42..1d7ac5baf 100644 --- a/talk/media/devices/devicemanager.cc +++ b/talk/media/devices/devicemanager.cc @@ -224,7 +224,7 @@ VideoCapturer* DeviceManager::MaybeConstructFakeVideoCapturer( return NULL; } LOG(LS_INFO) << "Created file video capturer " << device.name; - capturer->set_repeat(rtc::kForever); + capturer->set_repeat(FileVideoCapturer::kForever); return capturer; } diff --git a/talk/media/devices/filevideocapturer.cc b/talk/media/devices/filevideocapturer.cc index c879847bb..96dbcb18f 100644 --- a/talk/media/devices/filevideocapturer.cc +++ b/talk/media/devices/filevideocapturer.cc @@ -330,7 +330,7 @@ bool FileVideoCapturer::ReadFrame(bool first_frame, int* wait_time_ms) { // 2.1 Read the frame header. rtc::StreamResult result = ReadFrameHeader(&captured_frame_); if (rtc::SR_EOS == result) { // Loop back if repeat. - if (repeat_ != rtc::kForever) { + if (repeat_ != kForever) { if (repeat_ > 0) { --repeat_; } else { diff --git a/talk/media/devices/filevideocapturer.h b/talk/media/devices/filevideocapturer.h index c5b15ef63..101b9b9de 100644 --- a/talk/media/devices/filevideocapturer.h +++ b/talk/media/devices/filevideocapturer.h @@ -77,6 +77,8 @@ class VideoRecorder { // Simulated video capturer that periodically reads frames from a file. class FileVideoCapturer : public VideoCapturer { public: + static const int kForever = -1; + FileVideoCapturer(); virtual ~FileVideoCapturer(); @@ -94,7 +96,7 @@ class FileVideoCapturer : public VideoCapturer { } // Set how many times to repeat reading the file. Repeat forever if the - // parameter is rtc::kForever(-1); no repeat if the parameter is 0 or + // parameter is kForever; no repeat if the parameter is 0 or // less than -1. void set_repeat(int repeat) { repeat_ = repeat; } diff --git a/talk/media/devices/filevideocapturer_unittest.cc b/talk/media/devices/filevideocapturer_unittest.cc index 7bc873c19..ccd240721 100644 --- a/talk/media/devices/filevideocapturer_unittest.cc +++ b/talk/media/devices/filevideocapturer_unittest.cc @@ -158,7 +158,7 @@ TEST_F(FileVideoCapturerTest, TestRepeatForever) { VideoCapturerListener listener; capturer_->SignalFrameCaptured.connect( &listener, &VideoCapturerListener::OnFrameCaptured); - capturer_->set_repeat(rtc::kForever); + capturer_->set_repeat(cricket::FileVideoCapturer::kForever); capture_format_ = capturer_->GetSupportedFormats()->at(0); capture_format_.interval = cricket::VideoFormat::FpsToInterval(50); EXPECT_EQ(cricket::CS_RUNNING, capturer_->Start(capture_format_)); diff --git a/talk/media/sctp/sctpdataengine_unittest.cc b/talk/media/sctp/sctpdataengine_unittest.cc index d118dae28..37540882c 100644 --- a/talk/media/sctp/sctpdataengine_unittest.cc +++ b/talk/media/sctp/sctpdataengine_unittest.cc @@ -318,7 +318,7 @@ class SctpDataMediaChannelTest : public testing::Test, rtc::Thread* thread = rtc::Thread::Current(); while (!thread->empty()) { rtc::Message msg; - if (thread->Get(&msg, rtc::kForever)) { + if (thread->Get(&msg, rtc::Thread::kForever)) { thread->Dispatch(&msg); } } diff --git a/webrtc/base/asynchttprequest.cc b/webrtc/base/asynchttprequest.cc index 23042f17d..bdca585c3 100644 --- a/webrtc/base/asynchttprequest.cc +++ b/webrtc/base/asynchttprequest.cc @@ -91,7 +91,7 @@ void AsyncHttpRequest::DoWork() { // Do nothing while we wait for the request to finish. We only do this so // that we can be a SignalThread; in the future this class should not be // a SignalThread, since it does not need to spawn a new thread. - Thread::Current()->ProcessMessages(kForever); + Thread::Current()->ProcessMessages(Thread::kForever); } void AsyncHttpRequest::LaunchRequest() { diff --git a/webrtc/base/autodetectproxy.cc b/webrtc/base/autodetectproxy.cc index bc54b9638..8878d41cd 100644 --- a/webrtc/base/autodetectproxy.cc +++ b/webrtc/base/autodetectproxy.cc @@ -55,7 +55,7 @@ void AutoDetectProxy::DoWork() { LOG(LS_INFO) << "AutoDetectProxy initiating proxy classification"; Next(); // Process I/O until Stop() - Thread::Current()->ProcessMessages(kForever); + Thread::Current()->ProcessMessages(Thread::kForever); // Clean up the autodetect socket, from the thread that created it delete socket_; } diff --git a/webrtc/base/basictypes.h b/webrtc/base/basictypes.h index 7649a43f8..10e614a02 100644 --- a/webrtc/base/basictypes.h +++ b/webrtc/base/basictypes.h @@ -114,10 +114,6 @@ typedef int socklen_t; namespace rtc { template inline T _min(T a, T b) { return (a > b) ? b : a; } template inline T _max(T a, T b) { return (a < b) ? b : a; } - - // For wait functions that take a number of milliseconds, kForever indicates - // unlimited time. - const int kForever = -1; } #define ALIGNP(p, t) \ diff --git a/webrtc/base/event.h b/webrtc/base/event.h index d364bc072..fb6868207 100644 --- a/webrtc/base/event.h +++ b/webrtc/base/event.h @@ -25,6 +25,8 @@ namespace rtc { class Event { public: + static const int kForever = -1; + Event(bool manual_reset, bool initially_signaled); ~Event(); diff --git a/webrtc/base/messagequeue.h b/webrtc/base/messagequeue.h index 41c1e24b0..5fd58388d 100644 --- a/webrtc/base/messagequeue.h +++ b/webrtc/base/messagequeue.h @@ -165,6 +165,8 @@ class DelayedMessage { class MessageQueue { public: + static const int kForever = -1; + explicit MessageQueue(SocketServer* ss = NULL); virtual ~MessageQueue(); diff --git a/webrtc/base/nullsocketserver_unittest.cc b/webrtc/base/nullsocketserver_unittest.cc index a39043d4e..4bb1d7f8e 100644 --- a/webrtc/base/nullsocketserver_unittest.cc +++ b/webrtc/base/nullsocketserver_unittest.cc @@ -34,7 +34,7 @@ TEST_F(NullSocketServerTest, WaitAndSet) { thread.Post(this, 0); // The process_io will be ignored. const bool process_io = true; - EXPECT_TRUE_WAIT(ss_.Wait(rtc::kForever, process_io), kTimeout); + EXPECT_TRUE_WAIT(ss_.Wait(SocketServer::kForever, process_io), kTimeout); } TEST_F(NullSocketServerTest, TestWait) { diff --git a/webrtc/base/sharedexclusivelock.cc b/webrtc/base/sharedexclusivelock.cc index 9facf60ea..f577a9dbd 100644 --- a/webrtc/base/sharedexclusivelock.cc +++ b/webrtc/base/sharedexclusivelock.cc @@ -19,7 +19,7 @@ SharedExclusiveLock::SharedExclusiveLock() void SharedExclusiveLock::LockExclusive() { cs_exclusive_.Enter(); - shared_count_is_zero_.Wait(rtc::kForever); + shared_count_is_zero_.Wait(Event::kForever); } void SharedExclusiveLock::UnlockExclusive() { diff --git a/webrtc/base/socketserver.h b/webrtc/base/socketserver.h index 467105a6a..15c56f461 100644 --- a/webrtc/base/socketserver.h +++ b/webrtc/base/socketserver.h @@ -24,6 +24,8 @@ class MessageQueue; // notified of asynchronous I/O from this server's Wait method. class SocketServer : public SocketFactory { public: + static const int kForever = -1; + // When the socket server is installed into a Thread, this function is // called to allow the socket server to use the thread's message queue for // any messaging that it might need to perform. diff --git a/webrtc/base/thread.h b/webrtc/base/thread.h index b05d6a9d0..265054741 100644 --- a/webrtc/base/thread.h +++ b/webrtc/base/thread.h @@ -33,6 +33,8 @@ class Thread; class ThreadManager { public: + static const int kForever = -1; + ThreadManager(); ~ThreadManager(); diff --git a/webrtc/base/virtualsocketserver.cc b/webrtc/base/virtualsocketserver.cc index 59587bb84..26e6c406c 100644 --- a/webrtc/base/virtualsocketserver.cc +++ b/webrtc/base/virtualsocketserver.cc @@ -594,7 +594,7 @@ bool VirtualSocketServer::ProcessMessagesUntilIdle() { stop_on_idle_ = true; while (!msg_queue_->empty()) { Message msg; - if (msg_queue_->Get(&msg, kForever)) { + if (msg_queue_->Get(&msg, Thread::kForever)) { msg_queue_->Dispatch(&msg); } } diff --git a/webrtc/overrides/webrtc/base/basictypes.h b/webrtc/overrides/webrtc/base/basictypes.h index 1f8ae42b2..b92f20256 100644 --- a/webrtc/overrides/webrtc/base/basictypes.h +++ b/webrtc/overrides/webrtc/base/basictypes.h @@ -82,10 +82,6 @@ typedef int socklen_t; namespace rtc { template inline T _min(T a, T b) { return (a > b) ? b : a; } template inline T _max(T a, T b) { return (a < b) ? b : a; } - -// For wait functions that take a number of milliseconds, kForever indicates -// unlimited time. -const int kForever = -1; } #if defined(WEBRTC_WIN)