Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Side by Side Diff: third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp

Issue 1878253003: Allow explicit conversion operators and implement WTF::OwnPtr::operator bool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org>
4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org>
5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved.
6 * Copyright (C) 2012 Intel Corporation 6 * Copyright (C) 2012 Intel Corporation
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 void XMLHttpRequest::abort() 941 void XMLHttpRequest::abort()
942 { 942 {
943 WTF_LOG(Network, "XMLHttpRequest %p abort()", this); 943 WTF_LOG(Network, "XMLHttpRequest %p abort()", this);
944 944
945 // internalAbort() clears |m_loader|. Compute |sendFlag| now. 945 // internalAbort() clears |m_loader|. Compute |sendFlag| now.
946 // 946 //
947 // |sendFlag| corresponds to "the send() flag" defined in the XHR spec. 947 // |sendFlag| corresponds to "the send() flag" defined in the XHR spec.
948 // 948 //
949 // |sendFlag| is only set when we have an active, asynchronous loader. 949 // |sendFlag| is only set when we have an active, asynchronous loader.
950 // Don't use it as "the send() flag" when the XHR is in sync mode. 950 // Don't use it as "the send() flag" when the XHR is in sync mode.
951 bool sendFlag = m_loader; 951 bool sendFlag = !!m_loader;
952 952
953 // internalAbort() clears the response. Save the data needed for 953 // internalAbort() clears the response. Save the data needed for
954 // dispatching ProgressEvents. 954 // dispatching ProgressEvents.
955 long long expectedLength = m_response.expectedContentLength(); 955 long long expectedLength = m_response.expectedContentLength();
956 long long receivedLength = m_receivedLength; 956 long long receivedLength = m_receivedLength;
957 957
958 if (!internalAbort()) 958 if (!internalAbort())
959 return; 959 return;
960 960
961 // The script never gets any chance to call abort() on a sync XHR between 961 // The script never gets any chance to call abort() on a sync XHR between
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 // 1018 //
1019 // If, window.onload contains open() and send(), m_loader will be set to 1019 // If, window.onload contains open() and send(), m_loader will be set to
1020 // non 0 value. So, we cannot continue the outer open(). In such case, 1020 // non 0 value. So, we cannot continue the outer open(). In such case,
1021 // just abort the outer open() by returning false. 1021 // just abort the outer open() by returning false.
1022 OwnPtr<ThreadableLoader> loader = m_loader.release(); 1022 OwnPtr<ThreadableLoader> loader = m_loader.release();
1023 loader->cancel(); 1023 loader->cancel();
1024 1024
1025 // If abort() called internalAbort() and a nested open() ended up 1025 // If abort() called internalAbort() and a nested open() ended up
1026 // clearing the error flag, but didn't send(), make sure the error 1026 // clearing the error flag, but didn't send(), make sure the error
1027 // flag is still set. 1027 // flag is still set.
1028 bool newLoadStarted = m_loader; 1028 bool newLoadStarted = !!m_loader;
1029 if (!newLoadStarted) 1029 if (!newLoadStarted)
1030 m_error = true; 1030 m_error = true;
1031 1031
1032 return !newLoadStarted; 1032 return !newLoadStarted;
1033 } 1033 }
1034 1034
1035 void XMLHttpRequest::clearResponse() 1035 void XMLHttpRequest::clearResponse()
1036 { 1036 {
1037 // FIXME: when we add the support for multi-part XHR, we will have to 1037 // FIXME: when we add the support for multi-part XHR, we will have to
1038 // be careful with this initialization. 1038 // be careful with this initialization.
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 visitor->trace(m_responseArrayBuffer); 1704 visitor->trace(m_responseArrayBuffer);
1705 visitor->trace(m_progressEventThrottle); 1705 visitor->trace(m_progressEventThrottle);
1706 visitor->trace(m_upload); 1706 visitor->trace(m_upload);
1707 visitor->trace(m_blobLoader); 1707 visitor->trace(m_blobLoader);
1708 XMLHttpRequestEventTarget::trace(visitor); 1708 XMLHttpRequestEventTarget::trace(visitor);
1709 DocumentParserClient::trace(visitor); 1709 DocumentParserClient::trace(visitor);
1710 ActiveDOMObject::trace(visitor); 1710 ActiveDOMObject::trace(visitor);
1711 } 1711 }
1712 1712
1713 } // namespace blink 1713 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698