Changeset 175982 in webkit
- Timestamp:
- Nov 11, 2014, 3:13:05 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
-
Source/WebKit2/ChangeLog (modified) (1 diff)
-
Source/WebKit2/NetworkProcess/NetworkProcess.cpp (modified) (2 diffs)
-
Source/WebKit2/NetworkProcess/NetworkProcess.h (modified) (1 diff)
-
Source/WebKit2/NetworkProcess/cocoa/NetworkProcessCocoa.mm (modified) (2 diffs)
-
Source/WebKit2/WebProcess/WebProcess.cpp (modified) (2 diffs)
-
Source/WebKit2/WebProcess/WebProcess.h (modified) (1 diff)
-
Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm (modified) (2 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/DumpRenderTree/mac/DumpRenderTree.mm (modified) (1 diff)
-
Tools/WebKitTestRunner/mac/TestControllerMac.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r175980 r175982 1 2014-11-11 Alexey Proskuryakov <ap@apple.com> 2 3 DRT and WKTR touch disk cache 4 https://bugs.webkit.org/show_bug.cgi?id=138622 5 6 Reviewed by Geoffrey Garen. 7 8 Setting a cache model has a very strange behavior in WebKit2, where it ignores 9 sizes that were explicitly passed from UI process, and uses different ones. As 10 setCacheModel() is always called on launch, it always creates a non-empty disk cache. 11 12 The design needs to be improved one day, but for now, just make sure that we never 13 create a disk cache during testing. 14 15 * NetworkProcess/NetworkProcess.cpp: 16 (WebKit::NetworkProcess::NetworkProcess): 17 (WebKit::NetworkProcess::initializeNetworkProcess): 18 * NetworkProcess/NetworkProcess.h: 19 * NetworkProcess/cocoa/NetworkProcessCocoa.mm: 20 (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): 21 (WebKit::NetworkProcess::platformSetCacheModel): 22 * WebProcess/WebProcess.cpp: 23 (WebKit::WebProcess::WebProcess): 24 (WebKit::WebProcess::initializeWebProcess): 25 * WebProcess/WebProcess.h: 26 * WebProcess/cocoa/WebProcessCocoa.mm: 27 (WebKit::WebProcess::platformSetCacheModel): 28 (WebKit::WebProcess::platformInitializeWebProcess): 29 1 30 2014-11-11 Eric Carlson <eric.carlson@apple.com> 2 31 -
trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp
r174987 r175982 68 68 : m_hasSetCacheModel(false) 69 69 , m_cacheModel(CacheModelDocumentViewer) 70 , m_diskCacheIsDisabledForTesting(false) 70 71 , m_canHandleHTTPSServerTrustEvaluation(true) 71 72 #if PLATFORM(COCOA) … … 162 163 memoryPressureHandler().install(); 163 164 165 m_diskCacheIsDisabledForTesting = parameters.shouldUseTestingNetworkSession; 164 166 setCacheModel(static_cast<uint32_t>(parameters.cacheModel)); 167 165 168 setCanHandleHTTPSServerTrustEvaluation(parameters.canHandleHTTPSServerTrustEvaluation); 166 169 -
trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h
r174987 r175982 138 138 bool m_hasSetCacheModel; 139 139 CacheModel m_cacheModel; 140 bool m_diskCacheIsDisabledForTesting; 140 141 bool m_canHandleHTTPSServerTrustEvaluation; 141 142 -
trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkProcessCocoa.mm
r172500 r175982 68 68 m_diskCacheDirectory = parameters.diskCacheDirectory; 69 69 70 // FIXME: Most of what this function does for cache size gets immediately overridden by setCacheModel(). 71 // - memory cache size passed from UI process is always ignored; 72 // - disk cache size passed from UI process is effectively a minimum size. 73 // One non-obvious constraint is that we need to use -setSharedURLCache: even in testing mode, to prevent creating a default one on disk later, when some other code touches the cache. 74 75 ASSERT(!m_diskCacheIsDisabledForTesting || !parameters.nsURLCacheDiskCapacity); 76 70 77 if (!m_diskCacheDirectory.isNull()) { 71 78 SandboxExtension::consumePermanently(parameters.diskCacheDirectoryExtensionHandle); … … 135 142 pageCacheCapacity, urlCacheMemoryCapacity, urlCacheDiskCapacity); 136 143 137 138 144 NSURLCache *nsurlCache = [NSURLCache sharedURLCache]; 139 145 [nsurlCache setMemoryCapacity:urlCacheMemoryCapacity]; 140 [nsurlCache setDiskCapacity:std::max<unsigned long>(urlCacheDiskCapacity, [nsurlCache diskCapacity])]; // Don't shrink a big disk cache, since that would cause churn. 146 if (!m_diskCacheIsDisabledForTesting) 147 [nsurlCache setDiskCapacity:std::max<unsigned long>(urlCacheDiskCapacity, [nsurlCache diskCapacity])]; // Don't shrink a big disk cache, since that would cause churn. 141 148 } 142 149 -
trunk/Source/WebKit2/WebProcess/WebProcess.cpp
r175719 r175982 157 157 , m_hasSetCacheModel(false) 158 158 , m_cacheModel(CacheModelDocumentViewer) 159 , m_diskCacheIsDisabledForTesting(false) 159 160 #if PLATFORM(COCOA) 160 161 , m_compositingRenderServerPort(MACH_PORT_NULL) … … 307 308 cacheStorage().setCacheDirectory(parameters.applicationCacheDirectory); 308 309 310 m_diskCacheIsDisabledForTesting = parameters.shouldUseTestingNetworkSession; 309 311 setCacheModel(static_cast<uint32_t>(parameters.cacheModel)); 310 312 -
trunk/Source/WebKit2/WebProcess/WebProcess.h
r175719 r175982 316 316 bool m_hasSetCacheModel; 317 317 CacheModel m_cacheModel; 318 bool m_diskCacheIsDisabledForTesting; 318 319 319 320 #if PLATFORM(COCOA) -
trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm
r175288 r175982 122 122 123 123 [nsurlCache setMemoryCapacity:urlCacheMemoryCapacity]; 124 [nsurlCache setDiskCapacity:std::max<unsigned long>(urlCacheDiskCapacity, [nsurlCache diskCapacity])]; // Don't shrink a big disk cache, since that would cause churn. 124 if (!m_diskCacheIsDisabledForTesting) 125 [nsurlCache setDiskCapacity:std::max<unsigned long>(urlCacheDiskCapacity, [nsurlCache diskCapacity])]; // Don't shrink a big disk cache, since that would cause churn. 125 126 } 126 127 … … 168 169 #endif 169 170 #endif 171 172 // FIXME: Most of what this function does for cache size gets immediately overridden by setCacheModel(). 173 // - memory cache size passed from UI process is always ignored; 174 // - disk cache size passed from UI process is effectively a minimum size. 175 // One non-obvious constraint is that we need to use -setSharedURLCache: even in testing mode, to prevent creating a default one on disk later, when some other code touches the cache. 176 177 ASSERT(!m_diskCacheIsDisabledForTesting || !parameters.nsURLCacheDiskCapacity); 170 178 171 179 #if PLATFORM(IOS) -
trunk/Tools/ChangeLog
r175930 r175982 1 2014-11-11 Alexey Proskuryakov <ap@apple.com> 2 3 DRT and WKTR touch disk cache 4 https://bugs.webkit.org/show_bug.cgi?id=138622 5 6 Reviewed by Geoffrey Garen. 7 8 * DumpRenderTree/mac/DumpRenderTree.mm: (prepareConsistentTestingEnvironment): 9 Set a shared cache before calling -_switchNetworkLoaderToNewTestingSession, not after, 10 because this function uses the shared cache. 11 12 * WebKitTestRunner/mac/TestControllerMac.mm: (WTR::TestController::platformInitializeContext): 13 Create an empty shared cache to prevent a default one from being created on disk. 14 1 15 2014-10-07 Sergio Villar Senin <svillar@igalia.com> 2 16 -
trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm
r175783 r175982 1089 1089 1090 1090 #if !PLATFORM(IOS) 1091 // FIXME: We'd like to start with a clean state for every test, but this function can't be used more than once yet. 1091 // +[WebPreferences _switchNetworkLoaderToNewTestingSession] calls +[NSURLCache sharedURLCache], which initializes a default cache on disk. 1092 // Making the shared cache memory-only avoids touching the file system. 1093 RetainPtr<NSURLCache> sharedCache = 1094 adoptNS([[NSURLCache alloc] initWithMemoryCapacity:1024 * 1024 1095 diskCapacity:0 1096 diskPath:nil]); 1097 [NSURLCache setSharedURLCache:sharedCache.get()]; 1098 1092 1099 [WebPreferences _switchNetworkLoaderToNewTestingSession]; 1093 1094 NSURLCache *sharedCache =1095 [[NSURLCache alloc] initWithMemoryCapacity:1024 * 10241096 diskCapacity:01097 diskPath:[libraryPathForDumpRenderTree() stringByAppendingPathComponent:@"URLCache"]];1098 [NSURLCache setSharedURLCache:sharedCache];1099 [sharedCache release];1100 1100 1101 1101 adjustFonts(); -
trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm
r174824 r175982 107 107 void TestController::platformInitializeContext() 108 108 { 109 // Testing uses a private session, which is memory only. However creating one instantiates a shared NSURLCache, 110 // and if we haven't created one yet, the default one will be created on disk. 111 // Making the shared cache memory-only avoids touching the file system. 112 RetainPtr<NSURLCache> sharedCache = 113 adoptNS([[NSURLCache alloc] initWithMemoryCapacity:1024 * 1024 114 diskCapacity:0 115 diskPath:nil]); 116 [NSURLCache setSharedURLCache:sharedCache.get()]; 109 117 } 110 118
Note:
See TracChangeset
for help on using the changeset viewer.