| Differences between
and this patch
- a/Source/WebCore/ChangeLog +46 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2014-11-13  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2
3
        Move WebCore/loader to std::unique_ptr
4
        https://bugs.webkit.org/show_bug.cgi?id=138646
5
6
        Reviewed by Chris Dumez.
7
8
        Replace OwnPtr with std::unique_ptr<> and std::make_unique<>.
9
        However this patch leaves ResourceRequest::adopt() because this need
10
        to be handled by different patch.
11
12
        No new tests, no behavior changes.
13
14
        * loader/DocumentLoader.cpp:
15
        (WebCore::DocumentLoader::DocumentLoader):
16
        (WebCore::DocumentLoader::addAllArchiveResources):
17
        (WebCore::DocumentLoader::addArchiveResource):
18
        (WebCore::DocumentLoader::clearArchiveResources):
19
        (WebCore::DocumentLoader::startLoadingMainResource):
20
        * loader/DocumentLoader.h:
21
        * loader/DocumentThreadableLoader.cpp:
22
        (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
23
        (WebCore::DocumentThreadableLoader::preflightSuccess):
24
        * loader/DocumentThreadableLoader.h:
25
        * loader/SubresourceLoader.cpp:
26
        (WebCore::SubresourceLoader::SubresourceLoader):
27
        (WebCore::SubresourceLoader::didReceiveResponse):
28
        (WebCore::SubresourceLoader::notifyDone):
29
        * loader/SubresourceLoader.h:
30
        * loader/TextTrackLoader.h:
31
        * loader/appcache/ApplicationCacheHost.h:
32
        * loader/appcache/ApplicationCacheStorage.cpp:
33
        (WebCore::ApplicationCacheStorage::storeCopyOfCache):
34
        * loader/archive/cf/LegacyWebArchive.cpp:
35
        (WebCore::LegacyWebArchive::create):
36
        * loader/cache/CachedResourceLoader.cpp:
37
        (WebCore::CachedResourceLoader::requestPreload):
38
        (WebCore::CachedResourceLoader::clearPreloads):
39
        (WebCore::CachedResourceLoader::printPreloadStats):
40
        * loader/cache/CachedResourceLoader.h:
41
        * loader/icon/IconDatabase.cpp:
42
        (WebCore::IconDatabase::deleteAllPreparedStatements):
43
        (WebCore::readySQLiteStatement):
44
        * loader/icon/IconDatabase.h:
45
        * loader/icon/IconRecord.h:
46
1
2014-11-13  Myles C. Maxfield  <litherum@gmail.com>
47
2014-11-13  Myles C. Maxfield  <litherum@gmail.com>
2
48
3
        Addressing post-review comment
49
        Addressing post-review comment
- a/Source/WebCore/loader/DocumentLoader.cpp -6 / +6 lines
Lines 142-148 DocumentLoader::DocumentLoader(const ResourceRequest& req, const SubstituteData& a/Source/WebCore/loader/DocumentLoader.cpp_sec1
142
    , m_dataLoadTimer(this, &DocumentLoader::handleSubstituteDataLoadNow)
142
    , m_dataLoadTimer(this, &DocumentLoader::handleSubstituteDataLoadNow)
143
    , m_waitingForContentPolicy(false)
143
    , m_waitingForContentPolicy(false)
144
    , m_subresourceLoadersArePageCacheAcceptable(false)
144
    , m_subresourceLoadersArePageCacheAcceptable(false)
145
    , m_applicationCacheHost(adoptPtr(new ApplicationCacheHost(*this)))
145
    , m_applicationCacheHost(std::make_unique<ApplicationCacheHost>(*this))
146
{
146
{
147
}
147
}
148
148
Lines 1019-1026 void DocumentLoader::setArchive(PassRefPtr<Archive> archive) a/Source/WebCore/loader/DocumentLoader.cpp_sec2
1019
void DocumentLoader::addAllArchiveResources(Archive* archive)
1019
void DocumentLoader::addAllArchiveResources(Archive* archive)
1020
{
1020
{
1021
    if (!m_archiveResourceCollection)
1021
    if (!m_archiveResourceCollection)
1022
        m_archiveResourceCollection = adoptPtr(new ArchiveResourceCollection);
1022
        m_archiveResourceCollection = std::make_unique<ArchiveResourceCollection>();
1023
        
1023
1024
    ASSERT(archive);
1024
    ASSERT(archive);
1025
    if (!archive)
1025
    if (!archive)
1026
        return;
1026
        return;
Lines 1033-1039 void DocumentLoader::addAllArchiveResources(Archive* archive) a/Source/WebCore/loader/DocumentLoader.cpp_sec3
1033
void DocumentLoader::addArchiveResource(PassRefPtr<ArchiveResource> resource)
1033
void DocumentLoader::addArchiveResource(PassRefPtr<ArchiveResource> resource)
1034
{
1034
{
1035
    if (!m_archiveResourceCollection)
1035
    if (!m_archiveResourceCollection)
1036
        m_archiveResourceCollection = adoptPtr(new ArchiveResourceCollection);
1036
        m_archiveResourceCollection = std::make_unique<ArchiveResourceCollection>();
1037
        
1037
        
1038
    ASSERT(resource);
1038
    ASSERT(resource);
1039
    if (!resource)
1039
    if (!resource)
Lines 1049-1055 PassRefPtr<Archive> DocumentLoader::popArchiveForSubframe(const String& frameNam a/Source/WebCore/loader/DocumentLoader.cpp_sec4
1049
1049
1050
void DocumentLoader::clearArchiveResources()
1050
void DocumentLoader::clearArchiveResources()
1051
{
1051
{
1052
    m_archiveResourceCollection.clear();
1052
    m_archiveResourceCollection = nullptr;
1053
    m_substituteResourceDeliveryTimer.stop();
1053
    m_substituteResourceDeliveryTimer.stop();
1054
}
1054
}
1055
1055
Lines 1439-1445 void DocumentLoader::startLoadingMainResource() a/Source/WebCore/loader/DocumentLoader.cpp_sec5
1439
        // If the load was aborted by clearing m_request, it's possible the ApplicationCacheHost
1439
        // If the load was aborted by clearing m_request, it's possible the ApplicationCacheHost
1440
        // is now in a state where starting an empty load will be inconsistent. Replace it with
1440
        // is now in a state where starting an empty load will be inconsistent. Replace it with
1441
        // a new ApplicationCacheHost.
1441
        // a new ApplicationCacheHost.
1442
        m_applicationCacheHost = adoptPtr(new ApplicationCacheHost(*this));
1442
        m_applicationCacheHost = std::make_unique<ApplicationCacheHost>(*this);
1443
        maybeLoadEmpty();
1443
        maybeLoadEmpty();
1444
        return;
1444
        return;
1445
    }
1445
    }
- a/Source/WebCore/loader/DocumentLoader.h -2 / +2 lines
Lines 388-394 namespace WebCore { a/Source/WebCore/loader/DocumentLoader.h_sec1
388
        SubstituteResourceMap m_pendingSubstituteResources;
388
        SubstituteResourceMap m_pendingSubstituteResources;
389
        Timer m_substituteResourceDeliveryTimer;
389
        Timer m_substituteResourceDeliveryTimer;
390
390
391
        OwnPtr<ArchiveResourceCollection> m_archiveResourceCollection;
391
        std::unique_ptr<ArchiveResourceCollection> m_archiveResourceCollection;
392
#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
392
#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
393
        RefPtr<Archive> m_archive;
393
        RefPtr<Archive> m_archive;
394
        RefPtr<SharedBuffer> m_parsedArchiveData;
394
        RefPtr<SharedBuffer> m_parsedArchiveData;
Lines 415-421 namespace WebCore { a/Source/WebCore/loader/DocumentLoader.h_sec2
415
        bool m_subresourceLoadersArePageCacheAcceptable;
415
        bool m_subresourceLoadersArePageCacheAcceptable;
416
416
417
        friend class ApplicationCacheHost;  // for substitute resource delivery
417
        friend class ApplicationCacheHost;  // for substitute resource delivery
418
        OwnPtr<ApplicationCacheHost> m_applicationCacheHost;
418
        std::unique_ptr<ApplicationCacheHost> m_applicationCacheHost;
419
419
420
#if ENABLE(CONTENT_FILTERING)
420
#if ENABLE(CONTENT_FILTERING)
421
        std::unique_ptr<ContentFilter> m_contentFilter;
421
        std::unique_ptr<ContentFilter> m_contentFilter;
- a/Source/WebCore/loader/DocumentThreadableLoader.cpp -3 / +3 lines
Lines 98-111 void DocumentThreadableLoader::makeCrossOriginAccessRequest(const ResourceReques a/Source/WebCore/loader/DocumentThreadableLoader.cpp_sec1
98
{
98
{
99
    ASSERT(m_options.crossOriginRequestPolicy == UseAccessControl);
99
    ASSERT(m_options.crossOriginRequestPolicy == UseAccessControl);
100
100
101
    OwnPtr<ResourceRequest> crossOriginRequest = adoptPtr(new ResourceRequest(request));
101
    auto crossOriginRequest = std::make_unique<ResourceRequest>(request);
102
    updateRequestForAccessControl(*crossOriginRequest, securityOrigin(), m_options.allowCredentials());
102
    updateRequestForAccessControl(*crossOriginRequest, securityOrigin(), m_options.allowCredentials());
103
103
104
    if ((m_options.preflightPolicy == ConsiderPreflight && isSimpleCrossOriginAccessRequest(crossOriginRequest->httpMethod(), crossOriginRequest->httpHeaderFields())) || m_options.preflightPolicy == PreventPreflight)
104
    if ((m_options.preflightPolicy == ConsiderPreflight && isSimpleCrossOriginAccessRequest(crossOriginRequest->httpMethod(), crossOriginRequest->httpHeaderFields())) || m_options.preflightPolicy == PreventPreflight)
105
        makeSimpleCrossOriginAccessRequest(*crossOriginRequest);
105
        makeSimpleCrossOriginAccessRequest(*crossOriginRequest);
106
    else {
106
    else {
107
        m_simpleRequest = false;
107
        m_simpleRequest = false;
108
        m_actualRequest = crossOriginRequest.release();
108
        m_actualRequest = WTF::move(crossOriginRequest);
109
109
110
        if (CrossOriginPreflightResultCache::shared().canSkipPreflight(securityOrigin()->toString(), m_actualRequest->url(), m_options.allowCredentials(), m_actualRequest->httpMethod(), m_actualRequest->httpHeaderFields()))
110
        if (CrossOriginPreflightResultCache::shared().canSkipPreflight(securityOrigin()->toString(), m_actualRequest->url(), m_options.allowCredentials(), m_actualRequest->httpMethod(), m_actualRequest->httpHeaderFields()))
111
            preflightSuccess();
111
            preflightSuccess();
Lines 335-341 void DocumentThreadableLoader::didFail(unsigned long identifier, const ResourceE a/Source/WebCore/loader/DocumentThreadableLoader.cpp_sec2
335
335
336
void DocumentThreadableLoader::preflightSuccess()
336
void DocumentThreadableLoader::preflightSuccess()
337
{
337
{
338
    OwnPtr<ResourceRequest> actualRequest;
338
    std::unique_ptr<ResourceRequest> actualRequest;
339
    actualRequest.swap(m_actualRequest);
339
    actualRequest.swap(m_actualRequest);
340
340
341
    actualRequest->setHTTPOrigin(securityOrigin()->toString());
341
    actualRequest->setHTTPOrigin(securityOrigin()->toString());
- a/Source/WebCore/loader/DocumentThreadableLoader.h -2 / +1 lines
Lines 36-42 a/Source/WebCore/loader/DocumentThreadableLoader.h_sec1
36
#include "FrameLoaderTypes.h"
36
#include "FrameLoaderTypes.h"
37
#include "ThreadableLoader.h"
37
#include "ThreadableLoader.h"
38
#include <wtf/Forward.h>
38
#include <wtf/Forward.h>
39
#include <wtf/OwnPtr.h>
40
#include <wtf/PassRefPtr.h>
39
#include <wtf/PassRefPtr.h>
41
#include <wtf/RefCounted.h>
40
#include <wtf/RefCounted.h>
42
#include <wtf/RefPtr.h>
41
#include <wtf/RefPtr.h>
Lines 106-112 namespace WebCore { a/Source/WebCore/loader/DocumentThreadableLoader.h_sec2
106
        bool m_sameOriginRequest;
105
        bool m_sameOriginRequest;
107
        bool m_simpleRequest;
106
        bool m_simpleRequest;
108
        bool m_async;
107
        bool m_async;
109
        OwnPtr<ResourceRequest> m_actualRequest;  // non-null during Access Control preflight checks
108
        std::unique_ptr<ResourceRequest> m_actualRequest; // non-null during Access Control preflight checks
110
    };
109
    };
111
110
112
} // namespace WebCore
111
} // namespace WebCore
- a/Source/WebCore/loader/SubresourceLoader.cpp -3 / +3 lines
Lines 68-74 SubresourceLoader::SubresourceLoader(Frame* frame, CachedResource* resource, con a/Source/WebCore/loader/SubresourceLoader.cpp_sec1
68
    , m_resource(resource)
68
    , m_resource(resource)
69
    , m_loadingMultipartContent(false)
69
    , m_loadingMultipartContent(false)
70
    , m_state(Uninitialized)
70
    , m_state(Uninitialized)
71
    , m_requestCountTracker(adoptPtr(new RequestCountTracker(frame->document()->cachedResourceLoader(), resource)))
71
    , m_requestCountTracker(std::make_unique<RequestCountTracker>(frame->document()->cachedResourceLoader(), resource))
72
{
72
{
73
#ifndef NDEBUG
73
#ifndef NDEBUG
74
    subresourceLoaderCounter.increment();
74
    subresourceLoaderCounter.increment();
Lines 225-231 void SubresourceLoader::didReceiveResponse(const ResourceResponse& response) a/Source/WebCore/loader/SubresourceLoader.cpp_sec2
225
        m_loadingMultipartContent = true;
225
        m_loadingMultipartContent = true;
226
226
227
        // We don't count multiParts in a CachedResourceLoader's request count
227
        // We don't count multiParts in a CachedResourceLoader's request count
228
        m_requestCountTracker.clear();
228
        m_requestCountTracker = nullptr;
229
        if (!m_resource->isImage()) {
229
        if (!m_resource->isImage()) {
230
            cancel();
230
            cancel();
231
            return;
231
            return;
Lines 380-386 void SubresourceLoader::notifyDone() a/Source/WebCore/loader/SubresourceLoader.cpp_sec3
380
    if (reachedTerminalState())
380
    if (reachedTerminalState())
381
        return;
381
        return;
382
382
383
    m_requestCountTracker.clear();
383
    m_requestCountTracker = nullptr;
384
#if PLATFORM(IOS)
384
#if PLATFORM(IOS)
385
    m_documentLoader->cachedResourceLoader().loadDone(m_resource, m_state != CancelledWhileInitializing);
385
    m_documentLoader->cachedResourceLoader().loadDone(m_resource, m_state != CancelledWhileInitializing);
386
#else
386
#else
- a/Source/WebCore/loader/SubresourceLoader.h -1 / +1 lines
Lines 121-127 private: a/Source/WebCore/loader/SubresourceLoader.h_sec1
121
    CachedResource* m_resource;
121
    CachedResource* m_resource;
122
    bool m_loadingMultipartContent;
122
    bool m_loadingMultipartContent;
123
    SubresourceLoaderState m_state;
123
    SubresourceLoaderState m_state;
124
    OwnPtr<RequestCountTracker> m_requestCountTracker;
124
    std::unique_ptr<RequestCountTracker> m_requestCountTracker;
125
};
125
};
126
126
127
}
127
}
- a/Source/WebCore/loader/TextTrackLoader.h -1 lines
Lines 33-39 a/Source/WebCore/loader/TextTrackLoader.h_sec1
33
#include "Timer.h"
33
#include "Timer.h"
34
#include "WebVTTParser.h"
34
#include "WebVTTParser.h"
35
#include <memory>
35
#include <memory>
36
#include <wtf/OwnPtr.h>
37
36
38
namespace WebCore {
37
namespace WebCore {
39
38
- a/Source/WebCore/loader/appcache/ApplicationCacheHost.h -1 lines
Lines 33-39 a/Source/WebCore/loader/appcache/ApplicationCacheHost.h_sec1
33
33
34
#include "URL.h"
34
#include "URL.h"
35
#include <wtf/Deque.h>
35
#include <wtf/Deque.h>
36
#include <wtf/OwnPtr.h>
37
#include <wtf/PassRefPtr.h>
36
#include <wtf/PassRefPtr.h>
38
#include <wtf/RefPtr.h>
37
#include <wtf/RefPtr.h>
39
#include <wtf/Vector.h>
38
#include <wtf/Vector.h>
- a/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp -3 / +3 lines
Lines 1357-1366 bool ApplicationCacheStorage::storeCopyOfCache(const String& cacheDirectory, App a/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp_sec1
1357
        
1357
        
1358
        cacheCopy->addResource(resourceCopy.release());
1358
        cacheCopy->addResource(resourceCopy.release());
1359
    }
1359
    }
1360
    
1360
1361
    // Now create a new cache group.
1361
    // Now create a new cache group.
1362
    OwnPtr<ApplicationCacheGroup> groupCopy(adoptPtr(new ApplicationCacheGroup(cache->group()->manifestURL(), true)));
1362
    auto groupCopy = std::make_unique<ApplicationCacheGroup>(cache->group()->manifestURL(), true);
1363
    
1363
1364
    groupCopy->setNewestCache(cacheCopy);
1364
    groupCopy->setNewestCache(cacheCopy);
1365
    
1365
    
1366
    ApplicationCacheStorage copyStorage;
1366
    ApplicationCacheStorage copyStorage;
- a/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp -3 / +3 lines
Lines 437-448 PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(Node* node, std::function< a/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp_sec1
437
    // If the page was loaded with javascript enabled, we don't want to archive <noscript> tags
437
    // If the page was loaded with javascript enabled, we don't want to archive <noscript> tags
438
    // In practice we don't actually know whether scripting was enabled when the page was originally loaded
438
    // In practice we don't actually know whether scripting was enabled when the page was originally loaded
439
    // but we can approximate that by checking if scripting is enabled right now.
439
    // but we can approximate that by checking if scripting is enabled right now.
440
    OwnPtr<Vector<QualifiedName>> tagNamesToFilter;
440
    std::unique_ptr<Vector<QualifiedName>> tagNamesToFilter;
441
    if (frame->page() && frame->page()->settings().isScriptEnabled()) {
441
    if (frame->page() && frame->page()->settings().isScriptEnabled()) {
442
        tagNamesToFilter = adoptPtr(new Vector<QualifiedName>);
442
        tagNamesToFilter = std::make_unique<Vector<QualifiedName>>();
443
        tagNamesToFilter->append(HTMLNames::noscriptTag);
443
        tagNamesToFilter->append(HTMLNames::noscriptTag);
444
    }
444
    }
445
        
445
446
    Vector<Node*> nodeList;
446
    Vector<Node*> nodeList;
447
    String markupString = createMarkup(*node, IncludeNode, &nodeList, DoNotResolveURLs, tagNamesToFilter.get());
447
    String markupString = createMarkup(*node, IncludeNode, &nodeList, DoNotResolveURLs, tagNamesToFilter.get());
448
    Node::NodeType nodeType = node->nodeType();
448
    Node::NodeType nodeType = node->nodeType();
- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp -3 / +3 lines
Lines 877-883 void CachedResourceLoader::requestPreload(CachedResource::Type type, CachedResou a/Source/WebCore/loader/cache/CachedResourceLoader.cpp_sec1
877
    resource->increasePreloadCount();
877
    resource->increasePreloadCount();
878
878
879
    if (!m_preloads)
879
    if (!m_preloads)
880
        m_preloads = adoptPtr(new ListHashSet<CachedResource*>);
880
        m_preloads = std::make_unique<ListHashSet<CachedResource*>>();
881
    m_preloads->add(resource.get());
881
    m_preloads->add(resource.get());
882
882
883
#if PRELOAD_DEBUG
883
#if PRELOAD_DEBUG
Lines 923-929 void CachedResourceLoader::clearPreloads() a/Source/WebCore/loader/cache/CachedResourceLoader.cpp_sec2
923
        if (!deleted && res->preloadResult() == CachedResource::PreloadNotReferenced)
923
        if (!deleted && res->preloadResult() == CachedResource::PreloadNotReferenced)
924
            memoryCache()->remove(res);
924
            memoryCache()->remove(res);
925
    }
925
    }
926
    m_preloads.clear();
926
    m_preloads = nullptr;
927
}
927
}
928
928
929
void CachedResourceLoader::clearPendingPreloads()
929
void CachedResourceLoader::clearPendingPreloads()
Lines 969-975 void CachedResourceLoader::printPreloadStats() a/Source/WebCore/loader/cache/CachedResourceLoader.cpp_sec3
969
        
969
        
970
        res->decreasePreloadCount();
970
        res->decreasePreloadCount();
971
    }
971
    }
972
    m_preloads.clear();
972
    m_preloads = nullptr;
973
    
973
    
974
    if (scripts)
974
    if (scripts)
975
        printf("SCRIPTS: %d (%d hits, hit rate %d%%)\n", scripts, scripts - scriptMisses, (scripts - scriptMisses) * 100 / scripts);
975
        printf("SCRIPTS: %d (%d hits, hit rate %d%%)\n", scripts, scripts - scriptMisses, (scripts - scriptMisses) * 100 / scripts);
- a/Source/WebCore/loader/cache/CachedResourceLoader.h -1 / +1 lines
Lines 165-171 private: a/Source/WebCore/loader/cache/CachedResourceLoader.h_sec1
165
    
165
    
166
    int m_requestCount;
166
    int m_requestCount;
167
    
167
    
168
    OwnPtr<ListHashSet<CachedResource*>> m_preloads;
168
    std::unique_ptr<ListHashSet<CachedResource*>> m_preloads;
169
    struct PendingPreload {
169
    struct PendingPreload {
170
        CachedResource::Type m_type;
170
        CachedResource::Type m_type;
171
        CachedResourceRequest m_request;
171
        CachedResourceRequest m_request;
- a/Source/WebCore/loader/icon/IconDatabase.cpp -17 / +17 lines
Lines 1758-1777 void IconDatabase::deleteAllPreparedStatements() a/Source/WebCore/loader/icon/IconDatabase.cpp_sec1
1758
{
1758
{
1759
    ASSERT_ICON_SYNC_THREAD();
1759
    ASSERT_ICON_SYNC_THREAD();
1760
    
1760
    
1761
    m_setIconIDForPageURLStatement.clear();
1761
    m_setIconIDForPageURLStatement = nullptr;
1762
    m_removePageURLStatement.clear();
1762
    m_removePageURLStatement = nullptr;
1763
    m_getIconIDForIconURLStatement.clear();
1763
    m_getIconIDForIconURLStatement = nullptr;
1764
    m_getImageDataForIconURLStatement.clear();
1764
    m_getImageDataForIconURLStatement = nullptr;
1765
    m_addIconToIconInfoStatement.clear();
1765
    m_addIconToIconInfoStatement = nullptr;
1766
    m_addIconToIconDataStatement.clear();
1766
    m_addIconToIconDataStatement = nullptr;
1767
    m_getImageDataStatement.clear();
1767
    m_getImageDataStatement = nullptr;
1768
    m_deletePageURLsForIconURLStatement.clear();
1768
    m_deletePageURLsForIconURLStatement = nullptr;
1769
    m_deleteIconFromIconInfoStatement.clear();
1769
    m_deleteIconFromIconInfoStatement = nullptr;
1770
    m_deleteIconFromIconDataStatement.clear();
1770
    m_deleteIconFromIconDataStatement = nullptr;
1771
    m_updateIconInfoStatement.clear();
1771
    m_updateIconInfoStatement = nullptr;
1772
    m_updateIconDataStatement.clear();
1772
    m_updateIconDataStatement  = nullptr;
1773
    m_setIconInfoStatement.clear();
1773
    m_setIconInfoStatement = nullptr;
1774
    m_setIconDataStatement.clear();
1774
    m_setIconDataStatement = nullptr;
1775
}
1775
}
1776
1776
1777
void* IconDatabase::cleanupSyncThread()
1777
void* IconDatabase::cleanupSyncThread()
Lines 1810-1824 void* IconDatabase::cleanupSyncThread() a/Source/WebCore/loader/icon/IconDatabase.cpp_sec2
1810
// 1 - If the SQLDatabase& argument is different, the statement must be destroyed and remade.  This happens when the user
1810
// 1 - If the SQLDatabase& argument is different, the statement must be destroyed and remade.  This happens when the user
1811
//     switches to and from private browsing
1811
//     switches to and from private browsing
1812
// 2 - Lazy construction of the Statement in the first place, in case we've never made this query before
1812
// 2 - Lazy construction of the Statement in the first place, in case we've never made this query before
1813
inline void readySQLiteStatement(OwnPtr<SQLiteStatement>& statement, SQLiteDatabase& db, const String& str)
1813
inline void readySQLiteStatement(std::unique_ptr<SQLiteStatement>& statement, SQLiteDatabase& db, const String& str)
1814
{
1814
{
1815
    if (statement && (statement->database() != &db || statement->isExpired())) {
1815
    if (statement && (statement->database() != &db || statement->isExpired())) {
1816
        if (statement->isExpired())
1816
        if (statement->isExpired())
1817
            LOG(IconDatabase, "SQLiteStatement associated with %s is expired", str.ascii().data());
1817
            LOG(IconDatabase, "SQLiteStatement associated with %s is expired", str.ascii().data());
1818
        statement.clear();
1818
        statement = nullptr;
1819
    }
1819
    }
1820
    if (!statement) {
1820
    if (!statement) {
1821
        statement = adoptPtr(new SQLiteStatement(db, str));
1821
        statement = std::make_unique<SQLiteStatement>(db, str);
1822
        if (statement->prepare() != SQLResultOk)
1822
        if (statement->prepare() != SQLResultOk)
1823
            LOG_ERROR("Preparing statement %s failed", str.ascii().data());
1823
            LOG_ERROR("Preparing statement %s failed", str.ascii().data());
1824
    }
1824
    }
- a/Source/WebCore/loader/icon/IconDatabase.h -14 / +14 lines
Lines 231-250 private: a/Source/WebCore/loader/icon/IconDatabase.h_sec1
231
    
231
    
232
    SQLiteDatabase m_syncDB;
232
    SQLiteDatabase m_syncDB;
233
    
233
    
234
    OwnPtr<SQLiteStatement> m_setIconIDForPageURLStatement;
234
    std::unique_ptr<SQLiteStatement> m_setIconIDForPageURLStatement;
235
    OwnPtr<SQLiteStatement> m_removePageURLStatement;
235
    std::unique_ptr<SQLiteStatement> m_removePageURLStatement;
236
    OwnPtr<SQLiteStatement> m_getIconIDForIconURLStatement;
236
    std::unique_ptr<SQLiteStatement> m_getIconIDForIconURLStatement;
237
    OwnPtr<SQLiteStatement> m_getImageDataForIconURLStatement;
237
    std::unique_ptr<SQLiteStatement> m_getImageDataForIconURLStatement;
238
    OwnPtr<SQLiteStatement> m_addIconToIconInfoStatement;
238
    std::unique_ptr<SQLiteStatement> m_addIconToIconInfoStatement;
239
    OwnPtr<SQLiteStatement> m_addIconToIconDataStatement;
239
    std::unique_ptr<SQLiteStatement> m_addIconToIconDataStatement;
240
    OwnPtr<SQLiteStatement> m_getImageDataStatement;
240
    std::unique_ptr<SQLiteStatement> m_getImageDataStatement;
241
    OwnPtr<SQLiteStatement> m_deletePageURLsForIconURLStatement;
241
    std::unique_ptr<SQLiteStatement> m_deletePageURLsForIconURLStatement;
242
    OwnPtr<SQLiteStatement> m_deleteIconFromIconInfoStatement;
242
    std::unique_ptr<SQLiteStatement> m_deleteIconFromIconInfoStatement;
243
    OwnPtr<SQLiteStatement> m_deleteIconFromIconDataStatement;
243
    std::unique_ptr<SQLiteStatement> m_deleteIconFromIconDataStatement;
244
    OwnPtr<SQLiteStatement> m_updateIconInfoStatement;
244
    std::unique_ptr<SQLiteStatement> m_updateIconInfoStatement;
245
    OwnPtr<SQLiteStatement> m_updateIconDataStatement;
245
    std::unique_ptr<SQLiteStatement> m_updateIconDataStatement;
246
    OwnPtr<SQLiteStatement> m_setIconInfoStatement;
246
    std::unique_ptr<SQLiteStatement> m_setIconInfoStatement;
247
    OwnPtr<SQLiteStatement> m_setIconDataStatement;
247
    std::unique_ptr<SQLiteStatement> m_setIconDataStatement;
248
};
248
};
249
249
250
#endif // !ENABLE(ICONDATABASE)
250
#endif // !ENABLE(ICONDATABASE)
- a/Source/WebCore/loader/icon/IconRecord.h -1 lines
Lines 32-38 a/Source/WebCore/loader/icon/IconRecord.h_sec1
32
#include "PageURLRecord.h"
32
#include "PageURLRecord.h"
33
#include "SharedBuffer.h"
33
#include "SharedBuffer.h"
34
#include <wtf/HashSet.h>
34
#include <wtf/HashSet.h>
35
#include <wtf/OwnPtr.h>
36
#include <wtf/RefCounted.h>
35
#include <wtf/RefCounted.h>
37
#include <wtf/text/StringHash.h>
36
#include <wtf/text/StringHash.h>
38
#include <wtf/text/WTFString.h>
37
#include <wtf/text/WTFString.h>

Return to Bug 138646