Commit 8b70da20 authored by tommi's avatar tommi Committed by Commit Bot

Revert of Override rtc::Event with Chromium's implementation (patchset #2...

Revert of Override rtc::Event with Chromium's implementation (patchset #2 id:20001 of https://codereview.chromium.org/2975553002/ )

Reason for revert:
Reverting temporarily until the webrtc change can be rolled with it.

Original issue's description:
> Preparation of overriding WebRTC's rtc::Event with Chromium's implementation.
> This change will give WebRTC the benefits of Chromium's checks and integration with thread and sequence runners (e.g. io and waitable checks).
>
> Followup changes include enabling the code from the WebRTC side (requires build file changes) and integrating the TaskQueue implementation in Chromium with sequence runners.
>
> BUG=689520
> NOTRY=true
>
> Review-Url: https://codereview.chromium.org/2975553002
> Cr-Commit-Position: refs/heads/master@{#486737}
> Committed: https://chromium.googlesource.com/chromium/src/+/07019da77f12dc06fd8a2e66061c8a79c90bc439

TBR=grunell@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=689520

Review-Url: https://codereview.chromium.org/2981863002
Cr-Commit-Position: refs/heads/master@{#486739}
parent f897be01
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/webrtc_overrides/webrtc/rtc_base/event.h"
#include "base/time/time.h"
namespace rtc {
using base::WaitableEvent;
Event::Event(bool manual_reset, bool initially_signaled)
: event_(manual_reset ? WaitableEvent::ResetPolicy::MANUAL
: WaitableEvent::ResetPolicy::AUTOMATIC,
initially_signaled ? WaitableEvent::InitialState::SIGNALED
: WaitableEvent::InitialState::NOT_SIGNALED) {}
Event::~Event() {}
void Event::Set() {
event_.Signal();
}
void Event::Reset() {
event_.Reset();
}
bool Event::Wait(int milliseconds) {
if (milliseconds == kForever) {
event_.Wait();
return true;
}
return event_.TimedWait(base::TimeDelta::FromMilliseconds(milliseconds));
}
} // namespace rtc
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_RTC_BASE_EVENT_H_
#define THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_RTC_BASE_EVENT_H_
#include "base/macros.h"
#include "base/synchronization/waitable_event.h"
namespace rtc {
// Overrides WebRTC's internal event implementation to use Chromium's.
class Event {
public:
static const int kForever = -1;
Event(bool manual_reset, bool initially_signaled);
~Event();
void Set();
void Reset();
// Wait for the event to become signaled, for the specified number of
// |milliseconds|. To wait indefinetly, pass kForever.
bool Wait(int milliseconds);
private:
base::WaitableEvent event_;
DISALLOW_IMPLICIT_CONSTRUCTORS(Event);
};
} // namespace rtc
#endif // THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_RTC_BASE_EVENT_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment