Title: [201946] trunk/Source/WebCore
Revision
201946
Author
[email protected]
Date
2016-06-10 15:26:34 -0700 (Fri, 10 Jun 2016)

Log Message

handleDataURL is only used by curl
https://bugs.webkit.org/show_bug.cgi?id=158636

Reviewed by Tim Horton.

* CMakeLists.txt:
* platform/network/DataURL.cpp: Removed.
* platform/network/DataURL.h: Removed.
* platform/network/curl/ResourceHandleManager.cpp:
(WebCore::ResourceHandleManager::startScheduledJobs):
(WebCore::handleDataURL):
(WebCore::ResourceHandleManager::dispatchSynchronousJob):

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (201945 => 201946)


--- trunk/Source/WebCore/CMakeLists.txt	2016-06-10 22:18:04 UTC (rev 201945)
+++ trunk/Source/WebCore/CMakeLists.txt	2016-06-10 22:26:34 UTC (rev 201946)
@@ -2331,7 +2331,6 @@
     platform/network/CredentialBase.cpp
     platform/network/CredentialStorage.cpp
     platform/network/DNSResolveQueue.cpp
-    platform/network/DataURL.cpp
     platform/network/DataURLDecoder.cpp
     platform/network/FormData.cpp
     platform/network/FormDataBuilder.cpp

Modified: trunk/Source/WebCore/ChangeLog (201945 => 201946)


--- trunk/Source/WebCore/ChangeLog	2016-06-10 22:18:04 UTC (rev 201945)
+++ trunk/Source/WebCore/ChangeLog	2016-06-10 22:26:34 UTC (rev 201946)
@@ -1,5 +1,20 @@
 2016-06-10  Alex Christensen  <[email protected]>
 
+        handleDataURL is only used by curl
+        https://bugs.webkit.org/show_bug.cgi?id=158636
+
+        Reviewed by Tim Horton.
+
+        * CMakeLists.txt:
+        * platform/network/DataURL.cpp: Removed.
+        * platform/network/DataURL.h: Removed.
+        * platform/network/curl/ResourceHandleManager.cpp:
+        (WebCore::ResourceHandleManager::startScheduledJobs):
+        (WebCore::handleDataURL):
+        (WebCore::ResourceHandleManager::dispatchSynchronousJob):
+
+2016-06-10  Alex Christensen  <[email protected]>
+
         Reduce ResourceResponse copying
         https://bugs.webkit.org/show_bug.cgi?id=158232
 

Deleted: trunk/Source/WebCore/platform/network/DataURL.cpp (201945 => 201946)


--- trunk/Source/WebCore/platform/network/DataURL.cpp	2016-06-10 22:18:04 UTC (rev 201945)
+++ trunk/Source/WebCore/platform/network/DataURL.cpp	2016-06-10 22:26:34 UTC (rev 201946)
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2007 Alp Toker <[email protected]>
- * Copyright (C) 2010 Patrick Gansterer <[email protected]>
- *
- * 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 INC. OR
- * 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 "DataURL.h"
-
-#include "HTTPParsers.h"
-#include "ResourceHandle.h"
-#include "ResourceHandleClient.h"
-#include "ResourceRequest.h"
-#include "ResourceResponse.h"
-#include "TextEncoding.h"
-#include <wtf/text/Base64.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/StringView.h>
-
-namespace WebCore {
-
-void handleDataURL(ResourceHandle* handle)
-{
-    ASSERT(handle->firstRequest().url().protocolIsData());
-    String url = ""
-
-    ASSERT(handle);
-    ASSERT(handle->client());
-
-    int index = url.find(',');
-    if (index == -1) {
-        handle->client()->cannotShowURL(handle);
-        return;
-    }
-
-    String mediaType = url.substring(5, index - 5);
-    String data = "" + 1);
-
-    bool base64 = mediaType.endsWith(";base64", false);
-    if (base64)
-        mediaType = mediaType.left(mediaType.length() - 7);
-
-    if (mediaType.isEmpty())
-        mediaType = "text/plain";
-
-    String mimeType = extractMIMETypeFromMediaType(mediaType);
-    String charset = extractCharsetFromMediaType(mediaType);
-
-    if (charset.isEmpty())
-        charset = "US-ASCII";
-
-    ResourceResponse response;
-    response.setMimeType(mimeType);
-    response.setTextEncodingName(charset);
-    response.setURL(handle->firstRequest().url());
-
-    if (base64) {
-        data = ""
-        handle->client()->didReceiveResponse(handle, WTFMove(response));
-
-        // didReceiveResponse might cause the client to be deleted.
-        if (handle->client()) {
-            Vector<char> out;
-            if (base64Decode(data, out, Base64IgnoreSpacesAndNewLines) && out.size() > 0)
-                handle->client()->didReceiveData(handle, out.data(), out.size(), 0);
-        }
-    } else {
-        TextEncoding encoding(charset);
-        data = "" encoding);
-        handle->client()->didReceiveResponse(handle, WTFMove(response));
-
-        // didReceiveResponse might cause the client to be deleted.
-        if (handle->client()) {
-            CString encodedData = encoding.encode(data, URLEncodedEntitiesForUnencodables);
-            if (encodedData.length())
-                handle->client()->didReceiveData(handle, encodedData.data(), encodedData.length(), 0);
-        }
-    }
-
-    if (handle->client())
-        handle->client()->didFinishLoading(handle, 0);
-}
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/platform/network/DataURL.h (201945 => 201946)


--- trunk/Source/WebCore/platform/network/DataURL.h	2016-06-10 22:18:04 UTC (rev 201945)
+++ trunk/Source/WebCore/platform/network/DataURL.h	2016-06-10 22:26:34 UTC (rev 201946)
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2010 Patrick Gansterer <[email protected]>
- *
- * 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 INC. OR
- * 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 DataURL_h
-#define DataURL_h
-
-namespace WebCore {
-
-class ResourceHandle;
-
-void handleDataURL(ResourceHandle*);
-
-}
-
-#endif // DataURL_h

Modified: trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp (201945 => 201946)


--- trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp	2016-06-10 22:18:04 UTC (rev 201945)
+++ trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp	2016-06-10 22:26:34 UTC (rev 201946)
@@ -7,6 +7,7 @@
  * Copyright (C) 2008 Nuanti Ltd.
  * Copyright (C) 2009 Appcelerator Inc.
  * Copyright (C) 2009 Brent Fulgham <[email protected]>
+ * Copyright (C) 2010 Patrick Gansterer <[email protected]>
  * Copyright (C) 2013 Peter Gal <[email protected]>, University of Szeged
  * Copyright (C) 2013 Alex Christensen <[email protected]>
  * Copyright (C) 2013 University of Szeged
@@ -48,8 +49,15 @@
 #include "MultipartHandle.h"
 #include "ResourceError.h"
 #include "ResourceHandle.h"
+#include "ResourceHandleClient.h"
 #include "ResourceHandleInternal.h"
+#include "ResourceRequest.h"
+#include "ResourceResponse.h"
 #include "SSLHandle.h"
+#include "TextEncoding.h"
+#include <wtf/text/Base64.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/StringView.h>
 
 #if OS(WINDOWS)
 #include "WebCoreBundleWin.h"
@@ -73,7 +81,6 @@
 #include <wtf/Vector.h>
 #include <wtf/text/CString.h>
 
-
 namespace WebCore {
 
 const int selectTimeoutMS = 5;
@@ -906,6 +913,68 @@
     return started;
 }
 
+static void handleDataURL(ResourceHandle* handle)
+{
+    ASSERT(handle->firstRequest().url().protocolIsData());
+    String url = ""
+
+    ASSERT(handle);
+    ASSERT(handle->client());
+
+    int index = url.find(',');
+    if (index == -1) {
+        handle->client()->cannotShowURL(handle);
+        return;
+    }
+
+    String mediaType = url.substring(5, index - 5);
+    String data = "" + 1);
+
+    bool base64 = mediaType.endsWith(";base64", false);
+    if (base64)
+        mediaType = mediaType.left(mediaType.length() - 7);
+
+    if (mediaType.isEmpty())
+        mediaType = "text/plain";
+
+    String mimeType = extractMIMETypeFromMediaType(mediaType);
+    String charset = extractCharsetFromMediaType(mediaType);
+
+    if (charset.isEmpty())
+        charset = "US-ASCII";
+
+    ResourceResponse response;
+    response.setMimeType(mimeType);
+    response.setTextEncodingName(charset);
+    response.setURL(handle->firstRequest().url());
+
+    if (base64) {
+        data = ""
+        handle->client()->didReceiveResponse(handle, WTFMove(response));
+
+        // didReceiveResponse might cause the client to be deleted.
+        if (handle->client()) {
+            Vector<char> out;
+            if (base64Decode(data, out, Base64IgnoreSpacesAndNewLines) && out.size() > 0)
+                handle->client()->didReceiveData(handle, out.data(), out.size(), 0);
+        }
+    } else {
+        TextEncoding encoding(charset);
+        data = "" encoding);
+        handle->client()->didReceiveResponse(handle, WTFMove(response));
+
+        // didReceiveResponse might cause the client to be deleted.
+        if (handle->client()) {
+            CString encodedData = encoding.encode(data, URLEncodedEntitiesForUnencodables);
+            if (encodedData.length())
+                handle->client()->didReceiveData(handle, encodedData.data(), encodedData.length(), 0);
+        }
+    }
+
+    if (handle->client())
+        handle->client()->didFinishLoading(handle, 0);
+}
+
 void ResourceHandleManager::dispatchSynchronousJob(ResourceHandle* job)
 {
     URL kurl = job->firstRequest().url();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to