⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 264501 in webkit


Ignore:
Timestamp:
Jul 16, 2020, 11:39:08 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Make DocumentParser.ParserState an enum class
​https://bugs.webkit.org/show_bug.cgi?id=214416

Patch by Rob Buis <​rbuis@igalia.com> on 2020-07-16
Reviewed by Darin Adler.

Make DocumentParser.ParserState an enum class since it is more readable.

  • dom/DocumentParser.cpp:

(WebCore::DocumentParser::DocumentParser):
(WebCore::DocumentParser::startParsing):
(WebCore::DocumentParser::prepareToStopParsing):
(WebCore::DocumentParser::stopParsing):
(WebCore::DocumentParser::detach):

  • dom/DocumentParser.h:

(WebCore::DocumentParser::isParsing const):
(WebCore::DocumentParser::isStopping const):
(WebCore::DocumentParser::isStopped const):
(WebCore::DocumentParser::isDetached const):
(): Deleted.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r264499 r264501  
     12020-07-16  Rob Buis  <rbuis@igalia.com>
     2
     3        Make DocumentParser.ParserState an enum class
     4        https://bugs.webkit.org/show_bug.cgi?id=214416
     5
     6        Reviewed by Darin Adler.
     7
     8        Make DocumentParser.ParserState an enum class since it is more readable.
     9
     10        * dom/DocumentParser.cpp:
     11        (WebCore::DocumentParser::DocumentParser):
     12        (WebCore::DocumentParser::startParsing):
     13        (WebCore::DocumentParser::prepareToStopParsing):
     14        (WebCore::DocumentParser::stopParsing):
     15        (WebCore::DocumentParser::detach):
     16        * dom/DocumentParser.h:
     17        (WebCore::DocumentParser::isParsing const):
     18        (WebCore::DocumentParser::isStopping const):
     19        (WebCore::DocumentParser::isStopped const):
     20        (WebCore::DocumentParser::isDetached const):
     21        (): Deleted.
     22
    1232020-07-16  Xabier Rodriguez Calvar  <calvaris@igalia.com>
    224
  • trunk/Source/WebCore/dom/DocumentParser.cpp

    r244115 r264501  
    3333
    3434DocumentParser::DocumentParser(Document& document)
    35     : m_state(ParsingState)
     35    : m_state(ParserState::Parsing)
    3636    , m_documentWasLoadedAsPartOfNavigation(false)
    3737    , m_document(makeWeakPtr(document))
    … …  
    4949void DocumentParser::startParsing()
    5050{
    51     m_state = ParsingState;
     51    m_state = ParserState::Parsing;
    5252}
    5353
    5454void DocumentParser::prepareToStopParsing()
    5555{
    56     ASSERT(m_state == ParsingState);
    57     m_state = StoppingState;
     56    ASSERT(m_state == ParserState::Parsing);
     57    m_state = ParserState::Stopping;
    5858}
    5959
    6060void DocumentParser::stopParsing()
    6161{
    62     m_state = StoppedState;
     62    m_state = ParserState::Stopped;
    6363}
    6464
    6565void DocumentParser::detach()
    6666{
    67     m_state = DetachedState;
     67    m_state = ParserState::Detached;
    6868    m_document = nullptr;
    6969}
  • trunk/Source/WebCore/dom/DocumentParser.h

    r246596 r264501  
    6666    Document* document() const { ASSERT(m_document); return m_document.get(); }
    6767
    68     bool isParsing() const { return m_state == ParsingState; }
    69     bool isStopping() const { return m_state == StoppingState; }
    70     bool isStopped() const { return m_state >= StoppedState; }
    71     bool isDetached() const { return m_state == DetachedState; }
     68    bool isParsing() const { return m_state == ParserState::Parsing; }
     69    bool isStopping() const { return m_state == ParserState::Stopping; }
     70    bool isStopped() const { return m_state >= ParserState::Stopped; }
     71    bool isDetached() const { return m_state == ParserState::Detached; }
    7272
    7373    // FIXME: Is this necessary? Does XMLDocumentParserLibxml2 really need to set this?
    … …  
    105105
    106106private:
    107     enum ParserState {
    108         ParsingState,
    109         StoppingState,
    110         StoppedState,
    111         DetachedState
     107    enum class ParserState : uint8_t {
     108        Parsing,
     109        Stopping,
     110        Stopped,
     111        Detached
    112112    };
    113113    ParserState m_state;
Note: See TracChangeset for help on using the changeset viewer.