Chromium Code Reviews| Index: content/browser/renderer_host/accelerated_plugin_view_mac.mm |
| =================================================================== |
| --- content/browser/renderer_host/accelerated_plugin_view_mac.mm (revision 105227) |
| +++ content/browser/renderer_host/accelerated_plugin_view_mac.mm (working copy) |
| @@ -72,6 +72,7 @@ |
| swapInterval = 1; |
| [glContext_ setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval]; |
| + handlingGlobalFrameDidChange_ = NO; |
| [[NSNotificationCenter defaultCenter] |
| addObserver:self |
| selector:@selector(globalFrameDidChange:) |
| @@ -151,15 +152,22 @@ |
| } |
| - (void)globalFrameDidChange:(NSNotification*)notification { |
| - // This call to -update can call -globalFrameDidChange: again, see |
| - // http://crbug.com/55754 comments 22 and 24. |
| - [glContext_ update]; |
| + // Short-circuit recursive calls. |
| + if (!handlingGlobalFrameDidChange_) { |
|
Nico
2011/10/13 02:26:07
nit: early return instead, less nesting that way.
Ken Russell (switch to Gerrit)
2011/10/13 18:41:20
Right, thanks. Done.
|
| + handlingGlobalFrameDidChange_ = YES; |
| - // You would think that -update updates the viewport. You would be wrong. |
| - CGLSetCurrentContext(cglContext_); |
| - NSSize size = [self frame].size; |
| - glViewport(0, 0, size.width, size.height); |
| - CGLSetCurrentContext(0); |
| + // This call to -update can call -globalFrameDidChange: again, see |
| + // http://crbug.com/55754 comments 22 and 24. |
| + [glContext_ update]; |
| + |
| + // You would think that -update updates the viewport. You would be wrong. |
| + CGLSetCurrentContext(cglContext_); |
| + NSSize size = [self frame].size; |
| + glViewport(0, 0, size.width, size.height); |
| + CGLSetCurrentContext(0); |
| + |
| + handlingGlobalFrameDidChange_ = NO; |
| + } |
| } |
| - (void)prepareForGLRendering { |