No need to lazily initialize ResourceResponse internals when accessing timing data.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Jun 2014 21:51:00 +0000 (21:51 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Jun 2014 21:51:00 +0000 (21:51 +0000)
<https://webkit.org/b/134437>
<rdar://problem/17499876>

When building with ENABLE(WEB_TIMING), the last thing that would happen when
serializing a ResourceResponse in the network process is that we'd retrieve
the ResourceLoadTiming to encode it as part of the response. Doing so would
trigger the lazy instantiation of ResourceResponse's internal data structures.

Since timing data is not actually lazily instantiated, we can just not do that.

This shaves off ~550ms of network process main thread time on PLT, reducing
response latency by not doing unnecessary stuff before letting the web process
look at the downloaded data.

Reviewed by Gavin Barraclough.

* WebCore.exp.in:
* platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::adopt):
(WebCore::ResourceResponseBase::resourceLoadTiming): Deleted.
(WebCore::ResourceResponseBase::setResourceLoadTiming): Deleted.
* platform/network/ResourceResponseBase.h:
(WebCore::ResourceResponseBase::resourceLoadTiming):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170575 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/platform/network/ResourceResponseBase.cpp
Source/WebCore/platform/network/ResourceResponseBase.h

index 1a5450d..4b44a74 100644 (file)
@@ -1,3 +1,30 @@
+2014-06-29  Andreas Kling  <akling@apple.com>
+
+        No need to lazily initialize ResourceResponse internals when accessing timing data.
+        <https://webkit.org/b/134437>
+        <rdar://problem/17499876>
+
+        When building with ENABLE(WEB_TIMING), the last thing that would happen when
+        serializing a ResourceResponse in the network process is that we'd retrieve
+        the ResourceLoadTiming to encode it as part of the response. Doing so would
+        trigger the lazy instantiation of ResourceResponse's internal data structures.
+
+        Since timing data is not actually lazily instantiated, we can just not do that.
+
+        This shaves off ~550ms of network process main thread time on PLT, reducing
+        response latency by not doing unnecessary stuff before letting the web process
+        look at the downloaded data.
+
+        Reviewed by Gavin Barraclough.
+
+        * WebCore.exp.in:
+        * platform/network/ResourceResponseBase.cpp:
+        (WebCore::ResourceResponseBase::adopt):
+        (WebCore::ResourceResponseBase::resourceLoadTiming): Deleted.
+        (WebCore::ResourceResponseBase::setResourceLoadTiming): Deleted.
+        * platform/network/ResourceResponseBase.h:
+        (WebCore::ResourceResponseBase::resourceLoadTiming):
+
 2014-06-29  Pratik Solanki  <pratik.solanki@gmail.com>
 
         Refactor ResourceRequest into Cocoa and iOS specific files
index 0df5ad9..c3d5b99 100644 (file)
@@ -3445,7 +3445,3 @@ __ZN7WebCore9PageGroup18captionPreferencesEv
 #if ENABLE(VIEW_MODE_CSS_MEDIA)
 __ZN7WebCore4Page11setViewModeENS0_8ViewModeE
 #endif
-
-#if ENABLE(WEB_TIMING)
-__ZNK7WebCore20ResourceResponseBase18resourceLoadTimingEv
-#endif
index a0f7169..01ee53b 100644 (file)
@@ -108,7 +108,7 @@ PassOwnPtr<ResourceResponse> ResourceResponseBase::adopt(PassOwnPtr<CrossThreadR
 
     response->lazyInit(CommonAndUncommonFields);
     response->m_httpHeaderFields.adopt(std::move(data->m_httpHeaders));
-    response->setResourceLoadTiming(data->m_resourceLoadTiming);
+    response->m_resourceLoadTiming = data->m_resourceLoadTiming;
     response->doPlatformAdopt(data);
     return response.release();
 }
@@ -559,20 +559,6 @@ void ResourceResponseBase::setConnectionID(unsigned connectionID)
     m_connectionID = connectionID;
 }
 
-ResourceLoadTiming& ResourceResponseBase::resourceLoadTiming() const
-{
-    lazyInit(CommonAndUncommonFields);
-
-    return m_resourceLoadTiming;
-}
-
-void ResourceResponseBase::setResourceLoadTiming(const ResourceLoadTiming& resourceLoadTiming)
-{
-    lazyInit(CommonAndUncommonFields);
-
-    m_resourceLoadTiming = resourceLoadTiming;
-}
-
 void ResourceResponseBase::lazyInit(InitLevel initLevel) const
 {
     const_cast<ResourceResponse*>(static_cast<const ResourceResponse*>(this))->platformLazyInit(initLevel);
index f71133b..d124849 100644 (file)
@@ -117,8 +117,7 @@ public:
     bool wasCached() const;
     void setWasCached(bool);
 
-    ResourceLoadTiming& resourceLoadTiming() const;
-    void setResourceLoadTiming(const ResourceLoadTiming&);
+    ResourceLoadTiming& resourceLoadTiming() const { return m_resourceLoadTiming; }
 
     // The ResourceResponse subclass may "shadow" this method to provide platform-specific memory usage information
     unsigned memoryUsage() const