Title: [112162] trunk/Source/WebCore
Revision
112162
Author
[email protected]
Date
2012-03-26 15:51:32 -0700 (Mon, 26 Mar 2012)

Log Message

        Remove obsolete FormDataStreamMac code
        https://bugs.webkit.org/show_bug.cgi?id=82244

        Reviewed by Brady Eidson.

        * platform/network/ResourceHandle.h:
        Removed ResourceHandle::didSendBodyDataDelegateExists().

        * platform/network/mac/FormDataStreamMac.h:
        * platform/network/mac/FormDataStreamMac.mm:
        Removed code that was needed to call ResourceLoaderClient::didSendData() before Foundation
        added support for it.

        * platform/network/mac/ResourceHandleMac.mm:
        (WebCore::ResourceHandle::start):
        (WebCore::ResourceHandle::cancel):
        (-[WebCoreResourceHandleAsDelegate connection:willSendRequest:redirectResponse:]):
        (-[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:]):
        (-[WebCoreResourceHandleAsDelegate connection:didFailWithError:]):
        We no longer need to associate streams with ResourceHandles!

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (112161 => 112162)


--- trunk/Source/WebCore/ChangeLog	2012-03-26 22:49:27 UTC (rev 112161)
+++ trunk/Source/WebCore/ChangeLog	2012-03-26 22:51:32 UTC (rev 112162)
@@ -1,3 +1,26 @@
+2012-03-26  Alexey Proskuryakov  <[email protected]>
+
+        Remove obsolete FormDataStreamMac code
+        https://bugs.webkit.org/show_bug.cgi?id=82244
+
+        Reviewed by Brady Eidson.
+
+        * platform/network/ResourceHandle.h:
+        Removed ResourceHandle::didSendBodyDataDelegateExists().
+
+        * platform/network/mac/FormDataStreamMac.h:
+        * platform/network/mac/FormDataStreamMac.mm:
+        Removed code that was needed to call ResourceLoaderClient::didSendData() before Foundation
+        added support for it.
+
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::start):
+        (WebCore::ResourceHandle::cancel):
+        (-[WebCoreResourceHandleAsDelegate connection:willSendRequest:redirectResponse:]):
+        (-[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:]):
+        (-[WebCoreResourceHandleAsDelegate connection:didFailWithError:]):
+        We no longer need to associate streams with ResourceHandles!
+
 2012-03-26  Adam Klein  <[email protected]>
 
         V8RecursionScope should not hold a raw pointer to ScriptExecutionContext

Modified: trunk/Source/WebCore/platform/network/ResourceHandle.h (112161 => 112162)


--- trunk/Source/WebCore/platform/network/ResourceHandle.h	2012-03-26 22:49:27 UTC (rev 112161)
+++ trunk/Source/WebCore/platform/network/ResourceHandle.h	2012-03-26 22:51:32 UTC (rev 112162)
@@ -106,9 +106,6 @@
 
     static bool willLoadFromCache(ResourceRequest&, Frame*);
     static void cacheMetadata(const ResourceResponse&, const Vector<char>&);
-#if PLATFORM(MAC)
-    static bool didSendBodyDataDelegateExists();
-#endif
 
     virtual ~ResourceHandle();
 

Modified: trunk/Source/WebCore/platform/network/mac/FormDataStreamMac.h (112161 => 112162)


--- trunk/Source/WebCore/platform/network/mac/FormDataStreamMac.h	2012-03-26 22:49:27 UTC (rev 112161)
+++ trunk/Source/WebCore/platform/network/mac/FormDataStreamMac.h	2012-03-26 22:51:32 UTC (rev 112162)
@@ -38,14 +38,10 @@
 namespace WebCore {
 
     class FormData;
-    class ResourceHandle;
 
     void setHTTPBody(NSMutableURLRequest *, PassRefPtr<FormData>);
     FormData* httpBodyFromStream(NSInputStream *);
 
-    void associateStreamWithResourceHandle(NSInputStream *, ResourceHandle*);
-    void disassociateStreamWithResourceHandle(NSInputStream *);
-
 } // namespace WebCore
 
 #endif // !USE(CFNETWORK)

Modified: trunk/Source/WebCore/platform/network/mac/FormDataStreamMac.mm (112161 => 112162)


--- trunk/Source/WebCore/platform/network/mac/FormDataStreamMac.mm	2012-03-26 22:49:27 UTC (rev 112161)
+++ trunk/Source/WebCore/platform/network/mac/FormDataStreamMac.mm	2012-03-26 22:51:32 UTC (rev 112162)
@@ -26,8 +26,6 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-/* originally written by Becky Willrich, additional code by Darin Adler */
-
 #import "config.h"
 #import "FormDataStreamMac.h"
 
@@ -36,14 +34,11 @@
 #import "BlobRegistryImpl.h"
 #import "FileSystem.h"
 #import "FormData.h"
-#import "ResourceHandle.h"
-#import "ResourceHandleClient.h"
 #import "SchedulePair.h"
 #import "WebCoreSystemInterface.h"
 #import <sys/stat.h>
 #import <sys/types.h>
 #import <wtf/Assertions.h>
-#import <wtf/HashMap.h>
 #import <wtf/MainThread.h>
 #import <wtf/StdLibExtras.h>
 #import <wtf/Threading.h>
@@ -68,68 +63,6 @@
     return streamFieldsMap;
 }
 
-typedef HashMap<CFReadStreamRef, RefPtr<ResourceHandle> > StreamResourceHandleMap;
-static StreamResourceHandleMap& getStreamResourceHandleMap()
-{
-    DEFINE_STATIC_LOCAL(StreamResourceHandleMap, streamResourceHandleMap, ());
-    return streamResourceHandleMap;
-}
-
-void associateStreamWithResourceHandle(NSInputStream *stream, ResourceHandle* resourceHandle)
-{
-    ASSERT(isMainThread());
-
-    ASSERT(resourceHandle);
-
-    if (!stream)
-        return;
-
-    {
-        MutexLocker locker(streamFieldsMapMutex());
-        if (!NSMapGet(streamFieldsMap(), stream))
-            return;
-    }
-
-    ASSERT(!getStreamResourceHandleMap().contains((CFReadStreamRef)stream));
-    getStreamResourceHandleMap().set((CFReadStreamRef)stream, resourceHandle);
-}
-
-void disassociateStreamWithResourceHandle(NSInputStream *stream)
-{
-    ASSERT(isMainThread());
-
-    if (!stream)
-        return;
-
-    getStreamResourceHandleMap().remove((CFReadStreamRef)stream);
-}
-
-struct DidSendDataCallbackData {
-    DidSendDataCallbackData(CFReadStreamRef stream_, unsigned long long bytesSent_, unsigned long long streamLength_)
-        : stream(stream_)
-        , bytesSent(bytesSent_)
-        , streamLength(streamLength_)
-    {
-    }
-
-    CFReadStreamRef stream;
-    unsigned long long bytesSent;
-    unsigned long long streamLength;
-};
-
-static void performDidSendDataCallback(void* context)
-{
-    ASSERT(isMainThread());
-
-    DidSendDataCallbackData* data = ""
-    ResourceHandle* resourceHandle = getStreamResourceHandleMap().get(data->stream).get();
-
-    if (resourceHandle && resourceHandle->client())
-        resourceHandle->client()->didSendData(resourceHandle, data->bytesSent, data->streamLength);
-
-    delete data;
-}
-
 static void formEventCallback(CFReadStreamRef stream, CFStreamEventType type, void* context);
 
 struct FormContext {
@@ -298,7 +231,7 @@
     return opened;
 }
 
-static CFIndex formRead(CFReadStreamRef stream, UInt8* buffer, CFIndex bufferLength, CFStreamError* error, Boolean* atEOF, void* context)
+static CFIndex formRead(CFReadStreamRef, UInt8* buffer, CFIndex bufferLength, CFStreamError* error, Boolean* atEOF, void* context)
 {
     FormStreamFields* form = static_cast<FormStreamFields*>(context);
 
@@ -322,12 +255,6 @@
                 form->currentStreamRangeLength -= bytesRead;
 #endif
 
-            if (!ResourceHandle::didSendBodyDataDelegateExists()) {
-                // FIXME: Figure out how to only do this when a ResourceHandleClient is available.
-                DidSendDataCallbackData* data = "" DidSendDataCallbackData(stream, form->bytesSent, form->streamLength);
-                callOnMainThread(performDidSendDataCallback, data);
-            }
-
             return bytesRead;
         }
         openNextStream(form);

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


--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2012-03-26 22:49:27 UTC (rev 112161)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2012-03-26 22:51:32 UTC (rev 112162)
@@ -147,12 +147,6 @@
     LOG(Network, "Handle %p destroyed", this);
 }
 
-static const double MaxFoundationVersionWithoutdidSendBodyDataDelegate = 677.21;
-bool ResourceHandle::didSendBodyDataDelegateExists()
-{
-    return NSFoundationVersionNumber > MaxFoundationVersionWithoutdidSendBodyDataDelegate;
-}
-
 static bool shouldRelaxThirdPartyCookiePolicy(const KURL& url)
 {
     // If a URL already has cookies, then we'll relax the 3rd party cookie policy and accept new cookies.
@@ -266,10 +260,6 @@
 
     bool shouldUseCredentialStorage = !client() || client()->shouldUseCredentialStorage(this);
 
-    if (!ResourceHandle::didSendBodyDataDelegateExists())
-        associateStreamWithResourceHandle([firstRequest().nsURLRequest() HTTPBodyStream], this);
-
-
     d->m_needsSiteSpecificQuirks = context->needsSiteSpecificQuirks();
 
     createNSURLConnection(
@@ -321,8 +311,6 @@
     if (d->m_currentMacChallenge)
         [[d->m_currentMacChallenge sender] cancelAuthenticationChallenge:d->m_currentMacChallenge];
 
-    if (!ResourceHandle::didSendBodyDataDelegateExists())
-        disassociateStreamWithResourceHandle([firstRequest().nsURLRequest() HTTPBodyStream]);
     [d->m_connection.get() cancel];
 }
 
@@ -723,17 +711,6 @@
 
     m_handle->willSendRequest(request, redirectResponse);
 
-    if (!ResourceHandle::didSendBodyDataDelegateExists()) {
-        // The client may change the request's body stream, in which case we have to re-associate
-        // the handle with the new stream so upload progress callbacks continue to work correctly.
-        NSInputStream* oldBodyStream = [newRequest HTTPBodyStream];
-        NSInputStream* newBodyStream = [request.nsURLRequest() HTTPBodyStream];
-        if (oldBodyStream != newBodyStream) {
-            disassociateStreamWithResourceHandle(oldBodyStream);
-            associateStreamWithResourceHandle(newBodyStream, m_handle);
-        }
-    }
-
     return request.nsURLRequest();
 }
 
@@ -880,9 +857,6 @@
     if (!m_handle || !m_handle->client())
         return;
 
-    if (!ResourceHandle::didSendBodyDataDelegateExists())
-        disassociateStreamWithResourceHandle([m_handle->firstRequest().nsURLRequest() HTTPBodyStream]);
-
     m_handle->client()->didFinishLoading(m_handle, 0);
 }
 
@@ -895,9 +869,6 @@
     if (!m_handle || !m_handle->client())
         return;
 
-    if (!ResourceHandle::didSendBodyDataDelegateExists())
-        disassociateStreamWithResourceHandle([m_handle->firstRequest().nsURLRequest() HTTPBodyStream]);
-
     m_handle->client()->didFail(m_handle, error);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to