Changeset 209873 in webkit


Ignore:
Timestamp:
Dec 15, 2016 2:08:26 PM (7 years ago)
Author:
beidson@apple.com
Message:

Add a new Logging Channel for IndexedDB Operation scheduling.
https://bugs.webkit.org/show_bug.cgi?id=165912

Reviewed by Alex Christensen.

No new tests (No behavior change).

  • Modules/indexeddb/IDBDatabase.cpp:

(WebCore::IDBDatabase::transaction):

  • Modules/indexeddb/IDBFactory.cpp:

(WebCore::IDBFactory::openInternal):
(WebCore::IDBFactory::deleteDatabase):

  • Modules/indexeddb/IDBTransaction.cpp:

(WebCore::IDBTransaction::internalAbort):
(WebCore::IDBTransaction::commit):
(WebCore::IDBTransaction::createObjectStore):
(WebCore::IDBTransaction::renameObjectStore):
(WebCore::IDBTransaction::createIndex):
(WebCore::IDBTransaction::renameIndex):
(WebCore::IDBTransaction::doRequestOpenCursor):
(WebCore::IDBTransaction::iterateCursor):
(WebCore::IDBTransaction::requestGetAllObjectStoreRecords):
(WebCore::IDBTransaction::requestGetAllIndexRecords):
(WebCore::IDBTransaction::requestGetRecord):
(WebCore::IDBTransaction::requestIndexRecord):
(WebCore::IDBTransaction::requestCount):
(WebCore::IDBTransaction::requestDeleteRecord):
(WebCore::IDBTransaction::requestClearObjectStore):
(WebCore::IDBTransaction::requestPutOrAdd):
(WebCore::IDBTransaction::deleteObjectStore):
(WebCore::IDBTransaction::deleteIndex):

  • Modules/indexeddb/shared/IDBCursorInfo.cpp:

(WebCore::IDBCursorInfo::loggingString):

  • Modules/indexeddb/shared/IDBCursorInfo.h:
  • Modules/indexeddb/shared/IDBGetAllRecordsData.cpp:

(WebCore::IDBGetAllRecordsData::loggingString):

  • Modules/indexeddb/shared/IDBGetAllRecordsData.h:
  • Modules/indexeddb/shared/IDBGetRecordData.cpp:

(WebCore::IDBGetRecordData::loggingString):

  • Modules/indexeddb/shared/IDBGetRecordData.h:
  • Modules/indexeddb/shared/IDBIndexInfo.cpp:

(WebCore::IDBIndexInfo::condensedLoggingString):

  • Modules/indexeddb/shared/IDBIndexInfo.h:
  • Modules/indexeddb/shared/IDBIterateCursorData.cpp:

(WebCore::IDBIterateCursorData::loggingString):

  • Modules/indexeddb/shared/IDBIterateCursorData.h:
  • Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:

(WebCore::IDBObjectStoreInfo::condensedLoggingString):

  • Modules/indexeddb/shared/IDBObjectStoreInfo.h:
  • platform/Logging.h:
Location:
trunk/Source/WebCore
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r209871 r209873  
     12016-12-15  Brady Eidson  <beidson@apple.com>
     2
     3        Add a new Logging Channel for IndexedDB Operation scheduling.
     4        https://bugs.webkit.org/show_bug.cgi?id=165912
     5
     6        Reviewed by Alex Christensen.
     7
     8        No new tests (No behavior change).
     9
     10        * Modules/indexeddb/IDBDatabase.cpp:
     11        (WebCore::IDBDatabase::transaction):
     12       
     13        * Modules/indexeddb/IDBFactory.cpp:
     14        (WebCore::IDBFactory::openInternal):
     15        (WebCore::IDBFactory::deleteDatabase):
     16       
     17        * Modules/indexeddb/IDBTransaction.cpp:
     18        (WebCore::IDBTransaction::internalAbort):
     19        (WebCore::IDBTransaction::commit):
     20        (WebCore::IDBTransaction::createObjectStore):
     21        (WebCore::IDBTransaction::renameObjectStore):
     22        (WebCore::IDBTransaction::createIndex):
     23        (WebCore::IDBTransaction::renameIndex):
     24        (WebCore::IDBTransaction::doRequestOpenCursor):
     25        (WebCore::IDBTransaction::iterateCursor):
     26        (WebCore::IDBTransaction::requestGetAllObjectStoreRecords):
     27        (WebCore::IDBTransaction::requestGetAllIndexRecords):
     28        (WebCore::IDBTransaction::requestGetRecord):
     29        (WebCore::IDBTransaction::requestIndexRecord):
     30        (WebCore::IDBTransaction::requestCount):
     31        (WebCore::IDBTransaction::requestDeleteRecord):
     32        (WebCore::IDBTransaction::requestClearObjectStore):
     33        (WebCore::IDBTransaction::requestPutOrAdd):
     34        (WebCore::IDBTransaction::deleteObjectStore):
     35        (WebCore::IDBTransaction::deleteIndex):
     36       
     37        * Modules/indexeddb/shared/IDBCursorInfo.cpp:
     38        (WebCore::IDBCursorInfo::loggingString):
     39        * Modules/indexeddb/shared/IDBCursorInfo.h:
     40       
     41        * Modules/indexeddb/shared/IDBGetAllRecordsData.cpp:
     42        (WebCore::IDBGetAllRecordsData::loggingString):
     43        * Modules/indexeddb/shared/IDBGetAllRecordsData.h:
     44       
     45        * Modules/indexeddb/shared/IDBGetRecordData.cpp:
     46        (WebCore::IDBGetRecordData::loggingString):
     47        * Modules/indexeddb/shared/IDBGetRecordData.h:
     48       
     49        * Modules/indexeddb/shared/IDBIndexInfo.cpp:
     50        (WebCore::IDBIndexInfo::condensedLoggingString):
     51        * Modules/indexeddb/shared/IDBIndexInfo.h:
     52       
     53        * Modules/indexeddb/shared/IDBIterateCursorData.cpp:
     54        (WebCore::IDBIterateCursorData::loggingString):
     55        * Modules/indexeddb/shared/IDBIterateCursorData.h:
     56       
     57        * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
     58        (WebCore::IDBObjectStoreInfo::condensedLoggingString):
     59        * Modules/indexeddb/shared/IDBObjectStoreInfo.h:
     60       
     61        * platform/Logging.h:
     62
    1632016-12-15  Konstantin Tokarev  <annulen@yandex.ru>
    264
  • trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp

    r209446 r209873  
    204204
    205205    auto info = IDBTransactionInfo::clientTransaction(m_connectionProxy.get(), objectStores, mode);
     206
     207    LOG(IndexedDBOperations, "IDB creating transaction: %s", info.loggingString().utf8().data());
    206208    auto transaction = IDBTransaction::create(*this, info);
    207209
  • trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp

    r208985 r209873  
    101101        return Exception { TypeError, ASCIILiteral("IDBFactory.open() called with an invalid security origin") };
    102102
     103    LOG(IndexedDBOperations, "IDB opening database: %s %" PRIu64, name.utf8().data(), version);
     104
    103105    return m_connectionProxy->openDatabase(context, databaseIdentifier, version);
    104106}
     
    119121    if (!databaseIdentifier.isValid())
    120122        return Exception { TypeError, ASCIILiteral("IDBFactory.deleteDatabase() called with an invalid security origin") };
     123
     124    LOG(IndexedDBOperations, "IDB deleting database: %s", name.utf8().data());
    121125
    122126    return m_connectionProxy->deleteDatabase(context, databaseIdentifier);
  • trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp

    r209446 r209873  
    250250    m_abortQueue.swap(m_pendingTransactionOperationQueue);
    251251
     252    LOG(IndexedDBOperations, "IDB abort-on-server operation: Transaction %s", info().identifier().loggingString().utf8().data());
    252253    scheduleOperation(IDBClient::createTransactionOperation(*this, nullptr, &IDBTransaction::abortOnServerAndCancelRequests));
    253254}
     
    500501    m_database->willCommitTransaction(*this);
    501502
     503    LOG(IndexedDBOperations, "IDB commit operation: Transaction %s", info().identifier().loggingString().utf8().data());
    502504    scheduleOperation(IDBClient::createTransactionOperation(*this, nullptr, &IDBTransaction::commitOnServer));
    503505}
     
    661663    m_referencedObjectStores.set(info.name(), WTFMove(objectStore));
    662664
     665    LOG(IndexedDBOperations, "IDB create object store operation: %s", info.condensedLoggingString().utf8().data());
    663666    scheduleOperation(IDBClient::createTransactionOperation(*this, &IDBTransaction::didCreateObjectStoreOnServer, &IDBTransaction::createObjectStoreOnServer, info));
    664667
     
    697700
    698701    uint64_t objectStoreIdentifier = objectStore.info().identifier();
     702
     703    LOG(IndexedDBOperations, "IDB rename object store operation: %s to %s", objectStore.info().condensedLoggingString().utf8().data(), newName.utf8().data());
    699704    scheduleOperation(IDBClient::createTransactionOperation(*this, &IDBTransaction::didRenameObjectStoreOnServer, &IDBTransaction::renameObjectStoreOnServer, objectStoreIdentifier, newName));
    700705
     
    727732        return nullptr;
    728733
     734    LOG(IndexedDBOperations, "IDB create index operation: %s under object store %s", info.condensedLoggingString().utf8().data(), objectStore.info().condensedLoggingString().utf8().data());
    729735    scheduleOperation(IDBClient::createTransactionOperation(*this, &IDBTransaction::didCreateIndexOnServer, &IDBTransaction::createIndexOnServer, info));
    730736
     
    775781    uint64_t objectStoreIdentifier = index.objectStore().info().identifier();
    776782    uint64_t indexIdentifier = index.info().identifier();
     783
     784    LOG(IndexedDBOperations, "IDB rename index operation: %s to %s under object store %" PRIu64, index.info().condensedLoggingString().utf8().data(), newName.utf8().data(), index.info().objectStoreIdentifier());
    777785    scheduleOperation(IDBClient::createTransactionOperation(*this, &IDBTransaction::didRenameIndexOnServer, &IDBTransaction::renameIndexOnServer, objectStoreIdentifier, indexIdentifier, newName));
    778786}
     
    826834    addRequest(request.get());
    827835
     836    LOG(IndexedDBOperations, "IDB open cursor operation: %s", cursor->info().loggingString().utf8().data());
    828837    scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didOpenCursorOnServer, &IDBTransaction::openCursorOnServer, cursor->info()));
    829838
     
    856865    addRequest(*cursor.request());
    857866
     867    LOG(IndexedDBOperations, "IDB iterate cursor operation: %s", data.loggingString().utf8().data());
    858868    scheduleOperation(IDBClient::createTransactionOperation(*this, *cursor.request(), &IDBTransaction::didIterateCursorOnServer, &IDBTransaction::iterateCursorOnServer, data));
    859869}
     
    889899    IDBGetAllRecordsData getAllRecordsData { keyRangeData, getAllType, count, objectStore.info().identifier(), 0 };
    890900
     901    LOG(IndexedDBOperations, "IDB get all object store records operation: %s", getAllRecordsData.loggingString().utf8().data());
    891902    scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didGetAllRecordsOnServer, &IDBTransaction::getAllRecordsOnServer, getAllRecordsData));
    892903
     
    907918    IDBGetAllRecordsData getAllRecordsData { keyRangeData, getAllType, count, index.objectStore().info().identifier(), index.info().identifier() };
    908919
     920    LOG(IndexedDBOperations, "IDB get all index records operation: %s", getAllRecordsData.loggingString().utf8().data());
    909921    scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didGetAllRecordsOnServer, &IDBTransaction::getAllRecordsOnServer, getAllRecordsData));
    910922
     
    959971    addRequest(request.get());
    960972
     973    LOG(IndexedDBOperations, "IDB get record operation: %s", getRecordData.loggingString().utf8().data());
    961974    scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didGetRecordOnServer, &IDBTransaction::getRecordOnServer, getRecordData));
    962975
     
    9931006
    9941007    IDBGetRecordData getRecordData = { range, IDBGetRecordDataType::KeyAndValue };
     1008
     1009    LOG(IndexedDBOperations, "IDB get index record operation: %s", getRecordData.loggingString().utf8().data());
    9951010    scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didGetRecordOnServer, &IDBTransaction::getRecordOnServer, getRecordData));
    9961011
     
    10511066    addRequest(request.get());
    10521067
     1068    LOG(IndexedDBOperations, "IDB object store count operation: %s, range %s", objectStore.info().condensedLoggingString().utf8().data(), range.loggingString().utf8().data());
    10531069    scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didGetCountOnServer, &IDBTransaction::getCountOnServer, range));
    10541070
     
    10681084    addRequest(request.get());
    10691085
     1086    LOG(IndexedDBOperations, "IDB index count operation: %s, range %s", index.info().condensedLoggingString().utf8().data(), range.loggingString().utf8().data());
    10701087    scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didGetCountOnServer, &IDBTransaction::getCountOnServer, range));
    10711088
     
    11021119    addRequest(request.get());
    11031120
     1121    LOG(IndexedDBOperations, "IDB delete record operation: %s, range %s", objectStore.info().condensedLoggingString().utf8().data(), range.loggingString().utf8().data());
    11041122    scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didDeleteRecordOnServer, &IDBTransaction::deleteRecordOnServer, range));
    11051123    return request;
     
    11351153
    11361154    uint64_t objectStoreIdentifier = objectStore.info().identifier();
     1155
     1156    LOG(IndexedDBOperations, "IDB clear object store operation: %s", objectStore.info().condensedLoggingString().utf8().data());
    11371157    scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didClearObjectStoreOnServer, &IDBTransaction::clearObjectStoreOnServer, objectStoreIdentifier));
    11381158
     
    11701190    addRequest(request.get());
    11711191
     1192    LOG(IndexedDBOperations, "IDB putOrAdd operation: %s", key ? key->loggingString().utf8().data() : "<null key>");
    11721193    scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didPutOrAddOnServer, &IDBTransaction::putOrAddOnServer, key, &value, overwriteMode));
    11731194
     
    12531274    }
    12541275
     1276    LOG(IndexedDBOperations, "IDB delete object store operation: %s", objectStoreName.utf8().data());
    12551277    scheduleOperation(IDBClient::createTransactionOperation(*this, &IDBTransaction::didDeleteObjectStoreOnServer, &IDBTransaction::deleteObjectStoreOnServer, objectStoreName));
    12561278}
     
    12781300    ASSERT(isVersionChange());
    12791301
     1302    LOG(IndexedDBOperations, "IDB delete index operation: %s (%" PRIu64 ")", indexName.utf8().data(), objectStoreIdentifier);
    12801303    scheduleOperation(IDBClient::createTransactionOperation(*this, &IDBTransaction::didDeleteIndexOnServer, &IDBTransaction::deleteIndexOnServer, objectStoreIdentifier, indexName));
    12811304}
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.cpp

    r207845 r209873  
    100100}
    101101
     102#if !LOG_DISABLED
     103String IDBCursorInfo::loggingString() const
     104{
     105    if (m_source == IndexedDB::CursorSource::Index)
     106        return String::format("<Crsr: Idx %" PRIu64 ", OS %" PRIu64 ", tx %s>", m_sourceIdentifier, m_objectStoreIdentifier, m_transactionIdentifier.loggingString().utf8().data());
     107
     108    return String::format("<Crsr: OS %" PRIu64 ", tx %s>", m_objectStoreIdentifier, m_transactionIdentifier.loggingString().utf8().data());
     109}
     110#endif
     111
    102112} // namespace WebCore
    103113
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.h

    r208646 r209873  
    7171    template<class Decoder> static bool decode(Decoder&, IDBCursorInfo&);
    7272
     73#if !LOG_DISABLED
     74    String loggingString() const;
     75#endif
     76
    7377private:
    7478    IDBCursorInfo(IDBTransaction&, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, IndexedDB::CursorDirection, IndexedDB::CursorType);
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBGetAllRecordsData.cpp

    r208194 r209873  
    3838}
    3939
     40#if !LOG_DISABLED
     41String IDBGetAllRecordsData::loggingString() const
     42{
     43    if (indexIdentifier)
     44        return String::format("<GetAllRecords: Idx %" PRIu64 ", OS %" PRIu64 ", %s, range %s>", indexIdentifier, objectStoreIdentifier, getAllType == IndexedDB::GetAllType::Keys ? "Keys" : "Values", keyRangeData.loggingString().utf8().data());
     45    return String::format("<GetAllRecords: OS %" PRIu64 ", %s, range %s>", objectStoreIdentifier, getAllType == IndexedDB::GetAllType::Keys ? "Keys" : "Values", keyRangeData.loggingString().utf8().data());
     46}
     47#endif
     48
    4049} // namespace WebCore
    4150
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBGetAllRecordsData.h

    r208985 r209873  
    4747    IDBGetAllRecordsData isolatedCopy() const;
    4848
     49#if !LOG_DISABLED
     50    String loggingString() const;
     51#endif
     52
    4953    template<class Encoder> void encode(Encoder&) const;
    5054    template<class Decoder> static bool decode(Decoder&, IDBGetAllRecordsData&);
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBGetRecordData.cpp

    r209197 r209873  
    3838}
    3939
     40#if !LOG_DISABLED
     41String IDBGetRecordData::loggingString() const
     42{
     43    return String::format("<GetRecord: %s %s>", type == IDBGetRecordDataType::KeyOnly ? "KeyOnly" : "Key+Value", keyRangeData.loggingString().utf8().data());
     44}
     45#endif
     46
    4047} // namespace WebCore
    4148
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBGetRecordData.h

    r209197 r209873  
    4343    IDBGetRecordData isolatedCopy() const;
    4444
     45#if !LOG_DISABLED
     46    String loggingString() const;
     47#endif
     48
    4549    template<class Encoder> void encode(Encoder&) const;
    4650    template<class Decoder> static bool decode(Decoder&, IDBGetRecordData&);
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBIndexInfo.cpp

    r207931 r209873  
    5959    return makeString(indentString, "Index: ", m_name, String::format(" (%" PRIu64 ") \n", m_identifier));
    6060}
     61
     62String IDBIndexInfo::condensedLoggingString() const
     63{
     64    return String::format("<Idx: %s (%" PRIu64 "), OS (%" PRIu64 ")>", m_name.utf8().data(), m_identifier, m_objectStoreIdentifier);
     65}
    6166#endif
    6267
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBIndexInfo.h

    r208646 r209873  
    5454#if !LOG_DISABLED
    5555    String loggingString(int indent = 0) const;
     56    String condensedLoggingString() const;
    5657#endif
    5758
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBIterateCursorData.cpp

    r208500 r209873  
    3636}
    3737
     38#if !LOG_DISABLED
     39String IDBIterateCursorData::loggingString() const
     40{
     41    return String::format("<Itr8Crsr: key %s, primaryKey %s, count %u", keyData.loggingString().utf8().data(), primaryKeyData.loggingString().utf8().data(), count);
     42}
     43#endif
     44
    3845} // namespace WebCore
    3946
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBIterateCursorData.h

    r208500 r209873  
    3939    IDBIterateCursorData isolatedCopy() const;
    4040
     41#if !LOG_DISABLED
     42    String loggingString() const;
     43#endif
     44
    4145    template<class Encoder> void encode(Encoder&) const;
    4246    template<class Decoder> static bool decode(Decoder&, IDBIterateCursorData&);
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp

    r208985 r209873  
    151151    return builder.toString();
    152152}
     153
     154String IDBObjectStoreInfo::condensedLoggingString() const
     155{
     156    return String::format("<OS: %s (%" PRIu64 ")>", m_name.utf8().data(), m_identifier);
     157}
     158
    153159#endif
    154160
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h

    r208985 r209873  
    6868#if !LOG_DISABLED
    6969    String loggingString(int indent = 0) const;
     70    String condensedLoggingString() const;
    7071#endif
    7172
  • trunk/Source/WebCore/platform/Logging.h

    r209181 r209873  
    5656    M(Images) \
    5757    M(IndexedDB) \
     58    M(IndexedDBOperations) \
    5859    M(Layers) \
    5960    M(Layout) \
Note: See TracChangeset for help on using the changeset viewer.