2009-07-20 17:36:23 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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/. */
|
1998-08-01 09:46:47 +04:00
|
|
|
|
2008-09-15 16:45:01 +04:00
|
|
|
#ifndef nsNPAPIPluginInstance_h_
|
|
|
|
#define nsNPAPIPluginInstance_h_
|
1998-08-04 07:21:43 +04:00
|
|
|
|
2015-03-29 17:59:08 +03:00
|
|
|
#include "nsSize.h"
|
2002-10-04 01:31:41 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2009-03-28 16:57:13 +03:00
|
|
|
#include "nsTArray.h"
|
|
|
|
#include "nsPIDOMWindow.h"
|
2009-07-01 19:09:49 +04:00
|
|
|
#include "nsITimer.h"
|
2013-12-03 12:36:13 +04:00
|
|
|
#include "nsIPluginInstanceOwner.h"
|
2010-07-20 06:11:26 +04:00
|
|
|
#include "nsIURI.h"
|
2011-01-05 22:44:21 +03:00
|
|
|
#include "nsIChannel.h"
|
|
|
|
#include "nsHashKeys.h"
|
2013-03-12 14:34:07 +04:00
|
|
|
#include <prinrval.h>
|
2013-08-28 06:59:14 +04:00
|
|
|
#include "js/TypeDecls.h"
|
2015-07-29 00:09:48 +03:00
|
|
|
#include "nsIAudioChannelAgent.h"
|
2011-11-21 11:55:50 +04:00
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
2012-07-20 23:20:51 +04:00
|
|
|
#include "nsAutoPtr.h"
|
2011-11-21 11:55:50 +04:00
|
|
|
#include "nsIRunnable.h"
|
2013-09-04 16:14:52 +04:00
|
|
|
#include "GLContextTypes.h"
|
2014-10-21 17:53:00 +04:00
|
|
|
#include "AndroidSurfaceTexture.h"
|
2013-03-12 14:34:07 +04:00
|
|
|
#include "AndroidBridge.h"
|
2012-07-20 23:20:51 +04:00
|
|
|
#include <map>
|
2012-05-04 19:48:41 +04:00
|
|
|
class PluginEventRunnable;
|
2012-07-20 23:20:51 +04:00
|
|
|
class SharedPluginTexture;
|
2011-11-21 11:55:50 +04:00
|
|
|
#endif
|
2011-10-05 22:44:19 +04:00
|
|
|
|
2010-07-13 22:42:03 +04:00
|
|
|
#include "mozilla/TimeStamp.h"
|
2009-10-27 22:51:12 +03:00
|
|
|
#include "mozilla/PluginLibrary.h"
|
2015-10-19 21:34:27 +03:00
|
|
|
#include "mozilla/WeakPtr.h"
|
1998-08-01 09:46:47 +04:00
|
|
|
|
2010-07-18 03:47:29 +04:00
|
|
|
class nsPluginStreamListenerPeer; // browser-initiated stream class
|
|
|
|
class nsNPAPIPluginStreamListener; // plugin-initiated stream class
|
2010-07-13 22:42:03 +04:00
|
|
|
class nsIPluginInstanceOwner;
|
2011-05-18 05:48:34 +04:00
|
|
|
class nsIOutputStream;
|
2012-10-03 06:43:18 +04:00
|
|
|
class nsPluginInstanceOwner;
|
2001-07-25 00:48:36 +04:00
|
|
|
|
2012-02-16 07:24:38 +04:00
|
|
|
#if defined(OS_WIN)
|
|
|
|
const NPDrawingModel kDefaultDrawingModel = NPDrawingModelSyncWin;
|
|
|
|
#elif defined(MOZ_X11)
|
|
|
|
const NPDrawingModel kDefaultDrawingModel = NPDrawingModelSyncX;
|
2012-05-05 06:36:27 +04:00
|
|
|
#elif defined(XP_MACOSX)
|
2012-02-16 07:24:38 +04:00
|
|
|
#ifndef NP_NO_QUICKDRAW
|
2012-08-30 23:10:55 +04:00
|
|
|
const NPDrawingModel kDefaultDrawingModel = NPDrawingModelQuickDraw; // Not supported
|
2012-02-16 07:24:38 +04:00
|
|
|
#else
|
|
|
|
const NPDrawingModel kDefaultDrawingModel = NPDrawingModelCoreGraphics;
|
|
|
|
#endif
|
2012-05-05 06:36:27 +04:00
|
|
|
#else
|
|
|
|
const NPDrawingModel kDefaultDrawingModel = static_cast<NPDrawingModel>(0);
|
2012-02-16 07:24:38 +04:00
|
|
|
#endif
|
|
|
|
|
2013-02-27 15:50:27 +04:00
|
|
|
/**
|
|
|
|
* Used to indicate whether it's OK to reenter Gecko and repaint, flush frames,
|
|
|
|
* run scripts, etc, during this plugin call.
|
|
|
|
* When NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO is set, we try to avoid dangerous
|
|
|
|
* Gecko activities when the plugin spins a nested event loop, on a best-effort
|
|
|
|
* basis.
|
|
|
|
*/
|
|
|
|
enum NSPluginCallReentry {
|
|
|
|
NS_PLUGIN_CALL_SAFE_TO_REENTER_GECKO,
|
|
|
|
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO
|
|
|
|
};
|
|
|
|
|
2009-07-01 19:09:49 +04:00
|
|
|
class nsNPAPITimer
|
1998-08-01 09:46:47 +04:00
|
|
|
{
|
|
|
|
public:
|
2009-07-01 19:09:49 +04:00
|
|
|
NPP npp;
|
|
|
|
uint32_t id;
|
|
|
|
nsCOMPtr<nsITimer> timer;
|
|
|
|
void (*callback)(NPP npp, uint32_t timerID);
|
2012-12-13 23:23:07 +04:00
|
|
|
bool inCallback;
|
2012-12-17 19:05:49 +04:00
|
|
|
bool needUnschedule;
|
2001-07-25 00:48:36 +04:00
|
|
|
};
|
1998-08-01 09:46:47 +04:00
|
|
|
|
2015-07-29 00:09:48 +03:00
|
|
|
class nsNPAPIPluginInstance final : public nsIAudioChannelAgentCallback
|
2015-10-19 21:34:27 +03:00
|
|
|
, public mozilla::SupportsWeakPtr<nsNPAPIPluginInstance>
|
1998-08-01 09:46:47 +04:00
|
|
|
{
|
2009-10-27 22:51:12 +03:00
|
|
|
private:
|
|
|
|
typedef mozilla::PluginLibrary PluginLibrary;
|
|
|
|
|
1998-08-01 09:46:47 +04:00
|
|
|
public:
|
2015-10-19 21:34:27 +03:00
|
|
|
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(nsNPAPIPluginInstance)
|
2013-07-19 06:21:20 +04:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2015-07-29 00:09:48 +03:00
|
|
|
NS_DECL_NSIAUDIOCHANNELAGENTCALLBACK
|
2011-05-18 05:48:34 +04:00
|
|
|
|
2015-02-25 19:36:39 +03:00
|
|
|
nsresult Initialize(nsNPAPIPlugin *aPlugin, nsPluginInstanceOwner* aOwner, const nsACString& aMIMEType);
|
2011-05-18 05:48:34 +04:00
|
|
|
nsresult Start();
|
|
|
|
nsresult Stop();
|
|
|
|
nsresult SetWindow(NPWindow* window);
|
|
|
|
nsresult NewStreamFromPlugin(const char* type, const char* target, nsIOutputStream* *result);
|
|
|
|
nsresult Print(NPPrint* platformPrint);
|
2013-02-27 15:50:28 +04:00
|
|
|
nsresult HandleEvent(void* event, int16_t* result,
|
|
|
|
NSPluginCallReentry aSafeToReenterGecko = NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
|
2011-05-18 05:48:34 +04:00
|
|
|
nsresult GetValueFromPlugin(NPPVariable variable, void* value);
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult GetDrawingModel(int32_t* aModel);
|
2011-09-29 10:19:26 +04:00
|
|
|
nsresult IsRemoteDrawingCoreAnimation(bool* aDrawing);
|
2012-10-16 23:41:21 +04:00
|
|
|
nsresult ContentsScaleFactorChanged(double aContentsScaleFactor);
|
2011-05-18 05:48:34 +04:00
|
|
|
nsresult GetJSObject(JSContext *cx, JSObject** outObject);
|
2011-11-12 05:10:31 +04:00
|
|
|
bool ShouldCache();
|
2011-09-29 10:19:26 +04:00
|
|
|
nsresult IsWindowless(bool* isWindowless);
|
2011-05-18 05:48:34 +04:00
|
|
|
nsresult AsyncSetWindow(NPWindow* window);
|
2012-11-10 19:45:52 +04:00
|
|
|
nsresult GetImageContainer(mozilla::layers::ImageContainer **aContainer);
|
2011-05-18 05:48:34 +04:00
|
|
|
nsresult GetImageSize(nsIntSize* aSize);
|
|
|
|
nsresult NotifyPainted(void);
|
2012-09-27 04:22:51 +04:00
|
|
|
nsresult GetIsOOP(bool* aIsOOP);
|
2011-05-18 05:48:34 +04:00
|
|
|
nsresult SetBackgroundUnknown();
|
|
|
|
nsresult BeginUpdateBackground(nsIntRect* aRect, gfxContext** aContext);
|
|
|
|
nsresult EndUpdateBackground(gfxContext* aContext, nsIntRect* aRect);
|
2011-09-29 10:19:26 +04:00
|
|
|
nsresult IsTransparent(bool* isTransparent);
|
2011-05-18 05:48:34 +04:00
|
|
|
nsresult GetFormValue(nsAString& aValue);
|
2011-09-29 10:19:26 +04:00
|
|
|
nsresult PushPopupsEnabledState(bool aEnabled);
|
2011-05-18 05:48:34 +04:00
|
|
|
nsresult PopPopupsEnabledState();
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult GetPluginAPIVersion(uint16_t* version);
|
2011-05-18 05:48:34 +04:00
|
|
|
nsresult InvalidateRect(NPRect *invalidRect);
|
|
|
|
nsresult InvalidateRegion(NPRegion invalidRegion);
|
|
|
|
nsresult GetMIMEType(const char* *result);
|
|
|
|
nsresult GetJSContext(JSContext* *outContext);
|
2012-10-03 06:43:18 +04:00
|
|
|
nsPluginInstanceOwner* GetOwner();
|
|
|
|
void SetOwner(nsPluginInstanceOwner *aOwner);
|
1998-08-01 09:46:47 +04:00
|
|
|
|
2015-07-29 00:09:48 +03:00
|
|
|
bool HasAudioChannelAgent() const
|
|
|
|
{
|
|
|
|
return !!mAudioChannelAgent;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult GetOrCreateAudioChannelAgent(nsIAudioChannelAgent** aAgent);
|
|
|
|
|
|
|
|
nsresult SetMuted(bool aIsMuted);
|
|
|
|
|
2010-07-20 06:11:26 +04:00
|
|
|
nsNPAPIPlugin* GetPlugin();
|
|
|
|
|
2009-07-01 19:09:49 +04:00
|
|
|
nsresult GetNPP(NPP * aNPP);
|
1998-08-01 09:46:47 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NPError SetWindowless(bool aWindowless);
|
1998-09-15 07:48:58 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NPError SetTransparent(bool aTransparent);
|
1998-09-15 07:48:58 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NPError SetWantsAllNetworkStreams(bool aWantsAllNetworkStreams);
|
2008-08-05 01:17:55 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NPError SetUsesDOMForCursor(bool aUsesDOMForCursor);
|
|
|
|
bool UsesDOMForCursor();
|
2011-04-08 23:58:04 +04:00
|
|
|
|
2009-07-01 19:09:49 +04:00
|
|
|
void SetDrawingModel(NPDrawingModel aModel);
|
2012-02-16 07:30:22 +04:00
|
|
|
void RedrawPlugin();
|
2012-02-16 07:24:38 +04:00
|
|
|
#ifdef XP_MACOSX
|
2009-08-27 04:29:47 +04:00
|
|
|
void SetEventModel(NPEventModel aModel);
|
2014-12-11 17:44:07 +03:00
|
|
|
|
|
|
|
void* GetCurrentEvent() {
|
|
|
|
return mCurrentPluginEvent;
|
|
|
|
}
|
2007-03-27 05:07:57 +04:00
|
|
|
#endif
|
|
|
|
|
2011-11-11 04:17:46 +04:00
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
2012-02-16 00:34:31 +04:00
|
|
|
void NotifyForeground(bool aForeground);
|
|
|
|
void NotifyOnScreen(bool aOnScreen);
|
|
|
|
void MemoryPressure();
|
2012-05-30 20:10:49 +04:00
|
|
|
void NotifyFullScreen(bool aFullScreen);
|
2012-07-20 23:20:51 +04:00
|
|
|
void NotifySize(nsIntSize size);
|
2012-02-16 00:34:31 +04:00
|
|
|
|
2012-09-18 22:52:15 +04:00
|
|
|
nsIntSize CurrentSize() { return mCurrentSize; }
|
|
|
|
|
2012-02-16 00:34:31 +04:00
|
|
|
bool IsOnScreen() {
|
|
|
|
return mOnScreen;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t GetANPDrawingModel() { return mANPDrawingModel; }
|
|
|
|
void SetANPDrawingModel(uint32_t aModel);
|
2012-01-31 18:40:58 +04:00
|
|
|
|
2011-09-17 01:34:31 +04:00
|
|
|
void* GetJavaSurface();
|
2012-05-04 19:48:41 +04:00
|
|
|
|
|
|
|
void PostEvent(void* event);
|
2012-05-30 20:10:49 +04:00
|
|
|
|
|
|
|
// These are really mozilla::dom::ScreenOrientation, but it's
|
|
|
|
// difficult to include that here
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t FullScreenOrientation() { return mFullScreenOrientation; }
|
|
|
|
void SetFullScreenOrientation(uint32_t orientation);
|
2012-06-07 06:39:18 +04:00
|
|
|
|
|
|
|
void SetWakeLock(bool aLock);
|
2012-07-20 23:20:51 +04:00
|
|
|
|
|
|
|
mozilla::gl::GLContext* GLContext();
|
2014-04-23 03:23:18 +04:00
|
|
|
|
2012-07-20 23:20:51 +04:00
|
|
|
// For ANPOpenGL
|
|
|
|
class TextureInfo {
|
|
|
|
public:
|
|
|
|
TextureInfo() :
|
|
|
|
mTexture(0), mWidth(0), mHeight(0), mInternalFormat(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
TextureInfo(GLuint aTexture, int32_t aWidth, int32_t aHeight, GLuint aInternalFormat) :
|
2012-07-20 23:20:51 +04:00
|
|
|
mTexture(aTexture), mWidth(aWidth), mHeight(aHeight), mInternalFormat(aInternalFormat)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
GLuint mTexture;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mWidth;
|
|
|
|
int32_t mHeight;
|
2012-07-20 23:20:51 +04:00
|
|
|
GLuint mInternalFormat;
|
|
|
|
};
|
|
|
|
|
|
|
|
TextureInfo LockContentTexture();
|
|
|
|
void ReleaseContentTexture(TextureInfo& aTextureInfo);
|
|
|
|
|
|
|
|
// For ANPNativeWindow
|
|
|
|
void* AcquireContentWindow();
|
|
|
|
|
2014-09-17 17:13:29 +04:00
|
|
|
EGLImage AsEGLImage();
|
2014-10-21 17:53:00 +04:00
|
|
|
mozilla::gl::AndroidSurfaceTexture* AsSurfaceTexture();
|
2012-07-20 23:20:51 +04:00
|
|
|
|
|
|
|
// For ANPVideo
|
|
|
|
class VideoInfo {
|
|
|
|
public:
|
2014-10-21 17:53:00 +04:00
|
|
|
VideoInfo(mozilla::gl::AndroidSurfaceTexture* aSurfaceTexture) :
|
2012-07-20 23:20:51 +04:00
|
|
|
mSurfaceTexture(aSurfaceTexture)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
~VideoInfo()
|
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
mSurfaceTexture = nullptr;
|
2012-07-20 23:20:51 +04:00
|
|
|
}
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::gl::AndroidSurfaceTexture> mSurfaceTexture;
|
2012-07-20 23:20:51 +04:00
|
|
|
gfxRect mDimensions;
|
|
|
|
};
|
|
|
|
|
|
|
|
void* AcquireVideoWindow();
|
|
|
|
void ReleaseVideoWindow(void* aWindow);
|
|
|
|
void SetVideoDimensions(void* aWindow, gfxRect aDimensions);
|
|
|
|
|
|
|
|
void GetVideos(nsTArray<VideoInfo*>& aVideos);
|
|
|
|
|
2014-11-18 04:02:19 +03:00
|
|
|
void SetOriginPos(mozilla::gl::OriginPos aOriginPos) {
|
|
|
|
mOriginPos = aOriginPos;
|
|
|
|
}
|
|
|
|
mozilla::gl::OriginPos OriginPos() const { return mOriginPos; }
|
2013-01-23 18:16:26 +04:00
|
|
|
|
|
|
|
static nsNPAPIPluginInstance* GetFromNPP(NPP npp);
|
2011-09-17 01:34:31 +04:00
|
|
|
#endif
|
|
|
|
|
2011-01-05 22:44:21 +03:00
|
|
|
nsresult NewStreamListener(const char* aURL, void* notifyData,
|
2012-05-18 03:54:26 +04:00
|
|
|
nsNPAPIPluginStreamListener** listener);
|
1999-01-25 12:00:42 +03:00
|
|
|
|
2012-04-02 23:17:34 +04:00
|
|
|
nsNPAPIPluginInstance();
|
1999-01-25 12:00:42 +03:00
|
|
|
|
2010-07-20 06:11:26 +04:00
|
|
|
// To be called when an instance becomes orphaned, when
|
|
|
|
// it's plugin is no longer guaranteed to be around.
|
|
|
|
void Destroy();
|
|
|
|
|
2010-03-09 00:54:04 +03:00
|
|
|
// Indicates whether the plugin is running normally.
|
|
|
|
bool IsRunning() {
|
|
|
|
return RUNNING == mRunning;
|
|
|
|
}
|
2010-12-20 04:37:43 +03:00
|
|
|
bool HasStartedDestroying() {
|
|
|
|
return mRunning >= DESTROYING;
|
|
|
|
}
|
2010-03-09 00:54:04 +03:00
|
|
|
|
|
|
|
// Indicates whether the plugin is running normally or being shut down
|
|
|
|
bool CanFireNotifications() {
|
|
|
|
return mRunning == RUNNING || mRunning == DESTROYING;
|
|
|
|
}
|
2009-12-18 05:09:22 +03:00
|
|
|
|
2011-11-12 05:10:31 +04:00
|
|
|
// return is only valid when the plugin is not running
|
|
|
|
mozilla::TimeStamp StopTime();
|
|
|
|
|
|
|
|
// cache this NPAPI plugin
|
2012-08-14 13:10:42 +04:00
|
|
|
void SetCached(bool aCache);
|
2011-11-12 05:10:31 +04:00
|
|
|
|
2009-07-01 19:09:49 +04:00
|
|
|
already_AddRefed<nsPIDOMWindow> GetDOMWindow();
|
2005-06-18 10:06:45 +04:00
|
|
|
|
2012-04-24 08:49:25 +04:00
|
|
|
nsresult PrivateModeStateChanged(bool aEnabled);
|
2009-06-29 22:53:52 +04:00
|
|
|
|
2013-03-04 22:18:20 +04:00
|
|
|
nsresult IsPrivateBrowsing(bool *aEnabled);
|
|
|
|
|
2009-07-01 19:09:49 +04:00
|
|
|
nsresult GetDOMElement(nsIDOMElement* *result);
|
2009-06-29 22:53:52 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsNPAPITimer* TimerWithID(uint32_t id, uint32_t* index);
|
2009-07-01 19:09:49 +04:00
|
|
|
uint32_t ScheduleTimer(uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
|
|
|
|
void UnscheduleTimer(uint32_t timerID);
|
2009-08-27 04:29:47 +04:00
|
|
|
NPBool ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
|
2010-07-18 03:47:29 +04:00
|
|
|
|
2011-01-05 22:44:21 +03:00
|
|
|
|
|
|
|
nsTArray<nsNPAPIPluginStreamListener*> *StreamListeners();
|
|
|
|
|
|
|
|
nsTArray<nsPluginStreamListenerPeer*> *FileCachedStreamListeners();
|
2010-07-18 03:47:29 +04:00
|
|
|
|
2010-09-10 22:28:52 +04:00
|
|
|
nsresult AsyncSetWindow(NPWindow& window);
|
|
|
|
|
2011-01-05 22:44:21 +03:00
|
|
|
void URLRedirectResponse(void* notifyData, NPBool allow);
|
|
|
|
|
2011-02-03 20:31:01 +03:00
|
|
|
// Called when the instance fails to instantiate beceause the Carbon
|
|
|
|
// event model is not supported.
|
|
|
|
void CarbonNPAPIFailure();
|
|
|
|
|
2012-10-02 23:48:05 +04:00
|
|
|
// Returns the contents scale factor of the screen the plugin is drawn on.
|
|
|
|
double GetContentsScaleFactor();
|
|
|
|
|
2015-03-17 20:28:32 +03:00
|
|
|
nsresult GetRunID(uint32_t *aRunID);
|
|
|
|
|
2013-02-27 15:50:27 +04:00
|
|
|
static bool InPluginCallUnsafeForReentry() { return gInUnsafePluginCalls > 0; }
|
|
|
|
static void BeginPluginCall(NSPluginCallReentry aReentryState)
|
|
|
|
{
|
|
|
|
if (aReentryState == NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO) {
|
|
|
|
++gInUnsafePluginCalls;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static void EndPluginCall(NSPluginCallReentry aReentryState)
|
2012-12-07 03:58:14 +04:00
|
|
|
{
|
2013-02-27 15:50:27 +04:00
|
|
|
if (aReentryState == NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO) {
|
|
|
|
NS_ASSERTION(gInUnsafePluginCalls > 0, "Must be in plugin call");
|
|
|
|
--gInUnsafePluginCalls;
|
|
|
|
}
|
2012-12-07 03:58:14 +04:00
|
|
|
}
|
|
|
|
|
2009-12-11 23:48:37 +03:00
|
|
|
protected:
|
1998-08-01 09:46:47 +04:00
|
|
|
|
2014-06-23 23:56:07 +04:00
|
|
|
virtual ~nsNPAPIPluginInstance();
|
|
|
|
|
2009-07-01 19:09:49 +04:00
|
|
|
nsresult GetTagType(nsPluginTagType *result);
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult GetMode(int32_t *result);
|
1998-08-01 09:46:47 +04:00
|
|
|
|
2012-10-03 19:49:04 +04:00
|
|
|
// check if this is a Java applet and affected by bug 750480
|
|
|
|
void CheckJavaC2PJSObjectQuirk(uint16_t paramCount,
|
|
|
|
const char* const* names,
|
|
|
|
const char* const* values);
|
|
|
|
|
2009-07-01 19:09:49 +04:00
|
|
|
// The structure used to communicate between the plugin instance and
|
|
|
|
// the browser.
|
2009-07-13 06:44:48 +04:00
|
|
|
NPP_t mNPP;
|
1998-09-15 07:48:58 +04:00
|
|
|
|
2009-07-01 19:09:49 +04:00
|
|
|
NPDrawingModel mDrawingModel;
|
2007-03-27 05:07:57 +04:00
|
|
|
|
2011-11-11 04:17:46 +04:00
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mANPDrawingModel;
|
2012-05-04 19:48:41 +04:00
|
|
|
|
|
|
|
friend class PluginEventRunnable;
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
nsTArray<RefPtr<PluginEventRunnable>> mPostedEvents;
|
2012-05-04 19:48:41 +04:00
|
|
|
void PopPostedEvent(PluginEventRunnable* r);
|
2012-07-26 17:39:21 +04:00
|
|
|
void OnSurfaceTextureFrameAvailable();
|
2012-05-30 20:10:49 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mFullScreenOrientation;
|
2012-06-07 06:39:18 +04:00
|
|
|
bool mWakeLocked;
|
2012-06-07 06:39:36 +04:00
|
|
|
bool mFullScreen;
|
2014-11-18 04:02:19 +03:00
|
|
|
mozilla::gl::OriginPos mOriginPos;
|
2012-07-20 23:20:51 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<SharedPluginTexture> mContentTexture;
|
|
|
|
RefPtr<mozilla::gl::AndroidSurfaceTexture> mContentSurface;
|
2011-09-17 01:34:31 +04:00
|
|
|
#endif
|
|
|
|
|
2010-03-09 00:54:04 +03:00
|
|
|
enum {
|
|
|
|
NOT_STARTED,
|
|
|
|
RUNNING,
|
|
|
|
DESTROYING,
|
|
|
|
DESTROYED
|
|
|
|
} mRunning;
|
|
|
|
|
2009-07-01 19:09:49 +04:00
|
|
|
// these are used to store the windowless properties
|
|
|
|
// which the browser will later query
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mWindowless;
|
|
|
|
bool mTransparent;
|
2011-11-12 05:10:31 +04:00
|
|
|
bool mCached;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mUsesDOMForCursor;
|
1998-08-01 09:46:47 +04:00
|
|
|
|
2009-12-11 23:48:37 +03:00
|
|
|
public:
|
2009-07-01 19:09:49 +04:00
|
|
|
// True while creating the plugin, or calling NPP_SetWindow() on it.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mInPluginInitCall;
|
2009-07-01 19:09:49 +04:00
|
|
|
|
2010-11-19 23:58:59 +03:00
|
|
|
nsXPIDLCString mFakeURL;
|
|
|
|
|
2009-12-11 23:48:37 +03:00
|
|
|
private:
|
2010-07-20 06:11:26 +04:00
|
|
|
nsNPAPIPlugin* mPlugin;
|
|
|
|
|
2011-01-05 22:44:21 +03:00
|
|
|
nsTArray<nsNPAPIPluginStreamListener*> mStreamListeners;
|
|
|
|
|
|
|
|
nsTArray<nsPluginStreamListenerPeer*> mFileCachedStreamListeners;
|
2010-07-18 03:47:29 +04:00
|
|
|
|
2009-07-01 19:09:49 +04:00
|
|
|
nsTArray<PopupControlState> mPopupStates;
|
2005-06-18 10:06:45 +04:00
|
|
|
|
2009-07-09 07:25:20 +04:00
|
|
|
char* mMIMEType;
|
2009-06-29 03:43:19 +04:00
|
|
|
|
2009-07-01 19:09:49 +04:00
|
|
|
// Weak pointer to the owner. The owner nulls this out (by calling
|
|
|
|
// InvalidateOwner()) when it's no longer our owner.
|
2012-10-03 06:43:18 +04:00
|
|
|
nsPluginInstanceOwner *mOwner;
|
2009-06-29 22:53:52 +04:00
|
|
|
|
2009-07-01 19:09:49 +04:00
|
|
|
nsTArray<nsNPAPITimer*> mTimers;
|
2009-08-27 04:29:47 +04:00
|
|
|
|
2014-12-11 17:44:07 +03:00
|
|
|
#ifdef XP_MACOSX
|
2009-08-27 04:29:47 +04:00
|
|
|
// non-null during a HandleEvent call
|
2009-09-17 05:30:26 +04:00
|
|
|
void* mCurrentPluginEvent;
|
2014-12-11 17:44:07 +03:00
|
|
|
#endif
|
2009-12-18 05:09:22 +03:00
|
|
|
|
2011-11-12 05:10:31 +04:00
|
|
|
// Timestamp for the last time this plugin was stopped.
|
|
|
|
// This is only valid when the plugin is actually stopped!
|
|
|
|
mozilla::TimeStamp mStopTime;
|
|
|
|
|
2011-11-11 04:17:46 +04:00
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
2012-07-20 23:20:51 +04:00
|
|
|
void EnsureSharedTexture();
|
2015-06-17 17:00:52 +03:00
|
|
|
already_AddRefed<mozilla::gl::AndroidSurfaceTexture> CreateSurfaceTexture();
|
2012-07-20 23:20:51 +04:00
|
|
|
|
|
|
|
std::map<void*, VideoInfo*> mVideos;
|
2012-02-16 00:34:31 +04:00
|
|
|
bool mOnScreen;
|
2012-07-20 23:20:51 +04:00
|
|
|
|
|
|
|
nsIntSize mCurrentSize;
|
2011-09-17 01:34:31 +04:00
|
|
|
#endif
|
2012-10-03 19:49:04 +04:00
|
|
|
|
|
|
|
// is this instance Java and affected by bug 750480?
|
|
|
|
bool mHaveJavaC2PJSObjectQuirk;
|
2012-12-07 03:58:14 +04:00
|
|
|
|
2013-02-27 15:50:27 +04:00
|
|
|
static uint32_t gInUnsafePluginCalls;
|
2014-08-16 01:17:35 +04:00
|
|
|
|
|
|
|
// The arrays can only be released when the plugin instance is destroyed,
|
|
|
|
// because the plugin, in in-process mode, might keep a reference to them.
|
|
|
|
uint32_t mCachedParamLength;
|
|
|
|
char **mCachedParamNames;
|
|
|
|
char **mCachedParamValues;
|
2015-07-29 00:09:48 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIAudioChannelAgent> mAudioChannelAgent;
|
2000-09-14 10:13:56 +04:00
|
|
|
};
|
1998-08-01 09:46:47 +04:00
|
|
|
|
2013-03-12 14:34:07 +04:00
|
|
|
// On Android, we need to guard against plugin code leaking entries in the local
|
|
|
|
// JNI ref table. See https://bugzilla.mozilla.org/show_bug.cgi?id=780831#c21
|
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
|
|
|
#define MAIN_THREAD_JNI_REF_GUARD mozilla::AutoLocalJNIFrame jniFrame
|
|
|
|
#else
|
|
|
|
#define MAIN_THREAD_JNI_REF_GUARD
|
|
|
|
#endif
|
|
|
|
|
|
|
|
PRIntervalTime NS_NotifyBeginPluginCall(NSPluginCallReentry aReentryState);
|
|
|
|
void NS_NotifyPluginCall(PRIntervalTime aTime, NSPluginCallReentry aReentryState);
|
|
|
|
|
|
|
|
#define NS_TRY_SAFE_CALL_RETURN(ret, fun, pluginInst, pluginCallReentry) \
|
|
|
|
PR_BEGIN_MACRO \
|
|
|
|
MAIN_THREAD_JNI_REF_GUARD; \
|
|
|
|
PRIntervalTime startTime = NS_NotifyBeginPluginCall(pluginCallReentry); \
|
|
|
|
ret = fun; \
|
|
|
|
NS_NotifyPluginCall(startTime, pluginCallReentry); \
|
|
|
|
PR_END_MACRO
|
|
|
|
|
|
|
|
#define NS_TRY_SAFE_CALL_VOID(fun, pluginInst, pluginCallReentry) \
|
|
|
|
PR_BEGIN_MACRO \
|
|
|
|
MAIN_THREAD_JNI_REF_GUARD; \
|
|
|
|
PRIntervalTime startTime = NS_NotifyBeginPluginCall(pluginCallReentry); \
|
|
|
|
fun; \
|
|
|
|
NS_NotifyPluginCall(startTime, pluginCallReentry); \
|
|
|
|
PR_END_MACRO
|
|
|
|
|
2008-09-15 16:45:01 +04:00
|
|
|
#endif // nsNPAPIPluginInstance_h_
|