From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/Modules/websockets/CloseEvent.h | 47 +++++++------------------- 1 file changed, 13 insertions(+), 34 deletions(-) (limited to 'Source/WebCore/Modules/websockets/CloseEvent.h') diff --git a/Source/WebCore/Modules/websockets/CloseEvent.h b/Source/WebCore/Modules/websockets/CloseEvent.h index fda51d8d7..85954f07f 100644 --- a/Source/WebCore/Modules/websockets/CloseEvent.h +++ b/Source/WebCore/Modules/websockets/CloseEvent.h @@ -28,41 +28,29 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef CloseEvent_h -#define CloseEvent_h +#pragma once #include "Event.h" #include "EventNames.h" namespace WebCore { -struct CloseEventInit : public EventInit { - CloseEventInit() - : wasClean(false) - , code(0) - { - }; - - bool wasClean; - unsigned short code; - String reason; -}; - class CloseEvent : public Event { public: - static PassRefPtr create() + static Ref create(bool wasClean, unsigned short code, const String& reason) { - return adoptRef(new CloseEvent()); + return adoptRef(*new CloseEvent(wasClean, code, reason)); } - static PassRefPtr create(bool wasClean, unsigned short code, const String& reason) - { - return adoptRef(new CloseEvent(wasClean, code, reason)); - } + struct Init : EventInit { + bool wasClean { false }; + unsigned short code { 0 }; + String reason; + }; - static PassRefPtr create(const AtomicString& type, const CloseEventInit& initializer) + static Ref create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No) { - return adoptRef(new CloseEvent(type, initializer)); + return adoptRef(*new CloseEvent(type, initializer, isTrusted)); } bool wasClean() const { return m_wasClean; } @@ -70,16 +58,9 @@ public: String reason() const { return m_reason; } // Event function. - virtual EventInterface eventInterface() const override { return CloseEventInterfaceType; } + EventInterface eventInterface() const override { return CloseEventInterfaceType; } private: - CloseEvent() - : Event(eventNames().closeEvent, false, false) - , m_wasClean(false) - , m_code(0) - { - } - CloseEvent(bool wasClean, int code, const String& reason) : Event(eventNames().closeEvent, false, false) , m_wasClean(wasClean) @@ -88,8 +69,8 @@ private: { } - CloseEvent(const AtomicString& type, const CloseEventInit& initializer) - : Event(type, initializer) + CloseEvent(const AtomicString& type, const Init& initializer, IsTrusted isTrusted) + : Event(type, initializer, isTrusted) , m_wasClean(initializer.wasClean) , m_code(initializer.code) , m_reason(initializer.reason) @@ -102,5 +83,3 @@ private: }; } // namespace WebCore - -#endif // CloseEvent_h -- cgit v1.2.1