Move DiskCacheMonitor to WebCore so that WebKit1 clients can use it as well
authorpsolanki@apple.com <psolanki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Aug 2014 21:07:36 +0000 (21:07 +0000)
committerpsolanki@apple.com <psolanki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Aug 2014 21:07:36 +0000 (21:07 +0000)
commita424d02fe30dec05a32f79233a7aa08d974c46d0
treef53049e47cd356b0252fd416646a5692eb69d754
parentfaf716764fdf830a38a73e9562d897ee566b0e5a
Move DiskCacheMonitor to WebCore so that WebKit1 clients can use it as well
https://bugs.webkit.org/show_bug.cgi?id=135896

Reviewed by Andreas Kling.

Source/WebCore:

Refactor code and move it to WebCore.

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* loader/ResourceLoader.h:
    Make willCacheResponse protected so that SubresourceLoader can override it.
* loader/SubresourceLoader.h:
* loader/cocoa/DiskCacheMonitorCocoa.h: Added.
    Mostly the same as the existing NetworkDiskCacheMonitor class in WebKit2. In the
    CFNetwork callback block, it calls a virtual function that is overridden by
    NetworkDiskCacheMonitor to send a message to WebContent process.
(WebCore::DiskCacheMonitor::~DiskCacheMonitor):
(WebCore::DiskCacheMonitor::resourceRequest):
(WebCore::DiskCacheMonitor::sessionID):
* loader/cocoa/DiskCacheMonitorCocoa.mm:
(WebCore::DiskCacheMonitor::tryGetFileBackedSharedBufferFromCFURLCachedResponse):
    Copied from NetworkResourceLoader::tryGetFileBackedSharedBufferFromCFURLCachedResponse.
(WebCore::DiskCacheMonitor::monitorFileBackingStoreCreation):
(WebCore::DiskCacheMonitor::DiskCacheMonitor):
(WebCore::DiskCacheMonitor::resourceBecameFileBacked):
    Replace the cached resource data with the contents of the file backed buffer. This is
    used in WebKit1 (and also for any resource loads that happen from the WebContent
    process).
* loader/cocoa/SubresourceLoaderCocoa.mm: Added.
(WebCore::SubresourceLoader::willCacheResponse):
    Override willCacheresponse from ResourceLoader to listen for disk cache notifications.

Source/WebKit2:

* NetworkProcess/mac/NetworkDiskCacheMonitor.h:
    Inherit from WebCore::DiskCacheMonitor which has the bulk of the functionality now.
(WebKit::NetworkDiskCacheMonitor::~NetworkDiskCacheMonitor):
* NetworkProcess/mac/NetworkDiskCacheMonitor.mm:
(WebKit::NetworkDiskCacheMonitor::monitorFileBackingStoreCreation):
(WebKit::NetworkDiskCacheMonitor::NetworkDiskCacheMonitor):
(WebKit::NetworkDiskCacheMonitor::resourceBecameFileBacked):
    Override virtual method and send the data to the WebContent process as before.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172811 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/loader/ResourceLoader.h
Source/WebCore/loader/SubresourceLoader.h
Source/WebCore/loader/cocoa/DiskCacheMonitor.h [new file with mode: 0644]
Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.h [new file with mode: 0644]
Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.mm [new file with mode: 0644]
Source/WebCore/loader/cocoa/SubresourceLoaderCocoa.mm [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.h
Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.mm