2009-03-06 Jay Campan <jcampan@google.com>
authordarin@chromium.org <darin@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Mar 2009 21:32:32 +0000 (21:32 +0000)
committerdarin@chromium.org <darin@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Mar 2009 21:32:32 +0000 (21:32 +0000)
        Reviewed by Darin Fisher.

        https://bugs.webkit.org/show_bug.cgi?id=24306

        Adding a flag to ResourceRequestBase to indicate whether or not upload
        progress notifications are needed for a resource. This is useful to
        avoid sending these notifications when there are no consumers
        (especially in the Chromium case where IPC is involved).

        * platform/network/ResourceRequestBase.h:
        (WebCore::ResourceRequestBase::reportUploadProgress):
        (WebCore::ResourceRequestBase::setReportUploadProgress):
        (WebCore::ResourceRequestBase::ResourceRequestBase):
        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::loadRequestAsynchronously):

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

WebCore/ChangeLog
WebCore/platform/network/ResourceRequestBase.h
WebCore/xml/XMLHttpRequest.cpp

index 6ad3777..00faffd 100644 (file)
@@ -1,3 +1,21 @@
+2009-03-06  Jay Campan  <jcampan@google.com>
+
+        Reviewed by Darin Fisher.
+
+        https://bugs.webkit.org/show_bug.cgi?id=24306
+
+        Adding a flag to ResourceRequestBase to indicate whether or not upload
+        progress notifications are needed for a resource. This is useful to
+        avoid sending these notifications when there are no consumers
+        (especially in the Chromium case where IPC is involved). 
+
+        * platform/network/ResourceRequestBase.h:
+        (WebCore::ResourceRequestBase::reportUploadProgress):
+        (WebCore::ResourceRequestBase::setReportUploadProgress):
+        (WebCore::ResourceRequestBase::ResourceRequestBase):
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::loadRequestAsynchronously):
+
 2009-03-06  Dmitry Titov  <dimich@chromium.org>
 
         Reviewed by Alexey Proskuryakov.
 2009-03-06  Dmitry Titov  <dimich@chromium.org>
 
         Reviewed by Alexey Proskuryakov.
index aa8e75d..4fd57e1 100644 (file)
@@ -107,12 +107,18 @@ namespace WebCore {
         void setAllowHTTPCookies(bool allowHTTPCookies);
 
         bool isConditional() const;
         void setAllowHTTPCookies(bool allowHTTPCookies);
 
         bool isConditional() const;
-        
+
+        // Whether the associated ResourceHandleClient needs to be notified of
+        // upload progress made for that resource.
+        bool reportUploadProgress() const { return m_reportUploadProgress; }
+        void setReportUploadProgress(bool reportUploadProgress) { m_reportUploadProgress = reportUploadProgress; }
+
     protected:
         // Used when ResourceRequest is initialized from a platform representation of the request
         ResourceRequestBase()
             : m_resourceRequestUpdated(false)
             , m_platformRequestUpdated(true)
     protected:
         // Used when ResourceRequest is initialized from a platform representation of the request
         ResourceRequestBase()
             : m_resourceRequestUpdated(false)
             , m_platformRequestUpdated(true)
+            , m_reportUploadProgress(false)
         {
         }
 
         {
         }
 
@@ -124,6 +130,7 @@ namespace WebCore {
             , m_allowHTTPCookies(true)
             , m_resourceRequestUpdated(true)
             , m_platformRequestUpdated(false)
             , m_allowHTTPCookies(true)
             , m_resourceRequestUpdated(true)
             , m_platformRequestUpdated(false)
+            , m_reportUploadProgress(false)
         {
         }
 
         {
         }
 
@@ -142,6 +149,7 @@ namespace WebCore {
         bool m_allowHTTPCookies;
         mutable bool m_resourceRequestUpdated;
         mutable bool m_platformRequestUpdated;
         bool m_allowHTTPCookies;
         mutable bool m_resourceRequestUpdated;
         mutable bool m_platformRequestUpdated;
+        bool m_reportUploadProgress;
 
     private:
         const ResourceRequest& asResourceRequest() const;
 
     private:
         const ResourceRequest& asResourceRequest() const;
index 28adf3f..75ed2ab 100644 (file)
@@ -830,6 +830,10 @@ void XMLHttpRequest::loadRequestAsynchronously(ResourceRequest& request)
     // for local files otherwise, <rdar://problem/5671813>.
     LoadCallbacks callbacks = m_inPreflight ? DoNotSendLoadCallbacks : SendLoadCallbacks;
     ContentSniff contentSniff = request.url().isLocalFile() ? SniffContent : DoNotSniffContent;
     // for local files otherwise, <rdar://problem/5671813>.
     LoadCallbacks callbacks = m_inPreflight ? DoNotSendLoadCallbacks : SendLoadCallbacks;
     ContentSniff contentSniff = request.url().isLocalFile() ? SniffContent : DoNotSniffContent;
+
+    if (m_upload)
+        request.setReportUploadProgress(true);
+
     m_loader = ThreadableLoader::create(scriptExecutionContext(), this, request, callbacks, contentSniff);
 
     if (m_loader) {
     m_loader = ThreadableLoader::create(scriptExecutionContext(), this, request, callbacks, contentSniff);
 
     if (m_loader) {