Changeset 218096 in webkit


Ignore:
Timestamp:
Jun 12, 2017 5:50:39 AM (7 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] Move WebKit GType macros to WTF
https://bugs.webkit.org/show_bug.cgi?id=173249

Reviewed by Žan Doberšek.

Source/WebKit2:

Moving to a common place where they could be shared by all ports using a glib-based API.

  • UIProcess/API/gtk/WebKitPrivate.h:

Source/WTF:

They can be used by glib-based ports and eventually by JavaScriptCore glib bindings too.

  • wtf/glib/WTFGType.h: Copied from Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h.
Location:
trunk/Source
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r218080 r218096  
     12017-06-12  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Move WebKit GType macros to WTF
     4        https://bugs.webkit.org/show_bug.cgi?id=173249
     5
     6        Reviewed by Žan Doberšek.
     7
     8        They can be used by glib-based ports and eventually by JavaScriptCore glib bindings too.
     9
     10        * wtf/glib/WTFGType.h: Copied from Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h.
     11
    1122017-06-11  Yusuke Suzuki  <utatane.tea@gmail.com>
    213
  • trunk/Source/WTF/wtf/glib/WTFGType.h

    r218095 r218096  
    11/*
    2  * Copyright (C) 2011 Igalia S.L.
     2 * Copyright (C) 2017 Igalia, S.L.
    33 *
    4  * Redistribution and use in source and binary forms, with or without
    5  * modification, are permitted provided that the following conditions
    6  * are met:
    7  * 1. Redistributions of source code must retain the above copyright
    8  *    notice, this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright
    10  *    notice, this list of conditions and the following disclaimer in the
    11  *    documentation and/or other materials provided with the distribution.
     4 *  This library is free software; you can redistribute it and/or
     5 *  modify it under the terms of the GNU Library General Public
     6 *  License as published by the Free Software Foundation; either
     7 *  version 2 of the License, or (at your option) any later version.
    128 *
    13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
    14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
    17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
    23  * THE POSSIBILITY OF SUCH DAMAGE.
     9 *  This library is distributed in the hope that it will be useful,
     10 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12 *  Library General Public License for more details.
     13 *
     14 *  You should have received a copy of the GNU Library General Public License
     15 *  along with this library; see the file COPYING.LIB.  If not, write to
     16 *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     17 *  Boston, MA 02110-1301, USA.
    2418 */
    2519
    26 #ifndef WebKitPrivate_h
    27 #define WebKitPrivate_h
     20#pragma once
    2821
    29 #include "WebKitNavigationAction.h"
    30 #include <WebKit/WKAPICast.h>
    31 #include <WebKit/WKDownload.h>
    32 #include <WebKit/WKFindOptions.h>
    33 #include <WebKit/WKGeolocationManager.h>
    34 #include <WebKit/WKGeolocationPermissionRequest.h>
    35 #include <WebKit/WKGeolocationPosition.h>
    36 #include <WebKit/WKIconDatabase.h>
    37 #include <WebKit/WKInspector.h>
    38 #include <WebKit/WKRetainPtr.h>
    39 #include <WebKit/WKSerializedScriptValue.h>
    40 #include <WebKit/WKString.h>
    41 #include <WebKit/WKUserMediaPermissionRequest.h>
    42 #include <WebKit/WebKit2_C.h>
    4322#include <glib.h>
    44 #include <wtf/Assertions.h>
    4523
    4624#define WEBKIT_PARAM_READABLE (static_cast<GParamFlags>(G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB))
     
    11189    return g_define_type_id__volatile; \
    11290} // Closes type_name##_get_type().
    113 
    114 unsigned wkEventModifiersToGdkModifiers(WKEventModifiers);
    115 unsigned wkEventMouseButtonToWebKitMouseButton(WKEventMouseButton);
    116 unsigned toGdkModifiers(WebKit::WebEvent::Modifiers);
    117 WebKitNavigationType toWebKitNavigationType(WebCore::NavigationType);
    118 unsigned toWebKitMouseButton(WebKit::WebMouseEvent::Button);
    119 unsigned toWebKitError(unsigned webCoreError);
    120 unsigned toWebCoreError(unsigned webKitError);
    121 
    122 enum SnapshotRegion {
    123     SnapshotRegionVisible,
    124     SnapshotRegionFullDocument
    125 };
    126 
    127 static const char networkCacheSubdirectory[] = "WebKitCache";
    128 
    129 #endif // WebKitPrivate_h
  • trunk/Source/WebKit2/ChangeLog

    r218089 r218096  
     12017-06-12  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Move WebKit GType macros to WTF
     4        https://bugs.webkit.org/show_bug.cgi?id=173249
     5
     6        Reviewed by Žan Doberšek.
     7
     8        Moving to a common place where they could be shared by all ports using a glib-based API.
     9
     10        * UIProcess/API/gtk/WebKitPrivate.h:
     11
    1122017-06-11  Carlos Garcia Campos  <cgarcia@igalia.com>
    213
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h

    r218089 r218096  
    2424 */
    2525
    26 #ifndef WebKitPrivate_h
    27 #define WebKitPrivate_h
     26#pragma once
    2827
    2928#include "WebKitNavigationAction.h"
     
    4342#include <glib.h>
    4443#include <wtf/Assertions.h>
    45 
    46 #define WEBKIT_PARAM_READABLE (static_cast<GParamFlags>(G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB))
    47 #define WEBKIT_PARAM_WRITABLE (static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB))
    48 #define WEBKIT_PARAM_READWRITE (static_cast<GParamFlags>(G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB))
    49 
    50 #define WEBKIT_DEFINE_ASYNC_DATA_STRUCT(structName) \
    51 static structName* create##structName() \
    52 { \
    53     structName* data = static_cast<structName*>(fastZeroedMalloc(sizeof(structName))); \
    54     new (data) structName(); \
    55     return data; \
    56 } \
    57 static void destroy##structName(structName* data) \
    58 { \
    59     data->~structName(); \
    60     fastFree(data); \
    61 }
    62 
    63 #define WEBKIT_DEFINE_TYPE(TypeName, type_name, TYPE_PARENT) _WEBKIT_DEFINE_TYPE_EXTENDED(TypeName, type_name, TYPE_PARENT, 0, { })
    64 #define WEBKIT_DEFINE_ABSTRACT_TYPE(TypeName, type_name, TYPE_PARENT) _WEBKIT_DEFINE_TYPE_EXTENDED(TypeName, type_name, TYPE_PARENT, G_TYPE_FLAG_ABSTRACT, { })
    65 #define WEBKIT_DEFINE_TYPE_WITH_CODE(TypeName, type_name, TYPE_PARENT, Code) _WEBKIT_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, 0) {Code;} _WEBKIT_DEFINE_TYPE_EXTENDED_END()
    66 
    67 #define _WEBKIT_DEFINE_TYPE_EXTENDED(TypeName, type_name, TYPE_PARENT, flags, Code) _WEBKIT_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, flags) {Code;} _WEBKIT_DEFINE_TYPE_EXTENDED_END()
    68 #define _WEBKIT_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, flags) \
    69 \
    70 static void type_name##_class_init(TypeName##Class* klass); \
    71 static gpointer type_name##_parent_class = 0; \
    72 static void type_name##_finalize(GObject* object) \
    73 { \
    74     TypeName* self = (TypeName*)object; \
    75     self->priv->~TypeName##Private(); \
    76     G_OBJECT_CLASS(type_name##_parent_class)->finalize(object); \
    77 } \
    78 \
    79 static void type_name##_class_intern_init(gpointer klass) \
    80 { \
    81     GObjectClass* gObjectClass = G_OBJECT_CLASS(klass); \
    82     g_type_class_add_private(klass, sizeof(TypeName##Private)); \
    83     type_name##_parent_class = g_type_class_peek_parent(klass); \
    84     type_name##_class_init((TypeName##Class*)klass); \
    85     gObjectClass->finalize = type_name##_finalize; \
    86 } \
    87 \
    88 static void type_name##_init(TypeName* self) \
    89 { \
    90     TypeName##Private* priv = G_TYPE_INSTANCE_GET_PRIVATE(self, type_name##_get_type(), TypeName##Private); \
    91     self->priv = priv; \
    92     new (priv) TypeName##Private(); \
    93 }\
    94 GType type_name##_get_type(void) \
    95 { \
    96     static volatile gsize g_define_type_id__volatile = 0; \
    97     if (g_once_init_enter(&g_define_type_id__volatile)) { \
    98         GType g_define_type_id = \
    99             g_type_register_static_simple( \
    100                 TYPE_PARENT, \
    101                 g_intern_static_string(#TypeName), \
    102                 sizeof(TypeName##Class), \
    103                 (GClassInitFunc)type_name##_class_intern_init, \
    104                 sizeof(TypeName), \
    105                 (GInstanceInitFunc)type_name##_init, \
    106                 (GTypeFlags)flags); \
    107         // Custom code follows.
    108 #define _WEBKIT_DEFINE_TYPE_EXTENDED_END() \
    109         g_once_init_leave(&g_define_type_id__volatile, g_define_type_id); \
    110     } \
    111     return g_define_type_id__volatile; \
    112 } // Closes type_name##_get_type().
     44#include <wtf/glib/WTFGType.h>
    11345
    11446unsigned wkEventModifiersToGdkModifiers(WKEventModifiers);
     
    12658
    12759static const char networkCacheSubdirectory[] = "WebKitCache";
    128 
    129 #endif // WebKitPrivate_h
Note: See TracChangeset for help on using the changeset viewer.