Skip to content

Commit

Permalink
[GTK][WPE] Port UserMessage enum to new serialization format
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=265190

Reviewed by Carlos Garcia Campos.

Remove the EnumTrait bits and use the generator for serialization.

* Source/WebKit/PlatformGTK.cmake:
* Source/WebKit/PlatformWPE.cmake:
* Source/WebKit/Shared/glib/UserMessage.h:
* Source/WebKit/Shared/glib/UserMessage.serialization.in: Added.

Canonical link: https://commits.webkit.org/271019@main
  • Loading branch information
csaavedra committed Nov 21, 2023
1 parent 1ed9a7f commit 8149385
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 16 deletions.
1 change: 1 addition & 0 deletions Source/WebKit/PlatformGTK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ list(APPEND WebKit_SERIALIZATION_IN_FILES
Shared/glib/DMABufRendererBufferFormat.serialization.in
Shared/glib/DMABufRendererBufferMode.serialization.in
Shared/glib/InputMethodState.serialization.in
Shared/glib/UserMessage.serialization.in
)

list(APPEND WebCore_SERIALIZATION_IN_FILES SoupNetworkProxySettings.serialization.in)
Expand Down
5 changes: 4 additions & 1 deletion Source/WebKit/PlatformWPE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ list(APPEND WebKit_UNIFIED_SOURCE_LIST_FILES

list(APPEND WebCore_SERIALIZATION_IN_FILES SoupNetworkProxySettings.serialization.in)

list(APPEND WebKit_SERIALIZATION_IN_FILES Shared/glib/InputMethodState.serialization.in)
list(APPEND WebKit_SERIALIZATION_IN_FILES
Shared/glib/InputMethodState.serialization.in
Shared/glib/UserMessage.serialization.in
)

list(APPEND WebKit_DERIVED_SOURCES
${WebKit_DERIVED_SOURCES_DIR}/WebKitResourcesGResourceBundle.c
Expand Down
22 changes: 7 additions & 15 deletions Source/WebKit/Shared/glib/UserMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

#pragma once

#include <wtf/EnumTraits.h>
#include <wtf/Vector.h>
#include <wtf/glib/GRefPtr.h>
#include <wtf/text/CString.h>
Expand All @@ -40,8 +39,14 @@ class Encoder;

namespace WebKit {

enum class UserMessageType : uint8_t {
Null,
Message,
Error,
};

struct UserMessage {
enum class Type { Null, Message, Error };
using Type = UserMessageType;

UserMessage()
: type(Type::Null)
Expand All @@ -66,16 +71,3 @@ struct UserMessage {
};

} // namespace WebKit

namespace WTF {

template<> struct EnumTraits<WebKit::UserMessage::Type> {
using values = EnumValues<
WebKit::UserMessage::Type,
WebKit::UserMessage::Type::Null,
WebKit::UserMessage::Type::Message,
WebKit::UserMessage::Type::Error
>;
};

} // namespace WTF
30 changes: 30 additions & 0 deletions Source/WebKit/Shared/glib/UserMessage.serialization.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (C) 2023 Igalia S.L.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
#

header: "UserMessage.h"
enum class WebKit::UserMessageType : uint8_t {
Null,
Message,
Error,
};

0 comments on commit 8149385

Please sign in to comment.