Title: [179164] branches/safari-600.1.4.15-branch/Source

Diff

Modified: branches/safari-600.1.4.15-branch/Source/_javascript_Core/ChangeLog (179163 => 179164)


--- branches/safari-600.1.4.15-branch/Source/_javascript_Core/ChangeLog	2015-01-27 04:39:58 UTC (rev 179163)
+++ branches/safari-600.1.4.15-branch/Source/_javascript_Core/ChangeLog	2015-01-27 04:50:07 UTC (rev 179164)
@@ -1,3 +1,20 @@
+2015-01-26  Lucas Forschler  <[email protected]>
+
+        Merge r177328
+
+    2014-12-15  Chris Dumez  <[email protected]>
+
+            [iOS] Add feature counting support
+            https://bugs.webkit.org/show_bug.cgi?id=139652
+            <rdar://problem/19255690>
+
+            Reviewed by Gavin Barraclough.
+
+            Link against AppSupport framework on iOS as we need it to implement
+            the new FeatureCounter API in WTF.
+
+            * Configurations/_javascript_Core.xcconfig:
+
 2015-01-21  Babak Shafiei  <[email protected]>
 
         Merge r176972.

Modified: branches/safari-600.1.4.15-branch/Source/_javascript_Core/Configurations/_javascript_Core.xcconfig (179163 => 179164)


--- branches/safari-600.1.4.15-branch/Source/_javascript_Core/Configurations/_javascript_Core.xcconfig	2015-01-27 04:39:58 UTC (rev 179163)
+++ branches/safari-600.1.4.15-branch/Source/_javascript_Core/Configurations/_javascript_Core.xcconfig	2015-01-27 04:50:07 UTC (rev 179164)
@@ -38,7 +38,7 @@
 
 OTHER_LDFLAGS_BASE = -lobjc -Wl,-Y,3 $(OTHER_LDFLAGS_HIDE_SYMBOLS);
 OTHER_LDFLAGS = $(inherited) $(OTHER_LDFLAGS_$(PLATFORM_NAME));
-OTHER_LDFLAGS_iphoneos = $(OTHER_LDFLAGS_BASE);
+OTHER_LDFLAGS_iphoneos = $(OTHER_LDFLAGS_BASE) -framework AppSupport;
 OTHER_LDFLAGS_iphonesimulator = $(OTHER_LDFLAGS_iphoneos);
 OTHER_LDFLAGS_macosx = $(OTHER_LDFLAGS_BASE) -sub_library libobjc -framework CoreServices;
 GCC_PREFIX_HEADER = _javascript_CorePrefix.h;

Modified: branches/safari-600.1.4.15-branch/Source/WTF/ChangeLog (179163 => 179164)


--- branches/safari-600.1.4.15-branch/Source/WTF/ChangeLog	2015-01-27 04:39:58 UTC (rev 179163)
+++ branches/safari-600.1.4.15-branch/Source/WTF/ChangeLog	2015-01-27 04:50:07 UTC (rev 179164)
@@ -1,3 +1,29 @@
+2015-01-26  Lucas Forschler  <[email protected]>
+
+        Merge r177328
+
+    2014-12-15  Chris Dumez  <[email protected]>
+
+            [iOS] Add feature counting support
+            https://bugs.webkit.org/show_bug.cgi?id=139652
+            <rdar://problem/19255690>
+
+            Reviewed by Gavin Barraclough.
+
+            Add a FeatureCounter API for to log / count when a feature
+            is used. For now, this is only implementated on iOS.
+
+            * WTF.vcxproj/WTF.vcxproj:
+            * WTF.xcodeproj/project.pbxproj:
+            * wtf/CMakeLists.txt:
+            * wtf/FeatureCounter.cpp: Added.
+            (WTF::incrementFeatureCounterKey):
+            (WTF::setFeatureCounterKey):
+            * wtf/FeatureCounter.h: Added.
+            * wtf/ios/FeatureCounter.mm: Added.
+            (WTF::incrementFeatureCounterKey):
+            (WTF::setFeatureCounterKey):
+
 2015-01-21  Babak Shafiei  <[email protected]>
 
         Merge r177000.

Modified: branches/safari-600.1.4.15-branch/Source/WTF/WTF.vcxproj/WTF.vcxproj (179163 => 179164)


--- branches/safari-600.1.4.15-branch/Source/WTF/WTF.vcxproj/WTF.vcxproj	2015-01-27 04:39:58 UTC (rev 179163)
+++ branches/safari-600.1.4.15-branch/Source/WTF/WTF.vcxproj/WTF.vcxproj	2015-01-27 04:50:07 UTC (rev 179164)
@@ -72,6 +72,7 @@
     <ClCompile Include="..\wtf\dtoa\strtod.cc" />
     <ClCompile Include="..\wtf\FastBitVector.cpp" />
     <ClCompile Include="..\wtf\FastMalloc.cpp" />
+    <ClCompile Include="..\wtf\FeatureCounter.cpp" />
     <ClCompile Include="..\wtf\FilePrintStream.cpp" />
     <ClCompile Include="..\wtf\FunctionDispatcher.cpp" />
     <ClCompile Include="..\wtf\gobject\GlibUtilities.cpp">
@@ -194,6 +195,7 @@
     <ClInclude Include="..\wtf\dtoa\utils.h" />
     <ClInclude Include="..\wtf\FastBitVector.h" />
     <ClInclude Include="..\wtf\FastMalloc.h" />
+    <ClInclude Include="..\wtf\FeatureCounter.h" />
     <ClInclude Include="..\wtf\FeatureDefines.h" />
     <ClInclude Include="..\wtf\FilePrintStream.h" />
     <ClInclude Include="..\wtf\FlipBytes.h" />

Modified: branches/safari-600.1.4.15-branch/Source/WTF/WTF.xcodeproj/project.pbxproj (179163 => 179164)


--- branches/safari-600.1.4.15-branch/Source/WTF/WTF.xcodeproj/project.pbxproj	2015-01-27 04:39:58 UTC (rev 179163)
+++ branches/safari-600.1.4.15-branch/Source/WTF/WTF.xcodeproj/project.pbxproj	2015-01-27 04:50:07 UTC (rev 179164)
@@ -73,6 +73,9 @@
 		2CDED0EF18115C38004DBA70 /* RunLoopCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CDED0EE18115C38004DBA70 /* RunLoopCF.cpp */; };
 		2CDED0F318115C85004DBA70 /* RunLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CDED0F118115C85004DBA70 /* RunLoop.cpp */; };
 		2CDED0F418115C85004DBA70 /* RunLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CDED0F218115C85004DBA70 /* RunLoop.h */; };
+		463111841A3F729A00E925A3 /* FeatureCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = 463111831A3F729A00E925A3 /* FeatureCounter.h */; };
+		463111861A3F72B800E925A3 /* FeatureCounter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 463111851A3F72B800E925A3 /* FeatureCounter.mm */; };
+		463111881A3F899100E925A3 /* FeatureCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 463111871A3F899100E925A3 /* FeatureCounter.cpp */; };
 		7CDD7FF8186D291E007433CD /* IteratorAdaptors.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CDD7FF7186D291E007433CD /* IteratorAdaptors.h */; };
 		7CDD7FFA186D2A54007433CD /* IteratorRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CDD7FF9186D2A54007433CD /* IteratorRange.h */; };
 		7E29C33E15FFD79B00516D61 /* ObjcRuntimeExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */; };
@@ -355,6 +358,9 @@
 		2CDED0F118115C85004DBA70 /* RunLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoop.cpp; sourceTree = "<group>"; };
 		2CDED0F218115C85004DBA70 /* RunLoop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunLoop.h; sourceTree = "<group>"; };
 		44DEE74A152274BB00C6EC37 /* iOS.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = iOS.xcconfig; sourceTree = "<group>"; };
+		463111831A3F729A00E925A3 /* FeatureCounter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FeatureCounter.h; sourceTree = "<group>"; };
+		463111851A3F72B800E925A3 /* FeatureCounter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FeatureCounter.mm; sourceTree = "<group>"; };
+		463111871A3F899100E925A3 /* FeatureCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FeatureCounter.cpp; sourceTree = "<group>"; };
 		5D247B6214689B8600E78B76 /* libWTF.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libWTF.a; sourceTree = BUILT_PRODUCTS_DIR; };
 		5D247B6E14689C4700E78B76 /* Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
 		5D247B7014689C4700E78B76 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
@@ -603,6 +609,7 @@
 		1FA47C87152502DA00568D1B /* ios */ = {
 			isa = PBXGroup;
 			children = (
+				463111851A3F72B800E925A3 /* FeatureCounter.mm */,
 				1FA47C88152502DA00568D1B /* WebCoreThread.cpp */,
 				1FA47C89152502DA00568D1B /* WebCoreThread.h */,
 			);
@@ -741,6 +748,8 @@
 				0FD81AC4154FB22E00983E72 /* FastBitVector.h */,
 				A8A472A1151A825A004123FF /* FastMalloc.cpp */,
 				A8A472A2151A825A004123FF /* FastMalloc.h */,
+				463111871A3F899100E925A3 /* FeatureCounter.cpp */,
+				463111831A3F729A00E925A3 /* FeatureCounter.h */,
 				B38FD7BC168953E80065C969 /* FeatureDefines.h */,
 				0F9D335B165DBA73005AD387 /* FilePrintStream.cpp */,
 				0F9D335C165DBA73005AD387 /* FilePrintStream.h */,
@@ -1132,6 +1141,7 @@
 				1AFDE648195201C300C48FFA /* TypeCasts.h in Headers */,
 				A8A47423151A825B004123FF /* SimpleStats.h in Headers */,
 				A8A47424151A825B004123FF /* SinglyLinkedList.h in Headers */,
+				463111841A3F729A00E925A3 /* FeatureCounter.h in Headers */,
 				A748745317A0BDAE00FA04CB /* SixCharacterHash.h in Headers */,
 				A8A47426151A825B004123FF /* Spectrum.h in Headers */,
 				A8A47428151A825B004123FF /* StackBounds.h in Headers */,
@@ -1296,6 +1306,7 @@
 				A8A4739C151A825B004123FF /* CurrentTime.cpp in Sources */,
 				A8A4739E151A825B004123FF /* DataLog.cpp in Sources */,
 				A8A473A0151A825B004123FF /* DateMath.cpp in Sources */,
+				463111861A3F72B800E925A3 /* FeatureCounter.mm in Sources */,
 				A8A473A2151A825B004123FF /* DecimalNumber.cpp in Sources */,
 				A8A473AE151A825B004123FF /* diy-fp.cc in Sources */,
 				A8A473B0151A825B004123FF /* double-conversion.cc in Sources */,
@@ -1316,6 +1327,7 @@
 				CD5497AC15857D0300B5BC30 /* MediaTime.cpp in Sources */,
 				A8A473EC151A825B004123FF /* MetaAllocator.cpp in Sources */,
 				A8A473F4151A825B004123FF /* NumberOfCores.cpp in Sources */,
+				463111881A3F899100E925A3 /* FeatureCounter.cpp in Sources */,
 				A8A473F7151A825B004123FF /* OSAllocatorPosix.cpp in Sources */,
 				A8A473F9151A825B004123FF /* OSRandomSource.cpp in Sources */,
 				A8A47400151A825B004123FF /* PageAllocationAligned.cpp in Sources */,

Modified: branches/safari-600.1.4.15-branch/Source/WTF/wtf/CMakeLists.txt (179163 => 179164)


--- branches/safari-600.1.4.15-branch/Source/WTF/wtf/CMakeLists.txt	2015-01-27 04:39:58 UTC (rev 179163)
+++ branches/safari-600.1.4.15-branch/Source/WTF/wtf/CMakeLists.txt	2015-01-27 04:50:07 UTC (rev 179164)
@@ -24,6 +24,7 @@
     DisallowCType.h
     DoublyLinkedList.h
     FastMalloc.h
+    FeatureCounter.h
     FeatureDefines.h
     FilePrintStream.h
     FlipBytes.h
@@ -158,6 +159,7 @@
     DecimalNumber.cpp
     FastBitVector.cpp
     FastMalloc.cpp
+    FeatureCounter.cpp
     FilePrintStream.cpp
     FunctionDispatcher.cpp
     GregorianDateTime.cpp

Copied: branches/safari-600.1.4.15-branch/Source/WTF/wtf/FeatureCounter.cpp (from rev 177328, trunk/Source/WTF/wtf/FeatureCounter.cpp) (0 => 179164)


--- branches/safari-600.1.4.15-branch/Source/WTF/wtf/FeatureCounter.cpp	                        (rev 0)
+++ branches/safari-600.1.4.15-branch/Source/WTF/wtf/FeatureCounter.cpp	2015-01-27 04:50:07 UTC (rev 179164)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "FeatureCounter.h"
+
+namespace WTF {
+
+#if !PLATFORM(IOS)
+
+void incrementFeatureCounterKey(const char* const key)
+{
+    UNUSED_PARAM(key);
+}
+
+void setFeatureCounterKey(const char* const key, int64_t value)
+{
+    UNUSED_PARAM(key);
+    UNUSED_PARAM(value);
+}
+
+#endif
+
+} // namespace WTF

Copied: branches/safari-600.1.4.15-branch/Source/WTF/wtf/FeatureCounter.h (from rev 177328, trunk/Source/WTF/wtf/FeatureCounter.h) (0 => 179164)


--- branches/safari-600.1.4.15-branch/Source/WTF/wtf/FeatureCounter.h	                        (rev 0)
+++ branches/safari-600.1.4.15-branch/Source/WTF/wtf/FeatureCounter.h	2015-01-27 04:50:07 UTC (rev 179164)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FeatureCounter_h
+#define FeatureCounter_h
+
+namespace WTF {
+
+WTF_EXPORT_PRIVATE void incrementFeatureCounterKey(const char* const key);
+WTF_EXPORT_PRIVATE void setFeatureCounterKey(const char* const key, int64_t value);
+
+#define FEATURE_COUNTER_INCREMENT_KEY(key)   WTF::incrementFeatureCounterKey(key)
+#define FEATURE_COUNTER_SET_KEY(key, value)  WTF::setFeatureCounterKey(key, value)
+
+} // namespace WTF
+
+#endif // FeatureCounter_h

Copied: branches/safari-600.1.4.15-branch/Source/WTF/wtf/ios/FeatureCounter.mm (from rev 177328, trunk/Source/WTF/wtf/ios/FeatureCounter.mm) (0 => 179164)


--- branches/safari-600.1.4.15-branch/Source/WTF/wtf/ios/FeatureCounter.mm	                        (rev 0)
+++ branches/safari-600.1.4.15-branch/Source/WTF/wtf/ios/FeatureCounter.mm	2015-01-27 04:50:07 UTC (rev 179164)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "FeatureCounter.h"
+
+#if PLATFORM(IOS)
+#import <AppSupport/CPAggregateDictionary.h>
+
+namespace WTF {
+
+void incrementFeatureCounterKey(const char* const key)
+{
+    NSString *nsKey = [[NSString alloc] initWithCharactersNoCopy:reinterpret_cast<unichar*>(const_cast<char*>(key)) length:strlen(key) freeWhenDone:NO];
+    [[CPAggregateDictionary sharedAggregateDictionary] incrementKey:nsKey];
+}
+
+void setFeatureCounterKey(const char* const key, int64_t value)
+{
+    NSString *nsKey = [[NSString alloc] initWithCharactersNoCopy:reinterpret_cast<unichar*>(const_cast<char*>(key)) length:strlen(key) freeWhenDone:NO];
+    [[CPAggregateDictionary sharedAggregateDictionary] setValue:value forScalarKey:nsKey];
+}
+
+} // namespace WTF
+
+#endif // PLATFORM(IOS)

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog (179163 => 179164)


--- branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog	2015-01-27 04:39:58 UTC (rev 179163)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog	2015-01-27 04:50:07 UTC (rev 179164)
@@ -1,3 +1,26 @@
+2015-01-26  Lucas Forschler  <[email protected]>
+
+        Merge r177328
+
+    2014-12-15  Chris Dumez  <[email protected]>
+
+            [iOS] Add feature counting support
+            https://bugs.webkit.org/show_bug.cgi?id=139652
+            <rdar://problem/19255690>
+
+            Reviewed by Gavin Barraclough.
+
+            Use FeatureCounter API to log PageCache failure reasons
+            as well as its success rate.
+
+            No new tests, no behavior change.
+
+            * history/PageCache.cpp:
+            (WebCore::logCanCacheFrameDecision):
+            (WebCore::logCanCachePageDecision):
+            (WebCore::PageCache::canCache):
+            * platform/FeatureCounterKeys.h: Added.
+
 2015-01-26  David Kilzer  <[email protected]>
 
         Merge r177927.

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/history/PageCache.cpp (179163 => 179164)


--- branches/safari-600.1.4.15-branch/Source/WebCore/history/PageCache.cpp	2015-01-27 04:39:58 UTC (rev 179163)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/history/PageCache.cpp	2015-01-27 04:50:07 UTC (rev 179164)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ * Copyright (C) 2007, 2014 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -36,6 +36,7 @@
 #include "DeviceOrientationController.h"
 #include "Document.h"
 #include "DocumentLoader.h"
+#include "FeatureCounterKeys.h"
 #include "FrameLoader.h"
 #include "FrameLoaderClient.h"
 #include "FrameLoaderStateMachine.h"
@@ -66,6 +67,12 @@
 #if !defined(NDEBUG)
 
 #define PCLOG(...) LOG(PageCache, "%*s%s", indentLevel*4, "", makeString(__VA_ARGS__).utf8().data())
+
+#else
+
+#define PCLOG(...) ((void)0)
+
+#endif // !defined(NDEBUG)
     
 // Used in histograms, please only add at the end, and do not remove elements (renaming e.g. to "FooEnumUnused1" is fine).
 // This is because statistics may be gathered from histograms between versions over time, and re-using values causes collisions.
@@ -94,6 +101,7 @@
     PCLOG("+---");
     if (!frame->loader().documentLoader()) {
         PCLOG("   -There is no DocumentLoader object");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureNoDocumentLoaderKey);
         return 1 << NoDocumentLoader;
     }
 
@@ -107,6 +115,7 @@
     unsigned rejectReasons = 0;
     if (!frame->loader().documentLoader()->mainDocumentError().isNull()) {
         PCLOG("   -Main document has an error");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureMainDocumentErrorKey);
 #if !PLATFORM(IOS)
         rejectReasons |= 1 << MainDocumentError;
 #else
@@ -118,15 +127,21 @@
     }
     if (frame->loader().documentLoader()->substituteData().isValid() && frame->loader().documentLoader()->substituteData().failingURL().isEmpty()) {
         PCLOG("   -Frame is an error page");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureIsErrorPageKey);
         rejectReasons |= 1 << IsErrorPage;
     }
     if (frame->loader().subframeLoader().containsPlugins() && !frame->page()->settings().pageCacheSupportsPlugins()) {
         PCLOG("   -Frame contains plugins");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureHasPlugins);
         rejectReasons |= 1 << HasPlugins;
     }
     if (frame->document()->url().protocolIs("https")
         && (frame->loader().documentLoader()->response().cacheControlContainsNoCache()
             || frame->loader().documentLoader()->response().cacheControlContainsNoStore())) {
+        if (frame->loader().documentLoader()->response().cacheControlContainsNoCache())
+            FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureHTTPSNoCacheKey);
+        if (frame->loader().documentLoader()->response().cacheControlContainsNoStore())
+            FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureHTTPSNoStoreKey);
         PCLOG("   -Frame is HTTPS, and cache control prohibits caching or storing");
         rejectReasons |= 1 << IsHttpsAndCacheControlled;
     }
@@ -142,41 +157,50 @@
 #if ENABLE(SQL_DATABASE)
     if (DatabaseManager::manager().hasOpenDatabases(frame->document())) {
         PCLOG("   -Frame has open database handles");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureHasOpenDatabasesKey);
         rejectReasons |= 1 << HasDatabaseHandles;
     }
 #endif
 #if ENABLE(SHARED_WORKERS)
     if (SharedWorkerRepository::hasSharedWorkers(frame->document())) {
         PCLOG("   -Frame has associated SharedWorkers");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureHasSharedWorkersKey);
         rejectReasons |= 1 << HasSharedWorkers;
     }
 #endif
     if (!frame->loader().history().currentItem()) {
         PCLOG("   -No current history item");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureNoCurrentHistoryItemKey);
         rejectReasons |= 1 << NoHistoryItem;
     }
     if (frame->loader().quickRedirectComing()) {
         PCLOG("   -Quick redirect is coming");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureQuirkRedirectComingKey);
         rejectReasons |= 1 << QuickRedirectComing;
     }
     if (frame->loader().documentLoader()->isLoadingInAPISense()) {
         PCLOG("   -DocumentLoader is still loading in API sense");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureLoadingAPISenseKey);
         rejectReasons |= 1 << IsLoadingInAPISense;
     }
     if (frame->loader().documentLoader()->isStopping()) {
         PCLOG("   -DocumentLoader is in the middle of stopping");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureDocumentLoaderStoppingKey);
         rejectReasons |= 1 << IsStopping;
     }
     if (!frame->document()->canSuspendActiveDOMObjects()) {
-        PCLOG("   -The document cannot suspect its active DOM Objects");
+        PCLOG("   -The document cannot suspend its active DOM Objects");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureCannotSuspendActiveDOMObjectsKey);
         rejectReasons |= 1 << CannotSuspendActiveDOMObjects;
     }
     if (!frame->loader().documentLoader()->applicationCacheHost()->canCacheInPageCache()) {
         PCLOG("   -The DocumentLoader uses an application cache");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureApplicationCacheKey);
         rejectReasons |= 1 << DocumentLoaderUsesApplicationCache;
     }
     if (!frame->loader().client().canCachePage()) {
         PCLOG("   -The client says this frame cannot be cached");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureDeniedByClientKey);
         rejectReasons |= 1 << ClientDeniesCaching;
     }
 
@@ -228,38 +252,48 @@
 #if ENABLE(DEVICE_ORIENTATION) && !PLATFORM(IOS)
     if (DeviceMotionController::isActiveAt(page)) {
         PCLOG("   -Page is using DeviceMotion");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureDeviceMotionKey);
         rejectReasons |= 1 << UsesDeviceMotion;
     }
     if (DeviceOrientationController::isActiveAt(page)) {
         PCLOG("   -Page is using DeviceOrientation");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureDeviceOrientationKey);
         rejectReasons |= 1 << UsesDeviceOrientation;
     }
 #endif
 #if ENABLE(PROXIMITY_EVENTS)
     if (DeviceProximityController::isActiveAt(page)) {
         PCLOG("   -Page is using DeviceProximity");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureDeviceProximityKey);
         rejectReasons |= 1 << UsesDeviceMotion;
     }
 #endif
     FrameLoadType loadType = page->mainFrame().loader().loadType();
     if (loadType == FrameLoadType::Reload) {
         PCLOG("   -Load type is: Reload");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureReloadKey);
         rejectReasons |= 1 << IsReload;
     }
     if (loadType == FrameLoadType::ReloadFromOrigin) {
         PCLOG("   -Load type is: Reload from origin");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureReloadFromOriginKey);
         rejectReasons |= 1 << IsReloadFromOrigin;
     }
     if (loadType == FrameLoadType::Same) {
         PCLOG("   -Load type is: Same");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureSameLoadKey);
         rejectReasons |= 1 << IsSameLoad;
     }
     
-    PCLOG(rejectReasons ? " Page CANNOT be cached\n--------" : " Page CAN be cached\n--------");
+    if (rejectReasons) {
+        PCLOG(" Page CANNOT be cached\n--------");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheFailureKey);
+    } else {
+        PCLOG(" Page CAN be cached\n--------");
+        FEATURE_COUNTER_INCREMENT_KEY(FeatureCounterPageCacheSuccessKey);
+    }
 }
 
-#endif // !defined(NDEBUG)
-
 PageCache* pageCache()
 {
     static PageCache* staticPageCache = new PageCache;
@@ -321,9 +355,7 @@
     if (!page)
         return false;
     
-#if !defined(NDEBUG)
     logCanCachePageDecision(page);
-#endif
 
     if (memoryPressureHandler().isUnderMemoryPressure())
         return false;

Copied: branches/safari-600.1.4.15-branch/Source/WebCore/platform/FeatureCounterKeys.h (from rev 177328, trunk/Source/WebCore/platform/FeatureCounterKeys.h) (0 => 179164)


--- branches/safari-600.1.4.15-branch/Source/WebCore/platform/FeatureCounterKeys.h	                        (rev 0)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/platform/FeatureCounterKeys.h	2015-01-27 04:50:07 UTC (rev 179164)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FeatureCounterKeys_h
+#define FeatureCounterKeys_h
+
+#include <wtf/FeatureCounter.h>
+
+namespace WebCore {
+
+// Page cache.
+static const char FeatureCounterPageCacheFailureNoDocumentLoaderKey[] = "com.apple.WebKit.pageCache.failure.noDocumentLoader";
+static const char FeatureCounterPageCacheFailureMainDocumentErrorKey[] = "com.apple.WebKit.pageCache.failure.mainDocumentError";
+static const char FeatureCounterPageCacheFailureIsErrorPageKey[] = "com.apple.WebKit.pageCache.failure.isErrorPage";
+static const char FeatureCounterPageCacheFailureHasPlugins[] = "com.apple.WebKit.pageCache.failure.hasPlugins";
+static const char FeatureCounterPageCacheFailureHTTPSNoCacheKey[] = "com.apple.WebKit.pageCache.failure.httpsNoCache";
+static const char FeatureCounterPageCacheFailureHTTPSNoStoreKey[] = "com.apple.WebKit.pageCache.failure.httpsNoStore";
+#if ENABLE(SQL_DATABASE)
+static const char FeatureCounterPageCacheFailureHasOpenDatabasesKey[] = "com.apple.WebKit.pageCache.failure.hasOpenDatabases";
+#endif
+#if ENABLE(SHARED_WORKERS)
+static const char FeatureCounterPageCacheFailureHasSharedWorkersKey[] = "com.apple.WebKit.pageCache.failure.hasSharedWorkers";
+#endif
+static const char FeatureCounterPageCacheFailureNoCurrentHistoryItemKey[] = "com.apple.WebKit.pageCache.failure.noCurrentHistoryItem";
+static const char FeatureCounterPageCacheFailureQuirkRedirectComingKey[] = "com.apple.WebKit.pageCache.failure.quirkRedirectComing";
+static const char FeatureCounterPageCacheFailureLoadingAPISenseKey[] = "com.apple.WebKit.pageCache.failure.loadingAPISense";
+static const char FeatureCounterPageCacheFailureDocumentLoaderStoppingKey[] = "com.apple.WebKit.pageCache.failure.documentLoaderStopping";
+static const char FeatureCounterPageCacheFailureCannotSuspendActiveDOMObjectsKey[] = "com.apple.WebKit.pageCache.failure.cannotSuspendActiveDOMObjects";
+static const char FeatureCounterPageCacheFailureApplicationCacheKey[] = "com.apple.WebKit.pageCache.failure.applicationCache";
+static const char FeatureCounterPageCacheFailureDeniedByClientKey[] = "com.apple.WebKit.pageCache.failure.deniedByClient";
+#if ENABLE(DEVICE_ORIENTATION)
+static const char FeatureCounterPageCacheFailureDeviceMotionKey[] = "com.apple.WebKit.pageCache.failure.deviceMotion";
+static const char FeatureCounterPageCacheFailureDeviceOrientationKey[] = "com.apple.WebKit.pageCache.failure.deviceOrientation";
+#endif
+#if ENABLE(PROXIMITY_EVENTS)
+static const char FeatureCounterPageCacheFailureDeviceProximityKey[] = "com.apple.WebKit.pageCache.failure.deviceProximity";
+#endif
+static const char FeatureCounterPageCacheFailureReloadKey[] = "com.apple.WebKit.pageCache.failure.reload";
+static const char FeatureCounterPageCacheFailureReloadFromOriginKey[] = "com.apple.WebKit.pageCache.failure.reloadFromOrigin";
+static const char FeatureCounterPageCacheFailureSameLoadKey[] = "com.apple.WebKit.pageCache.failure.sameLoad";
+static const char FeatureCounterPageCacheFailureKey[] = "com.apple.WebKit.pageCache.failure";
+static const char FeatureCounterPageCacheSuccessKey[] = "com.apple.WebKit.pageCache.success";
+
+} // namespace WebCore
+
+#endif // FeatureCounterKeys_h
+
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to