Skip to content

Commit 589918a

Browse files
committed
Use WTF::makeUnique<T>() instead of .reset(new T())
https://bugs.webkit.org/show_bug.cgi?id=302577 rdar://164798897 Reviewed by Chris Dumez. This improves exception safety and aligns with modern C++ practices. Test: Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm * Source/JavaScriptCore/dfg/DFGCSEPhase.cpp: * Source/WebCore/platform/video-codecs/cocoa/RTCVideoDecoderVTBAV1.mm: (-[RTCVideoDecoderVTBAV1 decodeData:size:timeStamp:]): * Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm: Canonical link: https://commits.webkit.org/303087@main
1 parent f6c59e7 commit 589918a

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎Source/JavaScriptCore/dfg/DFGCSEPhase.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ class ImpureMap {
233233
return add(m_fallbackStackMap, location, node);
234234
auto addResult = m_abstractHeapStackMap.add(abstractHeap.payload().value(), nullptr);
235235
if (addResult.isNewEntry) {
236-
addResult.iterator->value.reset(new ImpureDataSlot {location, node, 0});
236+
addResult.iterator->value = makeUniqueWithoutFastMallocCheck<ImpureDataSlot>(location, node, 0);
237237
return nullptr;
238238
}
239239
if (addResult.iterator->value->key == location)

‎Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -910,10 +910,10 @@ static void enableFeatureForPreferences(NSString *featureName, WKPreferences *pr
910910
ready = true;
911911
}];
912912

913-
m_server.reset(new TestWebKitAPI::HTTPServer({
913+
m_server = makeUnique<TestWebKitAPI::HTTPServer>(std::initializer_list<std::pair<String, TestWebKitAPI::HTTPResponse>> {
914914
{ "/"_s, { html } },
915915
{ "/sw.js"_s, { { { "Content-Type"_s, "application/javascript"_s } }, serviceWorkerScriptSource } }
916-
}, TestWebKitAPI::HTTPServer::Protocol::HttpsProxy));
916+
}, TestWebKitAPI::HTTPServer::Protocol::HttpsProxy);
917917

918918
auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
919919
// This step is required early to make sure the first NetworkProcess access has the correct

0 commit comments

Comments
 (0)