зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1261483 - Only call updateGLContext from the compositor thread to avoid races. r=mstange
--HG-- extra : rebase_source : 44771d0d3b4f1bed963b7c05369619b218913a98
This commit is contained in:
Родитель
0de6d7d691
Коммит
840dd73649
|
@ -205,6 +205,10 @@ typedef NSInteger NSEventGestureAxis;
|
|||
// to send its pair event first, in case we didn't yet for any reason.
|
||||
BOOL mExpectingWheelStop;
|
||||
|
||||
// Set to YES when our GL surface has been updated and we need to call
|
||||
// updateGLContext before we composite.
|
||||
BOOL mNeedsGLUpdate;
|
||||
|
||||
// Holds our drag service across multiple drag calls. The reference to the
|
||||
// service is obtained when the mouse enters the view and is released when
|
||||
// the mouse exits or there is a drop. This prevents us from having to
|
||||
|
@ -276,7 +280,6 @@ typedef NSInteger NSEventGestureAxis;
|
|||
- (void)updateGLContext;
|
||||
- (void)_surfaceNeedsUpdate:(NSNotification*)notification;
|
||||
|
||||
- (void)setGLContext:(NSOpenGLContext *)aGLContext;
|
||||
- (bool)preRender:(NSOpenGLContext *)aGLContext;
|
||||
- (void)postRender:(NSOpenGLContext *)aGLContext;
|
||||
|
||||
|
|
|
@ -3366,6 +3366,8 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||
// progress.
|
||||
mDidForceRefreshOpenGL = NO;
|
||||
|
||||
mNeedsGLUpdate = NO;
|
||||
|
||||
[self setFocusRingType:NSFocusRingTypeNone];
|
||||
|
||||
#ifdef __LP64__
|
||||
|
@ -3457,17 +3459,9 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
[mGLContext clearDrawable];
|
||||
CGLLockContext((CGLContextObj)[mGLContext CGLContextObj]);
|
||||
[self updateGLContext];
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
- (void)setGLContext:(NSOpenGLContext *)aGLContext
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
mGLContext = aGLContext;
|
||||
[mGLContext retain];
|
||||
CGLUnlockContext((CGLContextObj)[mGLContext CGLContextObj]);
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
@ -3485,12 +3479,18 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||
}
|
||||
|
||||
if (!mGLContext) {
|
||||
[self setGLContext:aGLContext];
|
||||
[self updateGLContext];
|
||||
mGLContext = aGLContext;
|
||||
[mGLContext retain];
|
||||
mNeedsGLUpdate = true;
|
||||
}
|
||||
|
||||
CGLLockContext((CGLContextObj)[aGLContext CGLContextObj]);
|
||||
|
||||
if (mNeedsGLUpdate) {
|
||||
[self updateGLContext];
|
||||
mNeedsGLUpdate = NO;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
|
||||
|
@ -3722,17 +3722,17 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||
|
||||
-(void)updateGLContext
|
||||
{
|
||||
if (mGLContext) {
|
||||
CGLLockContext((CGLContextObj)[mGLContext CGLContextObj]);
|
||||
[mGLContext setView:self];
|
||||
[mGLContext update];
|
||||
CGLUnlockContext((CGLContextObj)[mGLContext CGLContextObj]);
|
||||
}
|
||||
[mGLContext setView:self];
|
||||
[mGLContext update];
|
||||
}
|
||||
|
||||
- (void)_surfaceNeedsUpdate:(NSNotification*)notification
|
||||
{
|
||||
[self updateGLContext];
|
||||
if (mGLContext) {
|
||||
CGLLockContext((CGLContextObj)[mGLContext CGLContextObj]);
|
||||
mNeedsGLUpdate = YES;
|
||||
CGLUnlockContext((CGLContextObj)[mGLContext CGLContextObj]);
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)wantsBestResolutionOpenGLSurface
|
||||
|
|
Загрузка…
Ссылка в новой задаче