mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	Mac: Fix crash on older 10.7 versions when building with the 10.7 SDK (issue #1026).
git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1453@1351 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
		| @@ -46,11 +46,6 @@ patches = [ | ||||
|     'name': 'webkit_popups', | ||||
|     'path': '../third_party/WebKit/Source/WebKit/chromium/', | ||||
|   }, | ||||
|   { | ||||
|     # https://code.google.com/p/chromiumembedded/issues/detail?id=953 | ||||
|     'name': 'renderer_host_953', | ||||
|     'path': '../content/browser/renderer_host/', | ||||
|   }, | ||||
|   { | ||||
|     # http://code.google.com/p/chromiumembedded/issues/detail?id=642 | ||||
|     'name': 'renderer_main_642', | ||||
| @@ -68,9 +63,11 @@ patches = [ | ||||
|     'path': '../content/common/', | ||||
|   }, | ||||
|   { | ||||
|     # Fix crash on 10.6 when building with the 10.7 SDK | ||||
|     # Fix problem with temporary animations not rendering correctly. | ||||
|     # https://code.google.com/p/chromiumembedded/issues/detail?id=953 | ||||
|     # Fix crash on 10.6 and older 10.7 versions when building with the 10.7 SDK. | ||||
|     # http://code.google.com/p/chromiumembedded/issues/detail?id=1026 | ||||
|     'name': 'renderer_host_1026', | ||||
|     'name': 'renderer_host_953_1026', | ||||
|     'path': '../content/browser/renderer_host/', | ||||
|   }, | ||||
|   { | ||||
|   | ||||
| @@ -1,50 +0,0 @@ | ||||
| Index: render_widget_host_view_mac.mm | ||||
| =================================================================== | ||||
| --- render_widget_host_view_mac.mm	(revision 212850) | ||||
| +++ render_widget_host_view_mac.mm	(working copy) | ||||
| @@ -2097,13 +2097,20 @@ | ||||
|   | ||||
|    NSNotificationCenter* notificationCenter = | ||||
|        [NSNotificationCenter defaultCenter]; | ||||
| + | ||||
| +  // Backing property notifications crash on 10.6 when building with the 10.7 | ||||
| +  // SDK, see http://crbug.com/260595. | ||||
| +  BOOL supportsBackingPropertiesNotification = base::mac::IsOSLionOrLater(); | ||||
| + | ||||
|    if (oldWindow) { | ||||
| +    if (supportsBackingPropertiesNotification) { | ||||
| +      [notificationCenter | ||||
| +          removeObserver:self | ||||
| +                    name:NSWindowDidChangeBackingPropertiesNotification | ||||
| +                  object:oldWindow]; | ||||
| +    } | ||||
|      [notificationCenter | ||||
|          removeObserver:self | ||||
| -                  name:NSWindowDidChangeBackingPropertiesNotification | ||||
| -                object:oldWindow]; | ||||
| -    [notificationCenter | ||||
| -        removeObserver:self | ||||
|                    name:NSWindowDidMoveNotification | ||||
|                  object:oldWindow]; | ||||
|      [notificationCenter | ||||
| @@ -2112,13 +2119,15 @@ | ||||
|                  object:oldWindow]; | ||||
|    } | ||||
|    if (newWindow) { | ||||
| +    if (supportsBackingPropertiesNotification) { | ||||
| +      [notificationCenter | ||||
| +          addObserver:self | ||||
| +             selector:@selector(windowDidChangeBackingProperties:) | ||||
| +                 name:NSWindowDidChangeBackingPropertiesNotification | ||||
| +               object:newWindow]; | ||||
| +    } | ||||
|      [notificationCenter | ||||
|          addObserver:self | ||||
| -           selector:@selector(windowDidChangeBackingProperties:) | ||||
| -               name:NSWindowDidChangeBackingPropertiesNotification | ||||
| -             object:newWindow]; | ||||
| -    [notificationCenter | ||||
| -        addObserver:self | ||||
|             selector:@selector(windowChangedGlobalFrame:) | ||||
|                 name:NSWindowDidMoveNotification | ||||
|               object:newWindow]; | ||||
| @@ -1,13 +0,0 @@ | ||||
| Index: render_widget_host_view_mac.mm | ||||
| =================================================================== | ||||
| --- render_widget_host_view_mac.mm	(revision 197225) | ||||
| +++ render_widget_host_view_mac.mm	(working copy) | ||||
| @@ -1424,7 +1424,7 @@ | ||||
|      // Forget IOSurface since we are drawing a software frame now. | ||||
|      if (compositing_iosurface_.get() && | ||||
|          compositing_iosurface_->HasIOSurface()) { | ||||
| -      compositing_iosurface_->UnrefIOSurface(); | ||||
| +      compositing_iosurface_->ClearDrawable(); | ||||
|      } | ||||
|    } | ||||
|  } | ||||
							
								
								
									
										98
									
								
								cef3/patch/patches/renderer_host_953_1026.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										98
									
								
								cef3/patch/patches/renderer_host_953_1026.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,98 @@ | ||||
| Index: render_widget_host_view_mac.mm | ||||
| =================================================================== | ||||
| --- render_widget_host_view_mac.mm	(revision 202711) | ||||
| +++ render_widget_host_view_mac.mm	(working copy) | ||||
| @@ -4,6 +4,7 @@ | ||||
|   | ||||
|  #include "content/browser/renderer_host/render_widget_host_view_mac.h" | ||||
|   | ||||
| +#import <objc/runtime.h> | ||||
|  #include <QuartzCore/QuartzCore.h> | ||||
|   | ||||
|  #include "base/bind.h" | ||||
| @@ -125,6 +126,29 @@ | ||||
|    return modifiers; | ||||
|  } | ||||
|   | ||||
| +// This method will return YES for OS X versions 10.7.3 and later, and NO | ||||
| +// otherwise. | ||||
| +// Used to prevent a crash when building with the 10.7 SDK and accessing the | ||||
| +// notification below. See: http://crbug.com/260595. | ||||
| +static BOOL SupportsBackingPropertiesChangedNotification() { | ||||
| +  // windowDidChangeBackingProperties: method has been added to the | ||||
| +  // NSWindowDelegate protocol in 10.7.3, at the same time as the | ||||
| +  // NSWindowDidChangeBackingPropertiesNotification notification was added. | ||||
| +  // If the protocol contains this method description, the notification should | ||||
| +  // be supported as well. | ||||
| +  Protocol* windowDelegateProtocol = NSProtocolFromString(@"NSWindowDelegate"); | ||||
| +  struct objc_method_description methodDescription = | ||||
| +      protocol_getMethodDescription( | ||||
| +          windowDelegateProtocol, | ||||
| +          @selector(windowDidChangeBackingProperties:), | ||||
| +          NO, | ||||
| +          YES); | ||||
| + | ||||
| +  // If the protocol does not contain the method, the returned method | ||||
| +  // description is {NULL, NULL} | ||||
| +  return methodDescription.name != NULL || methodDescription.types != NULL; | ||||
| +} | ||||
| + | ||||
|  static float ScaleFactor(NSView* view) { | ||||
|    return ui::GetScaleFactorScale(ui::GetScaleFactorForNativeView(view)); | ||||
|  } | ||||
| @@ -1424,7 +1448,7 @@ | ||||
|      // Forget IOSurface since we are drawing a software frame now. | ||||
|      if (compositing_iosurface_.get() && | ||||
|          compositing_iosurface_->HasIOSurface()) { | ||||
| -      compositing_iosurface_->UnrefIOSurface(); | ||||
| +      compositing_iosurface_->ClearDrawable(); | ||||
|      } | ||||
|    } | ||||
|  } | ||||
| @@ -2097,13 +2121,21 @@ | ||||
|   | ||||
|    NSNotificationCenter* notificationCenter = | ||||
|        [NSNotificationCenter defaultCenter]; | ||||
| + | ||||
| +  // Backing property notifications crash on 10.6 when building with the 10.7 | ||||
| +  // SDK, see http://crbug.com/260595. | ||||
| +  static BOOL supportsBackingPropertiesNotification = | ||||
| +      SupportsBackingPropertiesChangedNotification(); | ||||
| + | ||||
|    if (oldWindow) { | ||||
| +    if (supportsBackingPropertiesNotification) { | ||||
| +      [notificationCenter | ||||
| +          removeObserver:self | ||||
| +                    name:NSWindowDidChangeBackingPropertiesNotification | ||||
| +                  object:oldWindow]; | ||||
| +    } | ||||
|      [notificationCenter | ||||
|          removeObserver:self | ||||
| -                  name:NSWindowDidChangeBackingPropertiesNotification | ||||
| -                object:oldWindow]; | ||||
| -    [notificationCenter | ||||
| -        removeObserver:self | ||||
|                    name:NSWindowDidMoveNotification | ||||
|                  object:oldWindow]; | ||||
|      [notificationCenter | ||||
| @@ -2112,13 +2144,15 @@ | ||||
|                  object:oldWindow]; | ||||
|    } | ||||
|    if (newWindow) { | ||||
| +    if (supportsBackingPropertiesNotification) { | ||||
| +      [notificationCenter | ||||
| +          addObserver:self | ||||
| +             selector:@selector(windowDidChangeBackingProperties:) | ||||
| +                 name:NSWindowDidChangeBackingPropertiesNotification | ||||
| +               object:newWindow]; | ||||
| +    } | ||||
|      [notificationCenter | ||||
|          addObserver:self | ||||
| -           selector:@selector(windowDidChangeBackingProperties:) | ||||
| -               name:NSWindowDidChangeBackingPropertiesNotification | ||||
| -             object:newWindow]; | ||||
| -    [notificationCenter | ||||
| -        addObserver:self | ||||
|             selector:@selector(windowChangedGlobalFrame:) | ||||
|                 name:NSWindowDidMoveNotification | ||||
|               object:newWindow]; | ||||
		Reference in New Issue
	
	Block a user