Changeset 29698 in webkit


Ignore:
Timestamp:
Jan 21, 2008 2:23:28 PM (16 years ago)
Author:
Darin Adler
Message:

WebCore:

Reviewed by John Sullivan.

  • fix <rdar://problem/5644324> Delegate-less WebKit clients should have no databases
  • remove the default database quota setting
  • simplify the quota-related client calls by merging the one for a new database with the one for an existing database, adding a feature where you can get details about a database being created using the same functions that work on the other databases, and removing the parameters and return values, instead having clients use a function to set the quota
  • fix unsafe multi-thread access to the database tracker's quota map
  • fix bug in deleteAllDatabases where it would iterate a HashMap while modifying it

The tracker database is now only created when we set the quota for a database origin.
Thus asking for info about databases won't cause anything to be written to disk.

  • WebCore.base.exp: Updated.
  • bindings/js/GCController.cpp: Added an #if to get rid of an unused function warning.
  • page/Chrome.cpp: Removed database-related functions. There's no problem having the code deal directly with the client.
  • page/Chrome.h: Ditto. Also made Chrome inherit from Noncopyable.
  • page/ChromeClient.h: Replaced the two quota-related functions with a single one. The details about the state of databases in the origin are now available by asking for database details. There's also no need to pass the security origin, since it's easy to get that from the frame's document.
  • page/Settings.cpp: Removed the default quota setting.
  • page/Settings.h: Ditto.
  • platform/FileSystem.h: Added deleteEmptyDirectory.
  • platform/gtk/FileSystemGtk.cpp: (WebCore::deleteEmptyDirectory): Added.
  • platform/posix/FileSystemPOSIX.cpp: (WebCore::deleteEmptyDirectory): Added.
  • platform/qt/FileSystemQt.cpp: (WebCore::deleteEmptyDirectory): Added.
  • platform/win/FileSystemWin.cpp: (WebCore::deleteEmptyDirectory): Added.
  • platform/wx/FileSystemWx.cpp: (WebCore::deleteEmptyDirectory): Added placeholder.
  • storage/DatabaseDetails.h: Removed the isValid() function since its name is confusing -- we removed our other isValid() functions. For the few callers that need this, it's fine to just check name().isEmpty(). Made the member functions all const.
  • storage/DatabaseTracker.cpp: (WebCore::DatabaseTracker::DatabaseTracker): Removed m_defaultQuota initialization. Added m_proposedDatabase and m_thread. (WebCore::DatabaseTracker::setDatabaseDirectoryPath): Got rid of code that would open the tracker database here. This might slightly speed up launch time, since we won't do the I/O until we have to, and before we were actually creating an SQL database in this code that's run when we go to the first webpage. (WebCore::DatabaseTracker::trackerDatabasePath): Added. (WebCore::DatabaseTracker::openTrackerDatabase): Added a boolean parameter telling this function whether to create the database. Made this function safe to call if the database is already open. Also made the function fail quietly if the path has not been set yet. (WebCore::DatabaseTracker::canEstablishDatabase): Got rid of the call to the establishEntryForOrigin function. The origin is now put in the tracker database when the quota is set to a non-zero value. When judging if there's enough space for the new database, require at least one byte even if estimatedSize is 0, and check for overflow. Also added code here to populate the origins map, which guarantees it will be ready when the database uses it on another thread later. Also changed this to call the new ChromeClient function. (WebCore::DatabaseTracker::hasEntryForDatabase): Added code to open the tracker database, since that's no longer done by setDatabaseDirectoryPath. (WebCore::DatabaseTracker::originPath): Added. (WebCore::DatabaseTracker::fullPathForDatabase): Added code so that this will return a null string for the proposed database if called from within the ChromeClient function. Also switched from empty string to null string for the error cases. (WebCore::DatabaseTracker::populateOrigins): Added code to open the tracker database. (WebCore::DatabaseTracker::databaseNamesForOrigin): Ditto. (WebCore::DatabaseTracker::detailsForNameAndOrigin): Ditto. Also added code that will return the details of the proposed database if called from within the ChromeClient function. This is how the client can learn of the display name and the estimated size of the new database. (WebCore::DatabaseTracker::setDatabaseDetails): Added code to open the tracker database. (WebCore::DatabaseTracker::quotaForOrigin): Made this code OK to call on a non-main thread by using m_quotaMapGuard to guard access to the map. Other code runs on the main thread only, and only functions that write to the map use the lock. (WebCore::DatabaseTracker::setQuota): Changed this function so it can insert the initial quota as well as updating an existing quota. Added locking since this function modifies the quota map. Added code to open the tracker database. Added an early exit if the quota is already correct, which is guarantees that if you set a quota to 0 it won't trigger creation of a tracker database. (WebCore::DatabaseTracker::addDatabase): Added code to open the tracker database. (WebCore::DatabaseTracker::deleteAllDatabases): Made a copy of the quota map before iterating it to find all the origins. This fixes a problem with the old code where it would modify the map while iterating it, which gives assertions in debug builds and unpredictable results. (WebCore::DatabaseTracker::deleteOrigin): Replaced deleteDatabasesWithOrigin with this function. Added code to open the tracker database if needed. Added code to delete the origin from the tracker database, and to close the tracker database and delete files and directories as needed if we are deleting the final origin. (WebCore::DatabaseTracker::deleteDatabase): Added code to open the tracker database if needed.
  • storage/DatabaseTracker.h: Renamed databasePath to databaseDirectoryPath for clarity, including the data member, and the getter and setter functions. Replaced deleteDatabasesWithOrigin with deleteOrigin. Removed the functions dealing with default origin quota. There is no default any more; origins start with no quota and the client must set a quota. Added trackerDatabasePath and originPath helper functions. Added a boolean parameter to openTrackerDatabase to tell it whether to create the database or not. Removed the establishEntryForOrigin function. Renamed m_originQuotaMap to just m_quotaMap, and added m_quotaMapGuard. Added a QuotaMap typedef. Added m_proposedDatabase, which holds the origin and details for the current proposed database during the client callback function that must decide whether to grant quota. Added a m_thread data member for debugging use to assert if functions that can only be called on a single thread are misused.
  • storage/SQLTransaction.cpp: (WebCore::SQLTransaction::deliverQuotaIncreaseCallback): Changed to call the new exceededDatabaseQuota function instead of the old one.
  • svg/graphics/SVGImageEmptyClients.h: Updated for the change to ChromeClient.

WebKit/gtk:

Reviewed by John Sullivan.

  • updated for changes to database functions
  • WebCoreSupport/ChromeClientGtk.cpp: (WebKit::ChromeClient::exceededDatabaseQuota):
  • WebCoreSupport/ChromeClientGtk.h:
  • WebView/webkitprivate.cpp: (webkit_init):

WebKit/mac:

Reviewed by John Sullivan.

  • fix <rdar://problem/5644324> Delegate-less WebKit clients should have no databases
  • add a missing export of WebDatabaseExpectedSizeKey
  • implement deleteOrigin: and remove deleteDatabasesWithOrigin:
  • Storage/WebDatabaseManager.mm: (-[WebDatabaseManager detailsForDatabase:withOrigin:]): Updated to check for a null name instead of calling isValid(). (-[WebDatabaseManager deleteOrigin:]): Implemented. (WebKitInitializeDatabasesIfNecessary): Updated for name change.
  • Storage/WebDatabaseManagerPrivate.h: Removed deleteDatabasesWithOrigin:.
  • WebCoreSupport/WebChromeClient.h: Updated for changes to ChromeClient.
  • WebCoreSupport/WebChromeClient.mm: (WebChromeClient::exceededDatabaseQuota): Replaced the two different client functions we had before with a single one.
  • WebKit.exp: Added missing export for WebDatabaseExpectedSizeKey.
  • WebView/WebPreferenceKeysPrivate.h: Removed WebKitDefaultDatabaseQuotaKey.
  • WebView/WebPreferences.m: (+[WebPreferences initialize]): Removed the default for WebKitDefaultDatabaseQuotaKey.
  • WebView/WebPreferencesPrivate.h: Removed defaultDatabaseQuota and setDefaultDatabaseQuota:.
  • WebView/WebUIDelegatePrivate.h: Replaced the two different database quota delegate methods we had before with a single one.
  • WebView/WebView.mm: (-[WebView _preferencesChangedNotification:]): Removed the code to set the default database origin quota in WebCore::Settings based on WebPreferences.
  • WebView/WebViewInternal.h: Removed delegate method dispatch functions for unusual types of parameters that the database UI delegate methods had before.

WebKit/qt:

Reviewed by John Sullivan.

  • updated for changes to ChromeClient database functions
  • WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::exceededDatabaseQuota):
  • WebCoreSupport/ChromeClientQt.h:

WebKit/win:

Reviewed by John Sullivan.

  • fix <rdar://problem/5644324> Delegate-less WebKit clients should have no databases
  • fix incorrect value for WebDatabaseDisplayNameKey in header


  • Interfaces/IWebDatabaseManager.idl: Renamed detailsForDatabaseWithOrigin to detailsForDatabase. Replaced deleteDatabasesWithOrigin with deleteOrigin. Renamed deleteDatabaseWithOrigin to deleteDatabase. Fixed incorrect value for WebDatabaseDisplayNameKey.
  • Interfaces/IWebPreferencesPrivate.idl: Removed defaultDatabaseQuota and setDefaultDatabaseQuota.
  • Interfaces/IWebUIDelegatePrivate.idl: Replaced the two database quota functions with a single one.
  • WebChromeClient.cpp: (WebChromeClient::exceededDatabaseQuota): Replaced the two database quota functions with a single one.
  • WebChromeClient.h: Ditto.
  • WebDatabaseManager.cpp: (WebDatabaseManager::detailsForDatabase): Changed to check for a name of null to detect a nonexistent database rather than using isValid. (WebDatabaseManager::deleteOrigin): Updated for name change (actually a semantic change too, but both have the same name). (WebDatabaseManager::deleteDatabase): Updated for name change. (WebKitSetWebDatabasesPathIfNecessary): Ditto.
  • WebDatabaseManager.h: Updated for name changes.
  • WebPreferenceKeysPrivate.h: Removed WebKitDefaultDatabaseQuotaKey.
  • WebPreferences.cpp: (WebPreferences::initializeDefaultSettings): Removed the default for WebKitDefaultDatabaseQuotaKey.
  • WebPreferences.h: Removed defaultDatabaseQuota and setDefaultDatabaseQuota.
  • WebView.cpp: (WebView::notifyPreferencesChanged): Removed the code to set the default database origin quota in WebCore::Settings based on IWebPreferencesPrivate.

WebKit/wx:

Reviewed by John Sullivan.

  • updated for changes to ChromeClient database functions
  • WebKitSupport/ChromeClientWx.cpp: (WebCore::ChromeClientWx::exceededDatabaseQuota):
  • WebKitSupport/ChromeClientWx.h:
Location:
trunk
Files:
53 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r29696 r29698  
     12008-01-21  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by John Sullivan.
     4
     5        - fix <rdar://problem/5644324> Delegate-less WebKit clients should have no databases
     6
     7        - remove the default database quota setting
     8
     9        - simplify the quota-related client calls by merging the one for a new database with
     10          the one for an existing database, adding a feature where you can get details about
     11          a database being created using the same functions that work on the other databases,
     12          and removing the parameters and return values, instead having clients use a function
     13          to set the quota
     14
     15        - fix unsafe multi-thread access to the database tracker's quota map
     16        - fix bug in deleteAllDatabases where it would iterate a HashMap while modifying it
     17
     18        The tracker database is now only created when we set the quota for a database origin.
     19        Thus asking for info about databases won't cause anything to be written to disk.
     20
     21        * WebCore.base.exp: Updated.
     22
     23        * bindings/js/GCController.cpp: Added an #if to get rid of an unused function warning.
     24
     25        * page/Chrome.cpp: Removed database-related functions. There's no problem having the
     26        code deal directly with the client.
     27        * page/Chrome.h: Ditto. Also made Chrome inherit from Noncopyable.
     28
     29        * page/ChromeClient.h: Replaced the two quota-related functions with a single one.
     30        The details about the state of databases in the origin are now available by asking
     31        for database details. There's also no need to pass the security origin, since
     32        it's easy to get that from the frame's document.
     33
     34        * page/Settings.cpp: Removed the default quota setting.
     35        * page/Settings.h: Ditto.
     36
     37        * platform/FileSystem.h: Added deleteEmptyDirectory.
     38        * platform/gtk/FileSystemGtk.cpp:
     39        (WebCore::deleteEmptyDirectory): Added.
     40        * platform/posix/FileSystemPOSIX.cpp:
     41        (WebCore::deleteEmptyDirectory): Added.
     42        * platform/qt/FileSystemQt.cpp:
     43        (WebCore::deleteEmptyDirectory): Added.
     44        * platform/win/FileSystemWin.cpp:
     45        (WebCore::deleteEmptyDirectory): Added.
     46        * platform/wx/FileSystemWx.cpp:
     47        (WebCore::deleteEmptyDirectory): Added placeholder.
     48
     49        * storage/DatabaseDetails.h: Removed the isValid() function since its name is
     50        confusing -- we removed our other isValid() functions. For the few callers that
     51        need this, it's fine to just check name().isEmpty(). Made the member functions
     52        all const.
     53
     54        * storage/DatabaseTracker.cpp:
     55        (WebCore::DatabaseTracker::DatabaseTracker): Removed m_defaultQuota initialization.
     56        Added m_proposedDatabase and m_thread.
     57        (WebCore::DatabaseTracker::setDatabaseDirectoryPath): Got rid of code that would
     58        open the tracker database here. This might slightly speed up launch time, since
     59        we won't do the I/O until we have to, and before we were actually creating an SQL
     60        database in this code that's run when we go to the first webpage.
     61        (WebCore::DatabaseTracker::trackerDatabasePath): Added.
     62        (WebCore::DatabaseTracker::openTrackerDatabase): Added a boolean parameter telling
     63        this function whether to create the database. Made this function safe to call if
     64        the database is already open. Also made the function fail quietly if the path has
     65        not been set yet.
     66        (WebCore::DatabaseTracker::canEstablishDatabase): Got rid of the call to the
     67        establishEntryForOrigin function. The origin is now put in the tracker database
     68        when the quota is set to a non-zero value. When judging if there's enough space
     69        for the new database, require at least one byte even if estimatedSize is 0, and
     70        check for overflow. Also added code here to populate the origins map, which
     71        guarantees it will be ready when the database uses it on another thread later.
     72        Also changed this to call the new ChromeClient function.
     73        (WebCore::DatabaseTracker::hasEntryForDatabase): Added code to open the
     74        tracker database, since that's no longer done by setDatabaseDirectoryPath.
     75        (WebCore::DatabaseTracker::originPath): Added.
     76        (WebCore::DatabaseTracker::fullPathForDatabase): Added code so that this will
     77        return a null string for the proposed database if called from within the
     78        ChromeClient function. Also switched from empty string to null string for the
     79        error cases.
     80        (WebCore::DatabaseTracker::populateOrigins): Added code to open the tracker
     81        database.
     82        (WebCore::DatabaseTracker::databaseNamesForOrigin): Ditto.
     83        (WebCore::DatabaseTracker::detailsForNameAndOrigin): Ditto. Also added code that
     84        will return the details of the proposed database if called from within the
     85        ChromeClient function. This is how the client can learn of the display name and
     86        the estimated size of the new database.
     87        (WebCore::DatabaseTracker::setDatabaseDetails): Added code to open the tracker
     88        database.
     89        (WebCore::DatabaseTracker::quotaForOrigin): Made this code OK to call on a non-main
     90        thread by using m_quotaMapGuard to guard access to the map. Other code runs on the
     91        main thread only, and only functions that write to the map use the lock.
     92        (WebCore::DatabaseTracker::setQuota): Changed this function so it can insert the
     93        initial quota as well as updating an existing quota. Added locking since this
     94        function modifies the quota map. Added code to open the tracker database. Added
     95        an early exit if the quota is already correct, which is guarantees that if you
     96        set a quota to 0 it won't trigger creation of a tracker database.
     97        (WebCore::DatabaseTracker::addDatabase): Added code to open the tracker database.
     98        (WebCore::DatabaseTracker::deleteAllDatabases): Made a copy of the quota map before
     99        iterating it to find all the origins. This fixes a problem with the old code where
     100        it would modify the map while iterating it, which gives assertions in debug builds
     101        and unpredictable results.
     102        (WebCore::DatabaseTracker::deleteOrigin): Replaced deleteDatabasesWithOrigin with
     103        this function. Added code to open the tracker database if needed. Added code to
     104        delete the origin from the tracker database, and to close the tracker database
     105        and delete files and directories as needed if we are deleting the final origin.
     106        (WebCore::DatabaseTracker::deleteDatabase): Added code to open the tracker database
     107        if needed.
     108
     109        * storage/DatabaseTracker.h: Renamed databasePath to databaseDirectoryPath for
     110        clarity, including the data member, and the getter and setter functions.
     111        Replaced deleteDatabasesWithOrigin with deleteOrigin. Removed the functions
     112        dealing with default origin quota. There is no default any more; origins start
     113        with no quota and the client must set a quota. Added trackerDatabasePath and
     114        originPath helper functions. Added a boolean parameter to openTrackerDatabase
     115        to tell it whether to create the database or not. Removed the
     116        establishEntryForOrigin function. Renamed m_originQuotaMap to just m_quotaMap,
     117        and added m_quotaMapGuard. Added a QuotaMap typedef. Added m_proposedDatabase,
     118        which holds the origin and details for the current proposed database during
     119        the client callback function that must decide whether to grant quota. Added a
     120        m_thread data member for debugging use to assert if functions that can only
     121        be called on a single thread are misused.
     122
     123        * storage/SQLTransaction.cpp:
     124        (WebCore::SQLTransaction::deliverQuotaIncreaseCallback): Changed to call the
     125        new exceededDatabaseQuota function instead of the old one.
     126
     127        * svg/graphics/SVGImageEmptyClients.h: Updated for the change to ChromeClient.
     128
    11292008-01-21  David Hyatt  <hyatt@apple.com>
    2130
  • trunk/WebCore/WebCore.base.exp

    r29593 r29698  
    295295__ZN7WebCore15BackForwardListD1Ev
    296296__ZN7WebCore15ContextMenuItem26releasePlatformDescriptionEv
     297__ZN7WebCore15DatabaseTracker12deleteOriginEPNS_14SecurityOriginE
    297298__ZN7WebCore15DatabaseTracker14deleteDatabaseEPNS_14SecurityOriginERKNS_6StringE
    298299__ZN7WebCore15DatabaseTracker14quotaForOriginEPNS_14SecurityOriginE
    299300__ZN7WebCore15DatabaseTracker14usageForOriginEPNS_14SecurityOriginE
    300 __ZN7WebCore15DatabaseTracker15setDatabasePathERKNS_6StringE
    301301__ZN7WebCore15DatabaseTracker18deleteAllDatabasesEv
    302302__ZN7WebCore15DatabaseTracker22databaseNamesForOriginEPNS_14SecurityOriginERN3WTF6VectorINS_6StringELm0EEE
    303303__ZN7WebCore15DatabaseTracker23detailsForNameAndOriginERKNS_6StringEPNS_14SecurityOriginE
    304 __ZN7WebCore15DatabaseTracker25deleteDatabasesWithOriginEPNS_14SecurityOriginE
     304__ZN7WebCore15DatabaseTracker24setDatabaseDirectoryPathERKNS_6StringE
    305305__ZN7WebCore15DatabaseTracker7originsERN3WTF6VectorINS1_6RefPtrINS_14SecurityOriginEEELm0EEE
    306306__ZN7WebCore15DatabaseTracker7trackerEv
     
    492492__ZN7WebCore8Settings28setForceFTPDirectoryListingsEb
    493493__ZN7WebCore8Settings29setAuthorAndUserStylesEnabledEb
    494 __ZN7WebCore8Settings29setDefaultDatabaseOriginQuotaEy
    495494__ZN7WebCore8Settings31setShrinksStandaloneImagesToFitEb
    496495__ZN7WebCore8Settings32setNeedsAdobeFrameReloadingQuirkEb
  • trunk/WebCore/bindings/js/GCController.cpp

    r29663 r29698  
    3838namespace WebCore {
    3939
     40#if USE(PTHREADS)
     41
    4042static void* collect(void*)
    4143{
     
    4446    return 0;
    4547}
     48
     49#endif
    4650
    4751GCController& gcController()
  • trunk/WebCore/page/Chrome.cpp

    r29663 r29698  
    344344}
    345345
    346 unsigned long long Chrome::requestQuotaIncreaseForNewDatabase(Frame* frame, SecurityOrigin* origin, const String& databaseDisplayName, unsigned long long estimatedSize)
    347 {
    348     return m_client->requestQuotaIncreaseForNewDatabase(frame, origin, databaseDisplayName, estimatedSize);
    349 }
    350 
    351 unsigned long long Chrome::requestQuotaIncreaseForDatabaseOperation(Frame* frame, SecurityOrigin* origin, const String& databaseIdentifier, unsigned long long proposedNewQuota)
    352 {
    353     return m_client->requestQuotaIncreaseForDatabaseOperation(frame, origin, databaseIdentifier, proposedNewQuota);
    354 }
    355 
    356346PageGroupLoadDeferrer::PageGroupLoadDeferrer(Page* page, bool deferSelf)
    357347{
  • trunk/WebCore/page/Chrome.h

    r29663 r29698  
    11// -*- mode: c++; c-basic-offset: 4 -*-
    22/*
    3  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
     3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
    44 *
    55 * This library is free software; you can redistribute it and/or
     
    2424#include "FocusDirection.h"
    2525#include <wtf/Forward.h>
     26#include <wtf/Noncopyable.h>
    2627#include <wtf/RefPtr.h>
    2728
     
    4142    class IntRect;
    4243    class Page;
    43     class SecurityOrigin;
    4444    class String;
    4545   
     
    6262    };
    6363
    64     class Chrome {
     64    class Chrome : Noncopyable {
    6565    public:
    6666        Chrome(Page*, ChromeClient*);
     
    126126
    127127        void print(Frame*);
    128 
    129         unsigned long long requestQuotaIncreaseForNewDatabase(Frame*, SecurityOrigin*, const String& databaseDisplayName, unsigned long long estimatedSize);
    130         unsigned long long requestQuotaIncreaseForDatabaseOperation(Frame*, SecurityOrigin* origin, const String& databaseIdentifier, unsigned long long proposedNewQuota);
    131128       
    132129#if PLATFORM(MAC)
  • trunk/WebCore/page/ChromeClient.h

    r29663 r29698  
    11// -*- mode: c++; c-basic-offset: 4 -*-
    22/*
    3  * Copyright (C) 2006-2007 Apple, Inc.
     3 * Copyright (C) 2006, 2007, 2008 Apple, Inc. All rights reserved.
    44 *
    55 * This library is free software; you can redistribute it and/or
     
    3131    class IntRect;
    3232    class Page;
    33     class SecurityOrigin;
    3433    class String;
    3534   
     
    3938    class ChromeClient {
    4039    public:
    41         virtual ~ChromeClient() {  }
    4240        virtual void chromeDestroyed() = 0;
    4341       
     
    105103        virtual void print(Frame*) = 0;
    106104
    107         virtual unsigned long long requestQuotaIncreaseForNewDatabase(Frame*, SecurityOrigin* origin, const String& databaseDisplayName, unsigned long long estimatedSize) = 0;
    108         virtual unsigned long long requestQuotaIncreaseForDatabaseOperation(Frame*, SecurityOrigin* origin, const String& databaseIdentifier, unsigned long long proposedNewQuota) = 0;
    109 };
     105        virtual void exceededDatabaseQuota(Frame*, const String& databaseName) = 0;
     106
     107    protected:
     108        virtual ~ChromeClient() { }
     109    };
    110110
    111111}
  • trunk/WebCore/page/Settings.cpp

    r29663 r29698  
    302302}
    303303
    304 void Settings::setDefaultDatabaseOriginQuota(unsigned long long quota)
    305 {
    306 #if ENABLE(DATABASE)
    307     DatabaseTracker::tracker().setDefaultOriginQuota(quota);
    308 #endif
    309 }
    310 
    311 unsigned long long Settings::defaultDatabaseOriginQuota() const
    312 {
    313 #if ENABLE(DATABASE)
    314     return DatabaseTracker::tracker().defaultOriginQuota();
    315 #else
    316     return 0;
    317 #endif
    318 }
    319 
    320304void Settings::setFontRenderingMode(FontRenderingMode mode)
    321305{
  • trunk/WebCore/page/Settings.h

    r28869 r29698  
    145145        bool authorAndUserStylesEnabled() const { return m_authorAndUserStylesEnabled; }
    146146       
    147         void setDefaultDatabaseOriginQuota(unsigned long long);
    148         unsigned long long defaultDatabaseOriginQuota() const;
    149        
    150147        void setFontRenderingMode(FontRenderingMode mode);
    151148        FontRenderingMode fontRenderingMode() const;
  • trunk/WebCore/platform/FileSystem.h

    r29663 r29698  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 * Copyright (C) 2008 Collabora, Ltd. All rights reserved.
    44 *
     
    3232
    3333#include <wtf/Platform.h>
    34 #include <wtf/Vector.h>
    3534
    3635typedef const struct __CFData* CFDataRef;
     
    5150bool fileExists(const String&);
    5251bool deleteFile(const String&);
     52bool deleteEmptyDirectory(const String&);
    5353bool fileSize(const String&, long long& result);
    5454String pathByAppendingComponent(const String& path, const String& component);
     
    6060inline bool isHandleValid(const PlatformFileHandle& handle) { return handle != invalidPlatformFileHandle; }
    6161
    62 /* Prefix is what the filename should be prefixed with, not the full path */
     62// Prefix is what the filename should be prefixed with, not the full path.
    6363CString openTemporaryFile(const char* prefix, PlatformFileHandle&);
    6464void closeFile(PlatformFileHandle&);
  • trunk/WebCore/platform/gtk/FileSystemGtk.cpp

    r29663 r29698  
    22 * Copyright (C) 2007 Holger Hans Peter Freyther
    33 * Copyright (C) 2008 Collabora, Ltd.
     4 * Copyright (C) 2008 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    5152    if (filename) {
    5253        result = g_remove(filename) == 0;
     54        g_free(filename);
     55    }
     56   
     57    return result;
     58}
     59
     60bool deleteEmptyDirectory(const String& path)
     61{
     62    bool result = false;
     63    gchar* filename = g_filename_from_utf8(path.utf8().data(), -1, 0, 0, 0);
     64
     65    if (filename) {
     66        result = g_rmdir(filename) == 0;
    5367        g_free(filename);
    5468    }
  • trunk/WebCore/platform/posix/FileSystemPOSIX.cpp

    r29663 r29698  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
     28
    2829#include "config.h"
    2930#include "FileSystem.h"
     
    6263    // unlink(...) returns 0 on successful deletion of the path and non-zero in any other case (including invalid permissions or non-existent file)
    6364    return !unlink(fsRep.data());
     65}
     66
     67bool deleteEmptyDirectory(const String& path)
     68{
     69    CString fsRep = fileSystemRepresentation(path);
     70
     71    if (!fsRep.data() || fsRep.data()[0] == '\0')
     72        return false;
     73
     74    // rmdir(...) returns 0 on successful deletion of the path and non-zero in any other case (including invalid permissions or non-existent file)
     75    return !rmdir(fsRep.data());
    6476}
    6577
  • trunk/WebCore/platform/qt/FileSystemQt.cpp

    r29663 r29698  
    22 * Copyright (C) 2007 Staikos Computing Services Inc.
    33 * Copyright (C) 2007 Holger Hans Peter Freyther
     4 * Copyright (C) 2008 Apple, Inc. All rights reserved.
    45 *
    56 * Redistribution and use in source and binary forms, with or without
     
    4647}
    4748
     49bool deleteEmptyDirectory(const String& path)
     50{
     51    return QDir::rmdir(path);
     52}
     53
    4854bool fileSize(const String& path, long long& result)
    4955{
  • trunk/WebCore/platform/win/FileSystemWin.cpp

    r29631 r29698  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 * Copyright (C) 2008 Collabora, Ltd. All rights reserved.
    44 *
     
    6666}
    6767
     68bool deleteEmptyDirectory(const String& path)
     69{
     70    String filename = path;
     71    return !!RemoveDirectoryW(filename.charactersWithNullTermination());
     72}
     73
    6874String pathByAppendingComponent(const String& path, const String& component)
    6975{
  • trunk/WebCore/platform/wx/FileSystemWx.cpp

    r29663 r29698  
    4646}
    4747
     48bool deleteEmptyDirectory(const String& path)
     49{
     50    notImplemented();
     51    return false;
     52}
     53
    4854bool fileSize(const String& path, long long& resultSize)
    4955{
  • trunk/WebCore/storage/DatabaseDetails.h

    r29663 r29698  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
     28
    2829#ifndef DatabaseDetails_h
    2930#define DatabaseDetails_h
     
    3839        : m_expectedUsage(0)
    3940        , m_currentUsage(0)
    40     { }
    41    
     41    {
     42    }
     43
    4244    DatabaseDetails(const String& databaseName, const String& displayName, unsigned long long expectedUsage, unsigned long long currentUsage)
    4345        : m_name(databaseName)
     
    4547        , m_expectedUsage(expectedUsage)
    4648        , m_currentUsage(currentUsage)
    47     { }
    48    
    49     bool isValid() const { return !(m_name.isEmpty() && m_displayName.isEmpty() && !m_expectedUsage && !m_currentUsage); }
    50    
    51     const String& name() { return m_name; }
    52     const String& displayName() { return m_displayName; }
    53     unsigned long long expectedUsage() { return m_expectedUsage; }
    54     unsigned long long currentUsage() { return m_currentUsage; }
    55    
     49    {
     50    }
     51
     52    const String& name() const { return m_name; }
     53    const String& displayName() const { return m_displayName; }
     54    unsigned long long expectedUsage() const { return m_expectedUsage; }
     55    unsigned long long currentUsage() const { return m_currentUsage; }
     56
    5657private:
    5758    String m_name;
  • trunk/WebCore/storage/DatabaseTracker.cpp

    r29663 r29698  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
     28
    2829#include "config.h"
    2930#include "DatabaseTracker.h"
    3031
     32#include "ChromeClient.h"
    3133#include "Database.h"
    3234#include "DatabaseTrackerClient.h"
     
    3739#include "SQLiteStatement.h"
    3840
     41using namespace std;
     42
    3943namespace WebCore {
    40 
    41 // HTML5 SQL Storage spec suggests 5MB as the default quota per origin
    42 static const unsigned DefaultOriginQuota = 5242880;
    4344
    4445struct SecurityOriginHash {
     
    8283{
    8384    static DatabaseTracker tracker;
    84 
    8585    return tracker;
    8686}
    8787
    8888DatabaseTracker::DatabaseTracker()
    89     : m_defaultQuota(DefaultOriginQuota)
    90     , m_client(0)
    91 {
    92 }
    93 
    94 void DatabaseTracker::setDatabasePath(const String& path)
    95 {       
    96     m_databasePath = path;
    97     openTrackerDatabase();
    98 }
    99 
    100 const String& DatabaseTracker::databasePath()
    101 {
    102     return m_databasePath;
    103 }
    104 
    105 void DatabaseTracker::openTrackerDatabase()
    106 {
     89    : m_client(0)
     90    , m_proposedDatabase(0)
     91#ifndef NDEBUG
     92    , m_thread(currentThread())
     93#endif
     94{
     95}
     96
     97void DatabaseTracker::setDatabaseDirectoryPath(const String& path)
     98{
     99    ASSERT(currentThread() == m_thread);
    107100    ASSERT(!m_database.isOpen());
    108    
    109     makeAllDirectories(m_databasePath);
    110     String databasePath = pathByAppendingComponent(m_databasePath, "Databases.db");
    111 
     101    m_databaseDirectoryPath = path;
     102}
     103
     104const String& DatabaseTracker::databaseDirectoryPath() const
     105{
     106    ASSERT(currentThread() == m_thread);
     107    return m_databaseDirectoryPath;
     108}
     109
     110String DatabaseTracker::trackerDatabasePath() const
     111{
     112    ASSERT(currentThread() == m_thread);
     113    if (m_databaseDirectoryPath.isEmpty())
     114        return String();
     115    return pathByAppendingComponent(m_databaseDirectoryPath, "Databases.db");
     116}
     117
     118void DatabaseTracker::openTrackerDatabase(bool createIfDoesNotExist)
     119{
     120    ASSERT(currentThread() == m_thread);
     121
     122    if (m_database.isOpen())
     123        return;
     124
     125    String databasePath = trackerDatabasePath();
     126    if (databasePath.isEmpty())
     127        return;
     128
     129    if (!createIfDoesNotExist && !fileExists(databasePath))
     130        return;
     131
     132    makeAllDirectories(m_databaseDirectoryPath);
    112133    if (!m_database.open(databasePath)) {
    113134        // FIXME: What do do here?
     
    119140        }
    120141    }
    121 
    122142    if (!m_database.tableExists("Databases")) {
    123143        if (!m_database.executeCommand("CREATE TABLE Databases (guid INTEGER PRIMARY KEY AUTOINCREMENT, origin TEXT, name TEXT, displayName TEXT, estimatedSize INTEGER, path TEXT);")) {
     
    129149bool DatabaseTracker::canEstablishDatabase(Document* document, const String& name, const String& displayName, unsigned long estimatedSize)
    130150{
     151    ASSERT(currentThread() == m_thread);
     152
     153    // Populate the origins before we establish a database; this guarantees that quotaForOrigin
     154    // can run on the database thread later.
     155    populateOrigins();
     156
     157    // If a database already exists, ignore the passed-in estimated size and say it's OK.
    131158    SecurityOrigin* origin = document->securityOrigin();
    132    
    133     // If this origin has no databases yet, establish an entry in the tracker database with the default quota
    134     if (!hasEntryForOrigin(origin))
    135         establishEntryForOrigin(origin);
    136    
    137     // If a database already exists, you can always establish a handle to it
    138159    if (hasEntryForDatabase(origin, name))
    139160        return true;
    140        
    141     // If the new database will fit as-is, allow its creation
     161
     162    // If the database will fit, allow its creation.
    142163    unsigned long long usage = usageForOrigin(origin);
    143     if (usage + estimatedSize < quotaForOrigin(origin))
     164    unsigned long long requirement = usage + max(1UL, estimatedSize);
     165    if (requirement < usage)
     166        return false; // If the estimated size is so big it causes an overflow, don't allow creation.
     167    if (requirement <= quotaForOrigin(origin))
    144168        return true;
    145    
    146     // Otherwise, ask the UI Delegate for a new quota
    147     Page* page;
    148     if (!(page = document->page()))
    149         return false;
    150    
    151     // If no displayName was specified, pass the standard (required) name instead
    152     unsigned long long newQuota = page->chrome()->requestQuotaIncreaseForNewDatabase(document->frame(), origin, displayName.length() > 0 ? displayName : name, estimatedSize);
    153     setQuota(origin, newQuota);
    154    
    155     return usage + estimatedSize <= newQuota;
     169
     170    // Give the chrome client a chance to increase the quota.
     171    // Temporarily make the details of the proposed database available, so the client can get at them.
     172    Page* page = document->page();
     173    if (!page)
     174        return false;
     175    pair<SecurityOrigin*, DatabaseDetails> details(origin, DatabaseDetails(name, displayName, estimatedSize, 0));
     176    m_proposedDatabase = &details;
     177    page->chrome()->client()->exceededDatabaseQuota(document->frame(), name);
     178    m_proposedDatabase = 0;
     179
     180    // If the database will fit now, allow its creation.
     181    return requirement <= quotaForOrigin(origin);
    156182}
    157183
    158184bool DatabaseTracker::hasEntryForOrigin(SecurityOrigin* origin)
    159185{
     186    ASSERT(currentThread() == m_thread);
    160187    populateOrigins();
    161     return m_originQuotaMap->contains(origin);
     188    return m_quotaMap->contains(origin);
    162189}
    163190
    164191bool DatabaseTracker::hasEntryForDatabase(SecurityOrigin* origin, const String& databaseIdentifier)
    165192{
     193    ASSERT(currentThread() == m_thread);
     194    openTrackerDatabase(false);
     195    if (!m_database.isOpen())
     196        return false;
    166197    SQLiteStatement statement(m_database, "SELECT guid FROM Databases WHERE origin=? AND name=?;");
    167198
     
    175206}
    176207
    177 void DatabaseTracker::establishEntryForOrigin(SecurityOrigin* origin)
    178 {
    179     ASSERT(!hasEntryForOrigin(origin));
    180    
    181     SQLiteStatement statement(m_database, "INSERT INTO Origins VALUES (?, ?)");
    182     if (statement.prepare() != SQLResultOk) {
    183         LOG_ERROR("Unable to establish origin %s in the tracker", origin->stringIdentifier().ascii().data());
    184         return;
    185     }
    186        
    187     statement.bindText(1, origin->stringIdentifier());
    188     statement.bindInt64(2, m_defaultQuota);
    189    
    190     if (statement.step() != SQLResultDone) {
    191         LOG_ERROR("Unable to establish origin %s in the tracker", origin->stringIdentifier().ascii().data());
    192         return;
    193     }
    194 
    195     populateOrigins();
    196     m_originQuotaMap->set(origin, m_defaultQuota);
    197    
    198     if (m_client)
    199         m_client->dispatchDidModifyOrigin(origin);
     208String DatabaseTracker::originPath(SecurityOrigin* origin) const
     209{
     210    ASSERT(currentThread() == m_thread);
     211    if (m_databaseDirectoryPath.isEmpty())
     212        return String();
     213    return pathByAppendingComponent(m_databaseDirectoryPath, origin->stringIdentifier());
    200214}
    201215
    202216String DatabaseTracker::fullPathForDatabase(SecurityOrigin* origin, const String& name, bool createIfNotExists)
    203217{
     218    ASSERT(currentThread() == m_thread);
     219
     220    if (m_proposedDatabase && m_proposedDatabase->first == origin && m_proposedDatabase->second.name() == name)
     221        return String();
     222
    204223    String originIdentifier = origin->stringIdentifier();
    205     String originPath = pathByAppendingComponent(m_databasePath, originIdentifier);
     224    String originPath = this->originPath(origin);
    206225   
    207226    // Make sure the path for this SecurityOrigin exists
    208227    if (createIfNotExists && !makeAllDirectories(originPath))
    209         return "";
     228        return String();
    210229   
    211230    // See if we have a path for this database yet
     231    openTrackerDatabase(false);
     232    if (!m_database.isOpen())
     233        return String();
    212234    SQLiteStatement statement(m_database, "SELECT path FROM Databases WHERE origin=? AND name=?;");
    213235
    214236    if (statement.prepare() != SQLResultOk)
    215         return "";
     237        return String();
    216238
    217239    statement.bindText(1, originIdentifier);
     
    223245        return pathByAppendingComponent(originPath, statement.getColumnText16(0));
    224246    if (!createIfNotExists)
    225         return "";
     247        return String();
    226248       
    227249    if (result != SQLResultDone) {
    228250        LOG_ERROR("Failed to retrieve filename from Database Tracker for origin %s, name %s", origin->stringIdentifier().ascii().data(), name.ascii().data());
    229         return "";
     251        return String();
    230252    }
    231253    statement.finalize();
     
    235257    // FIXME: More informative error handling here, even though these steps should never fail
    236258    if (sequenceStatement.prepare() != SQLResultOk)
    237         return "";
     259        return String();
    238260    result = sequenceStatement.step();
    239261
     
    244266        seq = sequenceStatement.getColumnInt64(0);
    245267    } else if (result != SQLResultDone)
    246         return "";
     268        return String();
    247269    sequenceStatement.finalize();
    248270
     
    254276
    255277    if (!addDatabase(origin, name, String::format("%016llx.db", seq)))
    256         return "";
     278        return String();
    257279
    258280    return filename;
     
    261283void DatabaseTracker::populateOrigins()
    262284{
    263     if (m_originQuotaMap)
    264         return;
    265 
    266     m_originQuotaMap.set(new HashMap<RefPtr<SecurityOrigin>, unsigned long long, SecurityOriginHash, SecurityOriginTraits>);
    267 
     285    if (m_quotaMap)
     286        return;
     287
     288    ASSERT(currentThread() == m_thread);
     289
     290    m_quotaMap.set(new QuotaMap);
     291
     292    openTrackerDatabase(false);
    268293    if (!m_database.isOpen())
    269294        return;
     
    277302    while ((result = statement.step()) == SQLResultRow) {
    278303        RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromIdentifier(statement.getColumnText16(0));
    279         m_originQuotaMap->set(origin.get(), statement.getColumnInt64(1));
     304        m_quotaMap->set(origin.get(), statement.getColumnInt64(1));
    280305    }
    281306
    282307    if (result != SQLResultDone)
    283308        LOG_ERROR("Failed to read in all origins from the database");
    284 
    285     return;
    286309}
    287310
    288311void DatabaseTracker::origins(Vector<RefPtr<SecurityOrigin> >& result)
    289312{
    290     if (!m_originQuotaMap)
    291         populateOrigins();
    292 
    293     copyKeysToVector(*(m_originQuotaMap.get()), result);
     313    ASSERT(currentThread() == m_thread);
     314    populateOrigins();
     315    copyKeysToVector(*m_quotaMap, result);
    294316}
    295317
    296318bool DatabaseTracker::databaseNamesForOrigin(SecurityOrigin* origin, Vector<String>& resultVector)
    297319{
     320    ASSERT(currentThread() == m_thread);
     321    openTrackerDatabase(false);
    298322    if (!m_database.isOpen())
    299323        return false;
     
    320344DatabaseDetails DatabaseTracker::detailsForNameAndOrigin(const String& name, SecurityOrigin* origin)
    321345{
     346    ASSERT(currentThread() == m_thread);
     347
     348    if (m_proposedDatabase && m_proposedDatabase->first == origin && m_proposedDatabase->second.name() == name)
     349        return m_proposedDatabase->second;
     350
    322351    String originIdentifier = origin->stringIdentifier();
    323        
     352
     353    openTrackerDatabase(false);
     354    if (!m_database.isOpen())
     355        return DatabaseDetails();
    324356    SQLiteStatement statement(m_database, "SELECT displayName, estimatedSize FROM Databases WHERE origin=? AND name=?");
    325357    if (statement.prepare() != SQLResultOk)
     
    343375void DatabaseTracker::setDatabaseDetails(SecurityOrigin* origin, const String& name, const String& displayName, unsigned long estimatedSize)
    344376{
     377    ASSERT(currentThread() == m_thread);
     378
    345379    String originIdentifier = origin->stringIdentifier();
    346380    int64_t guid = 0;
    347381   
     382    openTrackerDatabase(true);
     383    if (!m_database.isOpen())
     384        return;
    348385    SQLiteStatement statement(m_database, "SELECT guid FROM Databases WHERE origin=? AND name=?");
    349386    if (statement.prepare() != SQLResultOk)
     
    390427unsigned long long DatabaseTracker::usageForDatabase(const String& name, SecurityOrigin* origin)
    391428{
     429    ASSERT(currentThread() == m_thread);
    392430    String path = fullPathForDatabase(origin, name, false);
    393431    if (path.isEmpty())
     
    400438unsigned long long DatabaseTracker::usageForOrigin(SecurityOrigin* origin)
    401439{
     440    ASSERT(currentThread() == m_thread);
    402441    Vector<String> names;
    403442    databaseNamesForOrigin(origin, names);
     
    412451unsigned long long DatabaseTracker::quotaForOrigin(SecurityOrigin* origin)
    413452{
     453    ASSERT(currentThread() == m_thread || m_quotaMap);
    414454    populateOrigins();
    415     return m_originQuotaMap->get(origin);
     455    MutexLocker lockQuotaMap(m_quotaMapGuard);
     456    return m_quotaMap->get(origin);
    416457}
    417458
    418459void DatabaseTracker::setQuota(SecurityOrigin* origin, unsigned long long quota)
    419460{
    420     populateOrigins();
    421     if (!m_originQuotaMap->contains(origin))
    422         establishEntryForOrigin(origin);
    423    
    424     m_originQuotaMap->set(origin, quota);
    425    
    426     SQLiteStatement statement(m_database, "UPDATE Origins SET quota=? WHERE origin=?");
    427    
    428     bool error = statement.prepare() != SQLResultOk;
    429     if (!error) {
    430         statement.bindInt64(1, quota);
    431         statement.bindText(2, origin->stringIdentifier());
    432        
    433         error = !statement.executeCommand();
    434     }
    435        
    436     if (error)
    437         LOG_ERROR("Failed to set quota %llu in tracker database for origin %s", quota, origin->stringIdentifier().ascii().data());
     461    ASSERT(currentThread() == m_thread);
     462    if (quotaForOrigin(origin) == quota)
     463        return;
     464
     465    openTrackerDatabase(true);
     466    if (!m_database.isOpen())
     467        return;
     468    if (!m_quotaMap->contains(origin)) {
     469        SQLiteStatement statement(m_database, "INSERT INTO Origins VALUES (?, ?)");
     470        if (statement.prepare() != SQLResultOk) {
     471            LOG_ERROR("Unable to establish origin %s in the tracker", origin->stringIdentifier().ascii().data());
     472        } else {
     473            statement.bindText(1, origin->stringIdentifier());
     474            statement.bindInt64(2, quota);
     475
     476            if (statement.step() != SQLResultDone)
     477                LOG_ERROR("Unable to establish origin %s in the tracker", origin->stringIdentifier().ascii().data());
     478        }
     479    } else {
     480        SQLiteStatement statement(m_database, "UPDATE Origins SET quota=? WHERE origin=?");       
     481        bool error = statement.prepare() != SQLResultOk;
     482        if (!error) {
     483            statement.bindInt64(1, quota);
     484            statement.bindText(2, origin->stringIdentifier());
     485
     486            error = !statement.executeCommand();
     487        }
     488        if (error)
     489            LOG_ERROR("Failed to set quota %llu in tracker database for origin %s", quota, origin->stringIdentifier().ascii().data());
     490    }
     491    // FIXME: Is it really OK to update the quota in memory if we failed to update it on disk?
     492
     493    {
     494        MutexLocker lockQuotaMap(m_quotaMapGuard);
     495        m_quotaMap->set(origin, quota);
     496    }
    438497   
    439498    if (m_client)
     
    443502bool DatabaseTracker::addDatabase(SecurityOrigin* origin, const String& name, const String& path)
    444503{
     504    ASSERT(currentThread() == m_thread);
     505    openTrackerDatabase(true);
    445506    if (!m_database.isOpen())
    446507        return false;
     
    471532void DatabaseTracker::deleteAllDatabases()
    472533{
     534    ASSERT(currentThread() == m_thread);
    473535    populateOrigins();
    474536   
    475     HashMap<RefPtr<SecurityOrigin>, unsigned long long, SecurityOriginHash, SecurityOriginTraits>::const_iterator iter = m_originQuotaMap->begin();
    476     HashMap<RefPtr<SecurityOrigin>, unsigned long long, SecurityOriginHash, SecurityOriginTraits>::const_iterator end = m_originQuotaMap->end();
    477 
    478     for (; iter != end; ++iter)
    479         deleteDatabasesWithOrigin(iter->first.get());
    480 }
    481 
    482 void DatabaseTracker::deleteDatabasesWithOrigin(SecurityOrigin* origin)
    483 {
     537    QuotaMap quotaMapCopy = *m_quotaMap;
     538    QuotaMap::const_iterator end = quotaMapCopy.end();
     539    for (QuotaMap::const_iterator iter = quotaMapCopy.begin(); iter != end; ++iter)
     540        deleteOrigin(iter->first.get());
     541}
     542
     543void DatabaseTracker::deleteOrigin(SecurityOrigin* origin)
     544{
     545    ASSERT(currentThread() == m_thread);
     546    openTrackerDatabase(false);
     547    if (!m_database.isOpen())
     548        return;
     549
    484550    Vector<String> databaseNames;
    485551    if (!databaseNamesForOrigin(origin, databaseNames)) {
     
    508574    }
    509575   
     576    SQLiteStatement originStatement(m_database, "DELETE FROM Origins WHERE origin=?");
     577    if (originStatement.prepare() != SQLResultOk) {
     578        LOG_ERROR("Unable to prepare deletion of origin %s from tracker", origin->stringIdentifier().ascii().data());
     579        return;
     580    }
     581
     582    originStatement.bindText(1, origin->stringIdentifier());
     583   
     584    if (!originStatement.executeCommand()) {
     585        LOG_ERROR("Unable to execute deletion of databases from origin %s from tracker", origin->stringIdentifier().ascii().data());
     586        return;
     587    }
     588
     589    deleteEmptyDirectory(originPath(origin));
     590
     591    RefPtr<SecurityOrigin> originPossiblyLastReference = origin;
     592    {
     593        MutexLocker lockQuotaMap(m_quotaMapGuard);
     594        m_quotaMap->remove(origin);
     595    }
     596
     597    // If we removed the last origin, do some additional deletion.
     598    if (m_quotaMap->isEmpty()) {
     599        if (m_database.isOpen())
     600            m_database.close();
     601        deleteFile(trackerDatabasePath());
     602        deleteEmptyDirectory(m_databaseDirectoryPath);
     603    }
     604
    510605    if (m_client) {
    511606        m_client->dispatchDidModifyOrigin(origin);
     
    517612void DatabaseTracker::deleteDatabase(SecurityOrigin* origin, const String& name)
    518613{
     614    ASSERT(currentThread() == m_thread);
     615    openTrackerDatabase(false);
     616    if (!m_database.isOpen())
     617        return;
     618
    519619    if (!deleteDatabaseFile(origin, name)) {
    520620        LOG_ERROR("Unable to delete file for database %s in origin %s", name.ascii().data(), origin->stringIdentifier().ascii().data());
     
    544644bool DatabaseTracker::deleteDatabaseFile(SecurityOrigin* origin, const String& name)
    545645{
     646    ASSERT(currentThread() == m_thread);
    546647    String fullPath = fullPathForDatabase(origin, name, false);
    547648    if (fullPath.isEmpty())
     
    553654void DatabaseTracker::setClient(DatabaseTrackerClient* client)
    554655{
     656    ASSERT(currentThread() == m_thread);
    555657    m_client = client;
    556 }
    557 
    558 void DatabaseTracker::setDefaultOriginQuota(unsigned long long quota)
    559 {
    560     m_defaultQuota = quota;
    561 }
    562 
    563 unsigned long long DatabaseTracker::defaultOriginQuota() const
    564 {
    565     return m_defaultQuota;
    566658}
    567659
     
    600692void DatabaseTracker::notifyDatabasesChanged()
    601693{
    602     // Note that if DatabaseTracker ever becomes non-singleton, we'll have to ammend this notification
    603     // mechanism to inclue which tracker the notification goes out on, as well
     694    // Note that if DatabaseTracker ever becomes non-singleton, we'll have to amend this notification
     695    // mechanism to include which tracker the notification goes out on as well.
    604696    DatabaseTracker& theTracker(tracker());
    605697
  • trunk/WebCore/storage/DatabaseTracker.h

    r29663 r29698  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
     28
    2829#ifndef DatabaseTracker_h
    2930#define DatabaseTracker_h
     
    4748class DatabaseTracker {
    4849public:
    49     void setDatabasePath(const String&);
    50     const String& databasePath();
     50    void setDatabaseDirectoryPath(const String&);
     51    const String& databaseDirectoryPath() const;
    5152
    5253    bool canEstablishDatabase(Document*, const String& name, const String& displayName, unsigned long estimatedSize);
    5354    void setDatabaseDetails(SecurityOrigin*, const String& name, const String& displayName, unsigned long estimatedSize);
    54     String fullPathForDatabase(SecurityOrigin*, const String& name, bool createIfNotExists = true);
     55    String fullPathForDatabase(SecurityOrigin*, const String& name, bool createIfDoesNotExist = true);
    5556
    5657    void origins(Vector<RefPtr<SecurityOrigin> >& result);
     
    6566   
    6667    void deleteAllDatabases();
    67     void deleteDatabasesWithOrigin(SecurityOrigin*);
     68    void deleteOrigin(SecurityOrigin*);
    6869    void deleteDatabase(SecurityOrigin*, const String& name);
    6970
    7071    void setClient(DatabaseTrackerClient*);
    71    
    72     void setDefaultOriginQuota(unsigned long long);
    73     unsigned long long defaultOriginQuota() const;
    7472   
    7573    // From a secondary thread, must be thread safe with its data
     
    7775   
    7876    static DatabaseTracker& tracker();
     77
    7978private:
    8079    DatabaseTracker();
    8180
    82     void openTrackerDatabase();
     81    String trackerDatabasePath() const;
     82    void openTrackerDatabase(bool createIfDoesNotExist);
     83
     84    String originPath(SecurityOrigin*) const;
    8385   
    8486    bool hasEntryForOrigin(SecurityOrigin*);
    8587    bool hasEntryForDatabase(SecurityOrigin*, const String& databaseIdentifier);
    86     void establishEntryForOrigin(SecurityOrigin*);
    8788   
    8889    bool addDatabase(SecurityOrigin*, const String& name, const String& path);
     
    9293
    9394    SQLiteDatabase m_database;
    94     mutable OwnPtr<HashMap<RefPtr<SecurityOrigin>, unsigned long long, SecurityOriginHash, SecurityOriginTraits> > m_originQuotaMap;
    9595
    96     String m_databasePath;
     96    typedef HashMap<RefPtr<SecurityOrigin>, unsigned long long, SecurityOriginHash, SecurityOriginTraits> QuotaMap;
     97    Mutex m_quotaMapGuard;
     98    mutable OwnPtr<QuotaMap> m_quotaMap;
     99
     100    String m_databaseDirectoryPath;
    97101   
    98     unsigned long long m_defaultQuota;
    99102    DatabaseTrackerClient* m_client;
     103
     104    std::pair<SecurityOrigin*, DatabaseDetails>* m_proposedDatabase;
     105
     106#ifndef NDEBUG
     107    ThreadIdentifier m_thread;
     108#endif
    100109
    101110    static void scheduleForNotification();
  • trunk/WebCore/storage/SQLTransaction.cpp

    r29663 r29698  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
     28
    2829#include "config.h"
    2930#include "SQLTransaction.h"
    3031
     32#include "ChromeClient.h"
    3133#include "Database.h"
    3234#include "DatabaseAuthorizer.h"
     35#include "DatabaseDetails.h"
    3336#include "DatabaseTracker.h"
    3437#include "Document.h"
     
    295298   
    296299    unsigned long long currentQuota = DatabaseTracker::tracker().quotaForOrigin(origin.get());
    297     unsigned long long newQuota = page->chrome()->requestQuotaIncreaseForDatabaseOperation(m_database->document()->frame(), origin.get(), m_database->stringIdentifier(), currentQuota + DefaultQuotaSizeIncrease);
    298    
    299     DatabaseTracker::tracker().setQuota(origin.get(), newQuota);
     300    page->chrome()->client()->exceededDatabaseQuota(m_database->document()->frame(), m_database->stringIdentifier());
     301    unsigned long long newQuota = DatabaseTracker::tracker().quotaForOrigin(origin.get());
    300302   
    301303    // If the new quota ended up being larger than the old quota, we will retry the statement.
  • trunk/WebCore/svg/graphics/SVGImageEmptyClients.h

    r29663 r29698  
    117117    virtual void print(Frame*) { }
    118118
    119     virtual unsigned long long requestQuotaIncreaseForNewDatabase(Frame*, SecurityOrigin*, const String&, unsigned long long) { return 0; }
    120     virtual unsigned long long requestQuotaIncreaseForDatabaseOperation(Frame*, SecurityOrigin*, const String&, unsigned long long) { return 0; }
     119    virtual void exceededDatabaseQuota(Frame*, const String&) { }
    121120};
    122121
  • trunk/WebKit/gtk/ChangeLog

    r29683 r29698  
     12008-01-21  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by John Sullivan.
     4
     5        - updated for changes to database functions
     6
     7        * WebCoreSupport/ChromeClientGtk.cpp:
     8        (WebKit::ChromeClient::exceededDatabaseQuota):
     9        * WebCoreSupport/ChromeClientGtk.h:
     10        * WebView/webkitprivate.cpp:
     11        (webkit_init):
     12
    1132008-01-20  Alp Toker  <alp@atoker.com>
    214
  • trunk/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp

    r29669 r29698  
    309309}
    310310
    311 unsigned long long ChromeClient::requestQuotaIncreaseForNewDatabase(Frame*, SecurityOrigin*, const String&, unsigned long long)
    312 {
    313     notImplemented();
    314     return 0;
    315 }
    316 
    317 unsigned long long ChromeClient::requestQuotaIncreaseForDatabaseOperation(Frame*, SecurityOrigin*, const String&, unsigned long long)
    318 {
    319     notImplemented();
    320     return 0;
    321 }
    322        
    323 }
     311void ChromeClient::exceededDatabaseQuota(Frame*, const String&)
     312{
     313    notImplemented();
     314}
     315
     316}
  • trunk/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h

    r29663 r29698  
    9494        virtual void print(WebCore::Frame*);
    9595
    96         virtual unsigned long long requestQuotaIncreaseForNewDatabase(WebCore::Frame*, WebCore::SecurityOrigin*, const WebCore::String&, unsigned long long);
    97         virtual unsigned long long requestQuotaIncreaseForDatabaseOperation(WebCore::Frame*, WebCore::SecurityOrigin*, const WebCore::String&, unsigned long long);
     96        virtual void exceededDatabaseQuota(Frame*, const String&);
    9897
    9998    private:
  • trunk/WebKit/gtk/WebView/webkitprivate.cpp

    r29663 r29698  
    106106    // FIXME: It should be possible for client applications to override this default location
    107107    gchar* databaseDirectory = g_build_filename(g_get_user_data_dir(), "webkit", "databases", NULL);
    108     WebCore::DatabaseTracker::tracker().setDatabasePath(databaseDirectory);
     108    WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(databaseDirectory);
    109109    g_free(databaseDirectory);
    110110#endif
  • trunk/WebKit/mac/ChangeLog

    r29682 r29698  
     12008-01-21  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by John Sullivan.
     4
     5        - fix <rdar://problem/5644324> Delegate-less WebKit clients should have no databases
     6        - add a missing export of WebDatabaseExpectedSizeKey
     7        - implement deleteOrigin: and remove deleteDatabasesWithOrigin:
     8
     9        * Storage/WebDatabaseManager.mm:
     10        (-[WebDatabaseManager detailsForDatabase:withOrigin:]): Updated to check for a null
     11        name instead of calling isValid().
     12        (-[WebDatabaseManager deleteOrigin:]): Implemented.
     13        (WebKitInitializeDatabasesIfNecessary): Updated for name change.
     14
     15        * Storage/WebDatabaseManagerPrivate.h: Removed deleteDatabasesWithOrigin:.
     16
     17        * WebCoreSupport/WebChromeClient.h: Updated for changes to ChromeClient.
     18        * WebCoreSupport/WebChromeClient.mm:
     19        (WebChromeClient::exceededDatabaseQuota): Replaced the two different client functions
     20        we had before with a single one.
     21
     22        * WebKit.exp: Added missing export for WebDatabaseExpectedSizeKey.
     23
     24        * WebView/WebPreferenceKeysPrivate.h: Removed WebKitDefaultDatabaseQuotaKey.
     25        * WebView/WebPreferences.m:
     26        (+[WebPreferences initialize]): Removed the default for WebKitDefaultDatabaseQuotaKey.
     27        * WebView/WebPreferencesPrivate.h: Removed defaultDatabaseQuota and
     28        setDefaultDatabaseQuota:.
     29
     30        * WebView/WebUIDelegatePrivate.h: Replaced the two different database quota delegate
     31        methods we had before with a single one.
     32
     33        * WebView/WebView.mm:
     34        (-[WebView _preferencesChangedNotification:]): Removed the code to set the
     35        default database origin quota in WebCore::Settings based on WebPreferences.
     36
     37        * WebView/WebViewInternal.h: Removed delegate method dispatch functions for unusual
     38        types of parameters that the database UI delegate methods had before.
     39
    1402008-01-20  Mark Rowe  <mrowe@apple.com>
    241
  • trunk/WebKit/mac/Storage/WebDatabaseManager.mm

    r29663 r29698  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    9191   
    9292    DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(databaseIdentifier, [origin _core]);
    93     if (!details.isValid())
     93    if (details.name().isNull())
    9494        return nil;
    9595       
     
    109109- (void)deleteOrigin:(WebSecurityOrigin *)origin
    110110{
    111     // FIXME: this needs to delete the origin as well as the databases therein
    112     [self deleteDatabasesWithOrigin:origin];
    113 }
    114 
    115 - (void)deleteDatabasesWithOrigin:(WebSecurityOrigin *)origin
    116 {
    117     DatabaseTracker::tracker().deleteDatabasesWithOrigin([origin _core]);
     111    DatabaseTracker::tracker().deleteOrigin([origin _core]);
    118112}
    119113
     
    138132        databasesDirectory = @"~/Library/WebKit/Databases";
    139133
    140     DatabaseTracker::tracker().setDatabasePath([databasesDirectory stringByStandardizingPath]);
     134    DatabaseTracker::tracker().setDatabaseDirectoryPath([databasesDirectory stringByStandardizingPath]);
    141135
    142136    // Set the DatabaseTrackerClient
  • trunk/WebKit/mac/Storage/WebDatabaseManagerPrivate.h

    r29663 r29698  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4646
    4747@interface WebDatabaseManager : NSObject
    48 {
    49 }
    5048
    51 + (WebDatabaseManager *) sharedWebDatabaseManager;
     49+ (WebDatabaseManager *)sharedWebDatabaseManager;
    5250
    53 // Will return an array of WebSecurityOrigins
     51// Will return an array of WebSecurityOrigin objects.
    5452- (NSArray *)origins;
    5553
    56 // Will return an array of strings, the names of each database in the given origin
     54// Will return an array of strings, the identifiers of each database in the given origin.
    5755- (NSArray *)databasesWithOrigin:(WebSecurityOrigin *)origin;
    5856
    59 // Will return the dictionary describing everything about the database for the passed origin and name
     57// Will return the dictionary describing everything about the database for the passed identifier and origin.
    6058- (NSDictionary *)detailsForDatabase:(NSString *)databaseIdentifier withOrigin:(WebSecurityOrigin *)origin;
    6159
    62 - (void)deleteAllDatabases;
     60- (void)deleteAllDatabases; // Deletes all databases and all origins.
    6361- (void)deleteOrigin:(WebSecurityOrigin *)origin;
    64 - (void)deleteDatabasesWithOrigin:(WebSecurityOrigin *)origin;
    6562- (void)deleteDatabase:(NSString *)databaseIdentifier withOrigin:(WebSecurityOrigin *)origin;
    6663
  • trunk/WebKit/mac/WebCoreSupport/WebChromeClient.h

    r29663 r29698  
    11/*
    2  * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 * Copyright (C) 2007 Trolltech ASA
    44 *
     
    101101    virtual void print(WebCore::Frame*);
    102102
    103     virtual unsigned long long requestQuotaIncreaseForNewDatabase(WebCore::Frame*, WebCore::SecurityOrigin* origin, const WebCore::String& databaseDisplayName, unsigned long long estimatedSize);
    104     virtual unsigned long long requestQuotaIncreaseForDatabaseOperation(WebCore::Frame*, WebCore::SecurityOrigin* origin, const WebCore::String& databaseIdentifier, unsigned long long proposedNewQuota);
     103    virtual void exceededDatabaseQuota(WebCore::Frame*, const WebCore::String& databaseName);
    105104
    106105private:
  • trunk/WebKit/mac/WebCoreSupport/WebChromeClient.mm

    r29663 r29698  
    11/*
    2  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 * Copyright (C) 2007 Trolltech ASA
    44 *
     
    4545#import <WebCore/BlockExceptions.h>
    4646#import <WebCore/FloatRect.h>
     47#import <WebCore/Frame.h>
    4748#import <WebCore/FrameLoadRequest.h>
    4849#import <WebCore/HitTestResult.h>
     
    364365}
    365366
    366 void WebChromeClient::setStatusbarText(const WebCore::String& status)
     367void WebChromeClient::setStatusbarText(const String& status)
    367368{
    368369    // We want the temporaries allocated here to be released even before returning to the
     
    413414}
    414415
    415 unsigned long long WebChromeClient::requestQuotaIncreaseForNewDatabase(WebCore::Frame* frame, WebCore::SecurityOrigin* origin, const WebCore::String& databaseDisplayName, unsigned long long estimatedSize)
    416 {
    417     WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin];
    418     unsigned long long result = CallUIDelegateReturningUnsignedLongLong(m_webView, @selector(webView:frame:quotaForSecurityOrigin:toCreateDatabase:withEstimatedSize:), kit(frame), webOrigin, (NSString *)databaseDisplayName, estimatedSize);
     416void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName)
     417{
     418    WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()];
     419    CallUIDelegate(m_webView, @selector(webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:), kit(frame), webOrigin, (NSString *)databaseName);
    419420    [webOrigin release];
    420     return result;
    421 }
    422 
    423 unsigned long long WebChromeClient::requestQuotaIncreaseForDatabaseOperation(WebCore::Frame* frame, WebCore::SecurityOrigin* origin, const WebCore::String& databaseIdentifier, unsigned long long proposedNewQuota)
    424 {
    425     WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin];
    426     unsigned long long result = CallUIDelegateReturningUnsignedLongLong(m_webView, @selector(webView:frame:quotaForSecurityOrigin:fromProposedQuota:database:), kit(frame), webOrigin, proposedNewQuota, (NSString *)databaseIdentifier);
    427     [webOrigin release];
    428     return result;
    429421}
    430422   
  • trunk/WebKit/mac/WebKit.exp

    r28441 r29698  
    4545_WebDatabaseDirectoryDefaultsKey
    4646_WebDatabaseDisplayNameKey
     47_WebDatabaseExpectedSizeKey
    4748_WebDatabaseIdentifierKey
    4849_WebDatabaseUsageKey
  • trunk/WebKit/mac/WebView/WebPreferenceKeysPrivate.h

    r28202 r29698  
    7575#define WebKitEditableLinkBehaviorPreferenceKey @"WebKitEditableLinkBehavior"
    7676#define WebKitCacheModelPreferenceKey @"WebKitCacheModelPreferenceKey"
    77 #define WebKitDefaultDatabaseQuotaKey @"WebKitDefaultDatabaseQuota"
    7877
    7978// CoreGraphics deferred updates are disabled if WebKitEnableCoalescedUpdatesPreferenceKey is set
  • trunk/WebKit/mac/WebView/WebPreferences.m

    r28314 r29698  
    333333        [NSNumber numberWithBool:NO],  WebKitDeveloperExtrasEnabledPreferenceKey,
    334334        [NSNumber numberWithBool:YES],  WebKitAuthorAndUserStylesEnabledPreferenceKey,
    335         [NSNumber numberWithUnsignedLongLong:5242880], WebKitDefaultDatabaseQuotaKey,
    336335        nil];
    337336
     
    978977}
    979978
    980 - (unsigned long long)defaultDatabaseQuota
    981 {
    982     return [self _unsignedLongLongValueForKey:WebKitDefaultDatabaseQuotaKey];
    983 }
    984 
    985 - (void)setDefaultDatabaseQuota:(unsigned long long)quota
    986 {
    987     [self _setUnsignedLongLongValue:quota forKey:WebKitDefaultDatabaseQuotaKey];
    988 }
    989 
    990979@end
    991980
  • trunk/WebKit/mac/WebView/WebPreferencesPrivate.h

    r28071 r29698  
    106106- (void)didRemoveFromWebView;
    107107
    108 - (unsigned long long)defaultDatabaseQuota;
    109 - (void)setDefaultDatabaseQuota:(unsigned long long)quota;
    110108@end
  • trunk/WebKit/mac/WebView/WebUIDelegatePrivate.h

    r28597 r29698  
    11/*
    2  * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    8888
    8989/*!
    90     @method webView:quotaForSecurityOrigin:toCreateDatabase:withEstimatedSize:
    91     @param sender The WebView sending the delegate method
     90    @method webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:
     91    @param sender The WebView sending the delegate method.
    9292    @param frame The WebFrame whose JavaScript initiated this call.
    93     @param origin The security origin of the database that needs a larger quota to create a database
    94     @param newDatabaseName The display name of the new database
    95     @param estimatedSize The estimated maximum usage of the new database
    96     @result The new quota, in bytes
    97     @discussion If the new quota is less than or equal to the current usage for the given security origin, the new database will not be created.
    98     Otherwise the database will created, even if the new quota doesn't allow for the entire estimated size.
     93    @param origin The security origin that needs a larger quota.
     94    @param databaseIdentifier The identifier of the database involved.
    9995*/
    100 - (unsigned long long)webView:(WebView *)sender frame:(WebFrame *)frame quotaForSecurityOrigin:(WebSecurityOrigin *)origin toCreateDatabase:(NSString *)newDatabaseName withEstimatedSize:(unsigned long long)estimatedSize;
    101 
    102 /*!
    103     @method webView:quotaForSecurityOrigin:fromProposedQuota:database:
    104     @param sender The WebView sending the delegate method
    105     @param frame The WebFrame whose JavaScript initiated this call.
    106     @param origin The security origin of the database that has reached its size limit
    107     @param proposedNewQuota WebKit's best guess as to the required new quota
    108     @param databaseIdentifier The string identifier of the database
    109     @result The new quota, in bytes
    110     @discussion If the new quota is less than the proposedNewQuota, the current database operation will fail.
    111     If the new quota is equal to or greater than the proposedNewQuota, the current database operation will continue,
    112     possibly calling this delegate method again to request even more space
    113 */
    114 - (unsigned long long)webView:(WebView *)sender frame:(WebFrame *)frame quotaForSecurityOrigin:(WebSecurityOrigin *)origin fromProposedQuota:(unsigned long long)proposedNewQuota database:(NSString *)databaseIdentifier;
     96- (void)webView:(WebView *)sender frame:(WebFrame *)frame exceededDatabaseQuotaForSecurityOrigin:(WebSecurityOrigin *)origin database:(NSString *)databaseIdentifier;
    11597
    11698- (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request windowFeatures:(NSDictionary *)features;
  • trunk/WebKit/mac/WebView/WebView.mm

    r29682 r29698  
    11/*
    2  * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 * Copyright (C) 2006 David Smith (catfish.man@gmail.com)
    44 *
     
    977977    settings->setNeedsAdobeFrameReloadingQuirk([self _needsAdobeFrameReloadingQuirk]);
    978978    settings->setNeedsKeyboardEventDisambiguationQuirks([self _needsKeyboardEventDisambiguationQuirks]);
    979     settings->setDefaultDatabaseOriginQuota([preferences defaultDatabaseQuota]);
    980979}
    981980
     
    42874286}
    42884287
    4289 typedef unsigned long long (*ObjCMsgSendULLRet)(id, SEL, ...);
    4290 static const ObjCMsgSendULLRet objc_msgSend_ullret = reinterpret_cast<ObjCMsgSendULLRet>(objc_msgSend);
    4291 
    4292 static inline unsigned long long CallDelegateReturningUnsignedLongLong(WebView *self, id delegate, SEL selector, id object1, id object2, id object3, unsigned long long integer)
    4293 {
    4294     if (!delegate || ![delegate respondsToSelector:selector])
    4295         return 0;
    4296     if (!self->_private->catchesDelegateExceptions)
    4297         return objc_msgSend_ullret(delegate, selector, self, object1, object2, object3, integer);
    4298     @try {
    4299         return objc_msgSend_ullret(delegate, selector, self, object1, object2, object3, integer);
    4300     } @catch(id exception) {
    4301         ReportDiscardedDelegateException(selector, exception);
    4302     }
    4303     return 0;
    4304 }
    4305 
    4306 static inline unsigned long long CallDelegateReturningUnsignedLongLong(WebView *self, id delegate, SEL selector, id object1, id object2, unsigned long long integer, id object3)
    4307 {
    4308     if (!delegate || ![delegate respondsToSelector:selector])
    4309         return 0;
    4310     if (!self->_private->catchesDelegateExceptions)
    4311         return objc_msgSend_ullret(delegate, selector, self, object1, object2, integer, object3);
    4312     @try {
    4313         return objc_msgSend_ullret(delegate, selector, self, object1, object2, integer, object3);
    4314     } @catch(id exception) {
    4315         ReportDiscardedDelegateException(selector, exception);
    4316     }
    4317     return 0;
    4318 }
    4319 
    43204288static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector)
    43214289{
     
    45244492{
    45254493    return CallDelegateReturningFloat(self, self->_private->UIDelegate, selector);
    4526 }
    4527 
    4528 unsigned long long CallUIDelegateReturningUnsignedLongLong(WebView *self, SEL selector, id object1, id object2, id object3, unsigned long long integer)
    4529 {
    4530     return CallDelegateReturningUnsignedLongLong(self, self->_private->UIDelegate, selector, object1, object2, object3, integer);
    4531 }
    4532 
    4533 unsigned long long CallUIDelegateReturningUnsignedLongLong(WebView *self, SEL selector, id object1, id object2, unsigned long long integer, id object3)
    4534 {
    4535     return CallDelegateReturningUnsignedLongLong(self, self->_private->UIDelegate, selector, object1, object2, integer, object3);
    45364494}
    45374495
  • trunk/WebKit/mac/WebView/WebViewInternal.h

    r29496 r29698  
    170170id CallUIDelegate(WebView *, SEL, id, NSUInteger);
    171171float CallUIDelegateReturningFloat(WebView *, SEL);
    172 unsigned long long CallUIDelegateReturningUnsignedLongLong(WebView *, SEL, id, id, id, unsigned long long);
    173 unsigned long long CallUIDelegateReturningUnsignedLongLong(WebView *, SEL, id, id, unsigned long long, id);
    174172BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL);
    175173BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id);
  • trunk/WebKit/qt/ChangeLog

    r29693 r29698  
     12008-01-21  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by John Sullivan.
     4
     5        - updated for changes to ChromeClient database functions
     6
     7        * WebCoreSupport/ChromeClientQt.cpp:
     8        (WebCore::ChromeClientQt::exceededDatabaseQuota):
     9        * WebCoreSupport/ChromeClientQt.h:
     10
    1112008-01-21  Benjamin Meyer  <bmeyer@trolltech.com>
    212
  • trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp

    r29689 r29698  
    331331}
    332332
    333 unsigned long long ChromeClientQt::requestQuotaIncreaseForNewDatabase(Frame*, SecurityOrigin*, const String&, unsigned long long)
    334 {
    335     notImplemented();
    336     return 0;
    337 }
    338 
    339 unsigned long long ChromeClientQt::requestQuotaIncreaseForDatabaseOperation(Frame*, SecurityOrigin*, const String&, unsigned long long)
    340 {
    341     notImplemented();
    342     return 0;
    343 }
    344 
    345 }
    346 
    347 
     333void ChromeClientQt::exceededDatabaseQuota(Frame*, const String&)
     334{
     335    notImplemented();
     336}
     337
     338}
     339
     340
  • trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.h

    r29663 r29698  
    108108        virtual void print(Frame*);
    109109
    110         virtual unsigned long long requestQuotaIncreaseForNewDatabase(Frame*, SecurityOrigin*, const String&, unsigned long long);
    111         virtual unsigned long long requestQuotaIncreaseForDatabaseOperation(Frame*, SecurityOrigin*, const String&, unsigned long long);
     110        virtual void exceededDatabaseQuota(Frame*, const String&);
    112111
    113112        QWebPage* m_webPage;
  • trunk/WebKit/win/ChangeLog

    r29671 r29698  
     12008-01-21  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by John Sullivan.
     4
     5        - fix <rdar://problem/5644324> Delegate-less WebKit clients should have no databases
     6        - fix incorrect value for WebDatabaseDisplayNameKey in header
     7       
     8        * Interfaces/IWebDatabaseManager.idl: Renamed detailsForDatabaseWithOrigin to
     9        detailsForDatabase. Replaced deleteDatabasesWithOrigin with deleteOrigin.
     10        Renamed deleteDatabaseWithOrigin to deleteDatabase. Fixed incorrect value for
     11        WebDatabaseDisplayNameKey.
     12        * Interfaces/IWebPreferencesPrivate.idl: Removed defaultDatabaseQuota and
     13        setDefaultDatabaseQuota.
     14        * Interfaces/IWebUIDelegatePrivate.idl: Replaced the two database quota functions
     15        with a single one.
     16
     17        * WebChromeClient.cpp:
     18        (WebChromeClient::exceededDatabaseQuota): Replaced the two database quota functions
     19        with a single one.
     20        * WebChromeClient.h: Ditto.
     21
     22        * WebDatabaseManager.cpp:
     23        (WebDatabaseManager::detailsForDatabase): Changed to check for a name of null to
     24        detect a nonexistent database rather than using isValid.
     25        (WebDatabaseManager::deleteOrigin): Updated for name change (actually a semantic
     26        change too, but both have the same name).
     27        (WebDatabaseManager::deleteDatabase): Updated for name change.
     28        (WebKitSetWebDatabasesPathIfNecessary): Ditto.
     29
     30        * WebDatabaseManager.h: Updated for name changes.
     31
     32        * WebPreferenceKeysPrivate.h: Removed WebKitDefaultDatabaseQuotaKey.
     33        * WebPreferences.cpp:
     34        (WebPreferences::initializeDefaultSettings): Removed the default for
     35        WebKitDefaultDatabaseQuotaKey.
     36        * WebPreferences.h: Removed defaultDatabaseQuota and setDefaultDatabaseQuota.
     37        * WebView.cpp:
     38        (WebView::notifyPreferencesChanged): Removed the code to set the
     39        default database origin quota in WebCore::Settings based on IWebPreferencesPrivate.
     40
    1412008-01-19  Mark Rowe  <mrowe@apple.com>
    242
  • trunk/WebKit/win/Interfaces/IWebDatabaseManager.idl

    r29671 r29698  
    2525
    2626cpp_quote("/*")
    27 cpp_quote(" * Copyright (C) 2007 Apple Inc. All rights reserved.")
     27cpp_quote(" * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.")
    2828cpp_quote(" *")
    2929cpp_quote(" * Redistribution and use in source and binary forms, with or without")
     
    5252import "ocidl.idl";
    5353
    54 cpp_quote("#define WebDatabaseDisplayNameKey TEXT(\"WebDatabaseExpectedSizeKey\")")
     54cpp_quote("#define WebDatabaseDisplayNameKey TEXT(\"WebDatabaseDisplayNameKey\")")
    5555cpp_quote("#define WebDatabaseExpectedSizeKey TEXT(\"WebDatabaseExpectedSizeKey\")")
    5656cpp_quote("#define WebDatabaseUsageKey TEXT(\"WebDatabaseUsageKey\")")
     
    7474    HRESULT origins([out, retval] IEnumVARIANT** result);
    7575    HRESULT databasesWithOrigin([in] IWebSecurityOrigin* origin, [out, retval] IEnumVARIANT** result);
    76     HRESULT detailsForDatabaseWithOrigin([in] BSTR databaseName, [in] IWebSecurityOrigin* origin, [out, retval] IPropertyBag **result);
     76    HRESULT detailsForDatabase([in] BSTR databaseName, [in] IWebSecurityOrigin* origin, [out, retval] IPropertyBag **result);
    7777
    7878    HRESULT deleteAllDatabases();
    79     HRESULT deleteDatabasesWithOrigin([in] IWebSecurityOrigin* origin);
    80     HRESULT deleteDatabaseWithOrigin([in] BSTR databaseName, [in] IWebSecurityOrigin* origin);
     79    HRESULT deleteOrigin([in] IWebSecurityOrigin* origin);
     80    HRESULT deleteDatabase([in] BSTR databaseName, [in] IWebSecurityOrigin* origin);
    8181}
  • trunk/WebKit/win/Interfaces/IWebPreferencesPrivate.idl

    r29671 r29698  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2828
    2929cpp_quote("/*")
    30 cpp_quote(" * Copyright (C) 2007 Apple Inc. All rights reserved.")
     30cpp_quote(" * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.")
    3131cpp_quote(" *")
    3232cpp_quote(" * Redistribution and use in source and binary forms, with or without")
     
    7575    HRESULT setAuthorAndUserStylesEnabled([in] BOOL enabled);
    7676    HRESULT authorAndUserStylesEnabled([out, retval] BOOL* enabled);
    77 
    78     HRESULT defaultDatabaseQuota([out, retval] unsigned long long* quota);
    79     HRESULT setDefaultDatabaseQuota([in] unsigned long long quota);
    8077}
  • trunk/WebKit/win/Interfaces/IWebUIDelegatePrivate.idl

    r28632 r29698  
    11/*
    2  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2525
    2626cpp_quote("/*")
    27 cpp_quote(" * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.")
     27cpp_quote(" * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.")
    2828cpp_quote(" *")
    2929cpp_quote(" * Redistribution and use in source and binary forms, with or without")
     
    8787}
    8888
    89 
    9089[
    9190    object,
     
    9695interface IWebUIDelegatePrivate3 : IWebUIDelegatePrivate2
    9796{
    98 /*!
    99     @method webView:quotaForSecurityOrigin:toCreateDatabase:withEstimatedSize:
    100     @param sender The WebView sending the delegate method
    101     @param origin The security origin of the database that needs a larger quota to create a database
    102     @param newDatabaseName The display name of the new database
    103     @param estimatedSize The estimated maximum usage of the new database
    104     @result The new quota, in bytes
    105     @discussion If the new quota is less than or equal to the current usage for the given security origin, the new database will not be created.
    106     Otherwise the database will created, even if the new quota doesn't allow for the entire estimated size.
    107 
    108     - (unsigned long long)webView:(WebView *)sender quotaForSecurityOrigin:(WebSecurityOrigin *)origin toCreateDatabase:(NSString *)newDatabaseName withEstimatedSize:(unsigned long long)estimatedSize;
    109 */
    110     HRESULT quotaForSecurityOriginForNewDatabase([in] IWebView* sender, [in] IWebFrame* frame, [in] IWebSecurityOrigin* origin, [in] BSTR newDatabaseName, [in] unsigned long long estimatedSize, [out, retval] unsigned long long* newQuota);
    111 
    112 /*!
    113     @method webView:quotaForSecurityOrigin:fromProposedQuota:database:
    114     @param sender The WebView sending the delegate method
    115     @param origin The security origin of the database that has reached its size limit
    116     @param proposedNewQuota WebKit's best guess as to the required new quota
    117     @param databaseIdentifier The string identifier of the database
    118     @result The new quota, in bytes
    119     @discussion If the new quota is less than the proposedNewQuota, the current database operation will fail.
    120     If the new quota is equal to or greater than the proposedNewQuota, the current database operation will continue,
    121     possibly calling this delegate method again to request even more space
    122 
    123     - (unsigned long long)webView:(WebView *)sender quotaForSecurityOrigin:(WebSecurityOrigin *)origin fromProposedQuota:(unsigned long long)proposedNewQuota database:(NSString *)databaseIdentifier;
    124 */
    125     HRESULT quotaForSecurityOriginForDatabaseOperation([in] IWebView* sender, [in] IWebFrame* frame, [in] IWebSecurityOrigin* origin, [in] unsigned long long proposedNewQuota, [in] BSTR databaseIdentifier, [out, retval] unsigned long long* newQuota);
     97    HRESULT exceededDatabaseQuota([in] IWebView* sender, [in] IWebFrame* frame, [in] IWebSecurityOrigin* origin, [in] BSTR databaseIdentifier);
    12698}
  • trunk/WebKit/win/WebChromeClient.cpp

    r29498 r29698  
    460460}
    461461
    462 unsigned long long WebChromeClient::requestQuotaIncreaseForNewDatabase(Frame* frame, SecurityOrigin* origin, const String& databaseDisplayName, unsigned long long estimatedSize)
    463 {
    464     COMPtr<WebSecurityOrigin> webOrigin(AdoptCOM, WebSecurityOrigin::createInstance(origin));
    465     unsigned long long result = 0;
     462void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseIdentifier)
     463{
     464    COMPtr<WebSecurityOrigin> origin(AdoptCOM, WebSecurityOrigin::createInstance(frame->document()->securityOrigin()));
    466465    COMPtr<IWebUIDelegate> uiDelegate;
    467466    if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
    468467        COMPtr<IWebUIDelegatePrivate3> uiDelegatePrivate3(Query, uiDelegate);
    469         if (uiDelegatePrivate3 &&
    470             SUCCEEDED(uiDelegatePrivate3->quotaForSecurityOriginForNewDatabase(m_webView, kit(frame), webOrigin.get(), BString(databaseDisplayName), estimatedSize, &result)))
    471             return result;
    472     }
    473     // an error happened - just return the current quota
    474     webOrigin->quota(&result);
    475     return result;
    476 }
    477 
    478 unsigned long long WebChromeClient::requestQuotaIncreaseForDatabaseOperation(Frame* frame, SecurityOrigin* origin, const String& databaseIdentifier, unsigned long long proposedNewQuota)
    479 {
    480     COMPtr<WebSecurityOrigin> webOrigin(AdoptCOM, WebSecurityOrigin::createInstance(origin));
    481     unsigned long long result = 0;
    482     COMPtr<IWebUIDelegate> uiDelegate;
    483     if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
    484         COMPtr<IWebUIDelegatePrivate3> uiDelegatePrivate3(Query, uiDelegate);
    485         if (uiDelegatePrivate3 &&
    486             SUCCEEDED(uiDelegatePrivate3->quotaForSecurityOriginForDatabaseOperation(m_webView, kit(frame), webOrigin.get(), proposedNewQuota, BString(databaseIdentifier), &result)))
    487             return result;
    488     }
    489     // an error happened - just return the current quota
    490     webOrigin->quota(&result);
    491     return result;
     468        uiDelegatePrivate3->exceededDatabaseQuota(m_webView, kit(frame), origin.get(), BString(databaseIdentifier));
     469    }
    492470}
    493471
  • trunk/WebKit/win/WebChromeClient.h

    r29386 r29698  
    9999    virtual void print(WebCore::Frame*);
    100100
    101     virtual unsigned long long requestQuotaIncreaseForNewDatabase(WebCore::Frame*, WebCore::SecurityOrigin*, const WebCore::String&, unsigned long long);
    102     virtual unsigned long long requestQuotaIncreaseForDatabaseOperation(WebCore::Frame*, WebCore::SecurityOrigin*, const WebCore::String&, unsigned long long);
     101    virtual void exceededDatabaseQuota(WebCore::Frame*, const WebCore::String&);
    103102
    104103    virtual WebView* webView() const { return m_webView; }
  • trunk/WebKit/win/WebDatabaseManager.cpp

    r29663 r29698  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
     28
    2829#include "config.h"
    2930#include "WebDatabaseManager.h"
     
    246247}
    247248
    248 HRESULT STDMETHODCALLTYPE WebDatabaseManager::detailsForDatabaseWithOrigin(
     249HRESULT STDMETHODCALLTYPE WebDatabaseManager::detailsForDatabase(
    249250    /* [in] */ BSTR databaseName,
    250251    /* [in] */ IWebSecurityOrigin* origin,
     
    266267        webSecurityOrigin->securityOrigin());
    267268
    268     if (!details.isValid())
     269    if (details.name().isNull())
    269270        return E_INVALIDARG;
    270271
     
    283284}
    284285   
    285 HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteDatabasesWithOrigin(
     286HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteOrigin(
    286287    /* [in] */ IWebSecurityOrigin* origin)
    287288{
     
    296297        return E_FAIL;
    297298
    298     DatabaseTracker::tracker().deleteDatabasesWithOrigin(webSecurityOrigin->securityOrigin());
     299    DatabaseTracker::tracker().deleteOrigin(webSecurityOrigin->securityOrigin());
    299300
    300301    return S_OK;
    301302}
    302303   
    303 HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteDatabaseWithOrigin(
     304HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteDatabase(
    304305    /* [in] */ BSTR databaseName,
    305306    /* [in] */ IWebSecurityOrigin* origin)
     
    358359
    359360    WebCore::String databasesDirectory = WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "Databases");
    360     WebCore::DatabaseTracker::tracker().setDatabasePath(databasesDirectory);
     361    WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(databasesDirectory);
    361362
    362363    pathSet = true;
    363364}
    364 
  • trunk/WebKit/win/WebDatabaseManager.h

    r29663 r29698  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
     28
    2829#ifndef WebDatabaseManager_h
    2930#define WebDatabaseManager_h
     
    5758        /* [retval][out] */ IEnumVARIANT** result);
    5859       
    59     virtual HRESULT STDMETHODCALLTYPE detailsForDatabaseWithOrigin(
     60    virtual HRESULT STDMETHODCALLTYPE detailsForDatabase(
    6061        /* [in] */ BSTR databaseName,
    6162        /* [in] */ IWebSecurityOrigin* origin,
     
    6465    virtual HRESULT STDMETHODCALLTYPE deleteAllDatabases();
    6566       
    66     virtual HRESULT STDMETHODCALLTYPE deleteDatabasesWithOrigin(
     67    virtual HRESULT STDMETHODCALLTYPE deleteOrigin(
    6768        /* [in] */ IWebSecurityOrigin* origin);
    6869       
    69     virtual HRESULT STDMETHODCALLTYPE deleteDatabaseWithOrigin(
     70    virtual HRESULT STDMETHODCALLTYPE deleteDatabase(
    7071        /* [in] */ BSTR databaseName,
    7172        /* [in] */ IWebSecurityOrigin* origin);
  • trunk/WebKit/win/WebPreferenceKeysPrivate.h

    r28866 r29698  
    6868#define WebKitPDFScaleFactorPreferenceKey "WebKitPDFScaleFactor"
    6969#define WebKitEditableLinkBehaviorPreferenceKey "WebKitEditableLinkBehavior"
    70 #define WebKitDefaultDatabaseQuotaKey "WebKitDefaultDatabaseQuota"
    7170
    7271// Window display is throttled to 60 frames per second if WebKitThrottleWindowDisplayPreferenceKey
  • trunk/WebKit/win/WebPreferences.cpp

    r28866 r29698  
    192192    RetainPtr<CFStringRef> cacheModelRef(AdoptCF, CFStringCreateWithFormat(0, 0, CFSTR("%d"), WebCacheModelDocumentViewer));
    193193    CFDictionaryAddValue(defaults, CFSTR(WebKitCacheModelPreferenceKey), cacheModelRef.get());
    194     CFDictionaryAddValue(defaults, CFSTR(WebKitDefaultDatabaseQuotaKey), CFSTR("5242880"));     // 5 MB
    195194
    196195    CFDictionaryAddValue(defaults, CFSTR(WebKitAuthorAndUserStylesEnabledPreferenceKey), kCFBooleanTrue);
     
    11341133}
    11351134
    1136 HRESULT STDMETHODCALLTYPE WebPreferences::defaultDatabaseQuota(unsigned long long* quota)
    1137 {
    1138     if (!quota)
    1139         return E_POINTER;
    1140 
    1141     long long value = longlongValueForKey(CFSTR(WebKitDefaultDatabaseQuotaKey));
    1142     if (value < 0 || value > LLONG_MAX) {
    1143         value = 0;
    1144         setDefaultDatabaseQuota(0);
    1145     }
    1146     *quota = value;
    1147     return S_OK;
    1148 }
    1149 
    1150 HRESULT STDMETHODCALLTYPE WebPreferences::setDefaultDatabaseQuota(unsigned long long quota)
    1151 {
    1152     if (quota > LLONG_MAX)
    1153         quota = 0;
    1154     setLongLongValue(CFSTR(WebKitDefaultDatabaseQuotaKey), quota);
    1155     return S_OK;
    1156 }
    1157 
    11581135HRESULT STDMETHODCALLTYPE WebPreferences::setAuthorAndUserStylesEnabled(BOOL enabled)
    11591136{
  • trunk/WebKit/win/WebPreferences.h

    r28422 r29698  
    289289         /* [out, retval] */ BOOL* automaticallyDetectsCacheModel);
    290290
    291     virtual HRESULT STDMETHODCALLTYPE defaultDatabaseQuota(
    292         /* [retval][out] */ unsigned long long *quota);
    293 
    294     virtual HRESULT STDMETHODCALLTYPE setDefaultDatabaseQuota(
    295         /* [in] */ unsigned long long quota);
    296 
    297291    virtual HRESULT STDMETHODCALLTYPE setAuthorAndUserStylesEnabled(BOOL);
    298292    virtual HRESULT STDMETHODCALLTYPE authorAndUserStylesEnabled(BOOL*);
  • trunk/WebKit/win/WebView.cpp

    r29627 r29698  
    39153915    COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences);
    39163916    if (prefsPrivate) {
    3917         unsigned long long defaultQuota = 0;
    3918         hr = prefsPrivate->defaultDatabaseQuota(&defaultQuota);
    3919         if (FAILED(hr))
    3920             return hr;
    3921         settings->setDefaultDatabaseOriginQuota(defaultQuota);
    3922 
    39233917        hr = prefsPrivate->authorAndUserStylesEnabled(&enabled);
    39243918        if (FAILED(hr))
  • trunk/WebKit/wx/ChangeLog

    r29663 r29698  
     12008-01-21  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by John Sullivan.
     4
     5        - updated for changes to ChromeClient database functions
     6
     7        * WebKitSupport/ChromeClientWx.cpp:
     8        (WebCore::ChromeClientWx::exceededDatabaseQuota):
     9        * WebKitSupport/ChromeClientWx.h:
     10
    1112008-01-16  Adam Roben  <aroben@apple.com>
    212
  • trunk/WebKit/wx/WebKitSupport/ChromeClientWx.cpp

    r29663 r29698  
    309309    notImplemented();
    310310}
     311
    311312void ChromeClientWx::print(Frame*)
    312313{
     
    314315}
    315316
    316 unsigned long long ChromeClientWx::requestQuotaIncreaseForNewDatabase(Frame*, SecurityOrigin*, const String&, unsigned long long)
    317 {
    318     notImplemented();
    319     return 0;
    320 }
    321 
    322 unsigned long long ChromeClientWx::requestQuotaIncreaseForDatabaseOperation(Frame*, SecurityOrigin*, const String&, unsigned long long)
    323 {
    324     notImplemented();
    325     return 0;
    326 }
    327 
    328 }
     317void ChromeClientWx::exceededDatabaseQuota(Frame*, const String&)
     318{
     319    notImplemented();
     320}
     321
     322}
  • trunk/WebKit/wx/WebKitSupport/ChromeClientWx.h

    r29663 r29698  
    105105    virtual void print(Frame*);
    106106
    107     virtual unsigned long long requestQuotaIncreaseForNewDatabase(Frame*, SecurityOrigin*, const String&, unsigned long long);
    108     virtual unsigned long long requestQuotaIncreaseForDatabaseOperation(Frame*, SecurityOrigin*, const String&, unsigned long long);   
     107    virtual void exceededDatabaseQuota(Frame*, const String&);
    109108
    110109private:
Note: See TracChangeset for help on using the changeset viewer.