Chromium Code Reviews| Index: third_party/WebKit/Source/platform/WaitableEvent.h |
| diff --git a/third_party/WebKit/public/platform/WebWaitableEvent.h b/third_party/WebKit/Source/platform/WaitableEvent.h |
| similarity index 71% |
| rename from third_party/WebKit/public/platform/WebWaitableEvent.h |
| rename to third_party/WebKit/Source/platform/WaitableEvent.h |
| index a194796246fa2d738e850fc643b5da1afc403c52..36c35e9ccc3566d7768c949bd410481a6457f856 100644 |
| --- a/third_party/WebKit/public/platform/WebWaitableEvent.h |
| +++ b/third_party/WebKit/Source/platform/WaitableEvent.h |
| @@ -28,40 +28,61 @@ |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| -#ifndef WebWaitableEvent_h |
| -#define WebWaitableEvent_h |
| +#ifndef WaitableEvent_h |
| +#define WaitableEvent_h |
| -#include "WebCommon.h" |
| +#include "platform/PlatformExport.h" |
| +#include "wtf/OwnPtr.h" |
| +#include "wtf/Vector.h" |
| + |
| +namespace base { |
| +class WaitableEvent; |
| +}; // namespace base |
| namespace blink { |
| // Provides a thread synchronization that can be used to allow one thread to |
| // wait until another thread to finish some work. |
| -class WebWaitableEvent { |
| +class PLATFORM_EXPORT WaitableEvent { |
|
haraken
2016/02/11 00:53:52
I think WaitableEvent could be moved to wtf/, but
|
| public: |
| // If ResetPolicy::Manual is specified on creation, to set the event state |
| // to non-signaled, a consumer must call reset(). Otherwise, the system |
| // automatically resets the event state to non-signaled after a single |
| // waiting thread has been released. |
| - enum class ResetPolicy { Auto, Manual }; |
| + enum class ResetPolicy { Auto, |
| + Manual }; |
|
esprehn
2016/02/11 01:01:27
why did you wrap these?
|
| // Specify the initial state on creation. |
| - enum class InitialState { NonSignaled, Signaled }; |
| + enum class InitialState { NonSignaled, |
| + Signaled }; |
| + |
| + WaitableEvent(ResetPolicy = ResetPolicy::Auto, InitialState = InitialState::NonSignaled); |
|
esprehn
2016/02/11 01:01:27
explicit
|
| - virtual ~WebWaitableEvent() {} |
| + ~WaitableEvent(); |
| // Puts the event in the un-signaled state. |
| - virtual void reset() {} |
| + void reset(); |
| // Waits indefinitely for the event to be signaled. |
| - virtual void wait() {} |
| + void wait(); |
| // Puts the event in the signaled state. Causing any thread blocked on Wait |
| // to be woken up. The event state is reset to non-signaled after |
| // a waiting thread has been released. |
| - virtual void signal() {} |
| + void signal(); |
| + |
| + // Waits on multiple events and returns the index of the object that |
| + // has been signaled. Any event objects given to this method must |
| + // not deleted while this wait is happening. |
| + static size_t waitMultiple(const WTF::Vector<WaitableEvent*>& events); |
| + |
| +private: |
| + WaitableEvent(const WaitableEvent&) = delete; |
| + void operator=(const WaitableEvent&) = delete; |
| + |
| + OwnPtr<base::WaitableEvent> m_impl; |
| }; |
| } // namespace blink |
| -#endif // WebWaitableEvent_h |
| +#endif // WaitableEvent_h |