dom/plugins/ipc/PluginStreamChild.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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/. */
     6 #ifndef mozilla_plugins_PluginStreamChild_h
     7 #define mozilla_plugins_PluginStreamChild_h
     9 #include "mozilla/plugins/PPluginStreamChild.h"
    10 #include "mozilla/plugins/AStream.h"
    12 namespace mozilla {
    13 namespace plugins {
    15 class PluginInstanceChild;
    17 class PluginStreamChild : public PPluginStreamChild, public AStream
    18 {
    19   friend class PluginInstanceChild;
    21 public:
    22   PluginStreamChild();
    23   virtual ~PluginStreamChild() { }
    25   virtual bool IsBrowserStream() MOZ_OVERRIDE { return false; }
    27   virtual bool Answer__delete__(const NPReason& reason,
    28                                 const bool& artificial) MOZ_OVERRIDE;
    30   int32_t NPN_Write(int32_t length, void* buffer);
    31   void NPP_DestroyStream(NPError reason);
    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   }
    44 private:
    45   PluginInstanceChild* Instance();
    47   NPStream mStream;
    48   bool mClosed;
    49 };
    52 } // namespace plugins
    53 } // namespace mozilla
    55 #endif

mercurial