Changeset 228967 in webkit
- Timestamp:
- Feb 23, 2018 3:26:40 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r228953 r228967 1 2018-02-23 John Wilander <wilander@apple.com> 2 3 Introduce ITP debug logging as an opt-in developer feature 4 https://bugs.webkit.org/show_bug.cgi?id=183065 5 <rdar://problem/37803761> 6 7 Reviewed by Brent Fulgham. 8 9 * wtf/Assertions.h: 10 Introduces RELEASE_LOG_INFO() and RELEASE_LOG_INFO_IF(). 11 1 12 2018-02-23 Fujii Hironori <Hironori.Fujii@sony.com> 2 13 -
trunk/Source/WTF/wtf/Assertions.h
r225958 r228967 457 457 #define RELEASE_LOG( channel, format, ...) os_log( LOG_CHANNEL(channel).osLogChannel, format, ##__VA_ARGS__) 458 458 #define RELEASE_LOG_ERROR(channel, format, ...) os_log_error(LOG_CHANNEL(channel).osLogChannel, format, ##__VA_ARGS__) 459 #define RELEASE_LOG_INFO(channel, format, ...) os_log_info(LOG_CHANNEL(channel).osLogChannel, format, ##__VA_ARGS__) 459 460 460 461 #define RELEASE_LOG_IF( isAllowed, channel, format, ...) do { if (isAllowed) RELEASE_LOG( channel, format, ##__VA_ARGS__); } while (0) 461 462 #define RELEASE_LOG_ERROR_IF(isAllowed, channel, format, ...) do { if (isAllowed) RELEASE_LOG_ERROR(channel, format, ##__VA_ARGS__); } while (0) 463 #define RELEASE_LOG_INFO_IF(isAllowed, channel, format, ...) do { if (isAllowed) RELEASE_LOG_INFO(channel, format, ##__VA_ARGS__); } while (0) 462 464 463 465 #define RELEASE_LOG_WITH_LEVEL(channel, logLevel, format, ...) do { \ -
trunk/Source/WebKit/ChangeLog
r228964 r228967 1 2018-02-23 John Wilander <wilander@apple.com> 2 3 Introduce ITP debug logging as an opt-in developer feature 4 https://bugs.webkit.org/show_bug.cgi?id=183065 5 <rdar://problem/37803761> 6 7 Reviewed by Brent Fulgham. 8 9 * Platform/Logging.h: 10 Added a dedicated channel for Resource Load Statistics debug logging 11 since this will be part of a developer-facing feature and should not 12 be mixed with general Resource Load Statistics logging. 13 * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm: 14 (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded): 15 Now picks up the user default setting for 16 ResourceLoadStatisticsDebugLoggingEnabled. 17 * UIProcess/WebResourceLoadStatisticsStore.cpp: 18 (WebKit::WebResourceLoadStatisticsStore::removeDataRecords): 19 Now logs for which domains it purges website data if 20 ResourceLoadStatisticsDebugLoggingEnabled is set. 21 (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning): 22 Now logs for which domains it partitions and blocks cookies 23 in third-party contexts if ResourceLoadStatisticsDebugLoggingEnabled 24 is set. 25 * UIProcess/WebResourceLoadStatisticsStore.h: 26 1 27 2018-02-23 Brent Fulgham <bfulgham@apple.com> 2 28 -
trunk/Source/WebKit/Platform/Logging.h
r228116 r228967 65 65 M(Resize) \ 66 66 M(ResourceLoadStatistics) \ 67 M(ResourceLoadStatisticsDebug) \ 67 68 M(Selection) \ 68 69 M(ServiceWorker) \ -
trunk/Source/WebKit/UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm
r219855 r228967 49 49 if (grandfatheringTime > 0_s && grandfatheringTime <= 24_h * 7) 50 50 setGrandfatheringTime(grandfatheringTime); 51 52 setDebugLogggingEnabled([[NSUserDefaults standardUserDefaults] boolForKey:@"ResourceLoadStatisticsDebugLoggingEnabled"]); 51 53 }); 52 54 } -
trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp
r228828 r228967 42 42 #include <wtf/MathExtras.h> 43 43 #include <wtf/NeverDestroyed.h> 44 #if !RELEASE_LOG_DISABLED 45 #include <wtf/text/StringBuilder.h> 46 #endif 44 47 45 48 namespace WebKit { … … 185 188 m_persistentStorage.finishAllPendingWorkSynchronously(); 186 189 } 187 190 191 #if !RELEASE_LOG_DISABLED 192 static void appendWithDelimiter(StringBuilder& builder, const String& domain, bool isFirstItem) 193 { 194 if (!isFirstItem) 195 builder.appendLiteral(", "); 196 builder.append(domain); 197 } 198 #endif 199 188 200 void WebResourceLoadStatisticsStore::removeDataRecords(CompletionHandler<void()>&& callback) 189 201 { … … 206 218 return; 207 219 } 220 221 #if !RELEASE_LOG_DISABLED 222 if (m_debugLoggingEnabled) { 223 StringBuilder domainsToRemoveDataRecordsForBuilder; 224 bool isFirstItem = true; 225 for (auto& domain : prevalentResourceDomains) { 226 appendWithDelimiter(domainsToRemoveDataRecordsForBuilder, domain, isFirstItem); 227 isFirstItem = false; 228 } 229 RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to remove data records for %{public}s.", domainsToRemoveDataRecordsForBuilder.toString().utf8().data()); 230 } 231 #endif 208 232 209 233 setDataRecordsBeingRemoved(true); … … 218 242 setDataRecordsBeingRemoved(false); 219 243 callback(); 244 #if !RELEASE_LOG_DISABLED 245 RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "Done removing data records."); 246 #endif 220 247 }); 221 248 }); … … 930 957 } 931 958 959 #if !RELEASE_LOG_DISABLED 960 if (m_debugLoggingEnabled) { 961 if (!domainsToPartition.isEmpty()) { 962 StringBuilder domainsToPartitionBuilder; 963 bool isFirstDomain = true; 964 for (auto& domain : domainsToPartition) { 965 appendWithDelimiter(domainsToPartitionBuilder, domain, isFirstDomain); 966 isFirstDomain = false; 967 } 968 RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to partition cookies in third-party contexts for %{public}s.", domainsToPartitionBuilder.toString().utf8().data()); 969 RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to partition cookies in third-party contexts for %s.", domainsToPartitionBuilder.toString().utf8().data()); 970 } 971 972 if (!domainsToBlock.isEmpty()) { 973 StringBuilder domainsToBlockBuilder; 974 bool isFirstDomain = true; 975 for (auto& domain : domainsToBlock) { 976 appendWithDelimiter(domainsToBlockBuilder, domain, isFirstDomain); 977 isFirstDomain = false; 978 } 979 RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to block cookies in third-party contexts for %{public}s.", domainsToBlockBuilder.toString().utf8().data()); 980 } 981 982 if (!domainsToNeitherPartitionNorBlock.isEmpty()) { 983 StringBuilder domainsToNeitherPartitionNorBlockBuilder; 984 bool isFirstDomain = true; 985 for (auto& domain : domainsToNeitherPartitionNorBlock) { 986 appendWithDelimiter(domainsToNeitherPartitionNorBlockBuilder, domain, isFirstDomain); 987 isFirstDomain = false; 988 } 989 RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to neither partition nor block cookies in third-party contexts for %{public}s.", domainsToNeitherPartitionNorBlockBuilder.toString().utf8().data()); 990 } 991 } 992 #endif 993 932 994 RunLoop::main().dispatch([this, protectedThis = makeRef(*this), domainsToPartition = crossThreadCopy(domainsToPartition), domainsToBlock = crossThreadCopy(domainsToBlock), domainsToNeitherPartitionNorBlock = crossThreadCopy(domainsToNeitherPartitionNorBlock), callback = WTFMove(callback)] () { 933 995 m_updatePrevalentDomainsToPartitionOrBlockCookiesHandler(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, ShouldClearFirst::No); 934 996 callback(); 997 #if !RELEASE_LOG_DISABLED 998 RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "Done updating cookie partitioning and blocking."); 999 #endif 935 1000 }); 936 1001 } -
trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h
r228951 r228967 177 177 void resetCookiePartitioningState(); 178 178 179 void setDebugLogggingEnabled(bool enabled) { m_debugLoggingEnabled = enabled; } 180 179 181 #if PLATFORM(COCOA) 180 182 void registerUserDefaultsIfNeeded(); … … 221 223 bool m_dataRecordsBeingRemoved { false }; 222 224 225 bool m_debugLoggingEnabled { false }; 226 223 227 Function<void (const String&)> m_statisticsTestingCallback; 224 228 };
Note: See TracChangeset
for help on using the changeset viewer.