dom/plugins/ipc/PluginStreamChild.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:6767bd2e3d6f
1 /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #ifndef mozilla_plugins_PluginStreamChild_h
7 #define mozilla_plugins_PluginStreamChild_h
8
9 #include "mozilla/plugins/PPluginStreamChild.h"
10 #include "mozilla/plugins/AStream.h"
11
12 namespace mozilla {
13 namespace plugins {
14
15 class PluginInstanceChild;
16
17 class PluginStreamChild : public PPluginStreamChild, public AStream
18 {
19 friend class PluginInstanceChild;
20
21 public:
22 PluginStreamChild();
23 virtual ~PluginStreamChild() { }
24
25 virtual bool IsBrowserStream() MOZ_OVERRIDE { return false; }
26
27 virtual bool Answer__delete__(const NPReason& reason,
28 const bool& artificial) MOZ_OVERRIDE;
29
30 int32_t NPN_Write(int32_t length, void* buffer);
31 void NPP_DestroyStream(NPError reason);
32
33 void EnsureCorrectInstance(PluginInstanceChild* i)
34 {
35 if (i != Instance())
36 NS_RUNTIMEABORT("Incorrect stream instance");
37 }
38 void EnsureCorrectStream(NPStream* s)
39 {
40 if (s != &mStream)
41 NS_RUNTIMEABORT("Incorrect stream data");
42 }
43
44 private:
45 PluginInstanceChild* Instance();
46
47 NPStream mStream;
48 bool mClosed;
49 };
50
51
52 } // namespace plugins
53 } // namespace mozilla
54
55 #endif

mercurial