mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 22:32:51 +00:00
Bug 1006336 - Change OwningThreadId in GLContext to PlatformThread::CurrentId(). r=bjacob
This commit is contained in:
parent
002ce1edc1
commit
b9eb78db67
@ -285,7 +285,7 @@ GLContext::GLContext(const SurfaceCaps& caps,
|
||||
mNeedsTextureSizeChecks(false),
|
||||
mWorkAroundDriverBugs(true)
|
||||
{
|
||||
mOwningThread = NS_GetCurrentThread();
|
||||
mOwningThreadId = PlatformThread::CurrentId();
|
||||
}
|
||||
|
||||
GLContext::~GLContext() {
|
||||
@ -2108,20 +2108,7 @@ GLContext::IsOffscreenSizeAllowed(const IntSize& aSize) const {
|
||||
bool
|
||||
GLContext::IsOwningThreadCurrent()
|
||||
{
|
||||
return NS_GetCurrentThread() == mOwningThread;
|
||||
}
|
||||
|
||||
void
|
||||
GLContext::DispatchToOwningThread(nsIRunnable *event)
|
||||
{
|
||||
// Before dispatching, we need to ensure we're not in the middle of
|
||||
// shutting down. Dispatching runnables in the middle of shutdown
|
||||
// (that is, when the main thread is no longer get-able) can cause them
|
||||
// to leak. See Bug 741319, and Bug 744115.
|
||||
nsCOMPtr<nsIThread> mainThread;
|
||||
if (NS_SUCCEEDED(NS_GetMainThread(getter_AddRefs(mainThread)))) {
|
||||
mOwningThread->Dispatch(event, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
return PlatformThread::CurrentId() == mOwningThreadId;
|
||||
}
|
||||
|
||||
GLBlitHelper*
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "SurfaceTypes.h"
|
||||
#include "GLScreenBuffer.h"
|
||||
#include "GLContextSymbols.h"
|
||||
#include "base/platform_thread.h" // for PlatformThreadId
|
||||
#include "mozilla/GenericRefCounted.h"
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "gfx2DGlue.h"
|
||||
@ -2569,7 +2570,6 @@ public:
|
||||
* executing thread.
|
||||
*/
|
||||
bool IsOwningThreadCurrent();
|
||||
void DispatchToOwningThread(nsIRunnable *event);
|
||||
|
||||
static void PlatformStartup();
|
||||
|
||||
@ -2733,8 +2733,8 @@ public:
|
||||
protected:
|
||||
nsRefPtr<GLContext> mSharedContext;
|
||||
|
||||
// The thread on which this context was created.
|
||||
nsCOMPtr<nsIThread> mOwningThread;
|
||||
// The thread id which this context was created.
|
||||
PlatformThreadId mOwningThreadId;
|
||||
|
||||
GLContextSymbols mSymbols;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user