Changeset 143264 in webkit


Ignore:
Timestamp:
Feb 18, 2013 2:31:54 PM (11 years ago)
Author:
mark.lam@apple.com
Message:

Introduced AbstractSQLStatement and AbstractSQLStatementBackend.
https://bugs.webkit.org/show_bug.cgi?id=110148.

Reviewed by Geoff Garen.

This is part of the webdatabase refactoring for webkit2.

  • Also changed the frontend and backend to only refer to the abstract interface of each other.

No new tests.

  • GNUmakefile.list.am:
  • Modules/webdatabase/AbstractSQLStatement.h: Added.

(AbstractSQLStatement):
(WebCore::AbstractSQLStatement::~AbstractSQLStatement):

  • Modules/webdatabase/AbstractSQLStatementBackend.h: Added.

(AbstractSQLStatementBackend):
(WebCore::AbstractSQLStatementBackend::~AbstractSQLStatementBackend):

  • Modules/webdatabase/SQLStatement.cpp:

(WebCore::SQLStatement::setBackend):

  • Modules/webdatabase/SQLStatement.h:

(SQLStatement):

  • Modules/webdatabase/SQLStatementBackend.cpp:

(WebCore::SQLStatementBackend::create):
(WebCore::SQLStatementBackend::SQLStatementBackend):
(WebCore::SQLStatementBackend::frontend):

  • Modules/webdatabase/SQLStatementBackend.h:

(SQLStatementBackend):

  • Modules/webdatabase/SQLTransaction.cpp:

(WebCore::SQLTransaction::deliverStatementCallback):

  • Modules/webdatabase/SQLTransactionBackend.cpp:

(WebCore::SQLTransactionBackend::currentStatement):
(WebCore::SQLTransactionBackend::executeSQL):

  • Modules/webdatabase/SQLTransactionBackend.h:

(SQLTransactionBackend):

  • Target.pri:
  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.vcxproj/WebCore.vcxproj:
  • WebCore.vcxproj/WebCore.vcxproj.filters:
  • WebCore.xcodeproj/project.pbxproj:
Location:
trunk/Source/WebCore
Files:
2 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r143263 r143264  
     12013-02-18  Mark Lam  <mark.lam@apple.com>
     2
     3        Introduced AbstractSQLStatement and AbstractSQLStatementBackend.
     4        https://bugs.webkit.org/show_bug.cgi?id=110148.
     5
     6        Reviewed by Geoff Garen.
     7
     8        This is part of the webdatabase refactoring for webkit2.
     9        - Also changed the frontend and backend to only refer to the
     10          abstract interface of each other.
     11
     12        No new tests.
     13
     14        * GNUmakefile.list.am:
     15        * Modules/webdatabase/AbstractSQLStatement.h: Added.
     16        (AbstractSQLStatement):
     17        (WebCore::AbstractSQLStatement::~AbstractSQLStatement):
     18        * Modules/webdatabase/AbstractSQLStatementBackend.h: Added.
     19        (AbstractSQLStatementBackend):
     20        (WebCore::AbstractSQLStatementBackend::~AbstractSQLStatementBackend):
     21        * Modules/webdatabase/SQLStatement.cpp:
     22        (WebCore::SQLStatement::setBackend):
     23        * Modules/webdatabase/SQLStatement.h:
     24        (SQLStatement):
     25        * Modules/webdatabase/SQLStatementBackend.cpp:
     26        (WebCore::SQLStatementBackend::create):
     27        (WebCore::SQLStatementBackend::SQLStatementBackend):
     28        (WebCore::SQLStatementBackend::frontend):
     29        * Modules/webdatabase/SQLStatementBackend.h:
     30        (SQLStatementBackend):
     31        * Modules/webdatabase/SQLTransaction.cpp:
     32        (WebCore::SQLTransaction::deliverStatementCallback):
     33        * Modules/webdatabase/SQLTransactionBackend.cpp:
     34        (WebCore::SQLTransactionBackend::currentStatement):
     35        (WebCore::SQLTransactionBackend::executeSQL):
     36        * Modules/webdatabase/SQLTransactionBackend.h:
     37        (SQLTransactionBackend):
     38        * Target.pri:
     39        * WebCore.gypi:
     40        * WebCore.vcproj/WebCore.vcproj:
     41        * WebCore.vcxproj/WebCore.vcxproj:
     42        * WebCore.vcxproj/WebCore.vcxproj.filters:
     43        * WebCore.xcodeproj/project.pbxproj:
     44
    1452013-02-18  David Kilzer  <ddkilzer@apple.com>
    246
  • trunk/Source/WebCore/GNUmakefile.list.am

    r143223 r143264  
    21012101        Source/WebCore/Modules/webaudio/WaveTable.h \
    21022102        Source/WebCore/Modules/webdatabase/AbstractDatabaseServer.h \
     2103        Source/WebCore/Modules/webdatabase/AbstractSQLStatement.h \
     2104        Source/WebCore/Modules/webdatabase/AbstractSQLStatementBackend.h \
    21032105        Source/WebCore/Modules/webdatabase/ChangeVersionData.h \
    21042106        Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.cpp \
  • trunk/Source/WebCore/Modules/webdatabase/SQLStatement.cpp

    r143090 r143264  
    3232
    3333#include "AbstractDatabaseServer.h"
     34#include "AbstractSQLStatementBackend.h"
    3435#include "Database.h"
    3536#include "DatabaseManager.h"
    3637#include "Logging.h"
    37 #include "SQLError.h"
    38 #include "SQLStatementBackend.h"
    3938#include "SQLStatementCallback.h"
    4039#include "SQLStatementErrorCallback.h"
     
    6059}
    6160
    62 void SQLStatement::setBackend(SQLStatementBackend* backend)
     61void SQLStatement::setBackend(AbstractSQLStatementBackend* backend)
    6362{
    6463    m_backend = backend;
  • trunk/Source/WebCore/Modules/webdatabase/SQLStatement.h

    r143090 r143264  
    3131#if ENABLE(SQL_DATABASE)
    3232
     33#include "AbstractSQLStatement.h"
    3334#include "SQLCallbackWrapper.h"
    3435#include "SQLResultSet.h"
     
    4041namespace WebCore {
    4142
     43class AbstractSQLStatementBackend;
    4244class Database;
    4345class SQLError;
    44 class SQLStatementBackend;
    4546class SQLStatementCallback;
    4647class SQLStatementErrorCallback;
    4748class SQLTransaction;
    4849
    49 class SQLStatement {
     50class SQLStatement : public AbstractSQLStatement {
    5051public:
    5152    static PassOwnPtr<SQLStatement> create(Database*,
     
    5455    bool performCallback(SQLTransaction*);
    5556
    56     void setBackend(SQLStatementBackend*);
     57    virtual void setBackend(AbstractSQLStatementBackend*);
    5758
    58     bool hasCallback();
    59     bool hasErrorCallback();
     59    virtual bool hasCallback();
     60    virtual bool hasErrorCallback();
    6061
    6162private:
    6263    SQLStatement(Database*, PassRefPtr<SQLStatementCallback>, PassRefPtr<SQLStatementErrorCallback>);
    6364
    64     // The SQLStatementBackend owns the SQLStatement. Hence, the backend is
     65    // The AbstractSQLStatementBackend owns the SQLStatement. Hence, the backend is
    6566    // guaranteed to be outlive the SQLStatement, and it is safe for us to refer
    6667    // to the backend using a raw pointer here.
    67     SQLStatementBackend* m_backend;
     68    AbstractSQLStatementBackend* m_backend;
    6869
    6970    SQLCallbackWrapper<SQLStatementCallback> m_statementCallbackWrapper;
  • trunk/Source/WebCore/Modules/webdatabase/SQLStatementBackend.cpp

    r143090 r143264  
    3131#if ENABLE(SQL_DATABASE)
    3232
     33#include "AbstractSQLStatement.h"
    3334#include "DatabaseBackendAsync.h"
    3435#include "Logging.h"
    3536#include "SQLError.h"
    36 #include "SQLStatement.h"
    37 #include "SQLStatementCallback.h"
    38 #include "SQLStatementErrorCallback.h"
    3937#include "SQLValue.h"
    4038#include "SQLiteDatabase.h"
     
    7775namespace WebCore {
    7876
    79 PassRefPtr<SQLStatementBackend> SQLStatementBackend::create(PassOwnPtr<SQLStatement> frontend,
     77PassRefPtr<SQLStatementBackend> SQLStatementBackend::create(PassOwnPtr<AbstractSQLStatement> frontend,
    8078    const String& statement, const Vector<SQLValue>& arguments, int permissions)
    8179{
     
    8381}
    8482
    85 SQLStatementBackend::SQLStatementBackend(PassOwnPtr<SQLStatement> frontend,
     83SQLStatementBackend::SQLStatementBackend(PassOwnPtr<AbstractSQLStatement> frontend,
    8684    const String& statement, const Vector<SQLValue>& arguments, int permissions)
    8785    : m_frontend(frontend)
     
    9593}
    9694
    97 SQLStatement* SQLStatementBackend::frontend()
     95AbstractSQLStatement* SQLStatementBackend::frontend()
    9896{
    9997    return m_frontend.get();
  • trunk/Source/WebCore/Modules/webdatabase/SQLStatementBackend.h

    r143090 r143264  
    3131#if ENABLE(SQL_DATABASE)
    3232
    33 #include "SQLResultSet.h"
     33#include "AbstractSQLStatementBackend.h"
    3434#include "SQLValue.h"
    3535#include <wtf/Forward.h>
     36#include <wtf/PassOwnPtr.h>
    3637#include <wtf/Vector.h>
    3738#include <wtf/text/WTFString.h>
     
    3940namespace WebCore {
    4041
     42class AbstractSQLStatement;
    4143class DatabaseBackendAsync;
    4244class SQLError;
    43 class SQLStatement;
    4445class SQLTransactionBackend;
    4546
    46 class SQLStatementBackend : public ThreadSafeRefCounted<SQLStatementBackend> {
     47class SQLStatementBackend : public AbstractSQLStatementBackend {
    4748public:
    48     static PassRefPtr<SQLStatementBackend> create(PassOwnPtr<SQLStatement>,
     49    static PassRefPtr<SQLStatementBackend> create(PassOwnPtr<AbstractSQLStatement>,
    4950        const String& sqlStatement, const Vector<SQLValue>& arguments, int permissions);
    5051
     
    5859    void setVersionMismatchedError(DatabaseBackendAsync*);
    5960
    60     SQLStatement* frontend();
    61     PassRefPtr<SQLError> sqlError() const;
    62     PassRefPtr<SQLResultSet> sqlResultSet() const;
     61    AbstractSQLStatement* frontend();
     62    virtual PassRefPtr<SQLError> sqlError() const;
     63    virtual PassRefPtr<SQLResultSet> sqlResultSet() const;
    6364
    6465private:
    65     SQLStatementBackend(PassOwnPtr<SQLStatement>, const String& statement,
     66    SQLStatementBackend(PassOwnPtr<AbstractSQLStatement>, const String& statement,
    6667        const Vector<SQLValue>& arguments, int permissions);
    6768
     
    6970    void clearFailureDueToQuota();
    7071
    71     OwnPtr<SQLStatement> m_frontend;
     72    OwnPtr<AbstractSQLStatement> m_frontend;
    7273    String m_statement;
    7374    Vector<SQLValue> m_arguments;
  • trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp

    r143090 r143264  
    175175    m_executeSqlAllowed = true;
    176176
    177     SQLStatement* currentStatement = m_backend->currentStatement();
     177    AbstractSQLStatement* currentAbstractStatement = m_backend->currentStatement();
     178    SQLStatement* currentStatement = static_cast<SQLStatement*>(currentAbstractStatement);
    178179    ASSERT(currentStatement);
    179180
  • trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp

    r143090 r143264  
    4040#include "Logging.h"
    4141#include "SQLError.h"
    42 #include "SQLStatement.h"
    4342#include "SQLStatementBackend.h"
    44 #include "SQLStatementCallback.h" // FIXME: remove when SQLStatement has been refactored.
    45 #include "SQLStatementErrorCallback.h" // FIXME: remove when SQLStatement has been refactored.
    4643#include "SQLTransaction.h"
    4744#include "SQLTransactionClient.h"
     
    378375}
    379376
    380 SQLStatement* SQLTransactionBackend::currentStatement()
     377AbstractSQLStatement* SQLTransactionBackend::currentStatement()
    381378{
    382379    return m_currentStatementBackend->frontend();
     
    464461}
    465462
    466 void SQLTransactionBackend::executeSQL(PassOwnPtr<SQLStatement> statement,
     463void SQLTransactionBackend::executeSQL(PassOwnPtr<AbstractSQLStatement> statement,
    467464    const String& sqlStatement, const Vector<SQLValue>& arguments, int permissions)
    468465{
  • trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h

    r143090 r143264  
    3131#if ENABLE(SQL_DATABASE)
    3232
     33#include "AbstractSQLStatement.h"
    3334#include "DatabaseBasicTypes.h"
    3435#include "SQLTransactionStateMachine.h"
     
    4243class SQLError;
    4344class SQLiteTransaction;
    44 class SQLStatement;
    4545class SQLStatementBackend;
    4646class SQLTransaction;
     
    7272
    7373    // APIs for the frontend:
    74     SQLStatement* currentStatement();
     74    AbstractSQLStatement* currentStatement();
    7575    PassRefPtr<SQLError> transactionError();
    7676    void setShouldRetryCurrentStatement(bool);
    7777
    78     void executeSQL(PassOwnPtr<SQLStatement>, const String& statement,
     78    void executeSQL(PassOwnPtr<AbstractSQLStatement>, const String& statement,
    7979        const Vector<SQLValue>& arguments, int permissions);
    8080
  • trunk/Source/WebCore/Target.pri

    r143136 r143264  
    14581458    \
    14591459    Modules/webdatabase/AbstractDatabaseServer.h \
     1460    Modules/webdatabase/AbstractSQLStatement.h \
     1461    Modules/webdatabase/AbstractSQLStatementBackend.h \
    14601462    Modules/webdatabase/ChangeVersionData.h \
    14611463    Modules/webdatabase/ChangeVersionWrapper.h \
  • trunk/Source/WebCore/WebCore.gypi

    r143196 r143264  
    985985            'Modules/webaudio/WaveTable.h',
    986986            'Modules/webdatabase/AbstractDatabaseServer.h',
     987            'Modules/webdatabase/AbstractSQLStatement.h',
     988            'Modules/webdatabase/AbstractSQLStatementBackend.h',
    987989            'Modules/webdatabase/ChangeVersionData.h',
    988990            'Modules/webdatabase/ChangeVersionWrapper.cpp',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r143196 r143264  
    2537925379                                </File>
    2538025380                                <File
     25381                                        RelativePath="..\Modules\webdatabase\AbstractSQLStatement.h"
     25382                                        >
     25383                                </File>
     25384                                <File
     25385                                        RelativePath="..\Modules\webdatabase\AbstractSQLStatementBackend.h"
     25386                                        >
     25387                                </File>
     25388                                <File
    2538125389                                        RelativePath="..\Modules\webdatabase\ChangeVersionData.h"
    2538225390                                        >
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r143090 r143264  
    64196419    <ClInclude Include="..\Modules\notifications\WorkerContextNotifications.h" />
    64206420    <ClInclude Include="..\Modules\webdatabase\AbstractDatabaseServer.h" />
     6421    <ClInclude Include="..\Modules\webdatabase\AbstractSQLStatement.h" />
     6422    <ClInclude Include="..\Modules\webdatabase\AbstractSQLStatementBackend.h" />
    64216423    <ClInclude Include="..\Modules\webdatabase\ChangeVersionData.h" />
    64226424    <ClInclude Include="..\Modules\webdatabase\ChangeVersionWrapper.h" />
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters

    r143090 r143264  
    84858485      <Filter>Modules\webdatabase</Filter>
    84868486    </ClInclude>
     8487    <ClInclude Include="..\Modules\webdatabase\AbstractSQLStatement.h">
     8488      <Filter>Modules\webdatabase</Filter>
     8489    </ClInclude>
     8490    <ClInclude Include="..\Modules\webdatabase\AbstractSQLStatementBackend.h">
     8491      <Filter>Modules\webdatabase</Filter>
     8492    </ClInclude>
    84878493    <ClInclude Include="..\Modules\webdatabase\ChangeVersionData.h">
    84888494      <Filter>Modules\webdatabase</Filter>
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r143259 r143264  
    67906790                FE456F181677D74E005EDDF9 /* DatabaseManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE456F161677D74E005EDDF9 /* DatabaseManager.cpp */; };
    67916791                FE456F191677D74E005EDDF9 /* DatabaseManager.h in Headers */ = {isa = PBXBuildFile; fileRef = FE456F171677D74E005EDDF9 /* DatabaseManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
     6792                FE4AADEE16D2C37400026FFC /* AbstractSQLStatement.h in Headers */ = {isa = PBXBuildFile; fileRef = FE4AADEC16D2C37400026FFC /* AbstractSQLStatement.h */; settings = {ATTRIBUTES = (Private, ); }; };
     6793                FE4AADEF16D2C37400026FFC /* AbstractSQLStatementBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = FE4AADED16D2C37400026FFC /* AbstractSQLStatementBackend.h */; settings = {ATTRIBUTES = (Private, ); }; };
    67926794                FE6F6AAF169E057500FC30A2 /* DatabaseBackendContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE6F6AAD169E057500FC30A2 /* DatabaseBackendContext.cpp */; };
    67936795                FE6F6AB0169E057500FC30A2 /* DatabaseBackendContext.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6F6AAE169E057500FC30A2 /* DatabaseBackendContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    1454314545                FE456F161677D74E005EDDF9 /* DatabaseManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DatabaseManager.cpp; path = Modules/webdatabase/DatabaseManager.cpp; sourceTree = "<group>"; };
    1454414546                FE456F171677D74E005EDDF9 /* DatabaseManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseManager.h; path = Modules/webdatabase/DatabaseManager.h; sourceTree = "<group>"; };
     14547                FE4AADEC16D2C37400026FFC /* AbstractSQLStatement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AbstractSQLStatement.h; path = Modules/webdatabase/AbstractSQLStatement.h; sourceTree = "<group>"; };
     14548                FE4AADED16D2C37400026FFC /* AbstractSQLStatementBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AbstractSQLStatementBackend.h; path = Modules/webdatabase/AbstractSQLStatementBackend.h; sourceTree = "<group>"; };
    1454514549                FE6F6AAD169E057500FC30A2 /* DatabaseBackendContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DatabaseBackendContext.cpp; path = Modules/webdatabase/DatabaseBackendContext.cpp; sourceTree = "<group>"; };
    1454614550                FE6F6AAE169E057500FC30A2 /* DatabaseBackendContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseBackendContext.h; path = Modules/webdatabase/DatabaseBackendContext.h; sourceTree = "<group>"; };
     
    1866018664                        children = (
    1866118665                                FE115FA9167988CD00249134 /* AbstractDatabaseServer.h */,
     18666                                FE4AADEC16D2C37400026FFC /* AbstractSQLStatement.h */,
     18667                                FE4AADED16D2C37400026FFC /* AbstractSQLStatementBackend.h */,
    1866218668                                FE36FD1116C7826400F887C1 /* ChangeVersionData.h */,
    1866318669                                97BC69D81505F076001B74AC /* ChangeVersionWrapper.cpp */,
     
    2318623192                        files = (
    2318723193                                FE115FAB167988CD00249134 /* AbstractDatabaseServer.h in Headers */,
     23194                                FE4AADEE16D2C37400026FFC /* AbstractSQLStatement.h in Headers */,
     23195                                FE4AADEF16D2C37400026FFC /* AbstractSQLStatementBackend.h in Headers */,
    2318823196                                41E1B1D10FF5986900576B3B /* AbstractWorker.h in Headers */,
    2318923197                                29A8122E0FBB9C1D00510293 /* AccessibilityARIAGridCell.h in Headers */,
Note: See TracChangeset for help on using the changeset viewer.