Clean kForever from basictypes and move it to the interfaces that actually have it.
R=tommi@webrtc.org Review URL: https://webrtc-codereview.appspot.com/33269004 Cr-Commit-Position: refs/heads/master@{#8296} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8296 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -119,7 +119,7 @@ class SynchronousMethodCall
|
|||||||
} else {
|
} else {
|
||||||
e_.reset(new rtc::Event(false, false));
|
e_.reset(new rtc::Event(false, false));
|
||||||
t->Post(this, 0);
|
t->Post(this, 0);
|
||||||
e_->Wait(rtc::kForever);
|
e_->Wait(rtc::Event::kForever);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ VideoCapturer* DeviceManager::MaybeConstructFakeVideoCapturer(
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
LOG(LS_INFO) << "Created file video capturer " << device.name;
|
LOG(LS_INFO) << "Created file video capturer " << device.name;
|
||||||
capturer->set_repeat(rtc::kForever);
|
capturer->set_repeat(FileVideoCapturer::kForever);
|
||||||
return capturer;
|
return capturer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ bool FileVideoCapturer::ReadFrame(bool first_frame, int* wait_time_ms) {
|
|||||||
// 2.1 Read the frame header.
|
// 2.1 Read the frame header.
|
||||||
rtc::StreamResult result = ReadFrameHeader(&captured_frame_);
|
rtc::StreamResult result = ReadFrameHeader(&captured_frame_);
|
||||||
if (rtc::SR_EOS == result) { // Loop back if repeat.
|
if (rtc::SR_EOS == result) { // Loop back if repeat.
|
||||||
if (repeat_ != rtc::kForever) {
|
if (repeat_ != kForever) {
|
||||||
if (repeat_ > 0) {
|
if (repeat_ > 0) {
|
||||||
--repeat_;
|
--repeat_;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ class VideoRecorder {
|
|||||||
// Simulated video capturer that periodically reads frames from a file.
|
// Simulated video capturer that periodically reads frames from a file.
|
||||||
class FileVideoCapturer : public VideoCapturer {
|
class FileVideoCapturer : public VideoCapturer {
|
||||||
public:
|
public:
|
||||||
|
static const int kForever = -1;
|
||||||
|
|
||||||
FileVideoCapturer();
|
FileVideoCapturer();
|
||||||
virtual ~FileVideoCapturer();
|
virtual ~FileVideoCapturer();
|
||||||
|
|
||||||
@@ -94,7 +96,7 @@ class FileVideoCapturer : public VideoCapturer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set how many times to repeat reading the file. Repeat forever if the
|
// 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.
|
// less than -1.
|
||||||
void set_repeat(int repeat) { repeat_ = repeat; }
|
void set_repeat(int repeat) { repeat_ = repeat; }
|
||||||
|
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ TEST_F(FileVideoCapturerTest, TestRepeatForever) {
|
|||||||
VideoCapturerListener listener;
|
VideoCapturerListener listener;
|
||||||
capturer_->SignalFrameCaptured.connect(
|
capturer_->SignalFrameCaptured.connect(
|
||||||
&listener, &VideoCapturerListener::OnFrameCaptured);
|
&listener, &VideoCapturerListener::OnFrameCaptured);
|
||||||
capturer_->set_repeat(rtc::kForever);
|
capturer_->set_repeat(cricket::FileVideoCapturer::kForever);
|
||||||
capture_format_ = capturer_->GetSupportedFormats()->at(0);
|
capture_format_ = capturer_->GetSupportedFormats()->at(0);
|
||||||
capture_format_.interval = cricket::VideoFormat::FpsToInterval(50);
|
capture_format_.interval = cricket::VideoFormat::FpsToInterval(50);
|
||||||
EXPECT_EQ(cricket::CS_RUNNING, capturer_->Start(capture_format_));
|
EXPECT_EQ(cricket::CS_RUNNING, capturer_->Start(capture_format_));
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ class SctpDataMediaChannelTest : public testing::Test,
|
|||||||
rtc::Thread* thread = rtc::Thread::Current();
|
rtc::Thread* thread = rtc::Thread::Current();
|
||||||
while (!thread->empty()) {
|
while (!thread->empty()) {
|
||||||
rtc::Message msg;
|
rtc::Message msg;
|
||||||
if (thread->Get(&msg, rtc::kForever)) {
|
if (thread->Get(&msg, rtc::Thread::kForever)) {
|
||||||
thread->Dispatch(&msg);
|
thread->Dispatch(&msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ void AsyncHttpRequest::DoWork() {
|
|||||||
// Do nothing while we wait for the request to finish. We only do this so
|
// 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
|
// 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.
|
// a SignalThread, since it does not need to spawn a new thread.
|
||||||
Thread::Current()->ProcessMessages(kForever);
|
Thread::Current()->ProcessMessages(Thread::kForever);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsyncHttpRequest::LaunchRequest() {
|
void AsyncHttpRequest::LaunchRequest() {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ void AutoDetectProxy::DoWork() {
|
|||||||
LOG(LS_INFO) << "AutoDetectProxy initiating proxy classification";
|
LOG(LS_INFO) << "AutoDetectProxy initiating proxy classification";
|
||||||
Next();
|
Next();
|
||||||
// Process I/O until Stop()
|
// 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
|
// Clean up the autodetect socket, from the thread that created it
|
||||||
delete socket_;
|
delete socket_;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,10 +114,6 @@ typedef int socklen_t;
|
|||||||
namespace rtc {
|
namespace rtc {
|
||||||
template<class T> inline T _min(T a, T b) { return (a > b) ? b : a; }
|
template<class T> inline T _min(T a, T b) { return (a > b) ? b : a; }
|
||||||
template<class T> inline T _max(T a, T b) { return (a < b) ? b : a; }
|
template<class T> 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) \
|
#define ALIGNP(p, t) \
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ namespace rtc {
|
|||||||
|
|
||||||
class Event {
|
class Event {
|
||||||
public:
|
public:
|
||||||
|
static const int kForever = -1;
|
||||||
|
|
||||||
Event(bool manual_reset, bool initially_signaled);
|
Event(bool manual_reset, bool initially_signaled);
|
||||||
~Event();
|
~Event();
|
||||||
|
|
||||||
|
|||||||
@@ -165,6 +165,8 @@ class DelayedMessage {
|
|||||||
|
|
||||||
class MessageQueue {
|
class MessageQueue {
|
||||||
public:
|
public:
|
||||||
|
static const int kForever = -1;
|
||||||
|
|
||||||
explicit MessageQueue(SocketServer* ss = NULL);
|
explicit MessageQueue(SocketServer* ss = NULL);
|
||||||
virtual ~MessageQueue();
|
virtual ~MessageQueue();
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ TEST_F(NullSocketServerTest, WaitAndSet) {
|
|||||||
thread.Post(this, 0);
|
thread.Post(this, 0);
|
||||||
// The process_io will be ignored.
|
// The process_io will be ignored.
|
||||||
const bool process_io = true;
|
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) {
|
TEST_F(NullSocketServerTest, TestWait) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ SharedExclusiveLock::SharedExclusiveLock()
|
|||||||
|
|
||||||
void SharedExclusiveLock::LockExclusive() {
|
void SharedExclusiveLock::LockExclusive() {
|
||||||
cs_exclusive_.Enter();
|
cs_exclusive_.Enter();
|
||||||
shared_count_is_zero_.Wait(rtc::kForever);
|
shared_count_is_zero_.Wait(Event::kForever);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SharedExclusiveLock::UnlockExclusive() {
|
void SharedExclusiveLock::UnlockExclusive() {
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ class MessageQueue;
|
|||||||
// notified of asynchronous I/O from this server's Wait method.
|
// notified of asynchronous I/O from this server's Wait method.
|
||||||
class SocketServer : public SocketFactory {
|
class SocketServer : public SocketFactory {
|
||||||
public:
|
public:
|
||||||
|
static const int kForever = -1;
|
||||||
|
|
||||||
// When the socket server is installed into a Thread, this function is
|
// 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
|
// called to allow the socket server to use the thread's message queue for
|
||||||
// any messaging that it might need to perform.
|
// any messaging that it might need to perform.
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ class Thread;
|
|||||||
|
|
||||||
class ThreadManager {
|
class ThreadManager {
|
||||||
public:
|
public:
|
||||||
|
static const int kForever = -1;
|
||||||
|
|
||||||
ThreadManager();
|
ThreadManager();
|
||||||
~ThreadManager();
|
~ThreadManager();
|
||||||
|
|
||||||
|
|||||||
@@ -594,7 +594,7 @@ bool VirtualSocketServer::ProcessMessagesUntilIdle() {
|
|||||||
stop_on_idle_ = true;
|
stop_on_idle_ = true;
|
||||||
while (!msg_queue_->empty()) {
|
while (!msg_queue_->empty()) {
|
||||||
Message msg;
|
Message msg;
|
||||||
if (msg_queue_->Get(&msg, kForever)) {
|
if (msg_queue_->Get(&msg, Thread::kForever)) {
|
||||||
msg_queue_->Dispatch(&msg);
|
msg_queue_->Dispatch(&msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,10 +82,6 @@ typedef int socklen_t;
|
|||||||
namespace rtc {
|
namespace rtc {
|
||||||
template<class T> inline T _min(T a, T b) { return (a > b) ? b : a; }
|
template<class T> inline T _min(T a, T b) { return (a > b) ? b : a; }
|
||||||
template<class T> inline T _max(T a, T b) { return (a < b) ? b : a; }
|
template<class T> 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)
|
#if defined(WEBRTC_WIN)
|
||||||
|
|||||||
Reference in New Issue
Block a user