зеркало из https://github.com/mozilla/pjs.git
Bug 586909: Discard D2D surfaces for a window when it's hidden. r=robarnold
This commit is contained in:
Родитель
73a5d3eb33
Коммит
3cfb25bdf2
|
@ -176,6 +176,7 @@
|
|||
#endif
|
||||
#include "LayerManagerOGL.h"
|
||||
#endif
|
||||
#include "BasicLayers.h"
|
||||
|
||||
#if !defined(WINCE)
|
||||
#include "nsUXThemeConstants.h"
|
||||
|
@ -1141,6 +1142,12 @@ NS_METHOD nsWindow::Show(PRBool bState)
|
|||
// SetWindowPos would get the correct answer.
|
||||
mIsVisible = bState;
|
||||
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
if (!mIsVisible && wasVisible) {
|
||||
ClearD2DSurface();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mWnd) {
|
||||
if (bState) {
|
||||
if (!wasVisible && mWindowType == eWindowType_toplevel) {
|
||||
|
@ -7861,6 +7868,31 @@ VOID CALLBACK nsWindow::HookTimerForPopups(HWND hwnd, UINT uMsg, UINT idEvent, D
|
|||
}
|
||||
#endif // WinCE
|
||||
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
BOOL CALLBACK nsWindow::ClearD2DSurfaceCallback(HWND aWnd, LPARAM aMsg)
|
||||
{
|
||||
nsWindow *window = nsWindow::GetNSWindowPtr(aWnd);
|
||||
if (window) {
|
||||
window->ClearD2DSurface();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
nsWindow::ClearD2DSurface()
|
||||
{
|
||||
mD2DWindowSurface = nsnull;
|
||||
if (gfxWindowsPlatform::GetPlatform()->GetRenderMode() ==
|
||||
gfxWindowsPlatform::RENDER_DIRECT2D) {
|
||||
// The layer manager holds onto a bunch of buffers created with create
|
||||
// similar surface. This can consume quite a bit of VMEM for each tab,
|
||||
// if a window is hidden we clear the layer manager to conserve VRAM.
|
||||
mLayerManager = nsnull;
|
||||
}
|
||||
::EnumChildWindows(mWnd, nsWindow::ClearD2DSurfaceCallback, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
static PRBool IsDifferentThreadWindow(HWND aWnd)
|
||||
{
|
||||
return ::GetCurrentThreadId() != ::GetWindowThreadProcessId(aWnd, NULL);
|
||||
|
|
|
@ -288,6 +288,9 @@ protected:
|
|||
static LRESULT CALLBACK MozSpecialWndProc(int code, WPARAM wParam, LPARAM lParam);
|
||||
static LRESULT CALLBACK MozSpecialMouseProc(int code, WPARAM wParam, LPARAM lParam);
|
||||
static VOID CALLBACK HookTimerForPopups( HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime );
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
static BOOL CALLBACK ClearD2DSurfaceCallback(HWND aChild, LPARAM aParam);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Window utilities
|
||||
|
@ -445,6 +448,9 @@ protected:
|
|||
#ifdef ACCESSIBILITY
|
||||
static STDMETHODIMP_(LRESULT) LresultFromObject(REFIID riid, WPARAM wParam, LPUNKNOWN pAcc);
|
||||
#endif // ACCESSIBILITY
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
void ClearD2DSurface();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIWidget> mParent;
|
||||
|
|
Загрузка…
Ссылка в новой задаче