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.
4
5#ifndef LIBRARIES_NACL_IO_STREAM_STREAM_EVENT_EMITTER_H_
6#define LIBRARIES_NACL_IO_STREAM_STREAM_EVENT_EMITTER_H_
7
8#include "nacl_io/event_emitter.h"
9
10#include "sdk_util/macros.h"
11#include "sdk_util/scoped_ref.h"
12
13namespace nacl_io {
14
15class FIFOInterface;
16class StreamEventEmitter;
17class StreamNode;
18
19typedef sdk_util::ScopedRef<StreamEventEmitter> ScopedStreamEventEmitter;
20
21class StreamEventEmitter : public EventEmitter {
22 public:
23  StreamEventEmitter();
24
25  void AttachStream(StreamNode* stream);
26  void DetachStream();
27
28  StreamNode* stream() { return stream_; }
29
30 protected:
31  virtual FIFOInterface* in_fifo() = 0;
32  virtual FIFOInterface* out_fifo() = 0;
33  void UpdateStatus_Locked();
34
35 protected:
36  StreamNode* stream_;
37  DISALLOW_COPY_AND_ASSIGN(StreamEventEmitter);
38};
39
40}  // namespace nacl_io
41
42#endif  // LIBRARIES_NACL_IO_STREAM_STREAM_EVENT_EMITTER_H_
43