Changeset 230338 in webkit
- Timestamp:
- Apr 6, 2018 10:45:57 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r230334 r230338 1 2018-04-06 Daniel Bates <dabates@apple.com> 2 3 Have class Exception take String by value instead of a String&& 4 https://bugs.webkit.org/show_bug.cgi?id=184360 5 6 Reviewed by Alexey Proskuryakov. 7 8 For convenience support instantiating an Exception with either an lvalue String or 9 rvalue String. 10 11 Although it can be argued that having Exception take a String by value instead of String&& 12 can lead to missed opportunities to WTFMove() a String object into Exception such mistakes 13 are just that, missed opportunities. That is, correctness is not affected and we may perform 14 an unnecessary ref/deref of the underlying StringImpl when instantiating an Exception. If 15 such missed opportunities show up in profiles and such mistakes happen often then we can 16 re-evaluate the decision to have Exception take a String by value. 17 18 * Modules/cache/DOMCache.cpp: 19 (WebCore::DOMCache::put): Simplify code now that Exception takes a String by value. 20 * Modules/fetch/FetchResponse.cpp: 21 (WebCore::FetchResponse::BodyLoader::didFail): Ditto. 22 * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: 23 (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed): Move String into Exception to avoid an 24 unnecessary ref/de-ref. 25 (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed): Ditto. 26 (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed): Ditto. 27 * dom/Exception.h: 28 (WebCore::Exception::Exception): Take String by value. Also use uniform initializer syntax. 29 1 30 2018-04-06 Antti Koivisto <antti@apple.com> 2 31 -
trunk/Source/WebCore/Modules/cache/DOMCache.cpp
r228326 r230338 322 322 323 323 if (response->loadingError()) { 324 promise.reject(Exception { TypeError, String { response->loadingError()->localizedDescription() }});324 promise.reject(Exception { TypeError, response->loadingError()->localizedDescription() }); 325 325 return; 326 326 } -
trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp
r228199 r230338 242 242 243 243 if (auto responseCallback = WTFMove(m_responseCallback)) 244 responseCallback(Exception { TypeError, String(error.localizedDescription()) });244 responseCallback(Exception { TypeError, error.localizedDescription() }); 245 245 246 246 if (auto consumeDataCallback = WTFMove(m_consumeDataCallback)) 247 consumeDataCallback(Exception { TypeError, String(error.localizedDescription()) });247 consumeDataCallback(Exception { TypeError, error.localizedDescription() }); 248 248 249 249 #if ENABLE(STREAMS_API) -
trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp
r230152 r230338 915 915 return; 916 916 if (protectedThis->m_isInitiator) 917 protectedThis->m_peerConnectionBackend.createOfferFailed(Exception { OperationError, String(error) });917 protectedThis->m_peerConnectionBackend.createOfferFailed(Exception { OperationError, WTFMove(error) }); 918 918 else 919 protectedThis->m_peerConnectionBackend.createAnswerFailed(Exception { OperationError, String(error) });919 protectedThis->m_peerConnectionBackend.createAnswerFailed(Exception { OperationError, WTFMove(error) }); 920 920 }); 921 921 } … … 936 936 if (protectedThis->isStopped()) 937 937 return; 938 protectedThis->m_peerConnectionBackend.setLocalDescriptionFailed(Exception { OperationError, String(error) });938 protectedThis->m_peerConnectionBackend.setLocalDescriptionFailed(Exception { OperationError, WTFMove(error) }); 939 939 }); 940 940 } … … 955 955 if (protectedThis->isStopped()) 956 956 return; 957 protectedThis->m_peerConnectionBackend.setRemoteDescriptionFailed(Exception { OperationError, String(error) });957 protectedThis->m_peerConnectionBackend.setRemoteDescriptionFailed(Exception { OperationError, WTFMove(error) }); 958 958 }); 959 959 } -
trunk/Source/WebCore/dom/Exception.h
r221414 r230338 34 34 class Exception { 35 35 public: 36 explicit Exception(ExceptionCode, String &&= { });36 explicit Exception(ExceptionCode, String = { }); 37 37 38 38 ExceptionCode code() const { return m_code; } … … 52 52 Exception isolatedCopy(Exception&&); 53 53 54 inline Exception::Exception(ExceptionCode code, String &&message)55 : m_code (code)56 , m_message (WTFMove(message))54 inline Exception::Exception(ExceptionCode code, String message) 55 : m_code { code } 56 , m_message { WTFMove(message) } 57 57 { 58 58 }
Note: See TracChangeset
for help on using the changeset viewer.