Make some constructors explicit
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Jul 2019 18:05:16 +0000 (18:05 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Jul 2019 18:05:16 +0000 (18:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=199981

Reviewed by Daniel Bates.

Make explicit public constructors of objects that take POD or String& arguments,
to reduce the changes of the compiler doing implicit conversions.

Source/WebCore:

* Modules/indexeddb/server/IndexValueEntry.h:
* Modules/indexeddb/server/IndexValueStore.h:
* Modules/indexeddb/shared/IDBDatabaseInfo.h:
* Modules/webdatabase/ChangeVersionData.h:
(WebCore::ChangeVersionData::ChangeVersionData):
* Modules/webdatabase/OriginLock.h:
* Modules/websockets/WebSocketExtensionParser.h:
(WebCore::WebSocketExtensionParser::WebSocketExtensionParser):
* bindings/js/ScriptCachedFrameData.h:
* contentextensions/URLFilterParser.cpp:
(WebCore::ContentExtensions::PatternParser::PatternParser):
* css/parser/CSSTokenizer.h:
* css/parser/SizesAttributeParser.h:
* dom/SpaceSplitString.cpp:
(WebCore::TokenIsEqualToCStringTokenProcessor::TokenIsEqualToCStringTokenProcessor):
* html/FormController.cpp:
(WebCore::SavedFormState::appendControlState):
(WebCore::SavedFormState::takeControlState):
* loader/ProgressTracker.cpp:
(WebCore::ProgressItem::ProgressItem):
* page/DragController.cpp:
(WebCore::DragController::DragController):
(WebCore::DragController::performDragOperation):
* page/DragController.h:
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::AnimationPropertyWrapperBase::AnimationPropertyWrapperBase):
* page/ios/DOMTimerHoldingTank.h:
(WebCore::DeferDOMTimersForScope::DeferDOMTimersForScope):
* platform/CountedUserActivity.h:
(WebCore::CountedUserActivity::CountedUserActivity):
* platform/audio/DirectConvolver.h:
* platform/audio/DownSampler.h:
* platform/audio/DynamicsCompressorKernel.h:
* platform/audio/EqualPowerPanner.h:
* platform/audio/MultiChannelResampler.h:
* platform/audio/ReverbAccumulationBuffer.h:
* platform/audio/ReverbInputBuffer.h:
* platform/audio/SincResampler.cpp:
* platform/audio/UpSampler.h:
* platform/audio/ios/AudioFileReaderIOS.h:
* platform/audio/mac/AudioFileReaderMac.h:
* platform/audio/mac/AudioSessionMac.cpp:
(WebCore::AudioSessionPrivate::AudioSessionPrivate):
* platform/cf/KeyedDecoderCF.h:
* platform/graphics/WidthIterator.cpp:
(WebCore::OriginalAdvancesForCharacterTreatedAsSpace::OriginalAdvancesForCharacterTreatedAsSpace):
* platform/graphics/cocoa/FontCacheCoreText.h:
(WebCore::SynthesisPair::SynthesisPair):
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::DrawingItem::DrawingItem):
* platform/network/cf/ResourceRequest.h:
(WebCore::ResourceRequest::ResourceRequest):
* platform/text/TextCodecICU.h:
* rendering/RenderTableSection.h:
(WebCore::CellSpan::CellSpan):
* rendering/shapes/RasterShape.cpp:
* rendering/shapes/RasterShape.h:
(WebCore::RasterShapeIntervals::RasterShapeIntervals):
* testing/MockLibWebRTCPeerConnection.h:
(WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate):

Source/WebCore/PAL:

* pal/system/cocoa/SleepDisablerCocoa.cpp:
(PAL::SleepDisablerCocoa::SleepDisablerCocoa):
* pal/system/cocoa/SleepDisablerCocoa.h:

Source/WebKit:

* Platform/Module.h:
* WebProcess/WebPage/WebInspector.cpp:
(WebKit::WebInspector::openInNewTab):

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

47 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/server/IndexValueEntry.h
Source/WebCore/Modules/indexeddb/server/IndexValueStore.h
Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h
Source/WebCore/Modules/webdatabase/ChangeVersionData.h
Source/WebCore/Modules/webdatabase/OriginLock.h
Source/WebCore/Modules/websockets/WebSocketExtensionParser.h
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/system/cocoa/SleepDisablerCocoa.cpp
Source/WebCore/PAL/pal/system/cocoa/SleepDisablerCocoa.h
Source/WebCore/bindings/js/ScriptCachedFrameData.h
Source/WebCore/contentextensions/URLFilterParser.cpp
Source/WebCore/css/parser/CSSTokenizer.h
Source/WebCore/css/parser/SizesAttributeParser.h
Source/WebCore/dom/SpaceSplitString.cpp
Source/WebCore/html/FormController.cpp
Source/WebCore/loader/ProgressTracker.cpp
Source/WebCore/page/DragController.cpp
Source/WebCore/page/DragController.h
Source/WebCore/page/animation/CSSPropertyAnimation.cpp
Source/WebCore/page/ios/DOMTimerHoldingTank.h
Source/WebCore/platform/CountedUserActivity.h
Source/WebCore/platform/audio/DirectConvolver.h
Source/WebCore/platform/audio/DownSampler.h
Source/WebCore/platform/audio/DynamicsCompressorKernel.h
Source/WebCore/platform/audio/EqualPowerPanner.h
Source/WebCore/platform/audio/MultiChannelResampler.h
Source/WebCore/platform/audio/ReverbAccumulationBuffer.h
Source/WebCore/platform/audio/ReverbInputBuffer.h
Source/WebCore/platform/audio/SincResampler.cpp
Source/WebCore/platform/audio/UpSampler.h
Source/WebCore/platform/audio/ios/AudioFileReaderIOS.h
Source/WebCore/platform/audio/mac/AudioFileReaderMac.h
Source/WebCore/platform/audio/mac/AudioSessionMac.cpp
Source/WebCore/platform/cf/KeyedDecoderCF.h
Source/WebCore/platform/graphics/WidthIterator.cpp
Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h
Source/WebCore/platform/graphics/displaylists/DisplayListItems.h
Source/WebCore/platform/network/cf/ResourceRequest.h
Source/WebCore/platform/text/TextCodecICU.h
Source/WebCore/rendering/RenderTableSection.h
Source/WebCore/rendering/shapes/RasterShape.cpp
Source/WebCore/rendering/shapes/RasterShape.h
Source/WebCore/testing/MockLibWebRTCPeerConnection.h
Source/WebKit/ChangeLog
Source/WebKit/Platform/Module.h
Source/WebKit/WebProcess/WebPage/WebInspector.cpp

index a25966a..da466bc 100644 (file)
@@ -1,3 +1,74 @@
+2019-07-22  Simon Fraser  <simon.fraser@apple.com>
+
+        Make some constructors explicit
+        https://bugs.webkit.org/show_bug.cgi?id=199981
+
+        Reviewed by Daniel Bates.
+
+        Make explicit public constructors of objects that take POD or String& arguments,
+        to reduce the changes of the compiler doing implicit conversions.
+
+        * Modules/indexeddb/server/IndexValueEntry.h:
+        * Modules/indexeddb/server/IndexValueStore.h:
+        * Modules/indexeddb/shared/IDBDatabaseInfo.h:
+        * Modules/webdatabase/ChangeVersionData.h:
+        (WebCore::ChangeVersionData::ChangeVersionData):
+        * Modules/webdatabase/OriginLock.h:
+        * Modules/websockets/WebSocketExtensionParser.h:
+        (WebCore::WebSocketExtensionParser::WebSocketExtensionParser):
+        * bindings/js/ScriptCachedFrameData.h:
+        * contentextensions/URLFilterParser.cpp:
+        (WebCore::ContentExtensions::PatternParser::PatternParser):
+        * css/parser/CSSTokenizer.h:
+        * css/parser/SizesAttributeParser.h:
+        * dom/SpaceSplitString.cpp:
+        (WebCore::TokenIsEqualToCStringTokenProcessor::TokenIsEqualToCStringTokenProcessor):
+        * html/FormController.cpp:
+        (WebCore::SavedFormState::appendControlState):
+        (WebCore::SavedFormState::takeControlState):
+        * loader/ProgressTracker.cpp:
+        (WebCore::ProgressItem::ProgressItem):
+        * page/DragController.cpp:
+        (WebCore::DragController::DragController):
+        (WebCore::DragController::performDragOperation):
+        * page/DragController.h:
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::AnimationPropertyWrapperBase::AnimationPropertyWrapperBase):
+        * page/ios/DOMTimerHoldingTank.h:
+        (WebCore::DeferDOMTimersForScope::DeferDOMTimersForScope):
+        * platform/CountedUserActivity.h:
+        (WebCore::CountedUserActivity::CountedUserActivity):
+        * platform/audio/DirectConvolver.h:
+        * platform/audio/DownSampler.h:
+        * platform/audio/DynamicsCompressorKernel.h:
+        * platform/audio/EqualPowerPanner.h:
+        * platform/audio/MultiChannelResampler.h:
+        * platform/audio/ReverbAccumulationBuffer.h:
+        * platform/audio/ReverbInputBuffer.h:
+        * platform/audio/SincResampler.cpp:
+        * platform/audio/UpSampler.h:
+        * platform/audio/ios/AudioFileReaderIOS.h:
+        * platform/audio/mac/AudioFileReaderMac.h:
+        * platform/audio/mac/AudioSessionMac.cpp:
+        (WebCore::AudioSessionPrivate::AudioSessionPrivate):
+        * platform/cf/KeyedDecoderCF.h:
+        * platform/graphics/WidthIterator.cpp:
+        (WebCore::OriginalAdvancesForCharacterTreatedAsSpace::OriginalAdvancesForCharacterTreatedAsSpace):
+        * platform/graphics/cocoa/FontCacheCoreText.h:
+        (WebCore::SynthesisPair::SynthesisPair):
+        * platform/graphics/displaylists/DisplayListItems.h:
+        (WebCore::DisplayList::DrawingItem::DrawingItem):
+        * platform/network/cf/ResourceRequest.h:
+        (WebCore::ResourceRequest::ResourceRequest):
+        * platform/text/TextCodecICU.h:
+        * rendering/RenderTableSection.h:
+        (WebCore::CellSpan::CellSpan):
+        * rendering/shapes/RasterShape.cpp:
+        * rendering/shapes/RasterShape.h:
+        (WebCore::RasterShapeIntervals::RasterShapeIntervals):
+        * testing/MockLibWebRTCPeerConnection.h:
+        (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate):
+
 2019-07-22  Rob Buis  <rbuis@igalia.com>
 
         Remove some unneeded code in MathOperator
index 49abd92..7c94c43 100644 (file)
@@ -40,7 +40,7 @@ namespace IDBServer {
 class IndexValueEntry {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    IndexValueEntry(bool unique);
+    explicit IndexValueEntry(bool unique);
     ~IndexValueEntry();
 
     void addKey(const IDBKeyData&);
index df8cd0a..066bd00 100644 (file)
@@ -47,7 +47,7 @@ typedef HashMap<IDBKeyData, std::unique_ptr<IndexValueEntry>, IDBKeyDataHash, ID
 class IndexValueStore {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    IndexValueStore(bool unique);
+    explicit IndexValueStore(bool unique);
 
     const IDBKeyData* lowestValueForKey(const IDBKeyData&) const;
     Vector<IDBKeyData> allValuesForKey(const IDBKeyData&, uint32_t limit) const;
index 417284a..3b20721 100644 (file)
@@ -35,7 +35,7 @@ namespace WebCore {
 class IDBDatabaseInfo {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    IDBDatabaseInfo(const String& name, uint64_t version);
+    explicit IDBDatabaseInfo(const String& name, uint64_t version);
 
     enum IsolatedCopyTag { IsolatedCopy };
     IDBDatabaseInfo(const IDBDatabaseInfo&, IsolatedCopyTag);
index deac98f..2c62610 100644 (file)
@@ -31,7 +31,7 @@ namespace WebCore {
 
 class ChangeVersionData {
 public:
-    ChangeVersionData(String oldVersion, String newVersion)
+    explicit ChangeVersionData(String oldVersion, String newVersion)
         : m_oldVersion(oldVersion), m_newVersion(newVersion) { }
 
     String oldVersion() const { return m_oldVersion; }
index ecc29e8..07be941 100644 (file)
@@ -35,7 +35,7 @@ namespace WebCore {
 class OriginLock : public ThreadSafeRefCounted<OriginLock> {
     WTF_MAKE_NONCOPYABLE(OriginLock); WTF_MAKE_FAST_ALLOCATED;
 public:
-    OriginLock(String originPath);
+    explicit OriginLock(String originPath);
     WEBCORE_EXPORT ~OriginLock();
 
     void lock();
index b1e1e6a..acf60ab 100644 (file)
@@ -38,7 +38,7 @@ namespace WebCore {
 
 class WebSocketExtensionParser {
 public:
-    WebSocketExtensionParser(const char* start, const char* end)
+    explicit WebSocketExtensionParser(const char* start, const char* end)
         : m_current(start)
         , m_end(end)
     {
index c2fd9bc..0ce96d8 100644 (file)
@@ -1,3 +1,17 @@
+2019-07-22  Simon Fraser  <simon.fraser@apple.com>
+
+        Make some constructors explicit
+        https://bugs.webkit.org/show_bug.cgi?id=199981
+
+        Reviewed by Daniel Bates.
+
+        Make explicit public constructors of objects that take POD or String& arguments,
+        to reduce the changes of the compiler doing implicit conversions.
+
+        * pal/system/cocoa/SleepDisablerCocoa.cpp:
+        (PAL::SleepDisablerCocoa::SleepDisablerCocoa):
+        * pal/system/cocoa/SleepDisablerCocoa.h:
+
 2019-07-21  Myles C. Maxfield  <mmaxfield@apple.com>
 
         [iOS] Fast and complex text codepaths disagree about how to lay out bopomofo with tone marks
index d94bc24..e1c0d20 100644 (file)
@@ -40,7 +40,6 @@ std::unique_ptr<SleepDisabler> SleepDisabler::create(const char* reason, Type ty
 
 SleepDisablerCocoa::SleepDisablerCocoa(const char* reason, Type type)
     : SleepDisabler(reason, type)
-    , m_sleepAssertion(0)
 {
     RetainPtr<CFStringRef> reasonCF = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, reason, kCFStringEncodingUTF8));
 
index 51f6723..a81a7e7 100644 (file)
@@ -33,11 +33,11 @@ namespace PAL {
 
 class SleepDisablerCocoa : public SleepDisabler {
 public:
-    SleepDisablerCocoa(const char*, Type);
+    explicit SleepDisablerCocoa(const char*, Type);
     virtual ~SleepDisablerCocoa();
 
 private:
-    uint32_t m_sleepAssertion;
+    uint32_t m_sleepAssertion { 0 };
 };
 
 } // namespace PAL
index 541fb00..b976f4a 100644 (file)
@@ -43,7 +43,7 @@ class DOMWrapperWorld;
 class ScriptCachedFrameData {
     WTF_MAKE_NONCOPYABLE(ScriptCachedFrameData); WTF_MAKE_FAST_ALLOCATED;
 public:
-    ScriptCachedFrameData(Frame&);
+    explicit ScriptCachedFrameData(Frame&);
     ~ScriptCachedFrameData();
 
     void restore(Frame&);
index 645a5a5..f0420d5 100644 (file)
@@ -40,7 +40,7 @@ namespace ContentExtensions {
 
 class PatternParser {
 public:
-    PatternParser(bool patternIsCaseSensitive)
+    explicit PatternParser(bool patternIsCaseSensitive)
         : m_patternIsCaseSensitive(patternIsCaseSensitive)
         , m_parseStatus(URLFilterParser::Ok)
     {
index a83ff97..25b0315 100644 (file)
@@ -45,7 +45,7 @@ class CSSTokenizer {
     WTF_MAKE_NONCOPYABLE(CSSTokenizer);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    CSSTokenizer(const String&);
+    explicit CSSTokenizer(const String&);
     CSSTokenizer(const String&, CSSParserObserverWrapper&); // For the inspector
 
     CSSParserTokenRange tokenRange() const;
index 15725f6..a2bcb2f 100644 (file)
@@ -41,7 +41,7 @@ class MediaQuerySet;
     
 class SizesAttributeParser {
 public:
-    SizesAttributeParser(const String&, const Document&);
+    explicit SizesAttributeParser(const String&, const Document&);
 
     float length();
 
index 18e385e..aa5b35b 100644 (file)
@@ -103,7 +103,7 @@ void SpaceSplitString::set(const AtomString& inputString, bool shouldFoldCase)
 
 class TokenIsEqualToCStringTokenProcessor {
 public:
-    TokenIsEqualToCStringTokenProcessor(const char* referenceString, unsigned referenceStringLength)
+    explicit TokenIsEqualToCStringTokenProcessor(const char* referenceString, unsigned referenceStringLength)
         : m_referenceString(referenceString)
         , m_referenceStringLength(referenceStringLength)
         , m_referenceStringWasFound(false)
index 6532bdb..ea5b09a 100644 (file)
@@ -79,7 +79,7 @@ static inline Optional<FormControlState> deserializeFormControlState(const Vecto
 
 class FormElementKey {
 public:
-    FormElementKey(AtomStringImpl* = 0, AtomStringImpl* = 0);
+    explicit FormElementKey(AtomStringImpl* = nullptr, AtomStringImpl* = nullptr);
     ~FormElementKey();
     FormElementKey(const FormElementKey&);
     FormElementKey& operator=(const FormElementKey&);
@@ -229,13 +229,13 @@ void SavedFormState::serializeTo(Vector<String>& stateVector) const
 
 void SavedFormState::appendControlState(const AtomString& name, const AtomString& type, const FormControlState& state)
 {
-    m_stateForNewFormElements.add({ name.impl(), type.impl() }, Deque<FormControlState> { }).iterator->value.append(state);
+    m_stateForNewFormElements.add(FormElementKey { name.impl(), type.impl() }, Deque<FormControlState> { }).iterator->value.append(state);
     ++m_controlStateCount;
 }
 
 FormControlState SavedFormState::takeControlState(const AtomString& name, const AtomString& type)
 {
-    auto iterator = m_stateForNewFormElements.find({ name.impl(), type.impl() });
+    auto iterator = m_stateForNewFormElements.find(FormElementKey { name.impl(), type.impl() });
     if (iterator == m_stateForNewFormElements.end())
         return { };
 
index 39f0fde..e17a9dc 100644 (file)
@@ -65,7 +65,7 @@ static const Seconds progressNotificationTimeInterval { 200_ms };
 struct ProgressItem {
     WTF_MAKE_NONCOPYABLE(ProgressItem); WTF_MAKE_FAST_ALLOCATED;
 public:
-    ProgressItem(long long length)
+    explicit ProgressItem(long long length)
         : bytesReceived(0)
         , estimatedLength(length)
     {
index 075ad6a..af9b8f3 100644 (file)
@@ -135,12 +135,6 @@ static PlatformMouseEvent createMouseEvent(const DragData& dragData)
 DragController::DragController(Page& page, DragClient& client)
     : m_page(page)
     , m_client(client)
-    , m_numberOfItemsToBeAccepted(0)
-    , m_dragHandlingMethod(DragHandlingMethod::None)
-    , m_dragDestinationAction(DragDestinationActionNone)
-    , m_dragSourceAction(DragSourceActionNone)
-    , m_didInitiateDrag(false)
-    , m_sourceDragOperation(DragOperationNone)
 {
 }
 
@@ -284,7 +278,7 @@ bool DragController::performDragOperation(const DragData& dragData)
         return false;
 
     m_client.willPerformDragDestinationAction(DragDestinationActionLoad, dragData);
-    FrameLoadRequest frameLoadRequest { m_page.mainFrame(), { urlString }, shouldOpenExternalURLsPolicy };
+    FrameLoadRequest frameLoadRequest { m_page.mainFrame(), ResourceRequest { urlString }, shouldOpenExternalURLsPolicy };
     frameLoadRequest.setIsRequestFromClientOrUserInput();
     m_page.mainFrame().loader().load(WTFMove(frameLoadRequest));
     return true;
index 2f05f7b..73fed09 100644 (file)
@@ -142,13 +142,13 @@ struct PromisedAttachmentInfo;
         RefPtr<Document> m_documentUnderMouse; // The document the mouse was last dragged over.
         RefPtr<Document> m_dragInitiator; // The Document (if any) that initiated the drag.
         RefPtr<HTMLInputElement> m_fileInputElementUnderMouse;
-        unsigned m_numberOfItemsToBeAccepted;
+        unsigned m_numberOfItemsToBeAccepted { 0 };
         DragHandlingMethod m_dragHandlingMethod { DragHandlingMethod::None };
 
-        DragDestinationAction m_dragDestinationAction;
-        DragSourceAction m_dragSourceAction;
-        bool m_didInitiateDrag;
-        DragOperation m_sourceDragOperation; // Set in startDrag when a drag starts from a mouse down within WebKit
+        DragDestinationAction m_dragDestinationAction { DragDestinationActionNone };
+        DragSourceAction m_dragSourceAction { DragSourceActionNone };
+        bool m_didInitiateDrag { false };
+        DragOperation m_sourceDragOperation { DragOperationNone }; // Set in startDrag when a drag starts from a mouse down within WebKit
         IntPoint m_dragOffset;
         URL m_draggingImageURL;
         bool m_isPerformingDrop { false };
index c571af0..74eedc9 100644 (file)
@@ -438,7 +438,7 @@ class AnimationPropertyWrapperBase {
     WTF_MAKE_NONCOPYABLE(AnimationPropertyWrapperBase);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    AnimationPropertyWrapperBase(CSSPropertyID prop)
+    explicit AnimationPropertyWrapperBase(CSSPropertyID prop)
         : m_prop(prop)
     {
     }
index 60277c7..b62184f 100644 (file)
@@ -53,7 +53,7 @@ private:
 
 class DeferDOMTimersForScope {
 public:
-    DeferDOMTimersForScope(bool enable)
+    explicit DeferDOMTimersForScope(bool enable)
         : m_previousIsDeferring { s_isDeferring }
     {
         if (enable)
index 18c3428..75a83b2 100644 (file)
@@ -32,9 +32,8 @@ namespace WebCore {
 
 class CountedUserActivity {
 public:
-    CountedUserActivity(const char* description)
+    explicit CountedUserActivity(const char* description)
         : m_activity(description)
-        , m_count(0)
     {
     }
 
@@ -52,7 +51,7 @@ public:
 
 private:
     UserActivity m_activity;
-    size_t m_count;
+    size_t m_count { 0 };
 };
 
 } // namespace WebCore
index 7cd879d..6f2faf4 100644 (file)
@@ -35,7 +35,7 @@ namespace WebCore {
 
 class DirectConvolver {
 public:
-    DirectConvolver(size_t inputBlockSize);
+    explicit DirectConvolver(size_t inputBlockSize);
 
     void process(AudioFloatArray* convolutionKernel, const float* sourceP, float* destP, size_t framesToProcess);
 
index a671c6f..f4b4201 100644 (file)
@@ -39,7 +39,7 @@ namespace WebCore {
 class DownSampler {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    DownSampler(size_t inputBlockSize);
+    explicit DownSampler(size_t inputBlockSize);
 
     // The destination buffer |destP| is of size sourceFramesToProcess / 2.
     void process(const float* sourceP, float* destP, size_t sourceFramesToProcess);
index c036a38..b7bcea2 100644 (file)
@@ -37,7 +37,7 @@ namespace WebCore {
 
 class DynamicsCompressorKernel {
 public:
-    DynamicsCompressorKernel(float sampleRate, unsigned numberOfChannels);
+    explicit DynamicsCompressorKernel(float sampleRate, unsigned numberOfChannels);
 
     void setNumberOfChannels(unsigned);
 
index 634f17c..8cf5991 100644 (file)
@@ -33,7 +33,7 @@ namespace WebCore {
 
 class EqualPowerPanner : public Panner {
 public:
-    EqualPowerPanner(float sampleRate);
+    explicit EqualPowerPanner(float sampleRate);
 
     void pan(double azimuth, double elevation, const AudioBus* inputBus, AudioBus* outputBuf, size_t framesToProcess) override;
 
index 629d57f..4417547 100644 (file)
@@ -40,7 +40,7 @@ class AudioBus;
 class MultiChannelResampler {
     WTF_MAKE_FAST_ALLOCATED;
 public:   
-    MultiChannelResampler(double scaleFactor, unsigned numberOfChannels);
+    explicit MultiChannelResampler(double scaleFactor, unsigned numberOfChannels);
     
     // Process given AudioSourceProvider for streaming applications.
     void process(AudioSourceProvider*, AudioBus* destination, size_t framesToProcess);
index d72756f..512b6ad 100644 (file)
@@ -38,7 +38,7 @@ namespace WebCore {
 // just read from the buffer, so it will be ready for accumulation the next time around.
 class ReverbAccumulationBuffer {
 public:
-    ReverbAccumulationBuffer(size_t length);
+    explicit ReverbAccumulationBuffer(size_t length);
 
     // This will read from, then clear-out numberOfFrames
     void readAndClear(float* destination, size_t numberOfFrames);
index 4c5561c..bb06e4e 100644 (file)
@@ -36,7 +36,7 @@ namespace WebCore {
 // ReverbInputBuffer is used to buffer input samples for deferred processing by the background threads.
 class ReverbInputBuffer {
 public:
-    ReverbInputBuffer(size_t length);
+    explicit ReverbInputBuffer(size_t length);
 
     // The realtime audio thread keeps writing samples here.
     // The assumption is that the buffer's length is evenly divisible by numberOfFrames (for nearly all cases this will be fine).
index 8977f39..5d08de5 100644 (file)
@@ -146,7 +146,7 @@ namespace {
 
 class BufferSourceProvider : public AudioSourceProvider {
 public:
-    BufferSourceProvider(const float* source, size_t numberOfSourceFrames)
+    explicit BufferSourceProvider(const float* source, size_t numberOfSourceFrames)
         : m_source(source)
         , m_sourceFramesAvailable(numberOfSourceFrames)
     {
index 205b62e..266bcaf 100644 (file)
@@ -39,7 +39,7 @@ namespace WebCore {
 class UpSampler {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    UpSampler(size_t inputBlockSize);
+    explicit UpSampler(size_t inputBlockSize);
 
     // The destination buffer |destP| is of size sourceFramesToProcess * 2.
     void process(const float* sourceP, float* destP, size_t sourceFramesToProcess);
index da4dac6..1150619 100644 (file)
@@ -43,8 +43,8 @@ class AudioBus;
 
 class AudioFileReader {
 public:
-    AudioFileReader(const char* filePath);
-    AudioFileReader(const void* data, size_t dataSize);
+    explicit AudioFileReader(const char* filePath);
+    explicit AudioFileReader(const void* data, size_t dataSize);
     ~AudioFileReader();
 
     RefPtr<AudioBus> createBus(float sampleRate, bool mixToMono); // Returns nullptr on error
index c9eb68e..5685bd5 100644 (file)
@@ -41,8 +41,8 @@ class AudioBus;
 
 class AudioFileReader {
 public:
-    AudioFileReader(const char* filePath);
-    AudioFileReader(const void* data, size_t dataSize);
+    explicit AudioFileReader(const char* filePath);
+    explicit AudioFileReader(const void* data, size_t dataSize);
     ~AudioFileReader();
 
     // Returns nullptr if error
index 881aa33..7f6ef9d 100644 (file)
@@ -55,7 +55,7 @@ static AudioDeviceID defaultDevice()
 class AudioSessionPrivate {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    AudioSessionPrivate(bool mutedState)
+    explicit AudioSessionPrivate(bool mutedState)
         : lastMutedState(mutedState) { }
     bool lastMutedState;
     AudioSession::CategoryType category { AudioSession::None };
index 2fca220..8aae25f 100644 (file)
@@ -34,7 +34,7 @@ namespace WebCore {
 
 class KeyedDecoderCF final : public KeyedDecoder {
 public:
-    KeyedDecoderCF(const uint8_t* data, size_t);
+    explicit KeyedDecoderCF(const uint8_t* data, size_t);
     ~KeyedDecoderCF() override;
 
 private:
index e48a19d..bcc86af 100644 (file)
@@ -65,7 +65,7 @@ WidthIterator::WidthIterator(const FontCascade* font, const TextRun& run, HashSe
 
 struct OriginalAdvancesForCharacterTreatedAsSpace {
 public:
-    OriginalAdvancesForCharacterTreatedAsSpace(bool isSpace, float advanceBefore, float advanceAt)
+    explicit OriginalAdvancesForCharacterTreatedAsSpace(bool isSpace, float advanceBefore, float advanceAt)
         : characterIsSpace(isSpace)
         , advanceBeforeCharacter(advanceBefore)
         , advanceAtCharacter(advanceAt)
index 4e37e37..8da558e 100644 (file)
@@ -35,7 +35,7 @@
 namespace WebCore {
 
 struct SynthesisPair {
-    SynthesisPair(bool needsSyntheticBold, bool needsSyntheticOblique)
+    explicit SynthesisPair(bool needsSyntheticBold, bool needsSyntheticOblique)
         : needsSyntheticBold(needsSyntheticBold)
         , needsSyntheticOblique(needsSyntheticOblique)
     {
index d0596eb..3ed8245 100644 (file)
@@ -162,7 +162,7 @@ private:
 
 class DrawingItem : public Item {
 public:
-    DrawingItem(ItemType type)
+    explicit DrawingItem(ItemType type)
         : Item(type)
     {
     }
index 976741f..71a922f 100644 (file)
@@ -41,7 +41,7 @@ namespace WebCore {
 
 class ResourceRequest : public ResourceRequestBase {
 public:
-    ResourceRequest(const String& url) 
+    explicit ResourceRequest(const String& url) 
         : ResourceRequestBase(URL({ }, url), ResourceRequestCachePolicy::UseProtocolCachePolicy)
     {
     }
index 54599f6..864903b 100644 (file)
@@ -35,7 +35,7 @@ using ICUConverterPtr = std::unique_ptr<UConverter, void (*)(UConverter*)>;
 
 class TextCodecICU : public TextCodec {
 public:
-    TextCodecICU(const char* encoding, const char* canonicalConverterName);
+    explicit TextCodecICU(const char* encoding, const char* canonicalConverterName);
     virtual ~TextCodecICU();
 
     static void registerEncodingNames(EncodingNameRegistrar);
index de8d911..f8a9ffe 100644 (file)
@@ -42,7 +42,7 @@ enum CollapsedBorderSide {
 // Helper class for paintObject.
 struct CellSpan {
 public:
-    CellSpan(unsigned start, unsigned end)
+    explicit CellSpan(unsigned start, unsigned end)
         : start(start)
         , end(end)
     {
index d8aff98..4b1597e 100644 (file)
@@ -36,7 +36,7 @@ namespace WebCore {
 
 class MarginIntervalGenerator {
 public:
-    MarginIntervalGenerator(unsigned radius);
+    explicit MarginIntervalGenerator(unsigned radius);
     void set(int y, const IntShapeInterval&);
     IntShapeInterval intervalAt(int y) const;
 
index 23ddaf4..fdf5d1a 100644 (file)
@@ -40,7 +40,7 @@ namespace WebCore {
 class RasterShapeIntervals {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    RasterShapeIntervals(unsigned size, int offset = 0)
+    explicit RasterShapeIntervals(unsigned size, int offset = 0)
         : m_offset(offset)
     {
         m_intervals.resize(clampTo<int>(size));
index be3c63f..2de663f 100644 (file)
@@ -112,7 +112,7 @@ private:
 
 class MockLibWebRTCIceCandidate : public webrtc::IceCandidateInterface {
 public:
-    MockLibWebRTCIceCandidate(const char* sdp, const char* sdpMid)
+    explicit MockLibWebRTCIceCandidate(const char* sdp, const char* sdpMid)
         : m_sdp(sdp)
         , m_sdpMid(sdpMid) { }
 
index d55ee8f..21f5a18 100644 (file)
@@ -1,3 +1,17 @@
+2019-07-22  Simon Fraser  <simon.fraser@apple.com>
+
+        Make some constructors explicit
+        https://bugs.webkit.org/show_bug.cgi?id=199981
+
+        Reviewed by Daniel Bates.
+
+        Make explicit public constructors of objects that take POD or String& arguments,
+        to reduce the changes of the compiler doing implicit conversions.
+
+        * Platform/Module.h:
+        * WebProcess/WebPage/WebInspector.cpp:
+        (WebKit::WebInspector::openInNewTab):
+
 2019-07-22  Daniel Bates  <dabates@apple.com>
 
         [iOS] REGRESSION (r241734): Autocorrection highlight should hide when field becomes defocused
index 441cddd..dd2b66a 100644 (file)
@@ -46,7 +46,7 @@ namespace WebKit {
 class Module {
     WTF_MAKE_NONCOPYABLE(Module);
 public:
-    Module(const String& path);
+    explicit Module(const String& path);
     ~Module();
 
     bool load();
index b6d38ac..c1e9c22 100644 (file)
@@ -167,7 +167,7 @@ void WebInspector::openInNewTab(const String& urlString)
         return;
 
     Frame& inspectedMainFrame = inspectedPage->mainFrame();
-    FrameLoadRequest frameLoadRequest { *inspectedMainFrame.document(), inspectedMainFrame.document()->securityOrigin(), { urlString }, "_blank"_s, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow, InitiatedByMainFrame::Unknown };
+    FrameLoadRequest frameLoadRequest { *inspectedMainFrame.document(), inspectedMainFrame.document()->securityOrigin(), ResourceRequest { urlString }, "_blank"_s, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow, InitiatedByMainFrame::Unknown };
 
     NavigationAction action { *inspectedMainFrame.document(), frameLoadRequest.resourceRequest(), frameLoadRequest.initiatedByMainFrame(), NavigationType::LinkClicked };
     Page* newPage = inspectedPage->chrome().createWindow(inspectedMainFrame, frameLoadRequest, { }, action);