Title: [185264] trunk/Source
Revision
185264
Author
achristen...@apple.com
Date
2015-06-05 14:37:44 -0700 (Fri, 05 Jun 2015)

Log Message

[Web Timing] Use new SPI to enable data collection.
https://bugs.webkit.org/show_bug.cgi?id=145650
rdar://problem/21203358

Reviewed by Chris Dumez.

Source/WebCore:

* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::ResourceHandle::createCFURLConnection):
Gather web timing data on iOS.
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::createNSURLConnection):
(WebCore::ResourceHandle::setCollectsTimingData):
Gather web timing data on Mac.

Source/WTF:

* wtf/Platform.h:
Added HAVE_TIMINGDATAOPTIONS for platform and version dependent feature.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (185263 => 185264)


--- trunk/Source/WTF/ChangeLog	2015-06-05 21:36:16 UTC (rev 185263)
+++ trunk/Source/WTF/ChangeLog	2015-06-05 21:37:44 UTC (rev 185264)
@@ -1,3 +1,14 @@
+2015-06-05  Alex Christensen  <achristen...@webkit.org>
+
+        [Web Timing] Use new SPI to enable data collection.
+        https://bugs.webkit.org/show_bug.cgi?id=145650
+        rdar://problem/21203358
+
+        Reviewed by Chris Dumez.
+
+        * wtf/Platform.h:
+        Added HAVE_TIMINGDATAOPTIONS for platform and version dependent feature.
+
 2015-06-05  Xabier Rodriguez Calvar  <calva...@igalia.com> and Youenn Fablet <youenn.fab...@crf.canon.fr>
 
         [Streams API] ReadableStream should store callbacks as a Deque

Modified: trunk/Source/WTF/wtf/Platform.h (185263 => 185264)


--- trunk/Source/WTF/wtf/Platform.h	2015-06-05 21:36:16 UTC (rev 185263)
+++ trunk/Source/WTF/wtf/Platform.h	2015-06-05 21:37:44 UTC (rev 185264)
@@ -1077,6 +1077,10 @@
 #define USE_INSERTION_UNDO_GROUPING 1
 #endif
 
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000)
+#define HAVE_TIMINGDATAOPTIONS 1
+#endif
+
 #if PLATFORM(IOS)
 #define USE_PLATFORM_TEXT_TRACK_MENU 1
 #endif

Modified: trunk/Source/WebCore/ChangeLog (185263 => 185264)


--- trunk/Source/WebCore/ChangeLog	2015-06-05 21:36:16 UTC (rev 185263)
+++ trunk/Source/WebCore/ChangeLog	2015-06-05 21:37:44 UTC (rev 185264)
@@ -1,3 +1,19 @@
+2015-06-05  Alex Christensen  <achristen...@webkit.org>
+
+        [Web Timing] Use new SPI to enable data collection.
+        https://bugs.webkit.org/show_bug.cgi?id=145650
+        rdar://problem/21203358
+
+        Reviewed by Chris Dumez.
+
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::ResourceHandle::createCFURLConnection):
+        Gather web timing data on iOS.
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::createNSURLConnection):
+        (WebCore::ResourceHandle::setCollectsTimingData):
+        Gather web timing data on Mac.
+
 2015-06-05  Xabier Rodriguez Calvar  <calva...@igalia.com> and Youenn Fablet <youenn.fab...@crf.canon.fr>
 
         [Streams API] ReadableStream should store callbacks as a Deque

Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (185263 => 185264)


--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2015-06-05 21:36:16 UTC (rev 185263)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2015-06-05 21:37:44 UTC (rev 185264)
@@ -206,6 +206,13 @@
         propertiesDictionary = adoptCF(CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, clientProperties));
     else
         propertiesDictionary = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+#if HAVE(TIMINGDATAOPTIONS)
+    const int64_t TimingDataOptionsEnableW3CNavigationTiming = (1 << 0);
+    auto enableW3CNavigationTiming = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &TimingDataOptionsEnableW3CNavigationTiming));
+    auto timingDataOptionsDictionary = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+    CFDictionaryAddValue(timingDataOptionsDictionary.get(), CFSTR("_kCFURLConnectionPropertyTimingDataOptions"), enableW3CNavigationTiming.get());
+    CFDictionaryAddValue(propertiesDictionary.get(), CFSTR("kCFURLConnectionURLConnectionProperties"), timingDataOptionsDictionary.get());
+#endif
 
     // FIXME: This code is different from iOS code in ResourceHandleMac.mm in that here we ignore stream properties that were present in client properties.
     CFDictionaryAddValue(propertiesDictionary.get(), kCFURLConnectionSocketStreamProperties, streamProperties);

Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (185263 => 185264)


--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2015-06-05 21:36:16 UTC (rev 185263)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2015-06-05 21:37:44 UTC (rev 185264)
@@ -69,7 +69,9 @@
 #import <Foundation/NSURLConnectionPrivate.h>
 #else
 @interface NSURLConnection (TimingData)
+#if !HAVE(TIMINGDATAOPTIONS)
 + (void)_setCollectsTimingData:(BOOL)collect;
+#endif
 - (NSDictionary *)_timingData;
 @end
 #endif
@@ -217,9 +219,13 @@
     if (synchronousWillSendRequestEnabled())
         CFURLRequestSetShouldStartSynchronously([nsRequest _CFURLRequest], 1);
 #else
-    NSDictionary *propertyDictionary = [NSDictionary dictionaryWithObject:streamProperties forKey:@"kCFURLConnectionSocketStreamProperties"];
+    NSMutableDictionary *propertyDictionary = [NSMutableDictionary dictionaryWithObject:streamProperties forKey:@"kCFURLConnectionSocketStreamProperties"];
     const bool usesCache = true;
 #endif
+#if HAVE(TIMINGDATAOPTIONS)
+    const int64_t TimingDataOptionsEnableW3CNavigationTiming = (1 << 0);
+    [propertyDictionary setObject:@{@"_kCFURLConnectionPropertyTimingDataOptions": @(TimingDataOptionsEnableW3CNavigationTiming)} forKey:@"kCFURLConnectionURLConnectionProperties"];
+#endif
     d->m_connection = adoptNS([[NSURLConnection alloc] _initWithRequest:nsRequest delegate:delegate usesCache:usesCache maxContentLength:0 startImmediately:NO connectionProperties:propertyDictionary]);
 }
 
@@ -746,10 +752,12 @@
 
 void ResourceHandle::setCollectsTimingData()
 {
+#if !HAVE(TIMINGDATAOPTIONS)
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
         [NSURLConnection _setCollectsTimingData:YES];
     });
+#endif
 }
 
 #if USE(CFNETWORK)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to