2009-08-19 00:20:03 +04:00
|
|
|
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-08-19 00:20:03 +04:00
|
|
|
|
2009-09-09 18:04:09 +04:00
|
|
|
#ifndef mozilla_plugins_BrowserStreamParent_h
|
|
|
|
#define mozilla_plugins_BrowserStreamParent_h
|
2009-08-19 00:20:03 +04:00
|
|
|
|
2009-09-10 02:59:06 +04:00
|
|
|
#include "mozilla/plugins/PBrowserStreamParent.h"
|
2009-09-21 18:51:35 +04:00
|
|
|
#include "mozilla/plugins/AStream.h"
|
2014-12-30 02:14:11 +03:00
|
|
|
#include "nsNPAPIPluginStreamListener.h"
|
|
|
|
#include "nsPluginStreamListenerPeer.h"
|
2009-08-19 00:20:03 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace plugins {
|
|
|
|
|
2009-09-09 10:31:35 +04:00
|
|
|
class PluginInstanceParent;
|
2009-08-19 00:20:03 +04:00
|
|
|
|
2009-09-21 18:51:35 +04:00
|
|
|
class BrowserStreamParent : public PBrowserStreamParent, public AStream
|
2009-08-19 00:20:03 +04:00
|
|
|
{
|
2009-09-09 10:31:35 +04:00
|
|
|
friend class PluginModuleParent;
|
|
|
|
friend class PluginInstanceParent;
|
2009-08-19 00:20:03 +04:00
|
|
|
|
|
|
|
public:
|
2009-09-09 18:04:09 +04:00
|
|
|
BrowserStreamParent(PluginInstanceParent* npp,
|
|
|
|
NPStream* stream);
|
2009-09-24 03:00:23 +04:00
|
|
|
virtual ~BrowserStreamParent();
|
2009-08-19 00:20:03 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsBrowserStream() override { return true; }
|
2009-09-21 18:51:35 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
|
2014-05-02 22:44:13 +04:00
|
|
|
|
2014-12-30 02:14:11 +03:00
|
|
|
virtual bool RecvAsyncNPP_NewStreamResult(
|
|
|
|
const NPError& rv,
|
2015-03-21 19:28:04 +03:00
|
|
|
const uint16_t& stype) override;
|
2014-12-30 02:14:11 +03:00
|
|
|
|
2009-09-18 03:09:20 +04:00
|
|
|
virtual bool AnswerNPN_RequestRead(const IPCByteRanges& ranges,
|
2015-03-21 19:28:04 +03:00
|
|
|
NPError* result) override;
|
2009-08-19 00:20:03 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool RecvNPN_DestroyStream(const NPReason& reason) override;
|
2010-02-24 00:45:00 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool RecvStreamDestroyed() override;
|
2009-12-03 11:16:14 +03:00
|
|
|
|
2009-08-19 00:20:03 +04:00
|
|
|
int32_t WriteReady();
|
|
|
|
int32_t Write(int32_t offset, int32_t len, void* buffer);
|
|
|
|
void StreamAsFile(const char* fname);
|
|
|
|
|
2010-02-24 00:45:00 +03:00
|
|
|
void NPP_DestroyStream(NPReason reason);
|
|
|
|
|
2014-12-30 02:14:11 +03:00
|
|
|
void SetAlive()
|
|
|
|
{
|
|
|
|
if (mState == INITIALIZING) {
|
|
|
|
mState = ALIVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-19 00:20:03 +04:00
|
|
|
private:
|
2010-02-24 00:45:00 +03:00
|
|
|
using PBrowserStreamParent::SendNPP_DestroyStream;
|
2009-12-03 11:16:14 +03:00
|
|
|
|
2009-09-09 10:31:35 +04:00
|
|
|
PluginInstanceParent* mNPP;
|
2009-08-19 00:20:03 +04:00
|
|
|
NPStream* mStream;
|
2011-10-19 18:46:24 +04:00
|
|
|
nsCOMPtr<nsISupports> mStreamPeer;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsNPAPIPluginStreamListener> mStreamListener;
|
2014-12-30 02:14:11 +03:00
|
|
|
NPReason mDeferredDestroyReason;
|
2010-02-24 00:45:00 +03:00
|
|
|
|
|
|
|
enum {
|
2014-12-30 02:14:11 +03:00
|
|
|
INITIALIZING,
|
|
|
|
DEFERRING_DESTROY,
|
2010-02-24 00:45:00 +03:00
|
|
|
ALIVE,
|
|
|
|
DYING,
|
|
|
|
DELETING
|
|
|
|
} mState;
|
2009-08-19 00:20:03 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace plugins
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|