1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "nacl_io/stream/stream_event_emitter.h"
11 #include "nacl_io/fifo_interface.h"
12 #include "sdk_util/auto_lock.h"
16 StreamEventEmitter::StreamEventEmitter() : stream_(NULL
) {
19 void StreamEventEmitter::AttachStream(StreamNode
* stream
) {
24 void StreamEventEmitter::DetachStream() {
27 RaiseEvents_Locked(POLLHUP
);
31 void StreamEventEmitter::UpdateStatus_Locked() {
33 if (!in_fifo()->IsEmpty())
36 if (!out_fifo()->IsFull())
39 ClearEvents_Locked(~status
);
40 RaiseEvents_Locked(status
);
43 } // namespace nacl_io