Changeset 260724 in webkit


Ignore:
Timestamp:
Apr 26, 2020 7:53:33 AM (4 years ago)
Author:
Darin Adler
Message:

Remove unnecessary inlining and templates for URL decomposition DOM functions
https://bugs.webkit.org/show_bug.cgi?id=211025

Reviewed by Alex Christensen.

  • Headers.cmake: Renamed URLUtils.h to URLDecomposition.h.
  • Modules/cache/DOMCacheStorage.cpp: Updated include and using namespace.
  • Sources.txt: Added URLDecomposition.cpp.
  • WebCore.xcodeproj/project.pbxproj: Added URLDecomposition.cpp and

renamed URLUtils.h to URLDecomposition.h.

  • html/DOMURL.h: Removed the WEBCORE_EXPORT on this class. Added final.

Derive from URLDecomposition instead of URLUtils. Changed return type of
href to const&. Moved toJSON here from URLUtils. Added overrides of the
fullURL and setFullURL functions for URLDecomposition.

  • html/DOMURL.idl: Removed ImplementationLacksVTable.
  • html/HTMLAnchorElement.cpp:

(WebCore::HTMLAnchorElement::HTMLAnchorElement): Moved initialization of
boolean data members to the class definition.

  • html/HTMLAnchorElement.h: Derive from URLDecomposition instead of

URLUtils. Added overrides of the fullURL and setFullURL functions for
URLDecomposition. Initialize data members here in the class definition.

  • html/HTMLMediaElement.cpp: Removed unnecessary include of DOMURL.h.
  • html/URLDecomposition.cpp: Added. Contains most of the code from

the URLUtils class template, which no longer needs to be in a header.

  • html/URLDecomposition.h: Renamed URLUtils.h to this. It's now an

abstract base class rather than a class template using the curiously
recurring template pattern.

  • html/URLSearchParams.h: Forward-declare DOMURL rather than including

the DOMURL.h header.

  • html/URLUtils.h: Removed. Renamed to URLDecompostion.h.
  • page/DOMWindow.cpp: Removed unneeded include of DOMURL.h.
  • testing/Internals.cpp: Added include of DOMURL.h.
Location:
trunk/Source/WebCore
Files:
1 added
1 deleted
13 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r260723 r260724  
     12020-04-26  Darin Adler  <darin@apple.com>
     2
     3        Remove unnecessary inlining and templates for URL decomposition DOM functions
     4        https://bugs.webkit.org/show_bug.cgi?id=211025
     5
     6        Reviewed by Alex Christensen.
     7
     8        * Headers.cmake: Renamed URLUtils.h to URLDecomposition.h.
     9        * Modules/cache/DOMCacheStorage.cpp: Updated include and using namespace.
     10        * Sources.txt: Added URLDecomposition.cpp.
     11        * WebCore.xcodeproj/project.pbxproj: Added URLDecomposition.cpp and
     12        renamed URLUtils.h to URLDecomposition.h.
     13
     14        * html/DOMURL.h: Removed the WEBCORE_EXPORT on this class. Added final.
     15        Derive from URLDecomposition instead of URLUtils. Changed return type of
     16        href to const&. Moved toJSON here from URLUtils. Added overrides of the
     17        fullURL and setFullURL functions for URLDecomposition.
     18
     19        * html/DOMURL.idl: Removed ImplementationLacksVTable.
     20
     21        * html/HTMLAnchorElement.cpp:
     22        (WebCore::HTMLAnchorElement::HTMLAnchorElement): Moved initialization of
     23        boolean data members to the class definition.
     24
     25        * html/HTMLAnchorElement.h: Derive from URLDecomposition instead of
     26        URLUtils. Added overrides of the fullURL and setFullURL functions for
     27        URLDecomposition. Initialize data members here in the class definition.
     28
     29        * html/HTMLMediaElement.cpp: Removed unnecessary include of DOMURL.h.
     30
     31        * html/URLDecomposition.cpp: Added. Contains most of the code from
     32        the URLUtils class template, which no longer needs to be in a header.
     33
     34        * html/URLDecomposition.h: Renamed URLUtils.h to this. It's now an
     35        abstract base class rather than a class template using the curiously
     36        recurring template pattern.
     37
     38        * html/URLSearchParams.h: Forward-declare DOMURL rather than including
     39        the DOMURL.h header.
     40
     41        * html/URLUtils.h: Removed. Renamed to URLDecompostion.h.
     42
     43        * page/DOMWindow.cpp: Removed unneeded include of DOMURL.h.
     44        * testing/Internals.cpp: Added include of DOMURL.h.
     45
    1462020-04-26  Cathie Chen  <cathiechen@igalia.com>
    247
  • trunk/Source/WebCore/Headers.cmake

    r260504 r260724  
    651651    html/TimeRanges.h
    652652    html/TypeAhead.h
     653    html/URLDecomposition.h
    653654    html/URLRegistry.h
    654     html/URLUtils.h
    655655    html/ValidityState.h
    656656    html/VoidCallback.h
  • trunk/Source/WebCore/Modules/cache/DOMCacheStorage.cpp

    r255136 r260724  
    3333#include "JSFetchResponse.h"
    3434#include "ScriptExecutionContext.h"
     35#include "SecurityOrigin.h"
    3536
    3637namespace WebCore {
    37 using namespace WebCore::DOMCacheEngine;
    3838
    3939DOMCacheStorage::DOMCacheStorage(ScriptExecutionContext& context, Ref<CacheStorageConnection>&& connection)
  • trunk/Source/WebCore/Sources.txt

    r260504 r260724  
    12771277html/TimeRanges.cpp
    12781278html/TypeAhead.cpp
     1279html/URLDecomposition.cpp
    12791280html/URLInputType.cpp
    12801281html/URLSearchParams.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r260718 r260724  
    27142714                93D4379F1D57B15300AB85EA /* JSExecState.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F934D831189F1EE00508D5D /* JSExecState.h */; settings = {ATTRIBUTES = (Private, ); }; };
    27152715                93D437A01D57B19A00AB85EA /* CustomElementReactionQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B56C9A81C89312800C456DF /* CustomElementReactionQueue.h */; settings = {ATTRIBUTES = (Private, ); }; };
    2716                 93D437A21D57B3FE00AB85EA /* URLUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 656B9DCA189DE10000BB842C /* URLUtils.h */; settings = {ATTRIBUTES = (Private, ); }; };
     2716                93D437A21D57B3FE00AB85EA /* URLDecomposition.h in Headers */ = {isa = PBXBuildFile; fileRef = 656B9DCA189DE10000BB842C /* URLDecomposition.h */; settings = {ATTRIBUTES = (Private, ); }; };
    27172717                93D437A31D57B7E200AB85EA /* JSMediaListCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = AD726FE716D9F204003A4E6D /* JSMediaListCustom.h */; settings = {ATTRIBUTES = (Private, ); }; };
    27182718                93D9D53C0DA27E180077216C /* RangeBoundaryPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 93D9D53B0DA27E180077216C /* RangeBoundaryPoint.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    92579257                656581EA09D1508D000E61D7 /* XLinkNames.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = XLinkNames.cpp; path = DerivedSources/WebCore/XLinkNames.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
    92589258                656581EB09D1508D000E61D7 /* XLinkNames.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = XLinkNames.h; path = DerivedSources/WebCore/XLinkNames.h; sourceTree = BUILT_PRODUCTS_DIR; };
    9259                 656B9DCA189DE10000BB842C /* URLUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = URLUtils.h; sourceTree = "<group>"; };
     9259                656B9DCA189DE10000BB842C /* URLDecomposition.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = URLDecomposition.h; sourceTree = "<group>"; };
    92609260                656D371A0ADBA5DE00A4554D /* LoaderNSURLExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = LoaderNSURLExtras.h; sourceTree = "<group>"; };
    92619261                656D371B0ADBA5DE00A4554D /* LoaderNSURLExtras.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = LoaderNSURLExtras.mm; sourceTree = "<group>"; };
     
    1094210942                93E2A304123E9DC0009FE12A /* HTMLParserIdioms.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLParserIdioms.cpp; sourceTree = "<group>"; };
    1094310943                93E2A305123E9DC0009FE12A /* HTMLParserIdioms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLParserIdioms.h; sourceTree = "<group>"; };
     10944                93E5B25424536B1E005C52D0 /* URLDecomposition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLDecomposition.cpp; sourceTree = "<group>"; };
    1094410945                93EB355E09E37FD600F43799 /* MouseEventWithHitTestResults.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseEventWithHitTestResults.cpp; sourceTree = "<group>"; };
    1094510946                93EEC1E509C2877700C515D1 /* Attr.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Attr.idl; sourceTree = "<group>"; };
     
    2252022521                                C375D7FB16639519006184AB /* TypeAhead.cpp */,
    2252122522                                C375D7FC16639519006184AB /* TypeAhead.h */,
     22523                                93E5B25424536B1E005C52D0 /* URLDecomposition.cpp */,
     22524                                656B9DCA189DE10000BB842C /* URLDecomposition.h */,
    2252222525                                F55B3DA91251F12D003EF269 /* URLInputType.cpp */,
    2252322526                                F55B3DAA1251F12D003EF269 /* URLInputType.h */,
     
    2252622529                                5C5381B11D87D45700E2EBE6 /* URLSearchParams.h */,
    2252722530                                5C5381AF1D8793E000E2EBE6 /* URLSearchParams.idl */,
    22528                                 656B9DCA189DE10000BB842C /* URLUtils.h */,
    2252922531                                F5A154251279534D00D0B0C0 /* ValidationMessage.cpp */,
    2253022532                                F5A154261279534D00D0B0C0 /* ValidationMessage.h */,
     
    3335433356                                D086FE9809D53AAB005BC74D /* UnlinkCommand.h in Headers */,
    3335533357                                FD1762E0176686D900D836A8 /* UpSampler.h in Headers */,
     33358                                93D437A21D57B3FE00AB85EA /* URLDecomposition.h in Headers */,
    3335633359                                267726051A5DF6F2003C24DD /* URLFilterParser.h in Headers */,
    3335733360                                F55B3DDE1251F12D003EF269 /* URLInputType.h in Headers */,
    3335833361                                7CC289DF1AA0FE5D009A9CE3 /* URLRegistry.h in Headers */,
    33359                                 93D437A21D57B3FE00AB85EA /* URLUtils.h in Headers */,
    3336033362                                A72763BF16689BFB002FCACB /* UserActionElementSet.h in Headers */,
    3336133363                                868160D618766A130021E79D /* UserActivity.h in Headers */,
  • trunk/Source/WebCore/html/DOMURL.h

    r238771 r260724  
    2828
    2929#include "ExceptionOr.h"
     30#include "URLDecomposition.h"
    3031#include <wtf/URL.h>
    31 #include "URLUtils.h"
    3232
    3333namespace WebCore {
     
    3838class URLSearchParams;
    3939
    40 class WEBCORE_EXPORT DOMURL : public RefCounted<DOMURL>, public URLUtils<DOMURL> {
     40class DOMURL final : public RefCounted<DOMURL>, public URLDecomposition {
    4141public:
    4242    static ExceptionOr<Ref<DOMURL>> create(const String& url, const String& base);
     
    4545    ~DOMURL();
    4646
    47     URL href() const { return m_url; }
    48     ExceptionOr<void> setHref(const String& url);
     47    const URL& href() const { return m_url; }
     48    ExceptionOr<void> setHref(const String&);
    4949    void setQuery(const String&);
    5050
    5151    URLSearchParams& searchParams();
     52
     53    const String& toJSON() const { return m_url.string(); }
    5254
    5355    static String createObjectURL(ScriptExecutionContext&, Blob&);
     
    5961    DOMURL(URL&& completeURL, URL&& baseURL);
    6062
     63    URL fullURL() const final { return m_url; }
     64    void setFullURL(const URL& fullURL) final { setHref(fullURL.string()); }
     65
    6166    URL m_baseURL;
    6267    URL m_url;
  • trunk/Source/WebCore/html/DOMURL.idl

    r222429 r260724  
    3333    ExportMacro=WEBCORE_EXPORT,
    3434    Exposed=(Window,Worker),
    35     ImplementationLacksVTable,
    3635    InterfaceName=URL,
    3736    JSGenerateToJSObject,
  • trunk/Source/WebCore/html/HTMLAnchorElement.cpp

    r260707 r260724  
    6666HTMLAnchorElement::HTMLAnchorElement(const QualifiedName& tagName, Document& document)
    6767    : HTMLElement(tagName, document)
    68     , m_hasRootEditableElementForSelectionOnMouseDown(false)
    69     , m_wasShiftKeyDownOnMouseDown(false)
    7068{
    7169}
  • trunk/Source/WebCore/html/HTMLAnchorElement.h

    r259687 r260724  
    2727#include "HTMLNames.h"
    2828#include "SharedStringHash.h"
    29 #include "URLUtils.h"
     29#include "URLDecomposition.h"
    3030#include <wtf/OptionSet.h>
    3131
     
    4242};
    4343
    44 class HTMLAnchorElement : public HTMLElement, public URLUtils<HTMLAnchorElement> {
     44class HTMLAnchorElement : public HTMLElement, public URLDecomposition {
    4545    WTF_MAKE_ISO_ALLOCATED(HTMLAnchorElement);
    4646public:
     
    117117    void clearRootEditableElementForSelectionOnMouseDown();
    118118
    119     bool m_hasRootEditableElementForSelectionOnMouseDown;
    120     bool m_wasShiftKeyDownOnMouseDown;
     119    URL fullURL() const final { return href(); }
     120    void setFullURL(const URL& fullURL) final { setHref(fullURL.string()); }
     121
     122    bool m_hasRootEditableElementForSelectionOnMouseDown { false };
     123    bool m_wasShiftKeyDownOnMouseDown { false };
    121124    OptionSet<Relation> m_linkRelations;
    122125
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r260709 r260724  
    150150
    151151#if ENABLE(MEDIA_STREAM)
    152 #include "DOMURL.h"
    153152#include "MediaStream.h"
    154153#endif
  • trunk/Source/WebCore/html/URLDecomposition.h

    r260723 r260724  
    11/*
    2  * Copyright (C) 2011 Google Inc. All rights reserved.
    3  * Copyright (C) 2012 Motorola Mobility Inc.
     2 * Copyright (C) 2014-2020 Apple Inc. All rights reserved.
    43 *
    54 * Redistribution and use in source and binary forms, with or without
     
    2726#pragma once
    2827
    29 #include "ExceptionOr.h"
    30 #include <wtf/URL.h>
    31 #include "URLUtils.h"
     28#include <wtf/Forward.h>
    3229
    3330namespace WebCore {
    3431
    35 class Blob;
    36 class ScriptExecutionContext;
    37 class URLRegistrable;
    38 class URLSearchParams;
     32class URLDecomposition {
     33public:
     34    String origin() const;
    3935
    40 class WEBCORE_EXPORT DOMURL : public RefCounted<DOMURL>, public URLUtils<DOMURL> {
    41 public:
    42     static ExceptionOr<Ref<DOMURL>> create(const String& url, const String& base);
    43     static ExceptionOr<Ref<DOMURL>> create(const String& url, const DOMURL& base);
    44     static ExceptionOr<Ref<DOMURL>> create(const String& url);
    45     ~DOMURL();
     36    WEBCORE_EXPORT String protocol() const;
     37    void setProtocol(StringView);
    4638
    47     URL href() const { return m_url; }
    48     ExceptionOr<void> setHref(const String& url);
    49     void setQuery(const String&);
     39    String username() const;
     40    void setUsername(StringView);
    5041
    51     URLSearchParams& searchParams();
     42    String password() const;
     43    void setPassword(StringView);
    5244
    53     static String createObjectURL(ScriptExecutionContext&, Blob&);
    54     static void revokeObjectURL(ScriptExecutionContext&, const String&);
     45    WEBCORE_EXPORT String host() const;
     46    void setHost(StringView);
    5547
    56     static String createPublicURL(ScriptExecutionContext&, URLRegistrable&);
     48    WEBCORE_EXPORT String hostname() const;
     49    void setHostname(StringView);
     50
     51    WEBCORE_EXPORT String port() const;
     52    void setPort(StringView);
     53
     54    WEBCORE_EXPORT String pathname() const;
     55    void setPathname(StringView);
     56
     57    WEBCORE_EXPORT String search() const;
     58    void setSearch(const String&);
     59
     60    WEBCORE_EXPORT String hash() const;
     61    void setHash(StringView);
     62
     63protected:
     64    virtual ~URLDecomposition() = default;
    5765
    5866private:
    59     DOMURL(URL&& completeURL, URL&& baseURL);
    60 
    61     URL m_baseURL;
    62     URL m_url;
    63     RefPtr<URLSearchParams> m_searchParams;
     67    virtual URL fullURL() const = 0;
     68    virtual void setFullURL(const URL&) = 0;
    6469};
    6570
  • trunk/Source/WebCore/html/URLSearchParams.h

    r239427 r260724  
    2525#pragma once
    2626
    27 #include "DOMURL.h"
    2827#include <wtf/Variant.h>
    2928#include <wtf/Vector.h>
     
    3130
    3231namespace WebCore {
     32
     33class DOMURL;
    3334
    3435class URLSearchParams : public RefCounted<URLSearchParams> {
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r260709 r260724  
    4646#include "DOMTimer.h"
    4747#include "DOMTokenList.h"
    48 #include "DOMURL.h"
    4948#include "DeviceMotionController.h"
    5049#include "DeviceMotionData.h"
  • trunk/Source/WebCore/testing/Internals.cpp

    r260699 r260724  
    5959#include "DOMRectList.h"
    6060#include "DOMStringList.h"
     61#include "DOMURL.h"
    6162#include "DOMWindow.h"
    6263#include "DeprecatedGlobalSettings.h"
Note: See TracChangeset for help on using the changeset viewer.