mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 736481 - 5/7 - make memory-pressure observer lifetime match WebGL context lifetime - r=jgilbert, a=blocking-fennec
This commit is contained in:
parent
b5fa6b73b1
commit
674aed832a
@ -187,16 +187,6 @@ WebGLContext::WebGLContext()
|
||||
mContextRestorer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
mContextStatus = ContextStable;
|
||||
mContextLostErrorSet = false;
|
||||
|
||||
nsRefPtr<WebGLMemoryPressureObserver> memoryPressureObserver
|
||||
= new WebGLMemoryPressureObserver(this);
|
||||
nsCOMPtr<nsIObserverService> observerService
|
||||
= mozilla::services::GetObserverService();
|
||||
if (observerService) {
|
||||
observerService->AddObserver(memoryPressureObserver,
|
||||
"memory-pressure",
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
WebGLContext::~WebGLContext()
|
||||
@ -210,6 +200,16 @@ WebGLContext::~WebGLContext()
|
||||
void
|
||||
WebGLContext::DestroyResourcesAndContext()
|
||||
{
|
||||
if (mMemoryPressureObserver) {
|
||||
nsCOMPtr<nsIObserverService> observerService
|
||||
= mozilla::services::GetObserverService();
|
||||
if (observerService) {
|
||||
observerService->RemoveObserver(mMemoryPressureObserver,
|
||||
"memory-pressure");
|
||||
}
|
||||
mMemoryPressureObserver = nsnull;
|
||||
}
|
||||
|
||||
if (!gl)
|
||||
return;
|
||||
|
||||
|
@ -104,8 +104,9 @@ class WebGLFramebuffer;
|
||||
class WebGLRenderbuffer;
|
||||
class WebGLUniformLocation;
|
||||
class WebGLExtension;
|
||||
class WebGLContext;
|
||||
struct WebGLVertexAttribData;
|
||||
|
||||
class WebGLMemoryPressureObserver;
|
||||
class WebGLRectangleObject;
|
||||
class WebGLContextBoundObject;
|
||||
|
||||
@ -959,6 +960,7 @@ protected:
|
||||
ForceDiscreteGPUHelperCGL mForceDiscreteGPUHelper;
|
||||
#endif
|
||||
|
||||
nsRefPtr<WebGLMemoryPressureObserver> mMemoryPressureObserver;
|
||||
|
||||
public:
|
||||
// console logging helpers
|
||||
|
@ -51,6 +51,8 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "nsIObserverService.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
/*
|
||||
@ -679,5 +681,15 @@ WebGLContext::InitAndValidateGL()
|
||||
return false;
|
||||
}
|
||||
|
||||
mMemoryPressureObserver
|
||||
= new WebGLMemoryPressureObserver(this);
|
||||
nsCOMPtr<nsIObserverService> observerService
|
||||
= mozilla::services::GetObserverService();
|
||||
if (observerService) {
|
||||
observerService->AddObserver(mMemoryPressureObserver,
|
||||
"memory-pressure",
|
||||
false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user