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

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:44:23 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 9513bcf32e43dcc88ae0cea797a63cf9ed682038
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 25 00:31:02 2002 +0000

    Tests:
    
            * harness.c: (runtest): Turn off leak checking. It's broken.
    
            * qt/qdate-test.chk: Update test for changes to QDate.
            * qt/qdate-test.cpp: (main): Ditto.
    
            * qt/qtime-test.chk: Update test for changes to QTime.
            * qt/qtime-test.cpp: (main): Ditto.
    
    WebCore:
    
    	- fixed 3057928 -- lstat private/etc/localtime repeatedly reported
    	by fs_usage when mouse is moved
    
            * WebCore-tests.exp: Remove now-unneeded external entry points
    	for QTime, QDate, QDateTime.
    
            * kwq/qt/qdatetime.h:
            * kwq/KWQDateTime.mm:
    	Redid QDateTime using CoreFoundation instead of time/localtime.
    	This avoids constantly hitting the disk when getting the current
    	time to stuff into an event.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2155 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 7aa4d24..ac8dfb4 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,17 @@
+2002-09-24  Darin Adler  <darin at apple.com>
+
+	- fixed 3057928 -- lstat private/etc/localtime repeatedly reported
+	by fs_usage when mouse is moved
+
+        * WebCore-tests.exp: Remove now-unneeded external entry points
+	for QTime, QDate, QDateTime.
+
+        * kwq/qt/qdatetime.h:
+        * kwq/KWQDateTime.mm:
+	Redid QDateTime using CoreFoundation instead of time/localtime.
+	This avoids constantly hitting the disk when getting the current
+	time to stuff into an event.
+
 2002-09-24  David Hyatt  <hyatt at apple.com>
 
 	Make sure we dispatch both a capturing and a bubbling event
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 7aa4d24..ac8dfb4 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,17 @@
+2002-09-24  Darin Adler  <darin at apple.com>
+
+	- fixed 3057928 -- lstat private/etc/localtime repeatedly reported
+	by fs_usage when mouse is moved
+
+        * WebCore-tests.exp: Remove now-unneeded external entry points
+	for QTime, QDate, QDateTime.
+
+        * kwq/qt/qdatetime.h:
+        * kwq/KWQDateTime.mm:
+	Redid QDateTime using CoreFoundation instead of time/localtime.
+	This avoids constantly hitting the disk when getting the current
+	time to stuff into an event.
+
 2002-09-24  David Hyatt  <hyatt at apple.com>
 
 	Make sure we dispatch both a capturing and a bubbling event
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 7aa4d24..ac8dfb4 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,17 @@
+2002-09-24  Darin Adler  <darin at apple.com>
+
+	- fixed 3057928 -- lstat private/etc/localtime repeatedly reported
+	by fs_usage when mouse is moved
+
+        * WebCore-tests.exp: Remove now-unneeded external entry points
+	for QTime, QDate, QDateTime.
+
+        * kwq/qt/qdatetime.h:
+        * kwq/KWQDateTime.mm:
+	Redid QDateTime using CoreFoundation instead of time/localtime.
+	This avoids constantly hitting the disk when getting the current
+	time to stuff into an event.
+
 2002-09-24  David Hyatt  <hyatt at apple.com>
 
 	Make sure we dispatch both a capturing and a bubbling event
diff --git a/WebCore/WebCore-tests.exp b/WebCore/WebCore-tests.exp
index c4ecf24..1a364a6 100644
--- a/WebCore/WebCore-tests.exp
+++ b/WebCore/WebCore-tests.exp
@@ -112,7 +112,6 @@ __ZN4KURLC1ERKS_RK7QString
 __ZN4KURLC1Ev
 __ZN4KURLD1Ev
 __ZN5QDateC1Eiii
-__ZN5QDateC1Ev
 __ZN5QFile4openEi
 __ZN5QFile5closeEv
 __ZN5QFile6existsERK7QString
@@ -123,7 +122,6 @@ __ZN5QRectC1Eiiii
 __ZN5QRectC1Ev
 __ZN5QSizeC1Eii
 __ZN5QSizeC1Ev
-__ZN5QTime5startEv
 __ZN5QTime7elapsedEv
 __ZN5QTime7restartEv
 __ZN5QTimeC1Eii
@@ -170,7 +168,6 @@ __ZN8QCStringC1Ev
 __ZN8QCStringpLEPKc
 __ZN8QCStringpLEc
 __ZN9QDateTimeC1ERK5QDateRK5QTime
-__ZN9QDateTimeC1Ev
 __ZNK10KWQMapImpl11endInternalEv
 __ZNK10KWQMapImpl12findInternalEP14KWQMapNodeImpl
 __ZNK10KWQMapImpl13beginInternalEv
@@ -219,10 +216,6 @@ __ZNK5QChar5upperEv
 __ZNK5QChar7isDigitEv
 __ZNK5QChar7isPunctEv
 __ZNK5QChar7isSpaceEv
-__ZNK5QDate3dayEv
-__ZNK5QDate4yearEv
-__ZNK5QDate5monthEv
-__ZNK5QDate6daysToERKS_
 __ZNK5QFile4sizeEv
 __ZNK5QFile6existsEv
 __ZNK5QRect4sizeEv
@@ -233,12 +226,7 @@ __ZNK5QRect7isValidEv
 __ZNK5QRect9intersectERKS_
 __ZNK5QSize10expandedToERKS_
 __ZNK5QSize7isValidEv
-__ZNK5QTime4hourEv
 __ZNK5QTime4msecEv
-__ZNK5QTime6isNullEv
-__ZNK5QTime6minuteEv
-__ZNK5QTime6secondEv
-__ZNK5QTime6secsToERKS_
 __ZNK6QPoint15manhattanLengthEv
 __ZNK7QRegExp5matchERK7QStringiPib
 __ZNK7QRegExp7patternEv
@@ -276,7 +264,6 @@ __ZNK8QCString5lowerEv
 __ZNK8QCString6lengthEv
 __ZNK8QCString7isEmptyEv
 __ZNK8QCString8containsEcb
-__ZNK9QDateTime4timeEv
 __ZNK9QDateTime6secsToERKS_
 __ZTV14QPtrCollection
 __ZeqRK5QRectS1_
diff --git a/WebCore/kwq/KWQDateTime.h b/WebCore/kwq/KWQDateTime.h
index 7676ec5..d6a5a76 100644
--- a/WebCore/kwq/KWQDateTime.h
+++ b/WebCore/kwq/KWQDateTime.h
@@ -27,6 +27,7 @@
 #define QDATETIME_H_
 
 #include <KWQDef.h>
+#include <CoreFoundation/CFDate.h>
 
 #ifdef _KWQ_IOSTREAM_
 #include <iosfwd>
@@ -34,53 +35,32 @@
 
 class QTime {
 public:
-    QTime();
-    QTime(int, int);
+    QTime() : timeInSeconds(0) { }
+    explicit QTime(CFAbsoluteTime t) : timeInSeconds(t) { }
+    QTime(int hours, int minutes);
 
-    bool isNull() const;
-    int hour() const;
-    int minute() const;
-    int second() const;
     int msec() const;
-    void start();
+    void start() { timeInSeconds = CFAbsoluteTimeGetCurrent(); }
     int elapsed();
     int restart();
-    int secsTo( const QTime & ) const;
     
 private:
-    uint getCurrentTime();
-    void setCurrentTime();
-    
-    uint timeMS;  // time is stored in milliseconds 
+    CFAbsoluteTime timeInSeconds; 
     
     friend class QDateTime;
 #ifdef _KWQ_IOSTREAM_
     friend std::ostream &operator<<( std::ostream &, const QTime & );
 #endif
-    
 };
 
 class QDate {
 public:
-
-    QDate();
-    QDate(int, int, int);
+    QDate(int year, int month, int day);
         
-    int	   year() const;
-    int	   month() const;
-    int	   day() const;	
-    
-    int daysTo( const QDate & ) const;
-    
-protected:
-    uint greg2jul( int, int, int ) const;
-    void jul2greg( uint jd, int &y, int &m, int &d ) const;
-
 private:
-
-    int dateDays; //date is stored in days
-    
-    void setCurrentDate();
+    int year;
+    int month;
+    int day;
     
     friend class QDateTime;
 #ifdef _KWQ_IOSTREAM_
@@ -91,19 +71,17 @@ private:
 
 class QDateTime {
 public:
-
-    static QDateTime currentDateTime();
-
-    QDateTime();
+    QDateTime() : dateInSeconds(0) { }
+    explicit QDateTime(CFAbsoluteTime d) : dateInSeconds(d) { }
     QDateTime(const QDate &, const QTime &);
     
+    QTime time() { return QTime(dateInSeconds); }
     int secsTo(const QDateTime &) const;
-    QTime time() const;
-    void   setTime_t( uint );
     
+    static QDateTime currentDateTime() { return QDateTime(CFAbsoluteTimeGetCurrent()); }
+
 private:
-    QTime timeDT;
-    QDate dateDT;
+    CFAbsoluteTime dateInSeconds;
 
 #ifdef _KWQ_IOSTREAM_
     friend std::ostream &operator<<( std::ostream &, const QDateTime & );
diff --git a/WebCore/kwq/KWQDateTime.mm b/WebCore/kwq/KWQDateTime.mm
index 84e144f..5f070cd 100644
--- a/WebCore/kwq/KWQDateTime.mm
+++ b/WebCore/kwq/KWQDateTime.mm
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2001 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2001, 2002 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,280 +27,61 @@
 #import <qdatetime.h>
 #import <time.h>
 
-// QTime class ===============================================================
-
-// constructors, copy constructors, and destructors ----------------------------
-
-QTime::QTime()
-{
-    timeMS = 0;
-}    
-
-QTime::QTime(int hours, int minutes)
-{
-    timeMS = (hours*3600 + minutes*60)*1000; 
-}
-
-// member functions --------------------------------------------------------
-
-bool QTime::isNull() const
-{
-    return timeMS == 0;
-}
-
-void QTime::start()
-{
-    setCurrentTime();
-}
-
-int QTime::hour() const
+static CFTimeZoneRef systemTimeZone()
 {
-    return timeMS / 3600000;
+    static CFTimeZoneRef zone = CFTimeZoneCopySystem();
+    return zone;
 }
 
-
-int QTime::minute() const
-{
-    return (timeMS % 3600000)/60000;
-}
-
-
-int QTime::second() const
+QTime::QTime(int hours, int minutes)
 {
-    return (timeMS / 1000) % 60;
+    CFGregorianDate date;
+    date.year = 2001;
+    date.month = 1;
+    date.day = 1;
+    date.hour = hours;
+    date.minute = minutes;
+    date.second = 0;
+    timeInSeconds = CFGregorianDateGetAbsoluteTime(date, systemTimeZone());
 }
 
-
-
 int QTime::msec() const
 {
-    return timeMS % 1000;
+    CFAbsoluteTime seconds = CFAbsoluteTimeGetGregorianDate(timeInSeconds, systemTimeZone()).second;
+    return (int)(seconds * 1000) % 1000;
 }
 
 int QTime::elapsed()
 {
-    int currentTime, elapsedTime;
-    
-    currentTime = getCurrentTime();
-    elapsedTime = currentTime - timeMS;
-    while (elapsedTime < 0) {
-        elapsedTime = elapsedTime + 86400000; // watch out for the next day
-    }
-    
-    return elapsedTime;
+    CFTimeInterval elapsed = CFAbsoluteTimeGetCurrent() - timeInSeconds;
+    return (int)(elapsed * 1000);
 }
 
-
 int QTime::restart()
 {
-    int currentTime, elapsedTime;
-    
-    currentTime = getCurrentTime();
-    elapsedTime = currentTime - timeMS;
-    while (elapsedTime < 0) {
-        elapsedTime = elapsedTime + 86400000; // watch out for the next day
-    }
-    timeMS = currentTime;
-    
-    return elapsedTime;
-
-}
-
-int QTime::secsTo( const QTime &time ) const
-{
-    return ((int)time.timeMS - (int)timeMS)/1000;
-}
-
-// private ---------------------------------------------------------------------
-
-void QTime::setCurrentTime()
-{
-    time_t currentTime;
-    tm *localTime;
-    
-    time(&currentTime);
-    localTime = localtime(&currentTime);
-    timeMS =  (localTime->tm_hour*3600 + localTime->tm_min*60 + localTime->tm_sec) * 1000;
-}
-
-uint QTime::getCurrentTime()
-{
-    time_t currentTime;
-    tm *localTime;
-    
-    time(&currentTime);
-    localTime = localtime(&currentTime);
-    return (localTime->tm_hour*3600 + localTime->tm_min*60 + localTime->tm_sec) * 1000;
-}
-
-
-
-
-// class QDate =================================================================
-
-QDate::QDate()
-{
- // do nothing
-}
-
-QDate::QDate(int year, int month, int day)
-{
-    dateDays = greg2jul(year, month, day);
-}
-
-
-int QDate::year() const
-{
-    int year, month, day;
-    
-    jul2greg(dateDays, year, month, day);
-    
-    return year;
-}
-
-
-int QDate::month() const
-{
-    int year, month, day;
-    
-    jul2greg(dateDays, year, month, day);
-    
-    return month;
-}
-
-
-int QDate::day() const
-{
-    int year, month, day;
-    
-    jul2greg(dateDays, year, month, day);
-    
-    return day;
-}
-
-int QDate::daysTo( const QDate &date ) const
-{
-    return date.dateDays - dateDays;
-}
-
-
-// member functions --------------------------------------------------------
-// private -----------------------------------------------------------------
-void QDate::setCurrentDate()
-{
-    time_t currentDate;
-    tm *localDate;
-    
-    time(&currentDate);
-    localDate = localtime(&currentDate);
-    dateDays = greg2jul(localDate->tm_year + 1900, localDate->tm_mon + 1, localDate->tm_mday);
-}
-
-// greg2jul and jul2greg algorithms are copied from Communications of the ACM, Vol 6, No 8
-// variable names changed slightly from _qdatetime.cpp
-
-
-uint QDate::greg2jul( int year, int month, int day ) const
-{
-    uint c, ya;
-    
-    if ( year <= 99 ){
-	year += 1900;
-    }
-    if ( month > 2 ) {
-	month -= 3;
-    } else {
-	month += 9;
-	year--;
-    }
-    c = year;					
-    c /= 100;
-    ya = year - 100*c;
-    return 1721119 + day + (146097*c)/4 + (1461*ya)/4 + (153*month+2)/5;
-}
-
-void QDate::jul2greg( uint ms, int &year, int &month, int &day ) const
-{
-    uint x, julian;
-    
-    julian = ms - 1721119;
-    year = (julian*4 - 1)/146097;
-    julian = julian*4 - 146097*year - 1;
-    x = julian/4;
-    julian = (x*4 + 3) / 1461;
-    year = 100*year + julian;
-    x = (x*4) + 3 - 1461*julian;
-    x = (x + 4)/4;
-    month = (5*x - 3)/153;
-    x = 5*x - 3 - 153*month;
-    day = (x + 5)/5;
-    if ( month < 10 ) {
-	month += 3;
-    } else {
-	month -= 9;
-	year++;
-    }
-}
-
-
-// class QDateTime =============================================================
-
-
-// static member functions -------------------------------------------------
-
-QDateTime QDateTime::currentDateTime()
-{
-    QTime currentTime;
-    QDate currentDate;
-    
-    currentTime.setCurrentTime();
-    currentDate.setCurrentDate();
-    return QDateTime( currentDate, currentTime );
+    CFAbsoluteTime currentTime = CFAbsoluteTimeGetCurrent();
+    CFTimeInterval elapsed = currentTime - timeInSeconds;    
+    timeInSeconds = currentTime;
+    return (int)(elapsed * 1000);
 }
 
-// constructors, copy constructors, and destructors ------------------------
-
-QDateTime::QDateTime()
+QDate::QDate(int y, int m, int d)
+    : year(y), month(m), day(d)
 {
- //do nothing
 }
 
-QDateTime::QDateTime(const QDate &newDate, const QTime &newTime)
+QDateTime::QDateTime(const QDate &d, const QTime &t)
 {
-    dateDT = newDate;
-    timeDT = newTime;
+    CFGregorianDate dateWithTime = CFAbsoluteTimeGetGregorianDate(t.timeInSeconds, systemTimeZone());
+    dateWithTime.year = d.year;
+    dateWithTime.month = d.month;
+    dateWithTime.day = d.day;
+    dateInSeconds = CFGregorianDateGetAbsoluteTime(dateWithTime, systemTimeZone());
 }
 
-// member functions --------------------------------------------------------
-
-int QDateTime::secsTo( const QDateTime &newerDateTime ) const
-{
-    return timeDT.secsTo(newerDateTime.timeDT) + dateDT.daysTo(newerDateTime.dateDT)*86400;
-}
-
-QTime QDateTime::time() const
-{
-    return timeDT;
-}
-
-// FIXME: Use Apple stuff? This is too much like qt's setTime_t.
-
-void QDateTime::setTime_t(uint secsSince1Jan1970UTC)
+int QDateTime::secsTo(const QDateTime &b) const
 {
-    time_t myTime = (time_t) secsSince1Jan1970UTC;
-    tm *localTime;
-    
-    localTime = localtime( &myTime );
-    if (!localTime) {
-	localTime = gmtime( &myTime );
-	if ( !localTime ) {
-	    dateDT.dateDays = dateDT.greg2jul( 1970, 1, 1);
-	    timeDT.timeMS = 0;
-	    return;
-	}
-    }
-    dateDT.dateDays = dateDT.greg2jul(localTime->tm_year + 1900, localTime->tm_mon + 1, localTime->tm_mday );
-    timeDT.timeMS = 3600000*localTime->tm_hour + 60000*localTime->tm_min + 1000*localTime->tm_sec;
+    return (int)(b.dateInSeconds - dateInSeconds);
 }
 
 #ifdef _KWQ_IOSTREAM_
@@ -309,23 +90,24 @@ std::ostream &operator<<(std::ostream &o, const QDate &date)
 {
     return o <<
         "QDate: [yy/mm/dd: " <<
-        date.year() <<
+        date.year <<
         '/' <<
-        date.month() <<
+        date.month <<
         '/' <<
-        date.day() <<
+        date.day <<
         ']';
 }
 
 std::ostream &operator<<(std::ostream &o, const QTime &time)
 {
+    CFGregorianDate g = CFAbsoluteTimeGetGregorianDate(time.timeInSeconds, systemTimeZone());
     return o <<
         "QTime: [hh:mm:ss:ms = " <<
-        time.hour() <<
+        (int)g.hour <<
         ':' <<
-        time.minute() <<
+        (int)g.minute <<
         ':' <<
-        time.second() <<
+        (int)g.second <<
         ':' <<
         time.msec() <<
         ']';
@@ -333,21 +115,22 @@ std::ostream &operator<<(std::ostream &o, const QTime &time)
 
 std::ostream &operator<<(std::ostream &o, const QDateTime &dateTime)
 {
+    CFGregorianDate g = CFAbsoluteTimeGetGregorianDate(dateTime.dateInSeconds, systemTimeZone());
     return o <<
         "QDateTime: [yy/mm/dd hh:mm:ss:ms = " <<
-        dateTime.dateDT.year() <<
+        (int)g.year <<
         '/' <<
-        dateTime.dateDT.month() <<
+        (int)g.month <<
         '/' <<
-        dateTime.dateDT.day() <<
+        (int)g.day <<
         ' ' << 
-        dateTime.timeDT.hour() <<
+        (int)g.hour <<
         ':' <<
-        dateTime.timeDT.minute() <<
+        (int)g.minute <<
         ':' <<
-        dateTime.timeDT.second() <<
+        (int)g.second <<
         ':' <<
-        dateTime.timeDT.msec() <<
+        ((int)(g.second * 1000) % 1000) <<
         ']';
 }
 
diff --git a/WebCore/kwq/qt/qdatetime.h b/WebCore/kwq/qt/qdatetime.h
index 7676ec5..d6a5a76 100644
--- a/WebCore/kwq/qt/qdatetime.h
+++ b/WebCore/kwq/qt/qdatetime.h
@@ -27,6 +27,7 @@
 #define QDATETIME_H_
 
 #include <KWQDef.h>
+#include <CoreFoundation/CFDate.h>
 
 #ifdef _KWQ_IOSTREAM_
 #include <iosfwd>
@@ -34,53 +35,32 @@
 
 class QTime {
 public:
-    QTime();
-    QTime(int, int);
+    QTime() : timeInSeconds(0) { }
+    explicit QTime(CFAbsoluteTime t) : timeInSeconds(t) { }
+    QTime(int hours, int minutes);
 
-    bool isNull() const;
-    int hour() const;
-    int minute() const;
-    int second() const;
     int msec() const;
-    void start();
+    void start() { timeInSeconds = CFAbsoluteTimeGetCurrent(); }
     int elapsed();
     int restart();
-    int secsTo( const QTime & ) const;
     
 private:
-    uint getCurrentTime();
-    void setCurrentTime();
-    
-    uint timeMS;  // time is stored in milliseconds 
+    CFAbsoluteTime timeInSeconds; 
     
     friend class QDateTime;
 #ifdef _KWQ_IOSTREAM_
     friend std::ostream &operator<<( std::ostream &, const QTime & );
 #endif
-    
 };
 
 class QDate {
 public:
-
-    QDate();
-    QDate(int, int, int);
+    QDate(int year, int month, int day);
         
-    int	   year() const;
-    int	   month() const;
-    int	   day() const;	
-    
-    int daysTo( const QDate & ) const;
-    
-protected:
-    uint greg2jul( int, int, int ) const;
-    void jul2greg( uint jd, int &y, int &m, int &d ) const;
-
 private:
-
-    int dateDays; //date is stored in days
-    
-    void setCurrentDate();
+    int year;
+    int month;
+    int day;
     
     friend class QDateTime;
 #ifdef _KWQ_IOSTREAM_
@@ -91,19 +71,17 @@ private:
 
 class QDateTime {
 public:
-
-    static QDateTime currentDateTime();
-
-    QDateTime();
+    QDateTime() : dateInSeconds(0) { }
+    explicit QDateTime(CFAbsoluteTime d) : dateInSeconds(d) { }
     QDateTime(const QDate &, const QTime &);
     
+    QTime time() { return QTime(dateInSeconds); }
     int secsTo(const QDateTime &) const;
-    QTime time() const;
-    void   setTime_t( uint );
     
+    static QDateTime currentDateTime() { return QDateTime(CFAbsoluteTimeGetCurrent()); }
+
 private:
-    QTime timeDT;
-    QDate dateDT;
+    CFAbsoluteTime dateInSeconds;
 
 #ifdef _KWQ_IOSTREAM_
     friend std::ostream &operator<<( std::ostream &, const QDateTime & );

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list