Changeset 181065 in webkit


Ignore:
Timestamp:
Mar 4, 2015 8:54:08 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

Optimize content extensions.
https://bugs.webkit.org/show_bug.cgi?id=142295

Patch by Alex Christensen <achristensen@webkit.org> on 2015-03-04
Reviewed by Benjamin Poulain.

  • contentextensions/ContentExtensionCompiler.cpp:

(WebCore::ContentExtensions::serializeActions):
There is no need to add duplicate sequential actions.

  • contentextensions/ContentExtensionRule.h:

(WebCore::ContentExtensions::Action::operator==):
Added to compare actions.

  • contentextensions/ContentExtensionsBackend.cpp:

(WebCore::ContentExtensions::ContentExtensionsBackend::actionsForURL):
Return early if a block action is found instead of moving to the next extension.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r181062 r181065  
     12015-03-04  Alex Christensen  <achristensen@webkit.org>
     2
     3        Optimize content extensions.
     4        https://bugs.webkit.org/show_bug.cgi?id=142295
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        * contentextensions/ContentExtensionCompiler.cpp:
     9        (WebCore::ContentExtensions::serializeActions):
     10        There is no need to add duplicate sequential actions.
     11        * contentextensions/ContentExtensionRule.h:
     12        (WebCore::ContentExtensions::Action::operator==):
     13        Added to compare actions.
     14        * contentextensions/ContentExtensionsBackend.cpp:
     15        (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForURL):
     16        Return early if a block action is found instead of moving to the next extension.
     17
    1182015-03-04  Commit Queue  <commit-queue@webkit.org>
    219
  • trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp

    r181000 r181065  
    5353    for (unsigned ruleIndex = 0; ruleIndex < ruleList.size(); ++ruleIndex) {
    5454        const ContentExtensionRule& rule = ruleList[ruleIndex];
     55       
     56        // Identical sequential actions should not be rewritten.
     57        if (ruleIndex && rule.action() == ruleList[ruleIndex - 1].action()) {
     58            actionLocations.append(actionLocations[ruleIndex - 1]);
     59            continue;
     60        }
    5561        actionLocations.append(actions.size());
    5662       
  • trunk/Source/WebCore/contentextensions/ContentExtensionRule.h

    r180978 r181065  
    6262        ASSERT(type != ActionType::CSSDisplayNone);
    6363    }
     64    bool operator==(const Action& other) const
     65    {
     66        return m_type == other.m_type
     67            && m_cssSelector == other.m_cssSelector;
     68    }
    6469    static Action deserialize(const Vector<SerializedActionByte>&, unsigned location);
    6570
  • trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp

    r181000 r181065  
    8787                actions.append(action);
    8888                if (action.type() == ActionType::BlockLoad)
    89                     break;
     89                    return actions;
    9090            }
    9191        }
Note: See TracChangeset for help on using the changeset viewer.