| Differences between
and this patch
- a/Source/WebCore/ChangeLog +38 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2014-03-27  Brian Burg  <bburg@apple.com>
2
3
        Web Replay: add page-level setting to bypass the MemoryCache
4
        https://bugs.webkit.org/show_bug.cgi?id=130728
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        When replaying a specific Page we don't want to store its cached resources in the
9
        MemoryCache. This patch adds a page setting to prevent the page's resources from
10
        being saved in the MemoryCache.
11
12
        If Settings::usesMemoryCache() is false, page resources are given the special
13
        SessionID bypassCacheSessionID(). The cached resource loader and memory cache
14
        act as if the memory cache is disabled if the resource has this special session id.
15
16
        No new tests, as this functionality will be exercised by network replay tests.
17
18
        * loader/cache/CachedResourceLoader.cpp:
19
        (WebCore::CachedResourceLoader::requestResource):
20
        (WebCore::CachedResourceLoader::revalidateResource):
21
        * loader/cache/MemoryCache.cpp:
22
        (WebCore::MemoryCache::add):
23
        * page/Page.cpp:
24
        (WebCore::Page::sessionID):
25
        * page/SessionID.h:
26
        (WebCore::SessionID::bypassCacheSessionID):
27
        * page/Settings.cpp:
28
        (WebCore::Settings::Settings):
29
        * page/Settings.h:
30
        (WebCore::Settings::setUsesMemoryCache):
31
        (WebCore::Settings::usesMemoryCache):
32
        * testing/InternalSettings.cpp:
33
        (WebCore::InternalSettings::Backup::Backup):
34
        (WebCore::InternalSettings::Backup::restoreTo):
35
        (WebCore::InternalSettings::setUsesMemoryCache):
36
        * testing/InternalSettings.h:
37
        * testing/InternalSettings.idl:
38
1
2014-03-27  Antti Koivisto  <antti@apple.com>
39
2014-03-27  Antti Koivisto  <antti@apple.com>
2
40
3
        Remove some unnecessary branches from LiveNodeList traversal
41
        Remove some unnecessary branches from LiveNodeList traversal
- a/Source/WebKit2/ChangeLog +10 lines
Lines 1-3 a/Source/WebKit2/ChangeLog_sec1
1
2014-03-27  Brian Burg  <bburg@apple.com>
2
3
        Web Replay: add page-level setting to bypass the MemoryCache
4
        https://bugs.webkit.org/show_bug.cgi?id=130728
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * UIProcess/APISession.cpp:
9
        (API::generateID): update the base ID for generating unique sessions.
10
1
2014-03-27  Anders Carlsson  <andersca@apple.com>
11
2014-03-27  Anders Carlsson  <andersca@apple.com>
2
12
3
        Add reload and reloadFromOrigin as API
13
        Add reload and reloadFromOrigin as API
- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp -1 / +5 lines
Lines 484-490 CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache a/Source/WebCore/loader/cache/CachedResourceLoader.cpp_sec1
484
        m_validatedURLs.add(request.resourceRequest().url());
484
        m_validatedURLs.add(request.resourceRequest().url());
485
485
486
    ASSERT(resource->url() == url.string());
486
    ASSERT(resource->url() == url.string());
487
    m_documentResources.set(resource->url(), resource);
487
488
    if (sessionID() != SessionID::bypassCacheSessionID())
489
        m_documentResources.set(resource->url(), resource);
490
488
    return resource;
491
    return resource;
489
}
492
}
490
493
Lines 496-501 CachedResourceHandle<CachedResource> CachedResourceLoader::revalidateResource(co a/Source/WebCore/loader/cache/CachedResourceLoader.cpp_sec2
496
    ASSERT(resource->canUseCacheValidator());
499
    ASSERT(resource->canUseCacheValidator());
497
    ASSERT(!resource->resourceToRevalidate());
500
    ASSERT(!resource->resourceToRevalidate());
498
    ASSERT(resource->sessionID() == sessionID());
501
    ASSERT(resource->sessionID() == sessionID());
502
    ASSERT(sessionID() != SessionID::bypassCacheSessionID());
499
503
500
    // Copy the URL out of the resource to be revalidated in case it gets deleted by the remove() call below.
504
    // Copy the URL out of the resource to be revalidated in case it gets deleted by the remove() call below.
501
    String url = resource->url();
505
    String url = resource->url();
- a/Source/WebCore/loader/cache/MemoryCache.cpp +3 lines
Lines 110-115 bool MemoryCache::add(CachedResource* resource) a/Source/WebCore/loader/cache/MemoryCache.cpp_sec1
110
    if (disabled())
110
    if (disabled())
111
        return false;
111
        return false;
112
112
113
    if (resource->sessionID() == SessionID::bypassCacheSessionID())
114
        return false;
115
113
    ASSERT(WTF::isMainThread());
116
    ASSERT(WTF::isMainThread());
114
117
115
    CachedResourceMap& resources = getSessionMap(resource->sessionID());
118
    CachedResourceMap& resources = getSessionMap(resource->sessionID());
- a/Source/WebCore/page/Page.cpp +3 lines
Lines 1520-1525 SessionID Page::sessionID() const a/Source/WebCore/page/Page.cpp_sec1
1520
    if (settings().privateBrowsingEnabled())
1520
    if (settings().privateBrowsingEnabled())
1521
        return SessionID::legacyPrivateSessionID();
1521
        return SessionID::legacyPrivateSessionID();
1522
1522
1523
    if (!settings().usesMemoryCache())
1524
        return SessionID::bypassCacheSessionID();
1525
1523
    return SessionID::defaultSessionID();
1526
    return SessionID::defaultSessionID();
1524
}
1527
}
1525
1528
- a/Source/WebCore/page/SessionID.h +1 lines
Lines 43-48 public: a/Source/WebCore/page/SessionID.h_sec1
43
    static SessionID emptySessionID() { return SessionID(0); }
43
    static SessionID emptySessionID() { return SessionID(0); }
44
    static SessionID defaultSessionID() { return SessionID(1); }
44
    static SessionID defaultSessionID() { return SessionID(1); }
45
    static SessionID legacyPrivateSessionID() { return SessionID(2); }
45
    static SessionID legacyPrivateSessionID() { return SessionID(2); }
46
    static SessionID bypassCacheSessionID() { return SessionID(3); }
46
private:
47
private:
47
    uint64_t m_sessionID;
48
    uint64_t m_sessionID;
48
};
49
};
- a/Source/WebCore/page/Settings.cpp +1 lines
Lines 177-182 Settings::Settings(Page* page) a/Source/WebCore/page/Settings.cpp_sec1
177
    , m_isScriptEnabled(false)
177
    , m_isScriptEnabled(false)
178
    , m_needsAdobeFrameReloadingQuirk(false)
178
    , m_needsAdobeFrameReloadingQuirk(false)
179
    , m_usesPageCache(false)
179
    , m_usesPageCache(false)
180
    , m_usesMemoryCache(true)
180
    , m_fontRenderingMode(0)
181
    , m_fontRenderingMode(0)
181
    , m_showTiledScrollingIndicator(false)
182
    , m_showTiledScrollingIndicator(false)
182
    , m_tiledBackingStoreEnabled(false)
183
    , m_tiledBackingStoreEnabled(false)
- a/Source/WebCore/page/Settings.h -1 / +5 lines
Lines 181-187 public: a/Source/WebCore/page/Settings.h_sec1
181
181
182
    void setUsesPageCache(bool);
182
    void setUsesPageCache(bool);
183
    bool usesPageCache() const { return m_usesPageCache; }
183
    bool usesPageCache() const { return m_usesPageCache; }
184
        
184
185
    void setUsesMemoryCache(bool usesMemoryCache) { m_usesMemoryCache = usesMemoryCache; }
186
    bool usesMemoryCache() const { return m_usesMemoryCache; }
187
185
    void setFontRenderingMode(FontRenderingMode mode);
188
    void setFontRenderingMode(FontRenderingMode mode);
186
    FontRenderingMode fontRenderingMode() const;
189
    FontRenderingMode fontRenderingMode() const;
187
190
Lines 307-312 private: a/Source/WebCore/page/Settings.h_sec2
307
    bool m_isScriptEnabled : 1;
310
    bool m_isScriptEnabled : 1;
308
    bool m_needsAdobeFrameReloadingQuirk : 1;
311
    bool m_needsAdobeFrameReloadingQuirk : 1;
309
    bool m_usesPageCache : 1;
312
    bool m_usesPageCache : 1;
313
    bool m_usesMemoryCache : 1;
310
    unsigned m_fontRenderingMode : 1;
314
    unsigned m_fontRenderingMode : 1;
311
    bool m_showTiledScrollingIndicator : 1;
315
    bool m_showTiledScrollingIndicator : 1;
312
    bool m_tiledBackingStoreEnabled : 1;
316
    bool m_tiledBackingStoreEnabled : 1;
- a/Source/WebCore/testing/InternalSettings.cpp +8 lines
Lines 91-96 InternalSettings::Backup::Backup(Settings& settings) a/Source/WebCore/testing/InternalSettings.cpp_sec1
91
    , m_autoscrollForDragAndDropEnabled(settings.autoscrollForDragAndDropEnabled())
91
    , m_autoscrollForDragAndDropEnabled(settings.autoscrollForDragAndDropEnabled())
92
    , m_pluginReplacementEnabled(RuntimeEnabledFeatures::sharedFeatures().pluginReplacementEnabled())
92
    , m_pluginReplacementEnabled(RuntimeEnabledFeatures::sharedFeatures().pluginReplacementEnabled())
93
    , m_shouldConvertPositionStyleOnCopy(settings.shouldConvertPositionStyleOnCopy())
93
    , m_shouldConvertPositionStyleOnCopy(settings.shouldConvertPositionStyleOnCopy())
94
    , m_usesMemoryCache(settings.usesMemoryCache())
94
{
95
{
95
}
96
}
96
97
Lines 149-154 void InternalSettings::Backup::restoreTo(Settings& settings) a/Source/WebCore/testing/InternalSettings.cpp_sec2
149
    settings.setUseLegacyBackgroundSizeShorthandBehavior(m_useLegacyBackgroundSizeShorthandBehavior);
150
    settings.setUseLegacyBackgroundSizeShorthandBehavior(m_useLegacyBackgroundSizeShorthandBehavior);
150
    settings.setAutoscrollForDragAndDropEnabled(m_autoscrollForDragAndDropEnabled);
151
    settings.setAutoscrollForDragAndDropEnabled(m_autoscrollForDragAndDropEnabled);
151
    settings.setShouldConvertPositionStyleOnCopy(m_shouldConvertPositionStyleOnCopy);
152
    settings.setShouldConvertPositionStyleOnCopy(m_shouldConvertPositionStyleOnCopy);
153
    settings.setUsesMemoryCache(m_usesMemoryCache);
152
    RuntimeEnabledFeatures::sharedFeatures().setPluginReplacementEnabled(m_pluginReplacementEnabled);
154
    RuntimeEnabledFeatures::sharedFeatures().setPluginReplacementEnabled(m_pluginReplacementEnabled);
153
}
155
}
154
156
Lines 493-496 void InternalSettings::setShouldConvertPositionStyleOnCopy(bool convert, Excepti a/Source/WebCore/testing/InternalSettings.cpp_sec3
493
    settings()->setShouldConvertPositionStyleOnCopy(convert);
495
    settings()->setShouldConvertPositionStyleOnCopy(convert);
494
}
496
}
495
497
498
void InternalSettings::setUsesMemoryCache(bool usesMemoryCache, ExceptionCode& ec)
499
{
500
    InternalSettingsGuardForSettings();
501
    settings()->setUsesMemoryCache(usesMemoryCache);
502
}
503
496
}
504
}
- a/Source/WebCore/testing/InternalSettings.h -1 / +2 lines
Lines 88-93 public: a/Source/WebCore/testing/InternalSettings.h_sec1
88
        bool m_autoscrollForDragAndDropEnabled;
88
        bool m_autoscrollForDragAndDropEnabled;
89
        bool m_pluginReplacementEnabled;
89
        bool m_pluginReplacementEnabled;
90
        bool m_shouldConvertPositionStyleOnCopy;
90
        bool m_shouldConvertPositionStyleOnCopy;
91
        bool m_usesMemoryCache;
91
    };
92
    };
92
93
93
    static PassRefPtr<InternalSettings> create(Page* page)
94
    static PassRefPtr<InternalSettings> create(Page* page)
Lines 132-138 public: a/Source/WebCore/testing/InternalSettings.h_sec2
132
    void setPluginReplacementEnabled(bool);
133
    void setPluginReplacementEnabled(bool);
133
    void setBackgroundShouldExtendBeyondPage(bool hasExtendedBackground, ExceptionCode&);
134
    void setBackgroundShouldExtendBeyondPage(bool hasExtendedBackground, ExceptionCode&);
134
    void setShouldConvertPositionStyleOnCopy(bool convert, ExceptionCode&);
135
    void setShouldConvertPositionStyleOnCopy(bool convert, ExceptionCode&);
135
136
    void setUsesMemoryCache(bool usesMemoryCache, ExceptionCode&);
136
137
137
private:
138
private:
138
    explicit InternalSettings(Page*);
139
    explicit InternalSettings(Page*);
- a/Source/WebCore/testing/InternalSettings.idl +1 lines
Lines 59-62 a/Source/WebCore/testing/InternalSettings.idl_sec1
59
    void setPluginReplacementEnabled(boolean enabled);
59
    void setPluginReplacementEnabled(boolean enabled);
60
    [RaisesException] void setBackgroundShouldExtendBeyondPage(boolean hasExtendedBackground);
60
    [RaisesException] void setBackgroundShouldExtendBeyondPage(boolean hasExtendedBackground);
61
    [RaisesException] void setShouldConvertPositionStyleOnCopy(boolean convert);
61
    [RaisesException] void setShouldConvertPositionStyleOnCopy(boolean convert);
62
    [RaisesException] void setUsesMemoryCache(boolean usesMemoryCache);
62
};
63
};
- a/Source/WebKit2/UIProcess/APISession.cpp -1 / +1 lines
Lines 34-40 static uint64_t generateID(bool isEphemeral) a/Source/WebKit2/UIProcess/APISession.cpp_sec1
34
{
34
{
35
    ASSERT(RunLoop::isMain());
35
    ASSERT(RunLoop::isMain());
36
36
37
    static uint64_t uniqueSessionID = WebCore::SessionID::legacyPrivateSessionID().sessionID();
37
    static uint64_t uniqueSessionID = WebCore::SessionID::bypassCacheSessionID().sessionID();
38
    ASSERT_UNUSED(isEphemeral, isEphemeral);
38
    ASSERT_UNUSED(isEphemeral, isEphemeral);
39
    return ++uniqueSessionID;
39
    return ++uniqueSessionID;
40
}
40
}

Return to Bug 130728