michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * vim: sw=4 ts=4 et : michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef dom_plugins_PluginInstanceChild_h michael@0: #define dom_plugins_PluginInstanceChild_h 1 michael@0: michael@0: #include "mozilla/plugins/PPluginInstanceChild.h" michael@0: #include "mozilla/plugins/PluginScriptableObjectChild.h" michael@0: #include "mozilla/plugins/StreamNotifyChild.h" michael@0: #include "mozilla/plugins/PPluginSurfaceChild.h" michael@0: #include "mozilla/ipc/CrossProcessMutex.h" michael@0: #include "nsClassHashtable.h" michael@0: #if defined(OS_WIN) michael@0: #include "mozilla/gfx/SharedDIBWin.h" michael@0: #elif defined(MOZ_WIDGET_COCOA) michael@0: #include "PluginUtilsOSX.h" michael@0: #include "mozilla/gfx/QuartzSupport.h" michael@0: #include "base/timer.h" michael@0: michael@0: #endif michael@0: michael@0: #include "npfunctions.h" michael@0: #include "nsAutoPtr.h" michael@0: #include "nsTArray.h" michael@0: #include "ChildAsyncCall.h" michael@0: #include "ChildTimer.h" michael@0: #include "nsRect.h" michael@0: #include "nsTHashtable.h" michael@0: #include "mozilla/PaintTracker.h" michael@0: michael@0: #include michael@0: michael@0: #if (MOZ_WIDGET_GTK == 2) michael@0: #include "gtk2xtbin.h" michael@0: #endif michael@0: michael@0: class gfxASurface; michael@0: michael@0: namespace mozilla { michael@0: michael@0: namespace layers { michael@0: struct RemoteImageData; michael@0: } michael@0: michael@0: namespace plugins { michael@0: michael@0: class PBrowserStreamChild; michael@0: class BrowserStreamChild; michael@0: class StreamNotifyChild; michael@0: michael@0: class PluginInstanceChild : public PPluginInstanceChild michael@0: { michael@0: friend class BrowserStreamChild; michael@0: friend class PluginStreamChild; michael@0: friend class StreamNotifyChild; michael@0: michael@0: #ifdef OS_WIN michael@0: friend LRESULT CALLBACK PluginWindowProc(HWND hWnd, michael@0: UINT message, michael@0: WPARAM wParam, michael@0: LPARAM lParam); michael@0: static LRESULT CALLBACK PluginWindowProcInternal(HWND hWnd, michael@0: UINT message, michael@0: WPARAM wParam, michael@0: LPARAM lParam); michael@0: #endif michael@0: michael@0: protected: michael@0: virtual bool AnswerNPP_SetWindow(const NPRemoteWindow& window) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: AnswerNPP_GetValue_NPPVpluginWantsAllNetworkStreams(bool* wantsAllStreams, NPError* rv) MOZ_OVERRIDE; michael@0: virtual bool michael@0: AnswerNPP_GetValue_NPPVpluginNeedsXEmbed(bool* needs, NPError* rv) MOZ_OVERRIDE; michael@0: virtual bool michael@0: AnswerNPP_GetValue_NPPVpluginScriptableNPObject(PPluginScriptableObjectChild** value, michael@0: NPError* result) MOZ_OVERRIDE; michael@0: virtual bool michael@0: AnswerNPP_GetValue_NPPVpluginNativeAccessibleAtkPlugId(nsCString* aPlugId, michael@0: NPError* aResult) MOZ_OVERRIDE; michael@0: virtual bool michael@0: AnswerNPP_SetValue_NPNVprivateModeBool(const bool& value, NPError* result) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: AnswerNPP_HandleEvent(const NPRemoteEvent& event, int16_t* handled) MOZ_OVERRIDE; michael@0: virtual bool michael@0: AnswerNPP_HandleEvent_Shmem(const NPRemoteEvent& event, michael@0: Shmem& mem, michael@0: int16_t* handled, michael@0: Shmem* rtnmem) MOZ_OVERRIDE; michael@0: virtual bool michael@0: AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event, michael@0: const uint32_t& surface, michael@0: int16_t* handled) MOZ_OVERRIDE; michael@0: michael@0: // Async rendering michael@0: virtual bool michael@0: RecvAsyncSetWindow(const gfxSurfaceType& aSurfaceType, michael@0: const NPRemoteWindow& aWindow) MOZ_OVERRIDE; michael@0: michael@0: virtual void michael@0: DoAsyncSetWindow(const gfxSurfaceType& aSurfaceType, michael@0: const NPRemoteWindow& aWindow, michael@0: bool aIsAsync); michael@0: michael@0: virtual PPluginSurfaceChild* michael@0: AllocPPluginSurfaceChild(const WindowsSharedMemoryHandle&, michael@0: const gfxIntSize&, const bool&) MOZ_OVERRIDE { michael@0: return new PPluginSurfaceChild(); michael@0: } michael@0: michael@0: virtual bool DeallocPPluginSurfaceChild(PPluginSurfaceChild* s) MOZ_OVERRIDE { michael@0: delete s; michael@0: return true; michael@0: } michael@0: michael@0: virtual bool michael@0: AnswerPaint(const NPRemoteEvent& event, int16_t* handled) MOZ_OVERRIDE michael@0: { michael@0: PaintTracker pt; michael@0: return AnswerNPP_HandleEvent(event, handled); michael@0: } michael@0: michael@0: virtual bool michael@0: RecvWindowPosChanged(const NPRemoteEvent& event) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: RecvContentsScaleFactorChanged(const double& aContentsScaleFactor) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: AnswerNPP_Destroy(NPError* result) MOZ_OVERRIDE; michael@0: michael@0: virtual PPluginScriptableObjectChild* michael@0: AllocPPluginScriptableObjectChild() MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: DeallocPPluginScriptableObjectChild(PPluginScriptableObjectChild* aObject) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: RecvPPluginScriptableObjectConstructor(PPluginScriptableObjectChild* aActor) MOZ_OVERRIDE; michael@0: michael@0: virtual PBrowserStreamChild* michael@0: AllocPBrowserStreamChild(const nsCString& url, michael@0: const uint32_t& length, michael@0: const uint32_t& lastmodified, michael@0: PStreamNotifyChild* notifyData, michael@0: const nsCString& headers, michael@0: const nsCString& mimeType, michael@0: const bool& seekable, michael@0: NPError* rv, michael@0: uint16_t *stype) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: AnswerPBrowserStreamConstructor( michael@0: PBrowserStreamChild* aActor, michael@0: const nsCString& url, michael@0: const uint32_t& length, michael@0: const uint32_t& lastmodified, michael@0: PStreamNotifyChild* notifyData, michael@0: const nsCString& headers, michael@0: const nsCString& mimeType, michael@0: const bool& seekable, michael@0: NPError* rv, michael@0: uint16_t* stype) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: DeallocPBrowserStreamChild(PBrowserStreamChild* stream) MOZ_OVERRIDE; michael@0: michael@0: virtual PPluginStreamChild* michael@0: AllocPPluginStreamChild(const nsCString& mimeType, michael@0: const nsCString& target, michael@0: NPError* result) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: DeallocPPluginStreamChild(PPluginStreamChild* stream) MOZ_OVERRIDE; michael@0: michael@0: virtual PStreamNotifyChild* michael@0: AllocPStreamNotifyChild(const nsCString& url, const nsCString& target, michael@0: const bool& post, const nsCString& buffer, michael@0: const bool& file, michael@0: NPError* result) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: DeallocPStreamNotifyChild(PStreamNotifyChild* notifyData) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: AnswerSetPluginFocus() MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: AnswerUpdateWindow() MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: RecvNPP_DidComposite() MOZ_OVERRIDE; michael@0: michael@0: #if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX) michael@0: bool CreateWindow(const NPRemoteWindow& aWindow); michael@0: void DeleteWindow(); michael@0: #endif michael@0: michael@0: public: michael@0: PluginInstanceChild(const NPPluginFuncs* aPluginIface); michael@0: michael@0: virtual ~PluginInstanceChild(); michael@0: michael@0: bool Initialize(); michael@0: michael@0: NPP GetNPP() michael@0: { michael@0: return &mData; michael@0: } michael@0: michael@0: NPError michael@0: NPN_GetValue(NPNVariable aVariable, void* aValue); michael@0: michael@0: NPError michael@0: NPN_SetValue(NPPVariable aVariable, void* aValue); michael@0: michael@0: PluginScriptableObjectChild* michael@0: GetActorForNPObject(NPObject* aObject); michael@0: michael@0: NPError michael@0: NPN_NewStream(NPMIMEType aMIMEType, const char* aWindow, michael@0: NPStream** aStream); michael@0: michael@0: void InvalidateRect(NPRect* aInvalidRect); michael@0: michael@0: #ifdef MOZ_WIDGET_COCOA michael@0: void Invalidate(); michael@0: #endif // definied(MOZ_WIDGET_COCOA) michael@0: michael@0: uint32_t ScheduleTimer(uint32_t interval, bool repeat, TimerFunc func); michael@0: void UnscheduleTimer(uint32_t id); michael@0: michael@0: void AsyncCall(PluginThreadCallback aFunc, void* aUserData); michael@0: michael@0: int GetQuirks(); michael@0: michael@0: void NPN_URLRedirectResponse(void* notifyData, NPBool allow); michael@0: michael@0: NPError NPN_InitAsyncSurface(NPSize *size, NPImageFormat format, michael@0: void *initData, NPAsyncSurface *surface); michael@0: NPError NPN_FinalizeAsyncSurface(NPAsyncSurface *surface); michael@0: michael@0: void NPN_SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect *changed); michael@0: michael@0: void DoAsyncRedraw(); michael@0: private: michael@0: friend class PluginModuleChild; michael@0: michael@0: NPError michael@0: InternalGetNPObjectForValue(NPNVariable aValue, michael@0: NPObject** aObject); michael@0: michael@0: bool IsAsyncDrawing(); michael@0: michael@0: NPError DeallocateAsyncBitmapSurface(NPAsyncSurface *aSurface); michael@0: michael@0: virtual bool RecvUpdateBackground(const SurfaceDescriptor& aBackground, michael@0: const nsIntRect& aRect) MOZ_OVERRIDE; michael@0: michael@0: virtual PPluginBackgroundDestroyerChild* michael@0: AllocPPluginBackgroundDestroyerChild() MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: RecvPPluginBackgroundDestroyerConstructor(PPluginBackgroundDestroyerChild* aActor) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: DeallocPPluginBackgroundDestroyerChild(PPluginBackgroundDestroyerChild* aActor) MOZ_OVERRIDE; michael@0: michael@0: #if defined(OS_WIN) michael@0: static bool RegisterWindowClass(); michael@0: bool CreatePluginWindow(); michael@0: void DestroyPluginWindow(); michael@0: void ReparentPluginWindow(HWND hWndParent); michael@0: void SizePluginWindow(int width, int height); michael@0: int16_t WinlessHandleEvent(NPEvent& event); michael@0: void CreateWinlessPopupSurrogate(); michael@0: void DestroyWinlessPopupSurrogate(); michael@0: void InitPopupMenuHook(); michael@0: void SetupFlashMsgThrottle(); michael@0: void UnhookWinlessFlashThrottle(); michael@0: void HookSetWindowLongPtr(); michael@0: static inline bool SetWindowLongHookCheck(HWND hWnd, michael@0: int nIndex, michael@0: LONG_PTR newLong); michael@0: void FlashThrottleMessage(HWND, UINT, WPARAM, LPARAM, bool); michael@0: static LRESULT CALLBACK DummyWindowProc(HWND hWnd, michael@0: UINT message, michael@0: WPARAM wParam, michael@0: LPARAM lParam); michael@0: static LRESULT CALLBACK PluginWindowProc(HWND hWnd, michael@0: UINT message, michael@0: WPARAM wParam, michael@0: LPARAM lParam); michael@0: static BOOL WINAPI TrackPopupHookProc(HMENU hMenu, michael@0: UINT uFlags, michael@0: int x, michael@0: int y, michael@0: int nReserved, michael@0: HWND hWnd, michael@0: CONST RECT *prcRect); michael@0: static BOOL CALLBACK EnumThreadWindowsCallback(HWND hWnd, michael@0: LPARAM aParam); michael@0: static LRESULT CALLBACK WinlessHiddenFlashWndProc(HWND hWnd, michael@0: UINT message, michael@0: WPARAM wParam, michael@0: LPARAM lParam); michael@0: #ifdef _WIN64 michael@0: static LONG_PTR WINAPI SetWindowLongPtrAHook(HWND hWnd, michael@0: int nIndex, michael@0: LONG_PTR newLong); michael@0: static LONG_PTR WINAPI SetWindowLongPtrWHook(HWND hWnd, michael@0: int nIndex, michael@0: LONG_PTR newLong); michael@0: michael@0: #else michael@0: static LONG WINAPI SetWindowLongAHook(HWND hWnd, michael@0: int nIndex, michael@0: LONG newLong); michael@0: static LONG WINAPI SetWindowLongWHook(HWND hWnd, michael@0: int nIndex, michael@0: LONG newLong); michael@0: #endif michael@0: michael@0: class FlashThrottleAsyncMsg : public ChildAsyncCall michael@0: { michael@0: public: michael@0: FlashThrottleAsyncMsg(); michael@0: FlashThrottleAsyncMsg(PluginInstanceChild* aInst, michael@0: HWND aWnd, UINT aMsg, michael@0: WPARAM aWParam, LPARAM aLParam, michael@0: bool isWindowed) michael@0: : ChildAsyncCall(aInst, nullptr, nullptr), michael@0: mWnd(aWnd), michael@0: mMsg(aMsg), michael@0: mWParam(aWParam), michael@0: mLParam(aLParam), michael@0: mWindowed(isWindowed) michael@0: {} michael@0: michael@0: void Run() MOZ_OVERRIDE; michael@0: michael@0: WNDPROC GetProc(); michael@0: HWND GetWnd() { return mWnd; } michael@0: UINT GetMsg() { return mMsg; } michael@0: WPARAM GetWParam() { return mWParam; } michael@0: LPARAM GetLParam() { return mLParam; } michael@0: michael@0: private: michael@0: HWND mWnd; michael@0: UINT mMsg; michael@0: WPARAM mWParam; michael@0: LPARAM mLParam; michael@0: bool mWindowed; michael@0: }; michael@0: michael@0: #endif michael@0: const NPPluginFuncs* mPluginIface; michael@0: NPP_t mData; michael@0: NPWindow mWindow; michael@0: #if defined(XP_MACOSX) michael@0: double mContentsScaleFactor; michael@0: #endif michael@0: int16_t mDrawingModel; michael@0: NPAsyncSurface* mCurrentAsyncSurface; michael@0: struct AsyncBitmapData { michael@0: void *mRemotePtr; michael@0: Shmem mShmem; michael@0: }; michael@0: michael@0: static PLDHashOperator DeleteSurface(NPAsyncSurface* surf, nsAutoPtr &data, void* userArg); michael@0: nsClassHashtable, AsyncBitmapData> mAsyncBitmaps; michael@0: Shmem mRemoteImageDataShmem; michael@0: mozilla::layers::RemoteImageData *mRemoteImageData; michael@0: nsAutoPtr mRemoteImageDataMutex; michael@0: mozilla::Mutex mAsyncInvalidateMutex; michael@0: CancelableTask *mAsyncInvalidateTask; michael@0: michael@0: // Cached scriptable actors to avoid IPC churn michael@0: PluginScriptableObjectChild* mCachedWindowActor; michael@0: PluginScriptableObjectChild* mCachedElementActor; michael@0: michael@0: #if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX) michael@0: NPSetWindowCallbackStruct mWsInfo; michael@0: #if (MOZ_WIDGET_GTK == 2) michael@0: bool mXEmbed; michael@0: XtClient mXtClient; michael@0: #endif michael@0: #elif defined(OS_WIN) michael@0: HWND mPluginWindowHWND; michael@0: WNDPROC mPluginWndProc; michael@0: HWND mPluginParentHWND; michael@0: int mNestedEventLevelDepth; michael@0: HWND mCachedWinlessPluginHWND; michael@0: HWND mWinlessPopupSurrogateHWND; michael@0: nsIntPoint mPluginSize; michael@0: WNDPROC mWinlessThrottleOldWndProc; michael@0: HWND mWinlessHiddenMsgHWND; michael@0: #endif michael@0: michael@0: friend class ChildAsyncCall; michael@0: michael@0: Mutex mAsyncCallMutex; michael@0: nsTArray mPendingAsyncCalls; michael@0: nsTArray > mTimers; michael@0: michael@0: /** michael@0: * During destruction we enumerate all remaining scriptable objects and michael@0: * invalidate/delete them. Enumeration can re-enter, so maintain a michael@0: * hash separate from PluginModuleChild.mObjectMap. michael@0: */ michael@0: nsAutoPtr< nsTHashtable > mDeletingHash; michael@0: michael@0: #if defined(OS_WIN) michael@0: private: michael@0: // Shared dib rendering management for windowless plugins. michael@0: bool SharedSurfaceSetWindow(const NPRemoteWindow& aWindow); michael@0: int16_t SharedSurfacePaint(NPEvent& evcopy); michael@0: void SharedSurfaceRelease(); michael@0: bool AlphaExtractCacheSetup(); michael@0: void AlphaExtractCacheRelease(); michael@0: void UpdatePaintClipRect(RECT* aRect); michael@0: michael@0: private: michael@0: enum { michael@0: RENDER_NATIVE, michael@0: RENDER_BACK_ONE, michael@0: RENDER_BACK_TWO michael@0: }; michael@0: gfx::SharedDIBWin mSharedSurfaceDib; michael@0: struct { michael@0: uint16_t doublePass; michael@0: HDC hdc; michael@0: HBITMAP bmp; michael@0: } mAlphaExtract; michael@0: #endif // defined(OS_WIN) michael@0: #if defined(MOZ_WIDGET_COCOA) michael@0: private: michael@0: #if defined(__i386__) michael@0: NPEventModel mEventModel; michael@0: #endif michael@0: CGColorSpaceRef mShColorSpace; michael@0: CGContextRef mShContext; michael@0: mozilla::RefPtr mCARenderer; michael@0: void *mCGLayer; michael@0: michael@0: // Core Animation drawing model requires a refresh timer. michael@0: uint32_t mCARefreshTimer; michael@0: michael@0: public: michael@0: const NPCocoaEvent* getCurrentEvent() { michael@0: return mCurrentEvent; michael@0: } michael@0: michael@0: bool CGDraw(CGContextRef ref, nsIntRect aUpdateRect); michael@0: michael@0: #if defined(__i386__) michael@0: NPEventModel EventModel() { return mEventModel; } michael@0: #endif michael@0: michael@0: private: michael@0: const NPCocoaEvent *mCurrentEvent; michael@0: #endif michael@0: michael@0: bool CanPaintOnBackground(); michael@0: michael@0: bool IsVisible() { michael@0: #ifdef XP_MACOSX michael@0: return mWindow.clipRect.top != mWindow.clipRect.bottom && michael@0: mWindow.clipRect.left != mWindow.clipRect.right; michael@0: #else michael@0: return mWindow.clipRect.top != 0 || michael@0: mWindow.clipRect.left != 0 || michael@0: mWindow.clipRect.bottom != 0 || michael@0: mWindow.clipRect.right != 0; michael@0: #endif michael@0: } michael@0: michael@0: // ShowPluginFrame - in general does four things: michael@0: // 1) Create mCurrentSurface optimized for rendering to parent process michael@0: // 2) Updated mCurrentSurface to be a complete copy of mBackSurface michael@0: // 3) Draw the invalidated plugin area into mCurrentSurface michael@0: // 4) Send it to parent process. michael@0: bool ShowPluginFrame(void); michael@0: michael@0: // If we can read back safely from mBackSurface, copy michael@0: // mSurfaceDifferenceRect from mBackSurface to mFrontSurface. michael@0: // @return Whether the back surface could be read. michael@0: bool ReadbackDifferenceRect(const nsIntRect& rect); michael@0: michael@0: // Post ShowPluginFrame task michael@0: void AsyncShowPluginFrame(void); michael@0: michael@0: // In the PaintRect functions, aSurface is the size of the full plugin michael@0: // window. Each PaintRect function renders into the subrectangle aRect of michael@0: // aSurface (possibly more if we're working around a Flash bug). michael@0: michael@0: // Paint plugin content rectangle to surface with bg color filling michael@0: void PaintRectToSurface(const nsIntRect& aRect, michael@0: gfxASurface* aSurface, michael@0: const gfxRGBA& aColor); michael@0: michael@0: // Render plugin content to surface using michael@0: // white/black image alpha extraction algorithm michael@0: void PaintRectWithAlphaExtraction(const nsIntRect& aRect, michael@0: gfxASurface* aSurface); michael@0: michael@0: // Call plugin NPAPI function to render plugin content to surface michael@0: // @param - aSurface - should be compatible with current platform plugin rendering michael@0: // @return - FALSE if plugin not painted to surface michael@0: void PaintRectToPlatformSurface(const nsIntRect& aRect, michael@0: gfxASurface* aSurface); michael@0: michael@0: // Update NPWindow platform attributes and call plugin "setwindow" michael@0: // @param - aForceSetWindow - call setwindow even if platform attributes are the same michael@0: void UpdateWindowAttributes(bool aForceSetWindow = false); michael@0: michael@0: // Create optimized mCurrentSurface for parent process rendering michael@0: // @return FALSE if optimized surface not created michael@0: bool CreateOptSurface(void); michael@0: michael@0: // Create mHelperSurface if mCurrentSurface non compatible with plugins michael@0: // @return TRUE if helper surface created successfully, or not needed michael@0: bool MaybeCreatePlatformHelperSurface(void); michael@0: michael@0: // Make sure that we have surface for rendering michael@0: bool EnsureCurrentBuffer(void); michael@0: michael@0: // Helper function for delayed InvalidateRect call michael@0: // non null mCurrentInvalidateTask will call this function michael@0: void InvalidateRectDelayed(void); michael@0: michael@0: // Clear mCurrentSurface/mCurrentSurfaceActor/mHelperSurface michael@0: void ClearCurrentSurface(); michael@0: michael@0: // Swap mCurrentSurface/mBackSurface and their associated actors michael@0: void SwapSurfaces(); michael@0: michael@0: // Clear all surfaces in response to NPP_Destroy michael@0: void ClearAllSurfaces(); michael@0: michael@0: // Set as true when SetupLayer called michael@0: // and go with different path in InvalidateRect function michael@0: bool mLayersRendering; michael@0: michael@0: // Current surface available for rendering michael@0: nsRefPtr mCurrentSurface; michael@0: michael@0: // Back surface, just keeping reference to michael@0: // surface which is on ParentProcess side michael@0: nsRefPtr mBackSurface; michael@0: michael@0: #ifdef XP_MACOSX michael@0: // Current IOSurface available for rendering michael@0: // We can't use thebes gfxASurface like other platforms. michael@0: PluginUtilsOSX::nsDoubleBufferCARenderer mDoubleBufferCARenderer; michael@0: #endif michael@0: michael@0: // (Not to be confused with mBackSurface). This is a recent copy michael@0: // of the opaque pixels under our object frame, if michael@0: // |mIsTransparent|. We ask the plugin render directly onto a michael@0: // copy of the background pixels if available, and fall back on michael@0: // alpha recovery otherwise. michael@0: nsRefPtr mBackground; michael@0: michael@0: #ifdef XP_WIN michael@0: // These actors mirror mCurrentSurface/mBackSurface michael@0: PPluginSurfaceChild* mCurrentSurfaceActor; michael@0: PPluginSurfaceChild* mBackSurfaceActor; michael@0: #endif michael@0: michael@0: // Accumulated invalidate rect, while back buffer is not accessible, michael@0: // in plugin coordinates. michael@0: nsIntRect mAccumulatedInvalidRect; michael@0: michael@0: // Plugin only call SetTransparent michael@0: // and does not remember their transparent state michael@0: // and p->getvalue return always false michael@0: bool mIsTransparent; michael@0: michael@0: // Surface type optimized of parent process michael@0: gfxSurfaceType mSurfaceType; michael@0: michael@0: // Keep InvalidateRect task pointer to be able Cancel it on Destroy michael@0: CancelableTask *mCurrentInvalidateTask; michael@0: michael@0: // Keep AsyncSetWindow task pointer to be able to Cancel it on Destroy michael@0: CancelableTask *mCurrentAsyncSetWindowTask; michael@0: michael@0: // True while plugin-child in plugin call michael@0: // Use to prevent plugin paint re-enter michael@0: bool mPendingPluginCall; michael@0: michael@0: // On some platforms, plugins may not support rendering to a surface with michael@0: // alpha, or not support rendering to an image surface. michael@0: // In those cases we need to draw to a temporary platform surface; we cache michael@0: // that surface here. michael@0: nsRefPtr mHelperSurface; michael@0: michael@0: // true when plugin does not support painting to ARGB32 michael@0: // surface this is false if plugin supports michael@0: // NPPVpluginTransparentAlphaBool (which is not part of michael@0: // NPAPI yet) michael@0: bool mDoAlphaExtraction; michael@0: michael@0: // true when the plugin has painted at least once. We use this to ensure michael@0: // that we ask a plugin to paint at least once even if it's invisible; michael@0: // some plugin (instances) rely on this in order to work properly. michael@0: bool mHasPainted; michael@0: michael@0: // Cached rectangle rendered to previous surface(mBackSurface) michael@0: // Used for reading back to current surface and syncing data, michael@0: // in plugin coordinates. michael@0: nsIntRect mSurfaceDifferenceRect; michael@0: }; michael@0: michael@0: } // namespace plugins michael@0: } // namespace mozilla michael@0: michael@0: #endif // ifndef dom_plugins_PluginInstanceChild_h