Chromium Code Reviews| Index: chrome/browser/renderer_host/accelerated_plugin_view_mac.mm |
| diff --git a/chrome/browser/renderer_host/accelerated_plugin_view_mac.mm b/chrome/browser/renderer_host/accelerated_plugin_view_mac.mm |
| index 82638b6ba48ace0e12344a09a76e4b2034a0f8c4..45491d616afd8b92993d90bb168dc288e56ac4e5 100644 |
| --- a/chrome/browser/renderer_host/accelerated_plugin_view_mac.mm |
| +++ b/chrome/browser/renderer_host/accelerated_plugin_view_mac.mm |
| @@ -16,6 +16,7 @@ |
| @synthesize cachedSize = cachedSize_; |
| - (CVReturn)getFrameForTime:(const CVTimeStamp*)outputTime { |
| + TRACE_EVENT0("browser", "AcceleratedPluginView::getFrameForTime"); |
| // There is no autorelease pool when this method is called because it will be |
| // called from a background thread. |
| base::mac::ScopedNSAutoreleasePool pool; |
| @@ -26,9 +27,12 @@ |
| return kCVReturnSuccess; |
| } |
| + CGLLockContext(cglContext_); |
| + |
| [self drawView]; |
| acknowledgedSwapBuffersCount_ = currentSwapBuffersCount; |
| + // Locked here because renderWidgetHostView_ is set to NULL on another thread. |
|
Ken Russell (switch to Gerrit)
2011/06/10 01:30:12
Maybe move this comment next to the call to CGLLoc
jbates
2011/06/11 02:00:44
Done.
|
| if (sendAck && renderWidgetHostView_) { |
| renderWidgetHostView_->AcknowledgeSwapBuffers( |
| rendererId_, |
| @@ -37,6 +41,8 @@ |
| acknowledgedSwapBuffersCount_); |
| } |
| + CGLUnlockContext(cglContext_); |
| + |
| return kCVReturnSuccess; |
| } |
| @@ -155,6 +161,7 @@ static CVReturn DrawOneAcceleratedPluginCallback( |
| } |
| - (void)drawRect:(NSRect)rect { |
| + TRACE_EVENT0("browser", "AcceleratedPluginView::drawRect"); |
| const NSRect* dirtyRects; |
| int dirtyRectCount; |
| [self getRectsBeingDrawn:&dirtyRects count:&dirtyRectCount]; |
| @@ -190,7 +197,9 @@ static CVReturn DrawOneAcceleratedPluginCallback( |
| NSRectFillList(dirtyRects, dirtyRectCount); |
| } |
| + CGLLockContext(cglContext_); |
|
Ken Russell (switch to Gerrit)
2011/06/10 01:30:12
This is unnecessary. The first thing drawView does
jbates
2011/06/11 02:00:44
I meant to remove the drawView mutex locking, sinc
|
| [self drawView]; |
| + CGLUnlockContext(cglContext_); |
|
Ken Russell (switch to Gerrit)
2011/06/10 01:30:12
Unnecessary.
|
| } |
| - (void)rightMouseDown:(NSEvent*)event { |
| @@ -232,8 +241,8 @@ static CVReturn DrawOneAcceleratedPluginCallback( |
| [super renewGState]; |
| } |
| -- (void)lockFocus { |
| - [super lockFocus]; |
| +- (void)setViewForGL { |
| + TRACE_EVENT0("browser", "AcceleratedPluginView::setViewForGL"); |
| // If we're using OpenGL, make sure it is connected and that the display link |
| // is running. |
| @@ -251,10 +260,18 @@ static CVReturn DrawOneAcceleratedPluginCallback( |
| displayLink_, cglContext_, cglPixelFormat_); |
| CVDisplayLinkStart(displayLink_); |
| } |
| +} |
| + |
| +- (void)lockFocus { |
| + TRACE_EVENT0("browser", "AcceleratedPluginView::lockFocus"); |
| + [super lockFocus]; |
| + [self setViewForGL]; |
| [glContext_ makeCurrentContext]; |
| } |
| - (void)viewWillMoveToWindow:(NSWindow*)newWindow { |
| + TRACE_EVENT1("browser", "AcceleratedPluginView::viewWillMoveToWindow", |
| + "newWindow", newWindow); |
| // Stop the display link thread while the view is not visible. |
| if (newWindow) { |
| if (displayLink_ && !CVDisplayLinkIsRunning(displayLink_)) |
| @@ -275,6 +292,7 @@ static CVReturn DrawOneAcceleratedPluginCallback( |
| } |
| - (void)viewDidHide { |
| + TRACE_EVENT0("browser", "AcceleratedPluginView::viewDidHide"); |
| [super viewDidHide]; |
| if ([[self window] respondsToSelector:@selector(underlaySurfaceRemoved)]) { |
| @@ -283,6 +301,7 @@ static CVReturn DrawOneAcceleratedPluginCallback( |
| } |
| - (void)viewDidUnhide { |
| + TRACE_EVENT0("browser", "AcceleratedPluginView::viewDidUnhide"); |
| [super viewDidUnhide]; |
| if ([[self window] respondsToSelector:@selector(underlaySurfaceRemoved)]) { |
| @@ -297,6 +316,7 @@ static CVReturn DrawOneAcceleratedPluginCallback( |
| } |
| - (void)setFrameSize:(NSSize)newSize { |
| + TRACE_EVENT0("browser", "AcceleratedPluginView::newSize"); |
| [self setCachedSize:newSize]; |
| [super setFrameSize:newSize]; |
| } |
| @@ -316,6 +336,7 @@ static CVReturn DrawOneAcceleratedPluginCallback( |
| } |
| - (void)viewDidMoveToSuperview { |
| + TRACE_EVENT0("browser", "AcceleratedPluginView::viewDidMoveToSuperview"); |
| if (![self superview]) |
| [self onRenderWidgetHostViewGone]; |
| } |