[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 07:05:31 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit a9f64e93f7e0202aae04981995c36873e48a8047
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Nov 21 06:05:16 2002 +0000

    	Fixed: 3079134 - Throttle plug-ins while in background
    
            * Plugins.subproj/WebBaseNetscapePluginView.h:
            * Plugins.subproj/WebBaseNetscapePluginView.m:
            (-[WebBaseNetscapePluginView sendNullEvent]): new
            (-[WebBaseNetscapePluginView stopNullEvents]): stops timer
            (-[WebBaseNetscapePluginView restartNullEvents]): stops timer if there is one, and starts a new one based on window activation state
            (-[WebBaseNetscapePluginView start]): call restartNullEvents
            (-[WebBaseNetscapePluginView stop]): call stopNullEvents
            (-[WebBaseNetscapePluginView windowBecameKey:]): call restartNullEvents
            (-[WebBaseNetscapePluginView windowResignedKey:]): call restartNullEvents
            (-[WebBaseNetscapePluginView windowDidMiniaturize:]): call stopNullEvents
            (-[WebBaseNetscapePluginView windowDidDeminiaturize:]): call restartNullEvents
            * Plugins.subproj/WebNetscapePluginNullEventSender.h: Removed. No need for another class, use a timer.
            * Plugins.subproj/WebNetscapePluginNullEventSender.m: Removed. No need for another class, use a timer.
            * WebKit.pbproj/project.pbxproj:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2797 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index dac6ce6..fa6d848 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,22 @@
+2002-11-20  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed: 3079134 - Throttle plug-ins while in background
+
+        * Plugins.subproj/WebBaseNetscapePluginView.h:
+        * Plugins.subproj/WebBaseNetscapePluginView.m:
+        (-[WebBaseNetscapePluginView sendNullEvent]): new
+        (-[WebBaseNetscapePluginView stopNullEvents]): stops timer
+        (-[WebBaseNetscapePluginView restartNullEvents]): stops timer if there is one, and starts a new one based on window activation state
+        (-[WebBaseNetscapePluginView start]): call restartNullEvents
+        (-[WebBaseNetscapePluginView stop]): call stopNullEvents
+        (-[WebBaseNetscapePluginView windowBecameKey:]): call restartNullEvents
+        (-[WebBaseNetscapePluginView windowResignedKey:]): call restartNullEvents
+        (-[WebBaseNetscapePluginView windowDidMiniaturize:]): call stopNullEvents
+        (-[WebBaseNetscapePluginView windowDidDeminiaturize:]): call restartNullEvents
+        * Plugins.subproj/WebNetscapePluginNullEventSender.h: Removed. No need for another class, use a timer.
+        * Plugins.subproj/WebNetscapePluginNullEventSender.m: Removed. No need for another class, use a timer.
+        * WebKit.pbproj/project.pbxproj:
+
 2002-11-20  Richard Williamson   <rjw at apple.com>
 
         Fixed 3107007.  Letter-spacing is causing width to be miscalculated.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index dac6ce6..fa6d848 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,22 @@
+2002-11-20  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed: 3079134 - Throttle plug-ins while in background
+
+        * Plugins.subproj/WebBaseNetscapePluginView.h:
+        * Plugins.subproj/WebBaseNetscapePluginView.m:
+        (-[WebBaseNetscapePluginView sendNullEvent]): new
+        (-[WebBaseNetscapePluginView stopNullEvents]): stops timer
+        (-[WebBaseNetscapePluginView restartNullEvents]): stops timer if there is one, and starts a new one based on window activation state
+        (-[WebBaseNetscapePluginView start]): call restartNullEvents
+        (-[WebBaseNetscapePluginView stop]): call stopNullEvents
+        (-[WebBaseNetscapePluginView windowBecameKey:]): call restartNullEvents
+        (-[WebBaseNetscapePluginView windowResignedKey:]): call restartNullEvents
+        (-[WebBaseNetscapePluginView windowDidMiniaturize:]): call stopNullEvents
+        (-[WebBaseNetscapePluginView windowDidDeminiaturize:]): call restartNullEvents
+        * Plugins.subproj/WebNetscapePluginNullEventSender.h: Removed. No need for another class, use a timer.
+        * Plugins.subproj/WebNetscapePluginNullEventSender.m: Removed. No need for another class, use a timer.
+        * WebKit.pbproj/project.pbxproj:
+
 2002-11-20  Richard Williamson   <rjw at apple.com>
 
         Fixed 3107007.  Letter-spacing is causing width to be miscalculated.
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.h b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.h
index deb3950..251fef4 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.h
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.h
@@ -16,8 +16,6 @@
 
 @interface WebBaseNetscapePluginView : NSView
 {
-    WebNetscapePluginNullEventSender *eventSender;
-
     WebNetscapePluginPackage *plugin;
     
     int mode;
@@ -40,6 +38,7 @@
     NSTrackingRectTag trackingTag;
     NSMutableArray *streams;
     NSMutableDictionary *streamNotifications;
+    NSTimer *nullEventTimer;
     
     NPP_NewProcPtr NPP_New;
     NPP_DestroyProcPtr NPP_Destroy;
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
index 6235bc0..32f84aa 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
@@ -11,7 +11,6 @@
 #import <WebKit/WebFramePrivate.h>
 #import <WebKit/WebKitLogging.h>
 #import <WebKit/WebNetscapePluginStream.h>
-#import <WebKit/WebNetscapePluginNullEventSender.h>
 #import <WebKit/WebNullPluginView.h>
 #import <WebKit/WebNSViewExtras.h>
 #import <WebKit/WebNetscapePluginPackage.h>
@@ -24,9 +23,12 @@
 #import <WebFoundation/WebNSURLExtras.h>
 
 #import <AppKit/NSEvent_Private.h>
-
 #import <Carbon/Carbon.h>
 
+// FIXME: Why .01? Why not 0? Why not a larger number?
+#define NullEventIntervalActive 	0.1
+#define NullEventIntervalNotActive	0.25
+
 @implementation WebBaseNetscapePluginView
 
 #pragma mark EVENTS
@@ -156,6 +158,50 @@
     return acceptedEvent;
 }
 
+-(void)sendNullEvent
+{
+    EventRecord event;
+
+    [self getCarbonEvent:&event];
+
+    // plug-in should not react to cursor position when not active.
+    // FIXME: How does passing a v and h of 0 prevent it from reacting to the cursor position?
+    if (![_window isKeyWindow]) {
+        event.where.v = 0;
+        event.where.h = 0;
+    }
+
+    [self sendEvent:&event];
+}
+
+- (void)stopNullEvents
+{
+    [nullEventTimer invalidate];
+    [nullEventTimer release];
+    nullEventTimer = nil;
+}
+
+- (void)restartNullEvents
+{
+    if(nullEventTimer){
+        [self stopNullEvents];
+    }
+
+    NSTimeInterval interval;
+    
+    if ([_window isKeyWindow]) {
+        interval = NullEventIntervalActive;
+    }else{
+        interval = NullEventIntervalNotActive;
+    }
+    
+    nullEventTimer = [[NSTimer scheduledTimerWithTimeInterval:interval
+                                                       target:self
+                                                     selector:@selector(sendNullEvent)
+                                                     userInfo:nil
+                                                      repeats:YES] retain];
+}
+
 - (BOOL)acceptsFirstResponder
 {
     return YES;
@@ -429,11 +475,10 @@
     LOG(Plugins, "NPP_New: %d", npErr);
     
     // Create a WindowRef is one doesn't already exist
-    [[self window] windowRef];
+    [_window windowRef];
         
     [self setWindow];
     
-    NSWindow *theWindow = [self window];
     NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
     NSView *view;
     for (view = self; view; view = [view superview]) {
@@ -443,26 +488,26 @@
             name:NSViewBoundsDidChangeNotification object:view];
     }
     [notificationCenter addObserver:self selector:@selector(windowWillClose:)
-        name:NSWindowWillCloseNotification object:theWindow];
+        name:NSWindowWillCloseNotification object:_window];
     [notificationCenter addObserver:self selector:@selector(windowBecameKey:) 
-        name:NSWindowDidBecomeKeyNotification object:theWindow];
+        name:NSWindowDidBecomeKeyNotification object:_window];
     [notificationCenter addObserver:self selector:@selector(windowResignedKey:) 
-        name:NSWindowDidResignKeyNotification object:theWindow];
+        name:NSWindowDidResignKeyNotification object:_window];
     [notificationCenter addObserver:self selector:@selector(defaultsHaveChanged:) 
         name:NSUserDefaultsDidChangeNotification object:nil];
     [notificationCenter addObserver:self selector:@selector(windowDidMiniaturize:)
-        name:NSWindowDidMiniaturizeNotification object:theWindow];
+        name:NSWindowDidMiniaturizeNotification object:_window];
     [notificationCenter addObserver:self selector:@selector(windowDidDeminiaturize:)
-        name:NSWindowDidDeminiaturizeNotification object:theWindow];
+        name:NSWindowDidDeminiaturizeNotification object:_window];
 
-    if ([theWindow isKeyWindow]) {
+    if ([_window isKeyWindow]) {
         [self sendActivateEvent:YES];
     }
     
-    eventSender = [[WebNetscapePluginNullEventSender alloc] initWithPluginView:self];
-    if (![theWindow isMiniaturized]) {
-        [eventSender sendNullEvents];
+    if (![_window isMiniaturized]) {
+        [self restartNullEvents];
     }
+    
     [self resetTrackingRect];
 }
 
@@ -480,8 +525,7 @@
     [streams makeObjectsPerformSelector:@selector(stop)];
     
     // Stop the null events
-    [eventSender stop];
-    [eventSender release];
+    [self stopNullEvents];
 
     // Set cursor back to arrow cursor
     [[NSCursor arrowCursor] set];
@@ -691,22 +735,24 @@
 {
     [self sendActivateEvent:YES];
     [self sendUpdateEvent];
+    [self restartNullEvents];
 }
 
 -(void)windowResignedKey:(NSNotification *)notification
 {
     [self sendActivateEvent:NO];
     [self sendUpdateEvent];
+    [self restartNullEvents];
 }
 
 -(void)windowDidMiniaturize:(NSNotification *)notification
 {
-    [eventSender stop];
+    [self stopNullEvents];
 }
 
 -(void)windowDidDeminiaturize:(NSNotification *)notification
 {
-    [eventSender sendNullEvents];
+    [self restartNullEvents];
 }
 
 - (void)defaultsHaveChanged:(NSNotification *)notification
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginNullEventSender.h b/WebKit/Plugins.subproj/WebNetscapePluginNullEventSender.h
deleted file mode 100644
index 0990087..0000000
--- a/WebKit/Plugins.subproj/WebNetscapePluginNullEventSender.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*	
-        WebNetscapePluginNullEventSender.h
-	Copyright 2002, Apple, Inc. All rights reserved.
-*/
-
-#import <Foundation/Foundation.h>
-
- at class WebBaseNetscapePluginView;
-
- at interface WebNetscapePluginNullEventSender : NSObject
-{
-    WebBaseNetscapePluginView *view;
-}
-
--(id)initWithPluginView:(WebBaseNetscapePluginView *)pluginView;
--(void)sendNullEvents;
--(void)stop;
-
- at end
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginNullEventSender.m b/WebKit/Plugins.subproj/WebNetscapePluginNullEventSender.m
deleted file mode 100644
index 72633cb..0000000
--- a/WebKit/Plugins.subproj/WebNetscapePluginNullEventSender.m
+++ /dev/null
@@ -1,56 +0,0 @@
-/*	
-        WebNetscapePluginNullEventSender.m
-	Copyright 2002, Apple, Inc. All rights reserved.
-*/
-
-#import <WebKit/WebBaseNetscapePluginView.h>
-#import <WebKit/WebKitLogging.h>
-#import <WebKit/WebNetscapePluginNullEventSender.h>
-
-#import <WebFoundation/WebAssertions.h>
-
-#import <Carbon/Carbon.h>
-
- at implementation WebNetscapePluginNullEventSender
-
--(id)initWithPluginView:(WebBaseNetscapePluginView *)pluginView
-{
-    [super init];
-    view = [pluginView retain];
-    return self;
-}
-
--(void)dealloc
-{
-    [view release];
-    [super dealloc];
-}
-
--(void)sendNullEvents
-{
-    EventRecord event;
-    
-    [WebBaseNetscapePluginView getCarbonEvent:&event];
-    
-    // plug-in should not react to cursor position when not active.
-    // FIXME: How does passing a v and h of 0 prevent it from reacting to the cursor position?
-    if (![[view window] isKeyWindow]) {
-        event.where.v = 0;
-        event.where.h = 0;
-    }
-    
-    [view sendEvent:&event];
-    
-    //LOG(Plugins, "NPP_HandleEvent(nullEvent): %d  when: %u %d", acceptedEvent, (unsigned)event.when, shouldStop);
-    
-    // FIXME: Why .01? Why not 0? Why not a larger number?
-    [self performSelector:@selector(sendNullEvents) withObject:nil afterDelay:.01];
-}
-
--(void)stop
-{
-    LOG(Plugins, "Stopping null events");
-    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(sendNullEvents) object:nil];
-}
-
- at end
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 6762cc5..50ddb6a 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -237,7 +237,6 @@
 				931A72D303265920008635CE,
 				657D8FA2036669BC00FA1ED0,
 				657D8FA3036669D800FA1ED0,
-				F5A672BB0263866E01000102,
 				F5F717240288493C018635CA,
 				657D8FA4036669DD00FA1ED0,
 				657D8FA5036669E300FA1ED0,
@@ -342,7 +341,6 @@
 				F5AEBB3E024A527601C1A526,
 				F59EAE420253C8DE018635CA,
 				F5883BE3025E5E9D01000102,
-				F5A672BC0263866E01000102,
 				F5A672BE0263866E01000102,
 				F5065223027F557E01C1A526,
 				F5065225027F557E01C1A526,
@@ -1766,8 +1764,6 @@
 				84D4BFFC0348EF9D00CA2ACA,
 				84D4BFF70348EF7600CA2ACA,
 				84D4BFF80348EF7600CA2ACA,
-				F5A672B70263866E01000102,
-				F5A672B80263866E01000102,
 				F5F7171E0288493C018635CA,
 				F5F7171F0288493C018635CA,
 				83402EF6035A588900BE770A,
@@ -3045,18 +3041,6 @@
 			settings = {
 			};
 		};
-		F5A672B70263866E01000102 = {
-			fileEncoding = 4;
-			isa = PBXFileReference;
-			path = WebNetscapePluginNullEventSender.h;
-			refType = 4;
-		};
-		F5A672B80263866E01000102 = {
-			fileEncoding = 4;
-			isa = PBXFileReference;
-			path = WebNetscapePluginNullEventSender.m;
-			refType = 4;
-		};
 		F5A672B90263866E01000102 = {
 			fileEncoding = 4;
 			isa = PBXFileReference;
@@ -3069,18 +3053,6 @@
 			path = WebBaseNetscapePluginStream.m;
 			refType = 4;
 		};
-		F5A672BB0263866E01000102 = {
-			fileRef = F5A672B70263866E01000102;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		F5A672BC0263866E01000102 = {
-			fileRef = F5A672B80263866E01000102;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
 		F5A672BD0263866E01000102 = {
 			fileRef = F5A672B90263866E01000102;
 			isa = PBXBuildFile;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list