1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 : * vim: sw=4 ts=4 et :
3 : * ***** BEGIN LICENSE BLOCK *****
4 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 : *
6 : * The contents of this file are subject to the Mozilla Public License Version
7 : * 1.1 (the "License"); you may not use this file except in compliance with
8 : * the License. You may obtain a copy of the License at
9 : * http://www.mozilla.org/MPL/
10 : *
11 : * Software distributed under the License is distributed on an "AS IS" basis,
12 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 : * for the specific language governing rights and limitations under the
14 : * License.
15 : *
16 : * The Original Code is Mozilla Plugin App.
17 : *
18 : * The Initial Developer of the Original Code is
19 : * Chris Jones <jones.chris.g@gmail.com>
20 : * Portions created by the Initial Developer are Copyright (C) 2009
21 : * the Initial Developer. All Rights Reserved.
22 : *
23 : * Contributor(s):
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either the GNU General Public License Version 2 or later (the "GPL"), or
27 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 : * in which case the provisions of the GPL or the LGPL are applicable instead
29 : * of those above. If you wish to allow use of your version of this file only
30 : * under the terms of either the GPL or the LGPL, and not to allow others to
31 : * use your version of this file under the terms of the MPL, indicate your
32 : * decision by deleting the provisions above and replace them with the notice
33 : * and other provisions required by the GPL or the LGPL. If you do not delete
34 : * the provisions above, a recipient may use your version of this file under
35 : * the terms of any one of the MPL, the GPL or the LGPL.
36 : *
37 : * ***** END LICENSE BLOCK ***** */
38 :
39 : #ifndef dom_plugins_PluginInstanceChild_h
40 : #define dom_plugins_PluginInstanceChild_h 1
41 :
42 : #include "mozilla/plugins/PPluginInstanceChild.h"
43 : #include "mozilla/plugins/PluginScriptableObjectChild.h"
44 : #include "mozilla/plugins/StreamNotifyChild.h"
45 : #include "mozilla/plugins/PPluginSurfaceChild.h"
46 : #include "mozilla/ipc/CrossProcessMutex.h"
47 : #include "nsClassHashtable.h"
48 : #if defined(OS_WIN)
49 : #include "mozilla/gfx/SharedDIBWin.h"
50 : #elif defined(MOZ_WIDGET_COCOA)
51 : #include "PluginUtilsOSX.h"
52 : #include "nsCoreAnimationSupport.h"
53 : #include "base/timer.h"
54 :
55 : using namespace mozilla::plugins::PluginUtilsOSX;
56 : #endif
57 :
58 : #include "npfunctions.h"
59 : #include "nsAutoPtr.h"
60 : #include "nsTArray.h"
61 : #include "ChildAsyncCall.h"
62 : #include "ChildTimer.h"
63 : #include "nsRect.h"
64 : #include "nsTHashtable.h"
65 : #include "mozilla/PaintTracker.h"
66 : #include "gfxASurface.h"
67 :
68 : #include <map>
69 :
70 : namespace mozilla {
71 :
72 : namespace layers {
73 : struct RemoteImageData;
74 : }
75 :
76 : namespace plugins {
77 :
78 : class PBrowserStreamChild;
79 : class BrowserStreamChild;
80 : class StreamNotifyChild;
81 :
82 : class PluginInstanceChild : public PPluginInstanceChild
83 : {
84 : friend class BrowserStreamChild;
85 : friend class PluginStreamChild;
86 : friend class StreamNotifyChild;
87 :
88 : #ifdef OS_WIN
89 : friend LRESULT CALLBACK PluginWindowProc(HWND hWnd,
90 : UINT message,
91 : WPARAM wParam,
92 : LPARAM lParam);
93 : static LRESULT CALLBACK PluginWindowProcInternal(HWND hWnd,
94 : UINT message,
95 : WPARAM wParam,
96 : LPARAM lParam);
97 : #endif
98 :
99 : protected:
100 : virtual bool AnswerNPP_SetWindow(const NPRemoteWindow& window);
101 :
102 : virtual bool
103 : AnswerNPP_GetValue_NPPVpluginWantsAllNetworkStreams(bool* wantsAllStreams, NPError* rv);
104 : virtual bool
105 : AnswerNPP_GetValue_NPPVpluginNeedsXEmbed(bool* needs, NPError* rv);
106 : virtual bool
107 : AnswerNPP_GetValue_NPPVpluginScriptableNPObject(PPluginScriptableObjectChild** value,
108 : NPError* result);
109 : virtual bool
110 : AnswerNPP_GetValue_NPPVpluginNativeAccessibleAtkPlugId(nsCString* aPlugId,
111 : NPError* aResult);
112 : virtual bool
113 : AnswerNPP_SetValue_NPNVprivateModeBool(const bool& value, NPError* result);
114 :
115 : virtual bool
116 : AnswerNPP_HandleEvent(const NPRemoteEvent& event, int16_t* handled);
117 : virtual bool
118 : AnswerNPP_HandleEvent_Shmem(const NPRemoteEvent& event, Shmem& mem, int16_t* handled, Shmem* rtnmem);
119 : virtual bool
120 : AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event, const uint32_t& surface, int16_t* handled);
121 :
122 : // Async rendering
123 : virtual bool
124 : RecvAsyncSetWindow(const gfxSurfaceType& aSurfaceType,
125 : const NPRemoteWindow& aWindow);
126 :
127 : virtual void
128 : DoAsyncSetWindow(const gfxSurfaceType& aSurfaceType,
129 : const NPRemoteWindow& aWindow,
130 : bool aIsAsync);
131 :
132 : virtual bool
133 : AnswerHandleKeyEvent(const nsKeyEvent& aEvent, bool* handled);
134 : virtual bool
135 : AnswerHandleTextEvent(const nsTextEvent& aEvent, bool* handled);
136 :
137 0 : virtual PPluginSurfaceChild* AllocPPluginSurface(const WindowsSharedMemoryHandle&,
138 : const gfxIntSize&, const bool&) {
139 0 : return new PPluginSurfaceChild();
140 : }
141 :
142 0 : virtual bool DeallocPPluginSurface(PPluginSurfaceChild* s) {
143 0 : delete s;
144 0 : return true;
145 : }
146 :
147 : NS_OVERRIDE
148 : virtual bool
149 0 : AnswerPaint(const NPRemoteEvent& event, int16_t* handled)
150 : {
151 0 : PaintTracker pt;
152 0 : return AnswerNPP_HandleEvent(event, handled);
153 : }
154 :
155 : NS_OVERRIDE
156 : virtual bool
157 : RecvWindowPosChanged(const NPRemoteEvent& event);
158 :
159 : virtual bool
160 : AnswerNPP_Destroy(NPError* result);
161 :
162 : virtual PPluginScriptableObjectChild*
163 : AllocPPluginScriptableObject();
164 :
165 : virtual bool
166 : DeallocPPluginScriptableObject(PPluginScriptableObjectChild* aObject);
167 :
168 : NS_OVERRIDE virtual bool
169 : RecvPPluginScriptableObjectConstructor(PPluginScriptableObjectChild* aActor);
170 :
171 : virtual PBrowserStreamChild*
172 : AllocPBrowserStream(const nsCString& url,
173 : const uint32_t& length,
174 : const uint32_t& lastmodified,
175 : PStreamNotifyChild* notifyData,
176 : const nsCString& headers,
177 : const nsCString& mimeType,
178 : const bool& seekable,
179 : NPError* rv,
180 : uint16_t *stype);
181 :
182 : virtual bool
183 : AnswerPBrowserStreamConstructor(
184 : PBrowserStreamChild* aActor,
185 : const nsCString& url,
186 : const uint32_t& length,
187 : const uint32_t& lastmodified,
188 : PStreamNotifyChild* notifyData,
189 : const nsCString& headers,
190 : const nsCString& mimeType,
191 : const bool& seekable,
192 : NPError* rv,
193 : uint16_t* stype);
194 :
195 : virtual bool
196 : DeallocPBrowserStream(PBrowserStreamChild* stream);
197 :
198 : virtual PPluginStreamChild*
199 : AllocPPluginStream(const nsCString& mimeType,
200 : const nsCString& target,
201 : NPError* result);
202 :
203 : virtual bool
204 : DeallocPPluginStream(PPluginStreamChild* stream);
205 :
206 : virtual PStreamNotifyChild*
207 : AllocPStreamNotify(const nsCString& url, const nsCString& target,
208 : const bool& post, const nsCString& buffer,
209 : const bool& file,
210 : NPError* result);
211 :
212 : NS_OVERRIDE virtual bool
213 : DeallocPStreamNotify(PStreamNotifyChild* notifyData);
214 :
215 : virtual bool
216 : AnswerSetPluginFocus();
217 :
218 : virtual bool
219 : AnswerUpdateWindow();
220 :
221 : virtual bool
222 : RecvNPP_DidComposite();
223 :
224 : public:
225 : PluginInstanceChild(const NPPluginFuncs* aPluginIface);
226 :
227 : virtual ~PluginInstanceChild();
228 :
229 : bool Initialize();
230 :
231 0 : NPP GetNPP()
232 : {
233 0 : return &mData;
234 : }
235 :
236 : NPError
237 : NPN_GetValue(NPNVariable aVariable, void* aValue);
238 :
239 : NPError
240 : NPN_SetValue(NPPVariable aVariable, void* aValue);
241 :
242 : PluginScriptableObjectChild*
243 : GetActorForNPObject(NPObject* aObject);
244 :
245 : NPError
246 : NPN_NewStream(NPMIMEType aMIMEType, const char* aWindow,
247 : NPStream** aStream);
248 :
249 : void InvalidateRect(NPRect* aInvalidRect);
250 :
251 : #ifdef MOZ_WIDGET_COCOA
252 : void Invalidate();
253 : #endif // definied(MOZ_WIDGET_COCOA)
254 :
255 : uint32_t ScheduleTimer(uint32_t interval, bool repeat, TimerFunc func);
256 : void UnscheduleTimer(uint32_t id);
257 :
258 : void AsyncCall(PluginThreadCallback aFunc, void* aUserData);
259 :
260 : int GetQuirks();
261 :
262 : void NPN_URLRedirectResponse(void* notifyData, NPBool allow);
263 :
264 : NPError NPN_InitAsyncSurface(NPSize *size, NPImageFormat format,
265 : void *initData, NPAsyncSurface *surface);
266 : NPError NPN_FinalizeAsyncSurface(NPAsyncSurface *surface);
267 :
268 : void NPN_SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect *changed);
269 :
270 : void DoAsyncRedraw();
271 : private:
272 : friend class PluginModuleChild;
273 :
274 : NPError
275 : InternalGetNPObjectForValue(NPNVariable aValue,
276 : NPObject** aObject);
277 :
278 : bool IsAsyncDrawing();
279 :
280 : NPError DeallocateAsyncBitmapSurface(NPAsyncSurface *aSurface);
281 :
282 : NS_OVERRIDE
283 : virtual bool RecvUpdateBackground(const SurfaceDescriptor& aBackground,
284 : const nsIntRect& aRect);
285 :
286 : NS_OVERRIDE
287 : virtual PPluginBackgroundDestroyerChild*
288 : AllocPPluginBackgroundDestroyer();
289 :
290 : NS_OVERRIDE
291 : virtual bool
292 : RecvPPluginBackgroundDestroyerConstructor(PPluginBackgroundDestroyerChild* aActor);
293 :
294 : NS_OVERRIDE
295 : virtual bool
296 : DeallocPPluginBackgroundDestroyer(PPluginBackgroundDestroyerChild* aActor);
297 :
298 : #if defined(OS_WIN)
299 : static bool RegisterWindowClass();
300 : bool CreatePluginWindow();
301 : void DestroyPluginWindow();
302 : void ReparentPluginWindow(HWND hWndParent);
303 : void SizePluginWindow(int width, int height);
304 : int16_t WinlessHandleEvent(NPEvent& event);
305 : void CreateWinlessPopupSurrogate();
306 : void DestroyWinlessPopupSurrogate();
307 : void InitPopupMenuHook();
308 : void SetupFlashMsgThrottle();
309 : void UnhookWinlessFlashThrottle();
310 : void HookSetWindowLongPtr();
311 : static inline bool SetWindowLongHookCheck(HWND hWnd,
312 : int nIndex,
313 : LONG_PTR newLong);
314 : void FlashThrottleMessage(HWND, UINT, WPARAM, LPARAM, bool);
315 : static LRESULT CALLBACK DummyWindowProc(HWND hWnd,
316 : UINT message,
317 : WPARAM wParam,
318 : LPARAM lParam);
319 : static LRESULT CALLBACK PluginWindowProc(HWND hWnd,
320 : UINT message,
321 : WPARAM wParam,
322 : LPARAM lParam);
323 : static BOOL WINAPI TrackPopupHookProc(HMENU hMenu,
324 : UINT uFlags,
325 : int x,
326 : int y,
327 : int nReserved,
328 : HWND hWnd,
329 : CONST RECT *prcRect);
330 : static BOOL CALLBACK EnumThreadWindowsCallback(HWND hWnd,
331 : LPARAM aParam);
332 : static LRESULT CALLBACK WinlessHiddenFlashWndProc(HWND hWnd,
333 : UINT message,
334 : WPARAM wParam,
335 : LPARAM lParam);
336 : #ifdef _WIN64
337 : static LONG_PTR WINAPI SetWindowLongPtrAHook(HWND hWnd,
338 : int nIndex,
339 : LONG_PTR newLong);
340 : static LONG_PTR WINAPI SetWindowLongPtrWHook(HWND hWnd,
341 : int nIndex,
342 : LONG_PTR newLong);
343 :
344 : #else
345 : static LONG WINAPI SetWindowLongAHook(HWND hWnd,
346 : int nIndex,
347 : LONG newLong);
348 : static LONG WINAPI SetWindowLongWHook(HWND hWnd,
349 : int nIndex,
350 : LONG newLong);
351 : #endif
352 :
353 : class FlashThrottleAsyncMsg : public ChildAsyncCall
354 : {
355 : public:
356 : FlashThrottleAsyncMsg();
357 : FlashThrottleAsyncMsg(PluginInstanceChild* aInst,
358 : HWND aWnd, UINT aMsg,
359 : WPARAM aWParam, LPARAM aLParam,
360 : bool isWindowed)
361 : : ChildAsyncCall(aInst, nsnull, nsnull),
362 : mWnd(aWnd),
363 : mMsg(aMsg),
364 : mWParam(aWParam),
365 : mLParam(aLParam),
366 : mWindowed(isWindowed)
367 : {}
368 :
369 : NS_OVERRIDE void Run();
370 :
371 : WNDPROC GetProc();
372 : HWND GetWnd() { return mWnd; }
373 : UINT GetMsg() { return mMsg; }
374 : WPARAM GetWParam() { return mWParam; }
375 : LPARAM GetLParam() { return mLParam; }
376 :
377 : private:
378 : HWND mWnd;
379 : UINT mMsg;
380 : WPARAM mWParam;
381 : LPARAM mLParam;
382 : bool mWindowed;
383 : };
384 :
385 : #endif
386 : const NPPluginFuncs* mPluginIface;
387 : NPP_t mData;
388 : NPWindow mWindow;
389 : int16_t mDrawingModel;
390 : NPAsyncSurface* mCurrentAsyncSurface;
391 0 : struct AsyncBitmapData {
392 : void *mRemotePtr;
393 : Shmem mShmem;
394 : };
395 :
396 : static PLDHashOperator DeleteSurface(NPAsyncSurface* surf, nsAutoPtr<AsyncBitmapData> &data, void* userArg);
397 : nsClassHashtable<nsPtrHashKey<NPAsyncSurface>, AsyncBitmapData> mAsyncBitmaps;
398 : Shmem mRemoteImageDataShmem;
399 : mozilla::layers::RemoteImageData *mRemoteImageData;
400 : nsAutoPtr<CrossProcessMutex> mRemoteImageDataMutex;
401 : mozilla::Mutex mAsyncInvalidateMutex;
402 : CancelableTask *mAsyncInvalidateTask;
403 :
404 : // Cached scriptable actors to avoid IPC churn
405 : PluginScriptableObjectChild* mCachedWindowActor;
406 : PluginScriptableObjectChild* mCachedElementActor;
407 :
408 : #if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
409 : NPSetWindowCallbackStruct mWsInfo;
410 : #elif defined(OS_WIN)
411 : HWND mPluginWindowHWND;
412 : WNDPROC mPluginWndProc;
413 : HWND mPluginParentHWND;
414 : int mNestedEventLevelDepth;
415 : HWND mCachedWinlessPluginHWND;
416 : HWND mWinlessPopupSurrogateHWND;
417 : nsIntPoint mPluginSize;
418 : WNDPROC mWinlessThrottleOldWndProc;
419 : HWND mWinlessHiddenMsgHWND;
420 : #endif
421 :
422 : friend class ChildAsyncCall;
423 :
424 : Mutex mAsyncCallMutex;
425 : nsTArray<ChildAsyncCall*> mPendingAsyncCalls;
426 : nsTArray<nsAutoPtr<ChildTimer> > mTimers;
427 :
428 : /**
429 : * During destruction we enumerate all remaining scriptable objects and
430 : * invalidate/delete them. Enumeration can re-enter, so maintain a
431 : * hash separate from PluginModuleChild.mObjectMap.
432 : */
433 : nsAutoPtr< nsTHashtable<DeletingObjectEntry> > mDeletingHash;
434 :
435 : #if defined(OS_WIN)
436 : private:
437 : // Shared dib rendering management for windowless plugins.
438 : bool SharedSurfaceSetWindow(const NPRemoteWindow& aWindow);
439 : int16_t SharedSurfacePaint(NPEvent& evcopy);
440 : void SharedSurfaceRelease();
441 : bool AlphaExtractCacheSetup();
442 : void AlphaExtractCacheRelease();
443 : void UpdatePaintClipRect(RECT* aRect);
444 :
445 : private:
446 : enum {
447 : RENDER_NATIVE,
448 : RENDER_BACK_ONE,
449 : RENDER_BACK_TWO
450 : };
451 : gfx::SharedDIBWin mSharedSurfaceDib;
452 : struct {
453 : PRUint16 doublePass;
454 : HDC hdc;
455 : HBITMAP bmp;
456 : } mAlphaExtract;
457 : #endif // defined(OS_WIN)
458 : #if defined(MOZ_WIDGET_COCOA)
459 : private:
460 : #if defined(__i386__)
461 : NPEventModel mEventModel;
462 : #endif
463 : CGColorSpaceRef mShColorSpace;
464 : CGContextRef mShContext;
465 : nsCARenderer mCARenderer;
466 : void *mCGLayer;
467 :
468 : // Core Animation drawing model requires a refresh timer.
469 : uint32_t mCARefreshTimer;
470 :
471 : public:
472 : const NPCocoaEvent* getCurrentEvent() {
473 : return mCurrentEvent;
474 : }
475 :
476 : bool CGDraw(CGContextRef ref, nsIntRect aUpdateRect);
477 :
478 : #if defined(__i386__)
479 : NPEventModel EventModel() { return mEventModel; }
480 : #endif
481 :
482 : private:
483 : const NPCocoaEvent *mCurrentEvent;
484 : #endif
485 :
486 : bool CanPaintOnBackground();
487 :
488 0 : bool IsVisible() {
489 : #ifdef XP_MACOSX
490 : return mWindow.clipRect.top != mWindow.clipRect.bottom &&
491 : mWindow.clipRect.left != mWindow.clipRect.right;
492 : #else
493 : return mWindow.clipRect.top != 0 ||
494 : mWindow.clipRect.left != 0 ||
495 : mWindow.clipRect.bottom != 0 ||
496 0 : mWindow.clipRect.right != 0;
497 : #endif
498 : }
499 :
500 : // ShowPluginFrame - in general does four things:
501 : // 1) Create mCurrentSurface optimized for rendering to parent process
502 : // 2) Updated mCurrentSurface to be a complete copy of mBackSurface
503 : // 3) Draw the invalidated plugin area into mCurrentSurface
504 : // 4) Send it to parent process.
505 : bool ShowPluginFrame(void);
506 :
507 : // If we can read back safely from mBackSurface, copy
508 : // mSurfaceDifferenceRect from mBackSurface to mFrontSurface.
509 : // @return Whether the back surface could be read.
510 : bool ReadbackDifferenceRect(const nsIntRect& rect);
511 :
512 : // Post ShowPluginFrame task
513 : void AsyncShowPluginFrame(void);
514 :
515 : // In the PaintRect functions, aSurface is the size of the full plugin
516 : // window. Each PaintRect function renders into the subrectangle aRect of
517 : // aSurface (possibly more if we're working around a Flash bug).
518 :
519 : // Paint plugin content rectangle to surface with bg color filling
520 : void PaintRectToSurface(const nsIntRect& aRect,
521 : gfxASurface* aSurface,
522 : const gfxRGBA& aColor);
523 :
524 : // Render plugin content to surface using
525 : // white/black image alpha extraction algorithm
526 : void PaintRectWithAlphaExtraction(const nsIntRect& aRect,
527 : gfxASurface* aSurface);
528 :
529 : // Call plugin NPAPI function to render plugin content to surface
530 : // @param - aSurface - should be compatible with current platform plugin rendering
531 : // @return - FALSE if plugin not painted to surface
532 : void PaintRectToPlatformSurface(const nsIntRect& aRect,
533 : gfxASurface* aSurface);
534 :
535 : // Update NPWindow platform attributes and call plugin "setwindow"
536 : // @param - aForceSetWindow - call setwindow even if platform attributes are the same
537 : void UpdateWindowAttributes(bool aForceSetWindow = false);
538 :
539 : // Create optimized mCurrentSurface for parent process rendering
540 : // @return FALSE if optimized surface not created
541 : bool CreateOptSurface(void);
542 :
543 : // Create mHelperSurface if mCurrentSurface non compatible with plugins
544 : // @return TRUE if helper surface created successfully, or not needed
545 : bool MaybeCreatePlatformHelperSurface(void);
546 :
547 : // Make sure that we have surface for rendering
548 : bool EnsureCurrentBuffer(void);
549 :
550 : // Helper function for delayed InvalidateRect call
551 : // non null mCurrentInvalidateTask will call this function
552 : void InvalidateRectDelayed(void);
553 :
554 : // Clear mCurrentSurface/mCurrentSurfaceActor/mHelperSurface
555 : void ClearCurrentSurface();
556 :
557 : // Swap mCurrentSurface/mBackSurface and their associated actors
558 : void SwapSurfaces();
559 :
560 : // Clear all surfaces in response to NPP_Destroy
561 : void ClearAllSurfaces();
562 :
563 : // Set as true when SetupLayer called
564 : // and go with different path in InvalidateRect function
565 : bool mLayersRendering;
566 :
567 : // Current surface available for rendering
568 : nsRefPtr<gfxASurface> mCurrentSurface;
569 :
570 : // Back surface, just keeping reference to
571 : // surface which is on ParentProcess side
572 : nsRefPtr<gfxASurface> mBackSurface;
573 :
574 : #ifdef XP_MACOSX
575 : // Current IOSurface available for rendering
576 : // We can't use thebes gfxASurface like other platforms.
577 : nsDoubleBufferCARenderer mDoubleBufferCARenderer;
578 : #endif
579 :
580 : // (Not to be confused with mBackSurface). This is a recent copy
581 : // of the opaque pixels under our object frame, if
582 : // |mIsTransparent|. We ask the plugin render directly onto a
583 : // copy of the background pixels if available, and fall back on
584 : // alpha recovery otherwise.
585 : nsRefPtr<gfxASurface> mBackground;
586 :
587 : #ifdef XP_WIN
588 : // These actors mirror mCurrentSurface/mBackSurface
589 : PPluginSurfaceChild* mCurrentSurfaceActor;
590 : PPluginSurfaceChild* mBackSurfaceActor;
591 : #endif
592 :
593 : // Accumulated invalidate rect, while back buffer is not accessible,
594 : // in plugin coordinates.
595 : nsIntRect mAccumulatedInvalidRect;
596 :
597 : // Plugin only call SetTransparent
598 : // and does not remember their transparent state
599 : // and p->getvalue return always false
600 : bool mIsTransparent;
601 :
602 : // Surface type optimized of parent process
603 : gfxSurfaceType mSurfaceType;
604 :
605 : // Keep InvalidateRect task pointer to be able Cancel it on Destroy
606 : CancelableTask *mCurrentInvalidateTask;
607 :
608 : // Keep AsyncSetWindow task pointer to be able to Cancel it on Destroy
609 : CancelableTask *mCurrentAsyncSetWindowTask;
610 :
611 : // True while plugin-child in plugin call
612 : // Use to prevent plugin paint re-enter
613 : bool mPendingPluginCall;
614 :
615 : // On some platforms, plugins may not support rendering to a surface with
616 : // alpha, or not support rendering to an image surface.
617 : // In those cases we need to draw to a temporary platform surface; we cache
618 : // that surface here.
619 : nsRefPtr<gfxASurface> mHelperSurface;
620 :
621 : // true when plugin does not support painting to ARGB32 surface
622 : // this is false for maemo platform, and false if plugin
623 : // supports NPPVpluginTransparentAlphaBool (which is not part of NPAPI yet)
624 : bool mDoAlphaExtraction;
625 :
626 : // true when the plugin has painted at least once. We use this to ensure
627 : // that we ask a plugin to paint at least once even if it's invisible;
628 : // some plugin (instances) rely on this in order to work properly.
629 : bool mHasPainted;
630 :
631 : // Cached rectangle rendered to previous surface(mBackSurface)
632 : // Used for reading back to current surface and syncing data,
633 : // in plugin coordinates.
634 : nsIntRect mSurfaceDifferenceRect;
635 :
636 : #if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)
637 : // Maemo5 Flash does not remember WindowlessLocal state
638 : // we should listen for NPP values negotiation and remember it
639 : bool mMaemoImageRendering;
640 : #endif
641 : };
642 :
643 : } // namespace plugins
644 : } // namespace mozilla
645 :
646 : #endif // ifndef dom_plugins_PluginInstanceChild_h
|