[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

cblu cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:25:16 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 86c53b1f5977d97c1182bbbea5df2e242f779831
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Feb 4 18:45:14 2004 +0000

    	Fixed: <rdar://problem/3546028>: Safari should not give plug-ins any time, thus use 0% CPU, when not in the currently active session
    
            Reviewed by john.
    
            * Plugins.subproj/WebBaseNetscapePluginView.m:
            (+[WebBaseNetscapePluginView initialize]): observe CG changes
            (-[WebBaseNetscapePluginView addWindowObservers]): observe user switch notifications
            (-[WebBaseNetscapePluginView removeWindowObservers]): stop observing user switch notifications
            (-[WebBaseNetscapePluginView viewHasMoved:]): tweak
            (-[WebBaseNetscapePluginView windowWillClose:]): tweak
            (-[WebBaseNetscapePluginView windowBecameKey:]): tweak
            (-[WebBaseNetscapePluginView windowResignedKey:]): tweak
            (-[WebBaseNetscapePluginView windowDidMiniaturize:]): tweak
            (-[WebBaseNetscapePluginView windowDidDeminiaturize:]): tweak
            (-[WebBaseNetscapePluginView loginWindowDidSwitchFromUser:]): new, stop null events
            (-[WebBaseNetscapePluginView loginWindowDidSwitchToUser:]): new, restart null events
            (ConsoleConnectionChangeNotifyProc): new, post user switch notifications
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6033 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 9988a67..b30bcb4 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,23 @@
+2004-02-04  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed: <rdar://problem/3546028>: Safari should not give plug-ins any time, thus use 0% CPU, when not in the currently active session
+
+        Reviewed by john.
+
+        * Plugins.subproj/WebBaseNetscapePluginView.m:
+        (+[WebBaseNetscapePluginView initialize]): observe CG changes
+        (-[WebBaseNetscapePluginView addWindowObservers]): observe user switch notifications
+        (-[WebBaseNetscapePluginView removeWindowObservers]): stop observing user switch notifications
+        (-[WebBaseNetscapePluginView viewHasMoved:]): tweak
+        (-[WebBaseNetscapePluginView windowWillClose:]): tweak 
+        (-[WebBaseNetscapePluginView windowBecameKey:]): tweak
+        (-[WebBaseNetscapePluginView windowResignedKey:]): tweak
+        (-[WebBaseNetscapePluginView windowDidMiniaturize:]): tweak
+        (-[WebBaseNetscapePluginView windowDidDeminiaturize:]): tweak
+        (-[WebBaseNetscapePluginView loginWindowDidSwitchFromUser:]): new, stop null events
+        (-[WebBaseNetscapePluginView loginWindowDidSwitchToUser:]): new, restart null events
+        (ConsoleConnectionChangeNotifyProc): new, post user switch notifications
+
 2004-02-02  John Sullivan  <sullivan at apple.com>
 
         Reviewed by Darin.
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
index 4f73914..145b8ea 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
@@ -30,6 +30,7 @@
 
 #import <AppKit/NSEvent_Private.h>
 #import <Carbon/Carbon.h>
+#import <CoreGraphics/CoreGraphicsPrivate.h>
 #import <HIToolbox/TextServicesPriv.h>
 #import <QD/QuickdrawPriv.h>
 
@@ -40,6 +41,10 @@ void CallDrawingNotifications(CGrafPtr port, Rect *mayDrawIntoThisRect, int draw
 #define NullEventIntervalActive 	0.02
 #define NullEventIntervalNotActive	0.25
 
+#define LoginWindowDidSwitchFromUserNotification    @"LoginWindowDidSwitchFromUserNotification"
+#define LoginWindowDidSwitchToUserNotification      @"LoginWindowDidSwitchToUserNotification"
+
+
 static WebBaseNetscapePluginView *currentPluginView = nil;
 
 typedef struct {
@@ -72,9 +77,16 @@ typedef struct {
 @end
 
 static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEvent, void *pluginView);
+void ConsoleConnectionChangeNotifyProc(CGSNotificationType type, CGSNotificationData data, CGSByteCount dataLength, CGSNotificationArg arg);
 
 @implementation WebBaseNetscapePluginView
 
++ (void)initialize
+{
+    CGSRegisterNotifyProc(ConsoleConnectionChangeNotifyProc, kCGSessionConsoleConnect, NULL);
+    CGSRegisterNotifyProc(ConsoleConnectionChangeNotifyProc, kCGSessionConsoleDisconnect, NULL);
+}
+
 #pragma mark EVENTS
 
 + (void)getCarbonEvent:(EventRecord *)carbonEvent
@@ -805,6 +817,11 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
                                name:NSWindowDidMiniaturizeNotification object:theWindow];
     [notificationCenter addObserver:self selector:@selector(windowDidDeminiaturize:)
                                name:NSWindowDidDeminiaturizeNotification object:theWindow];
+    
+    [notificationCenter addObserver:self selector:@selector(loginWindowDidSwitchFromUser:)
+                               name:LoginWindowDidSwitchFromUserNotification object:NSApp];
+    [notificationCenter addObserver:self selector:@selector(loginWindowDidSwitchToUser:)
+                               name:LoginWindowDidSwitchToUserNotification object:NSApp];
 }
 
 - (void)removeWindowObservers
@@ -817,6 +834,8 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
     [notificationCenter removeObserver:self name:NSWindowDidResignKeyNotification     object:nil];
     [notificationCenter removeObserver:self name:NSWindowDidMiniaturizeNotification   object:nil];
     [notificationCenter removeObserver:self name:NSWindowDidDeminiaturizeNotification object:nil];
+    [notificationCenter removeObserver:self name:LoginWindowDidSwitchFromUserNotification   object:NSApp];
+    [notificationCenter removeObserver:self name:LoginWindowDidSwitchToUserNotification     object:NSApp];
 }
 
 - (BOOL)start
@@ -1140,19 +1159,19 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
 
 #pragma mark NOTIFICATIONS
 
--(void)viewHasMoved:(NSNotification *)notification
+- (void)viewHasMoved:(NSNotification *)notification
 {
     [self tellQuickTimeToChill];
     [self setWindow];
     [self resetTrackingRect];
 }
 
--(void)windowWillClose:(NSNotification *)notification
+- (void)windowWillClose:(NSNotification *)notification
 {
     [self stop];
 }
 
--(void)windowBecameKey:(NSNotification *)notification
+- (void)windowBecameKey:(NSNotification *)notification
 {
     [self sendActivateEvent:YES];
     [self setNeedsDisplay:YES];
@@ -1160,19 +1179,29 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
     SetUserFocusWindow([[self window] windowRef]);
 }
 
--(void)windowResignedKey:(NSNotification *)notification
+- (void)windowResignedKey:(NSNotification *)notification
 {
     [self sendActivateEvent:NO];
     [self setNeedsDisplay:YES];
     [self restartNullEvents];
 }
 
--(void)windowDidMiniaturize:(NSNotification *)notification
+- (void)windowDidMiniaturize:(NSNotification *)notification
+{
+    [self stopNullEvents];
+}
+
+- (void)windowDidDeminiaturize:(NSNotification *)notification
+{
+    [self restartNullEvents];
+}
+
+- (void)loginWindowDidSwitchFromUser:(NSNotification *)notification
 {
     [self stopNullEvents];
 }
 
--(void)windowDidDeminiaturize:(NSNotification *)notification
+-(void)loginWindowDidSwitchToUser:(NSNotification *)notification
 {
     [self restartNullEvents];
 }
@@ -1643,3 +1672,15 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
 
 @end
 
+void ConsoleConnectionChangeNotifyProc(CGSNotificationType type, CGSNotificationData data, CGSByteCount dataLength, CGSNotificationArg arg)
+{
+    NSString *notificationName;
+    if (type == kCGSessionConsoleConnect) {
+        notificationName = LoginWindowDidSwitchToUserNotification;
+    } else if (type == kCGSessionConsoleDisconnect) {
+        notificationName = LoginWindowDidSwitchFromUserNotification;
+    } else {
+        ASSERT_NOT_REACHED();
+    }
+    [[NSNotificationCenter defaultCenter] postNotificationName:notificationName object:NSApp];
+}

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list