Changeset 90911 in webkit


Ignore:
Timestamp:
Jul 13, 2011 6:31:23 AM (13 years ago)
Author:
morrita@google.com
Message:

Refactoring: Ignored ExceptionCode value should be less annoying.
https://bugs.webkit.org/show_bug.cgi?id=63688

Source/JavaScriptCore:

Added ASSERT_AT macro.

Reviewed by Darin Adler.

  • wtf/Assertions.h:

Source/WebCore:

  • Introduced ExceptionCodePlaceholder class for the default parameter of ExceptionCode.
  • Introduced ASSERT_NO_EXCEPTION to check ExceptionCode not set to non-zero after the call.
  • Adopted ASSERT_NO_EXCEPTION in Range.cpp

No new tests. No behaviour change.

Reviewed by Darin Adler.

  • GNUmakefile.list.am:
  • WebCore.gypi:
  • WebCore.xcodeproj/project.pbxproj:
  • dom/ExceptionCodePlaceholder.h: Added.

(WebCore::ExceptionCodePlaceholder::ExceptionCodePlaceholder):
(WebCore::ExceptionCodePlaceholder::operator ExceptionCode& ):
(WebCore::IgnorableExceptionCode::IgnorableExceptionCode):
(WebCore::CheckedExceptionCode::CheckedExceptionCode):
(WebCore::CheckedExceptionCode::~CheckedExceptionCode):

  • dom/Range.cpp:

(WebCore::Range::Range):
(WebCore::Range::editingStartPosition):

  • dom/Range.h:
Location:
trunk/Source
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r90877 r90911  
     12011-07-13  MORITA Hajime  <morrita@google.com>
     2
     3        Refactoring: Ignored ExceptionCode value should be less annoying.
     4        https://bugs.webkit.org/show_bug.cgi?id=63688
     5
     6        Added ASSERT_AT macro.
     7
     8        Reviewed by Darin Adler.
     9
     10        * wtf/Assertions.h:
     11
    1122011-07-12  Filip Pizlo  <fpizlo@apple.com>
    213
  • trunk/Source/JavaScriptCore/wtf/Assertions.h

    r86499 r90911  
    236236
    237237#define ASSERT(assertion) ((void)0)
     238#define ASSERT_AT(assertion, file, line, function) ((void)0)
    238239#define ASSERT_NOT_REACHED() ((void)0)
    239240
     
    251252    if (!(assertion)) { \
    252253        WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #assertion); \
     254        CRASH(); \
     255    } \
     256while (0)
     257
     258#define ASSERT_AT(assertion, file, line, function) do  \
     259    if (!(assertion)) { \
     260        WTFReportAssertionFailure(file, line, function, #assertion); \
    253261        CRASH(); \
    254262    } \
  • trunk/Source/WebCore/ChangeLog

    r90908 r90911  
     12011-07-13  MORITA Hajime  <morrita@google.com>
     2
     3        Refactoring: Ignored ExceptionCode value should be less annoying.
     4        https://bugs.webkit.org/show_bug.cgi?id=63688
     5
     6        - Introduced ExceptionCodePlaceholder class for the default parameter of ExceptionCode.
     7        - Introduced ASSERT_NO_EXCEPTION to check ExceptionCode not set to non-zero after the call.
     8        - Adopted ASSERT_NO_EXCEPTION in Range.cpp
     9
     10        No new tests. No behaviour change.
     11
     12        Reviewed by Darin Adler.
     13
     14        * GNUmakefile.list.am:
     15        * WebCore.gypi:
     16        * WebCore.xcodeproj/project.pbxproj:
     17        * dom/ExceptionCodePlaceholder.h: Added.
     18        (WebCore::ExceptionCodePlaceholder::ExceptionCodePlaceholder):
     19        (WebCore::ExceptionCodePlaceholder::operator ExceptionCode& ):
     20        (WebCore::IgnorableExceptionCode::IgnorableExceptionCode):
     21        (WebCore::CheckedExceptionCode::CheckedExceptionCode):
     22        (WebCore::CheckedExceptionCode::~CheckedExceptionCode):
     23        * dom/Range.cpp:
     24        (WebCore::Range::Range):
     25        (WebCore::Range::editingStartPosition):
     26        * dom/Range.h:       
     27
    1282011-07-13  Nikolas Zimmermann  <nzimmermann@rim.com>
    229
  • trunk/Source/WebCore/GNUmakefile.list.am

    r90849 r90911  
    11771177        Source/WebCore/dom/FragmentScriptingPermission.h \
    11781178        Source/WebCore/dom/IgnoreDestructiveWriteCountIncrementer.h \
     1179        Source/WebCore/dom/ExceptionCodePlaceholder.h \
    11791180        Source/WebCore/dom/IconURL.cpp \
    11801181        Source/WebCore/dom/IconURL.h \
  • trunk/Source/WebCore/WebCore.gypi

    r90872 r90911  
    539539            'dom/Node.h',
    540540            'dom/NodeList.h',
     541            'dom/NeverThrown.h',
    541542            'dom/PendingScript.h',
    542543            'dom/Position.h',
     
    25082509            'dom/HashChangeEvent.h',
    25092510            'dom/IgnoreDestructiveWriteCountIncrementer.h',
     2511            'dom/ExceptionCodePlaceholder.h',
    25102512            'dom/IconURL.cpp',
    25112513            'dom/IconURL.h',
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r90872 r90911  
    32863286                A73F95FE12C97BFE0031AAF9 /* RoundedRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A73F95FC12C97BFE0031AAF9 /* RoundedRect.cpp */; };
    32873287                A73F95FF12C97BFE0031AAF9 /* RoundedRect.h in Headers */ = {isa = PBXBuildFile; fileRef = A73F95FD12C97BFE0031AAF9 /* RoundedRect.h */; settings = {ATTRIBUTES = (Private, ); }; };
     3288                A74BB76B13BDA86300FF7BF0 /* ExceptionCodePlaceholder.h in Headers */ = {isa = PBXBuildFile; fileRef = A74BB76A13BDA86300FF7BF0 /* ExceptionCodePlaceholder.h */; settings = {ATTRIBUTES = (Private, ); }; };
    32883289                A74C2D3C13811E0D00F83572 /* ShadowContentElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A74C2D3B13811E0D00F83572 /* ShadowContentElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
    32893290                A75E497610752ACB00C9B896 /* SerializedScriptValue.h in Headers */ = {isa = PBXBuildFile; fileRef = A75E497410752ACB00C9B896 /* SerializedScriptValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    98039804                A73F95FC12C97BFE0031AAF9 /* RoundedRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RoundedRect.cpp; sourceTree = "<group>"; };
    98049805                A73F95FD12C97BFE0031AAF9 /* RoundedRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoundedRect.h; sourceTree = "<group>"; };
     9806                A74BB76A13BDA86300FF7BF0 /* ExceptionCodePlaceholder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionCodePlaceholder.h; sourceTree = "<group>"; };
    98059807                A74C2D3B13811E0D00F83572 /* ShadowContentElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowContentElement.h; sourceTree = "<group>"; };
    98069808                A75E497410752ACB00C9B896 /* SerializedScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerializedScriptValue.h; sourceTree = "<group>"; };
     
    1962219624                                93831B560D087D6000E5C984 /* ExceptionCode.cpp */,
    1962319625                                935FBCF109BA143B00E230B1 /* ExceptionCode.h */,
     19626                                A74BB76A13BDA86300FF7BF0 /* ExceptionCodePlaceholder.h */,
    1962419627                                B12D233513560282002A28D4 /* ExclusiveTrackList.cpp */,
    1962519628                                B12D233613560282002A28D4 /* ExclusiveTrackList.h */,
     
    2111621119                                BC60D8F30D2A11E000B9918F /* ExceptionBase.h in Headers */,
    2111721120                                935FBCF209BA143B00E230B1 /* ExceptionCode.h in Headers */,
     21121                                A74BB76B13BDA86300FF7BF0 /* ExceptionCodePlaceholder.h in Headers */,
    2111821122                                148AFDA50AF58360008CC700 /* ExceptionHandlers.h in Headers */,
    2111921123                                B12D233F13560282002A28D4 /* ExclusiveTrackList.h in Headers */,
  • trunk/Source/WebCore/dom/Range.cpp

    r90130 r90911  
    8989    // Simply setting the containers and offsets directly would not do any of the checking
    9090    // that setStart and setEnd do, so we call those functions.
    91     ExceptionCode ec = 0;
    92     setStart(startContainer, startOffset, ec);
    93     ASSERT(!ec);
    94     setEnd(endContainer, endOffset, ec);
    95     ASSERT(!ec);
     91    setStart(startContainer, startOffset);
     92    setEnd(endContainer, endOffset);
    9693}
    9794
     
    15961593        return Position();
    15971594
    1598     ExceptionCode ec = 0;
    15991595    // if the selection is a caret, just return the position, since the style
    16001596    // behind us is relevant
    1601     if (collapsed(ec))
     1597    if (collapsed())
    16021598        return visiblePosition.deepEquivalent();
    16031599
  • trunk/Source/WebCore/dom/Range.h

    r86135 r90911  
    2626#define Range_h
    2727
     28#include "ExceptionCodePlaceholder.h"
    2829#include "FloatRect.h"
    2930#include "IntRect.h"
     
    6263    Node* endContainer(ExceptionCode&) const;
    6364    int endOffset(ExceptionCode&) const;
    64     bool collapsed(ExceptionCode&) const;
     65    bool collapsed(ExceptionCode& = ASSERT_NO_EXCEPTION) const;
    6566
    6667    Node* commonAncestorContainer(ExceptionCode&) const;
    6768    static Node* commonAncestorContainer(Node* containerA, Node* containerB);
    68     void setStart(PassRefPtr<Node> container, int offset, ExceptionCode&);
    69     void setEnd(PassRefPtr<Node> container, int offset, ExceptionCode&);
     69    void setStart(PassRefPtr<Node> container, int offset, ExceptionCode& = ASSERT_NO_EXCEPTION);
     70    void setEnd(PassRefPtr<Node> container, int offset, ExceptionCode& = ASSERT_NO_EXCEPTION);
    7071    void collapse(bool toStart, ExceptionCode&);
    7172    bool isPointInRange(Node* refNode, int offset, ExceptionCode&);
Note: See TracChangeset for help on using the changeset viewer.