[BlackBerry] Refactor : NetworkJob::handleNotifyHeaderReceived.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 31 Mar 2012 12:37:21 +0000 (12:37 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 31 Mar 2012 12:37:21 +0000 (12:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=82825

We should use "else if" to decrease string's compare.

Patch by Jason Liu <jason.liu@torchmobile.com.cn> on 2012-03-31
Reviewed by Rob Buis.

No new tests. Refactor.

* platform/network/blackberry/NetworkJob.cpp:
(WebCore::NetworkJob::handleNotifyHeaderReceived):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/network/blackberry/NetworkJob.cpp

index dbd7410..243c350 100644 (file)
@@ -1,3 +1,17 @@
+2012-03-31  Jason Liu  <jason.liu@torchmobile.com.cn>
+
+        [BlackBerry] Refactor : NetworkJob::handleNotifyHeaderReceived.
+        https://bugs.webkit.org/show_bug.cgi?id=82825
+
+        We should use "else if" to decrease string's compare.
+
+        Reviewed by Rob Buis.
+
+        No new tests. Refactor.
+
+        * platform/network/blackberry/NetworkJob.cpp:
+        (WebCore::NetworkJob::handleNotifyHeaderReceived):
+
 2012-03-31  Charles Wei  <charles.wei@torchmobile.com.cn>
 
         [BlackBerry] Upstream local change of PlatformKeyboardEventBlackBerry.cpp
index 6a189ce..34863f6 100644 (file)
@@ -294,11 +294,9 @@ void NetworkJob::handleNotifyHeaderReceived(const String& key, const String& val
     String lowerKey = key.lower();
     if (lowerKey == "content-type")
         m_contentType = value.lower();
-
-    if (lowerKey == "content-disposition")
+    else if (lowerKey == "content-disposition")
         m_contentDisposition = value;
-
-    if (lowerKey == "set-cookie") {
+    else if (lowerKey == "set-cookie") {
         // FIXME: If a tab is closed, sometimes network data will come in after the frame has been detached from its page but before it is deleted.
         // If this happens, m_frame->page() will return 0, and m_frame->loader()->client() will be in a bad state and calling into it will crash.
         // For now we check for this explicitly by checking m_frame->page(). But we should find out why the network job hasn't been cancelled when the frame was detached.
@@ -311,14 +309,11 @@ void NetworkJob::handleNotifyHeaderReceived(const String& key, const String& val
             m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value);
             return;
         }
-    }
-
-    if (lowerKey == "www-authenticate")
+    } else if (lowerKey == "www-authenticate")
         handleAuthHeader(ProtectionSpaceServerHTTP, value);
     else if (lowerKey == "proxy-authenticate" && !BlackBerry::Platform::Client::get()->getProxyAddress().empty())
         handleAuthHeader(ProtectionSpaceProxyHTTP, value);
-
-    if (equalIgnoringCase(key, BlackBerry::Platform::NetworkRequest::HEADER_BLACKBERRY_FTP))
+    else if (equalIgnoringCase(key, BlackBerry::Platform::NetworkRequest::HEADER_BLACKBERRY_FTP))
         handleFTPHeader(value);
 
     m_response.setHTTPHeaderField(key, value);