Commit 6d0ef6fb authored by darin@apple.com's avatar darin@apple.com
Browse files

2008-11-03 Darin Adler <darin@apple.com>

        Reviewed by Tim Hatcher.

        - https://bugs.webkit.org/show_bug.cgi?id=22061
          create script to check for exit-time destructors

        * WebCore.xcodeproj/project.pbxproj: Added a script
        phase that runs the check-for-exit-time-destructors script.

        * html/HTMLAttributeNames.in: Removed some unused attribute names.

        * html/HTMLEmbedElement.cpp:
        (WebCore::HTMLEmbedElement::parseMappedAttribute): Removed code that
        sets the write-only m_pluginPage.
        * html/HTMLEmbedElement.h: Ditto.

        * platform/mac/CursorMac.mm:
        (WebCore::leakNamedCursor): Changed to return a Cursor&.
        (WebCore::pointerCursor): Changed to leak an object to avoid an
        exit-time destructor.
        (WebCore::crossCursor): Ditto.
        (WebCore::handCursor): Ditto.
        (WebCore::moveCursor): Ditto.
        (WebCore::verticalTextCursor): Ditto.
        (WebCore::cellCursor): Ditto.
        (WebCore::contextMenuCursor): Ditto.
        (WebCore::aliasCursor): Ditto.
        (WebCore::zoomInCursor): Ditto.
        (WebCore::zoomOutCursor): Ditto.
        (WebCore::copyCursor): Ditto.
        (WebCore::noneCursor): Ditto.
        (WebCore::progressCursor): Ditto.
        (WebCore::noDropCursor): Ditto.
        (WebCore::notAllowedCursor): Ditto.
        (WebCore::iBeamCursor): Ditto.
        (WebCore::waitCursor): Ditto.
        (WebCore::helpCursor): Ditto.
        (WebCore::eastResizeCursor): Ditto.
        (WebCore::northResizeCursor): Ditto.
        (WebCore::northEastResizeCursor): Ditto.
        (WebCore::northWestResizeCursor): Ditto.
        (WebCore::southResizeCursor): Ditto.
        (WebCore::southEastResizeCursor): Ditto.
        (WebCore::southWestResizeCursor): Ditto.
        (WebCore::westResizeCursor): Ditto.
        (WebCore::northSouthResizeCursor): Ditto.
        (WebCore::eastWestResizeCursor): Ditto.
        (WebCore::northEastSouthWestResizeCursor): Ditto.
        (WebCore::northWestSouthEastResizeCursor): Ditto.
        (WebCore::columnResizeCursor): Ditto.
        (WebCore::rowResizeCursor): Ditto.
        (WebCore::grabCursor): Ditto.
        (WebCore::grabbingCursor): Ditto.

        * storage/Database.cpp:
        (WebCore::guidMutex): Changed to leak an object to avoid an
        exit-time destructor. Also added a comment explaining why it's
        thread safe.
        (WebCore::guidToVersionMap): Ditto.
        (WebCore::guidToDatabaseMap): Ditto.
        (WebCore::Database::databaseInfoTableName): Ditto.
        (WebCore::databaseVersionKey): Ditto.
        (WebCore::Database::getVersionFromDatabase): Ditto.
        (WebCore::Database::setVersionInDatabase): Ditto.
        (WebCore::guidForOriginAndName): Ditto.
        * storage/DatabaseTracker.cpp:
        (WebCore::DatabaseTracker::tracker): Ditto.
        (WebCore::notificationMutex): Ditto.
        (WebCore::notificationQueue): Ditto.
        (WebCore::DatabaseTracker::notifyDatabasesChanged): Ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38104 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent dd69d23f
2008-11-03 Darin Adler <darin@apple.com>
Reviewed by Tim Hatcher.
- https://bugs.webkit.org/show_bug.cgi?id=22061
create script to check for exit-time destructors
* WebCore.xcodeproj/project.pbxproj: Added a script
phase that runs the check-for-exit-time-destructors script.
* html/HTMLAttributeNames.in: Removed some unused attribute names.
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::parseMappedAttribute): Removed code that
sets the write-only m_pluginPage.
* html/HTMLEmbedElement.h: Ditto.
* platform/mac/CursorMac.mm:
(WebCore::leakNamedCursor): Changed to return a Cursor&.
(WebCore::pointerCursor): Changed to leak an object to avoid an
exit-time destructor.
(WebCore::crossCursor): Ditto.
(WebCore::handCursor): Ditto.
(WebCore::moveCursor): Ditto.
(WebCore::verticalTextCursor): Ditto.
(WebCore::cellCursor): Ditto.
(WebCore::contextMenuCursor): Ditto.
(WebCore::aliasCursor): Ditto.
(WebCore::zoomInCursor): Ditto.
(WebCore::zoomOutCursor): Ditto.
(WebCore::copyCursor): Ditto.
(WebCore::noneCursor): Ditto.
(WebCore::progressCursor): Ditto.
(WebCore::noDropCursor): Ditto.
(WebCore::notAllowedCursor): Ditto.
(WebCore::iBeamCursor): Ditto.
(WebCore::waitCursor): Ditto.
(WebCore::helpCursor): Ditto.
(WebCore::eastResizeCursor): Ditto.
(WebCore::northResizeCursor): Ditto.
(WebCore::northEastResizeCursor): Ditto.
(WebCore::northWestResizeCursor): Ditto.
(WebCore::southResizeCursor): Ditto.
(WebCore::southEastResizeCursor): Ditto.
(WebCore::southWestResizeCursor): Ditto.
(WebCore::westResizeCursor): Ditto.
(WebCore::northSouthResizeCursor): Ditto.
(WebCore::eastWestResizeCursor): Ditto.
(WebCore::northEastSouthWestResizeCursor): Ditto.
(WebCore::northWestSouthEastResizeCursor): Ditto.
(WebCore::columnResizeCursor): Ditto.
(WebCore::rowResizeCursor): Ditto.
(WebCore::grabCursor): Ditto.
(WebCore::grabbingCursor): Ditto.
* storage/Database.cpp:
(WebCore::guidMutex): Changed to leak an object to avoid an
exit-time destructor. Also added a comment explaining why it's
thread safe.
(WebCore::guidToVersionMap): Ditto.
(WebCore::guidToDatabaseMap): Ditto.
(WebCore::Database::databaseInfoTableName): Ditto.
(WebCore::databaseVersionKey): Ditto.
(WebCore::Database::getVersionFromDatabase): Ditto.
(WebCore::Database::setVersionInDatabase): Ditto.
(WebCore::guidForOriginAndName): Ditto.
* storage/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::tracker): Ditto.
(WebCore::notificationMutex): Ditto.
(WebCore::notificationQueue): Ditto.
(WebCore::DatabaseTracker::notifyDatabasesChanged): Ditto.
2008-11-04 Simon Fraser <simon.fraser@apple.com>
 
Reviewed by Dave Hyatt
......
......@@ -16180,6 +16180,7 @@
1C5F9D760E09A1B400E91D0A /* Streamline Inspector Source */,
93F19A0C08245E59001E9ABC /* Sources */,
939D050109D9FF6B00984996 /* Check For Global Initializers */,
933457E60EBFDF6B00B80894 /* Check For Exit Time Destructors */,
5D0D540D0E9862F60029E223 /* Check For Weak VTables */,
93F19B1208245E59001E9ABC /* Frameworks */,
1CB71D4A0B02658D0061EA45 /* Generate 64-bit Export File */,
......@@ -16377,6 +16378,20 @@
shellPath = /bin/sh;
shellScript = "# Touch Info.plist to let Xcode know it needs to copy it into the built product\ntouch \"$SRCROOT/Info.plist\"\n";
};
933457E60EBFDF6B00B80894 /* Check For Exit Time Destructors */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check For Exit Time Destructors";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ -f ../WebKitTools/Scripts/check-for-exit-time-destructors ]; then\n ../WebKitTools/Scripts/check-for-exit-time-destructors || exit $?\nfi";
};
939D050109D9FF6B00984996 /* Check For Global Initializers */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
......@@ -84,7 +84,6 @@ keytype
label
lang
language
left
leftmargin
link
longdesc
......@@ -155,12 +154,7 @@ onwebkitanimationstart
onwebkitanimationiteration
onwebkitanimationend
onwebkittransitionend
pagex
pagey
placeholder
plain
pluginpage
pluginspage
pluginurl
poster
precision
......
......@@ -103,9 +103,7 @@ void HTMLEmbedElement::parseMappedAttribute(MappedAttribute* attr)
m_imageLoader.set(new HTMLImageLoader(this));
m_imageLoader->updateFromElement();
}
} else if (attr->name() == pluginpageAttr || attr->name() == pluginspageAttr)
m_pluginPage = value;
else if (attr->name() == hiddenAttr) {
} else if (attr->name() == hiddenAttr) {
if (equalIgnoringCase(value.string(), "yes") || equalIgnoringCase(value.string(), "true")) {
// FIXME: Not dynamic, since we add this but don't remove it, but it may be OK for now
// that this rarely-used attribute won't work properly if you remove it.
......
......@@ -63,7 +63,6 @@ public:
virtual void getSubresourceAttributeStrings(Vector<String>&) const;
private:
String m_pluginPage;
bool m_needWidgetUpdate;
};
......
......@@ -56,7 +56,7 @@ static NSCursor* createCustomCursor(Image* image, const IntPoint& hotspot)
// Leak these cursors intentionally, that way we won't waste time trying to clean them
// up at process exit time.
static NSCursor* leakNamedCursor(const char* name, int x, int y)
static Cursor& leakNamedCursor(const char* name, int x, int y)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
NSString* resourceName = [[NSString alloc] initWithUTF8String:name];
......@@ -70,9 +70,9 @@ static NSCursor* leakNamedCursor(const char* name, int x, int y)
cursor = [[NSCursor alloc] initWithImage:cursorImage hotSpot:hotSpotPoint];
[cursorImage release];
}
return cursor;
return *new Cursor(cursor);
END_BLOCK_OBJC_EXCEPTIONS;
return 0;
return *new Cursor;
}
Cursor::Cursor(Image* image, const IntPoint& hotspot)
......@@ -105,193 +105,193 @@ Cursor::Cursor(NSCursor* c)
const Cursor& pointerCursor()
{
static Cursor c = [NSCursor arrowCursor];
static Cursor& c = *new Cursor([NSCursor arrowCursor]);
return c;
}
const Cursor& crossCursor()
{
static Cursor c = leakNamedCursor("crossHairCursor", 11, 11);
static Cursor& c = leakNamedCursor("crossHairCursor", 11, 11);
return c;
}
const Cursor& handCursor()
{
static Cursor c = leakNamedCursor("linkCursor", 6, 1);
static Cursor& c = leakNamedCursor("linkCursor", 6, 1);
return c;
}
const Cursor& moveCursor()
{
static Cursor c = leakNamedCursor("moveCursor", 7, 7);
static Cursor& c = leakNamedCursor("moveCursor", 7, 7);
return c;
}
const Cursor& verticalTextCursor()
{
static Cursor c = leakNamedCursor("verticalTextCursor", 7, 7);
static Cursor& c = leakNamedCursor("verticalTextCursor", 7, 7);
return c;
}
const Cursor& cellCursor()
{
static Cursor c = leakNamedCursor("cellCursor", 7, 7);
static Cursor& c = leakNamedCursor("cellCursor", 7, 7);
return c;
}
const Cursor& contextMenuCursor()
{
static Cursor c = leakNamedCursor("contextMenuCursor", 3, 2);
static Cursor& c = leakNamedCursor("contextMenuCursor", 3, 2);
return c;
}
const Cursor& aliasCursor()
{
static Cursor c = leakNamedCursor("aliasCursor", 11, 3);
static Cursor& c = leakNamedCursor("aliasCursor", 11, 3);
return c;
}
const Cursor& zoomInCursor()
{
static Cursor c = leakNamedCursor("zoomInCursor", 7, 7);
static Cursor& c = leakNamedCursor("zoomInCursor", 7, 7);
return c;
}
const Cursor& zoomOutCursor()
{
static Cursor c = leakNamedCursor("zoomOutCursor", 7, 7);
static Cursor& c = leakNamedCursor("zoomOutCursor", 7, 7);
return c;
}
const Cursor& copyCursor()
{
static Cursor c = leakNamedCursor("copyCursor", 3, 2);
static Cursor& c = leakNamedCursor("copyCursor", 3, 2);
return c;
}
const Cursor& noneCursor()
{
static Cursor c = leakNamedCursor("noneCursor", 7, 7);
static Cursor& c = leakNamedCursor("noneCursor", 7, 7);
return c;
}
const Cursor& progressCursor()
{
static Cursor c = leakNamedCursor("progressCursor", 3, 2);
static Cursor& c = leakNamedCursor("progressCursor", 3, 2);
return c;
}
const Cursor& noDropCursor()
{
static Cursor c = leakNamedCursor("noDropCursor", 3, 1);
static Cursor& c = leakNamedCursor("noDropCursor", 3, 1);
return c;
}
const Cursor& notAllowedCursor()
{
static Cursor c = leakNamedCursor("notAllowedCursor", 11, 11);
static Cursor& c = leakNamedCursor("notAllowedCursor", 11, 11);
return c;
}
const Cursor& iBeamCursor()
{
static Cursor c = [NSCursor IBeamCursor];
static Cursor& c = *new Cursor([NSCursor IBeamCursor]);
return c;
}
const Cursor& waitCursor()
{
static Cursor c = leakNamedCursor("waitCursor", 7, 7);
static Cursor& c = leakNamedCursor("waitCursor", 7, 7);
return c;
}
const Cursor& helpCursor()
{
static Cursor c = leakNamedCursor("helpCursor", 8, 8);
static Cursor& c = leakNamedCursor("helpCursor", 8, 8);
return c;
}
const Cursor& eastResizeCursor()
{
static Cursor c = leakNamedCursor("eastResizeCursor", 14, 7);
static Cursor& c = leakNamedCursor("eastResizeCursor", 14, 7);
return c;
}
const Cursor& northResizeCursor()
{
static Cursor c = leakNamedCursor("northResizeCursor", 7, 1);
static Cursor& c = leakNamedCursor("northResizeCursor", 7, 1);
return c;
}
const Cursor& northEastResizeCursor()
{
static Cursor c = leakNamedCursor("northEastResizeCursor", 14, 1);
static Cursor& c = leakNamedCursor("northEastResizeCursor", 14, 1);
return c;
}
const Cursor& northWestResizeCursor()
{
static Cursor c = leakNamedCursor("northWestResizeCursor", 0, 0);
static Cursor& c = leakNamedCursor("northWestResizeCursor", 0, 0);
return c;
}
const Cursor& southResizeCursor()
{
static Cursor c = leakNamedCursor("southResizeCursor", 7, 14);
static Cursor& c = leakNamedCursor("southResizeCursor", 7, 14);
return c;
}
const Cursor& southEastResizeCursor()
{
static Cursor c = leakNamedCursor("southEastResizeCursor", 14, 14);
static Cursor& c = leakNamedCursor("southEastResizeCursor", 14, 14);
return c;
}
const Cursor& southWestResizeCursor()
{
static Cursor c = leakNamedCursor("southWestResizeCursor", 1, 14);
static Cursor& c = leakNamedCursor("southWestResizeCursor", 1, 14);
return c;
}
const Cursor& westResizeCursor()
{
static Cursor c = leakNamedCursor("westResizeCursor", 1, 7);
static Cursor& c = leakNamedCursor("westResizeCursor", 1, 7);
return c;
}
const Cursor& northSouthResizeCursor()
{
static Cursor c = leakNamedCursor("northSouthResizeCursor", 7, 7);
static Cursor& c = leakNamedCursor("northSouthResizeCursor", 7, 7);
return c;
}
const Cursor& eastWestResizeCursor()
{
static Cursor c = leakNamedCursor("eastWestResizeCursor", 7, 7);
static Cursor& c = leakNamedCursor("eastWestResizeCursor", 7, 7);
return c;
}
const Cursor& northEastSouthWestResizeCursor()
{
static Cursor c = leakNamedCursor("northEastSouthWestResizeCursor", 7, 7);
static Cursor& c = leakNamedCursor("northEastSouthWestResizeCursor", 7, 7);
return c;
}
const Cursor& northWestSouthEastResizeCursor()
{
static Cursor c = leakNamedCursor("northWestSouthEastResizeCursor", 7, 7);
static Cursor& c = leakNamedCursor("northWestSouthEastResizeCursor", 7, 7);
return c;
}
const Cursor& columnResizeCursor()
{
static Cursor c = [NSCursor resizeLeftRightCursor];
static Cursor& c = *new Cursor([NSCursor resizeLeftRightCursor]);
return c;
}
const Cursor& rowResizeCursor()
{
static Cursor c = [NSCursor resizeUpDownCursor];
static Cursor& c = *new Cursor([NSCursor resizeUpDownCursor]);
return c;
}
......@@ -342,13 +342,13 @@ const Cursor& westPanningCursor()
const Cursor& grabCursor()
{
static Cursor c = [NSCursor openHandCursor];
static Cursor& c = *new Cursor([NSCursor openHandCursor]);
return c;
}
const Cursor& grabbingCursor()
{
static Cursor c = [NSCursor closedHandCursor];
static Cursor& c = *new Cursor([NSCursor closedHandCursor]);
return c;
}
......
......@@ -55,32 +55,34 @@ namespace WebCore {
static Mutex& guidMutex()
{
// FIXME: this is not a thread-safe way to initialize a shared global.
static Mutex mutex;
// Note: We don't have to use AtomicallyInitializedStatic here because
// this function is called once in the constructor on the main thread
// before any other threads that call this function are used.
static Mutex& mutex = *new Mutex;
return mutex;
}
static HashMap<int, String>& guidToVersionMap()
{
static HashMap<int, String> map;
static HashMap<int, String>& map = *new HashMap<int, String>;
return map;
}
static HashMap<int, HashSet<Database*>*>& guidToDatabaseMap()
{
static HashMap<int, HashSet<Database*>*> map;
static HashMap<int, HashSet<Database*>*>& map = *new HashMap<int, HashSet<Database*>*>;
return map;
}
const String& Database::databaseInfoTableName()
{
static String name = "__WebKitDatabaseInfoTable__";
static String& name = *new String("__WebKitDatabaseInfoTable__");
return name;
}
static const String& databaseVersionKey()
{
static String key = "WebKitDatabaseVersionKey";
static String& key = *new String("WebKitDatabaseVersionKey");
return key;
}
......@@ -216,7 +218,7 @@ static bool retrieveTextResultFromDatabase(SQLiteDatabase& db, const String& que
bool Database::getVersionFromDatabase(String& version)
{
static String getVersionQuery = "SELECT value FROM " + databaseInfoTableName() + " WHERE key = '" + databaseVersionKey() + "';";
static String& getVersionQuery = *new String("SELECT value FROM " + databaseInfoTableName() + " WHERE key = '" + databaseVersionKey() + "';");
m_databaseAuthorizer->disable();
......@@ -252,7 +254,7 @@ static bool setTextValueInDatabase(SQLiteDatabase& db, const String& query, cons
bool Database::setVersionInDatabase(const String& version)
{
static String setVersionQuery = "INSERT INTO " + databaseInfoTableName() + " (key, value) VALUES ('" + databaseVersionKey() + "', ?);";
static String& setVersionQuery = *new String("INSERT INTO " + databaseInfoTableName() + " (key, value) VALUES ('" + databaseVersionKey() + "', ?);");
m_databaseAuthorizer->disable();
......@@ -352,19 +354,21 @@ void Database::enableAuthorizer()
static int guidForOriginAndName(const String& origin, const String& name)
{
static int currentNewGUID = 1;
static Mutex stringIdentifierMutex;
static HashMap<String, int> stringIdentifierToGUIDMap;
String stringID;
if (origin.endsWith("/"))
stringID = origin + name;
else
stringID = origin + "/" + name;
// Note: We don't have to use AtomicallyInitializedStatic here because
// this function is called once in the constructor on the main thread
// before any other threads that call this function are used.
static Mutex& stringIdentifierMutex = *new Mutex;
MutexLocker locker(stringIdentifierMutex);
static HashMap<String, int>& stringIdentifierToGUIDMap = *new HashMap<String, int>;
int guid = stringIdentifierToGUIDMap.get(stringID);
if (!guid) {
static int currentNewGUID = 1;
guid = currentNewGUID++;
stringIdentifierToGUIDMap.set(stringID, guid);
}
......
......@@ -55,7 +55,7 @@ OriginQuotaManager& DatabaseTracker::originQuotaManager()
DatabaseTracker& DatabaseTracker::tracker()
{
static DatabaseTracker tracker;
static DatabaseTracker& tracker = *new DatabaseTracker;
return tracker;
}
......@@ -771,13 +771,15 @@ void DatabaseTracker::setClient(DatabaseTrackerClient* client)
static Mutex& notificationMutex()
{
static Mutex mutex;
static Mutex& mutex = *new Mutex;
return mutex;
}
static Vector<pair<SecurityOrigin*, String> >& notificationQueue()
typedef Vector<pair<SecurityOrigin*, String> > NotificationQueue;
static NotificationQueue& notificationQueue()
{
static Vector<pair<SecurityOrigin*, String> > queue;
static NotificationQueue& queue = *new NotificationQueue;
return queue;
}
......@@ -807,7 +809,7 @@ void DatabaseTracker::notifyDatabasesChanged(void*)
// mechanism to include which tracker the notification goes out on as well.
DatabaseTracker& theTracker(tracker());
Vector<pair<SecurityOrigin*, String> > notifications;
NotificationQueue notifications;
{
MutexLocker locker(notificationMutex());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment