~ubuntu-branches/ubuntu/lucid/xulrunner-1.9/lucid

« back to all changes in this revision

Viewing changes to mozilla/modules/plugin/base/src/nsPluginNativeWindowWin.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2009-07-08 12:22:18 UTC
  • mfrom: (1.1.21 upstream)
  • Revision ID: james.westby@ubuntu.com-20090708122218-nspy5z1k752xyivz
Tags: 1.9.0.12+build1+nobinonly-0ubuntu1
* New upstream release v1.9.0.12 build1 (FIREFOX_3_0_12_BUILD1)
  - see USN-798-1
* include all packages in translation template export; adjust
  MOZ_TRANSLATION_AUTO_XPI_SEARCHDIRS accordingly
  - update debian/rules
* drop upstreamed patches
  - delete debian/patches/bz412610_att335369_realpath_overflow.patch
  - delete debian/patches/bz478843_ftbfs_gcc44.patch
  - update debian/patches/series

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
static NS_DEFINE_CID(kCPluginManagerCID, NS_PLUGINMANAGER_CID); // needed for NS_TRY_SAFE_CALL
64
64
 
65
65
#define NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION "MozillaPluginWindowPropertyAssociation"
 
66
#define NS_PLUGIN_CUSTOM_MSG_ID TEXT("MozFlashUserRelay")
 
67
#define WM_USER_FLASH WM_USER+1
 
68
static UINT sWM_FLASHBOUNCEMSG = 0;
66
69
 
67
70
typedef nsTWeakRef<class nsPluginNativeWindowWin> PluginWindowWeakRef;
68
71
 
162
165
static PRBool sInMessageDispatch = PR_FALSE;
163
166
static UINT sLastMsg = 0;
164
167
 
165
 
static PRBool ProcessFlashMessageDelayed(nsPluginNativeWindowWin * aWin, 
 
168
static PRBool ProcessFlashMessageDelayed(nsPluginNativeWindowWin * aWin, nsIPluginInstance * aInst,
166
169
                                         HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
167
170
{
168
171
  NS_ENSURE_TRUE(aWin, NS_ERROR_NULL_POINTER);
169
 
 
170
 
  if (msg != WM_USER+1)
 
172
  NS_ENSURE_TRUE(aInst, NS_ERROR_NULL_POINTER);
 
173
 
 
174
  if (msg == sWM_FLASHBOUNCEMSG) {
 
175
    // See PluginWindowEvent::Run() below.
 
176
    NS_ASSERTION((sWM_FLASHBOUNCEMSG != 0), "RegisterWindowMessage failed in flash plugin WM_USER message handling!");
 
177
    NS_TRY_SAFE_CALL_VOID(::CallWindowProc((WNDPROC)aWin->GetWindowProc(), hWnd, WM_USER_FLASH, wParam, lParam),
 
178
                                           nsnull, aInst);
 
179
    return TRUE;
 
180
  }
 
181
 
 
182
  if (msg != WM_USER_FLASH)
171
183
    return PR_FALSE; // no need to delay
172
184
 
173
185
  // do stuff
334
346
  // (WM_USER+1) causing 100% CPU consumption and GUI freeze, see mozilla bug 132759;
335
347
  // we can prevent this from happening by delaying the processing such messages;
336
348
  if (win->mPluginType == nsPluginType_Flash) {
337
 
    if (ProcessFlashMessageDelayed(win, hWnd, msg, wParam, lParam))
 
349
    if (ProcessFlashMessageDelayed(win, inst, hWnd, msg, wParam, lParam))
338
350
      return TRUE;
339
351
  }
340
352
 
401
413
  mPrevWinProc = NULL;
402
414
  mPluginWinProc = NULL;
403
415
  mPluginType = nsPluginType_Unknown;
 
416
  
 
417
  if (sWM_FLASHBOUNCEMSG == 0)
 
418
    sWM_FLASHBOUNCEMSG = ::RegisterWindowMessage(NS_PLUGIN_CUSTOM_MSG_ID);
 
419
 
404
420
}
405
421
 
406
422
nsPluginNativeWindowWin::~nsPluginNativeWindowWin()
432
448
 
433
449
  nsCOMPtr<nsIPluginInstance> inst;
434
450
  win->GetPluginInstance(inst);
435
 
  NS_TRY_SAFE_CALL_VOID(::CallWindowProc(win->GetWindowProc(), 
436
 
                        hWnd, 
437
 
                        GetMsg(), 
438
 
                        GetWParam(), 
439
 
                        GetLParam()),
440
 
                        nsnull, inst);
 
451
 
 
452
  if (GetMsg() == WM_USER_FLASH) {
 
453
    // XXX Unwind issues related to runnable event callback depth for this
 
454
    // event and destruction of the plugin. (Bug 493601)
 
455
    ::PostMessage(hWnd, sWM_FLASHBOUNCEMSG, GetWParam(), GetLParam());
 
456
  }
 
457
  else {
 
458
    // Currently not used, but added so that processing events here
 
459
    // is more generic.
 
460
    NS_TRY_SAFE_CALL_VOID(::CallWindowProc(win->GetWindowProc(), 
 
461
                          hWnd, 
 
462
                          GetMsg(), 
 
463
                          GetWParam(), 
 
464
                          GetLParam()),
 
465
                          nsnull, inst);
 
466
  }
 
467
 
441
468
  Clear();
442
469
  return NS_OK;
443
470
}