Title: [181065] trunk/Source/WebCore
- Revision
- 181065
- Author
- [email protected]
- Date
- 2015-03-04 20:54:08 -0800 (Wed, 04 Mar 2015)
Log Message
Optimize content extensions.
https://bugs.webkit.org/show_bug.cgi?id=142295
Patch by Alex Christensen <[email protected]> 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.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (181064 => 181065)
--- trunk/Source/WebCore/ChangeLog 2015-03-05 04:25:49 UTC (rev 181064)
+++ trunk/Source/WebCore/ChangeLog 2015-03-05 04:54:08 UTC (rev 181065)
@@ -1,3 +1,20 @@
+2015-03-04 Alex Christensen <[email protected]>
+
+ Optimize content extensions.
+ https://bugs.webkit.org/show_bug.cgi?id=142295
+
+ 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.
+
2015-03-04 Commit Queue <[email protected]>
Unreviewed, rolling out r181046.
Modified: trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp (181064 => 181065)
--- trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp 2015-03-05 04:25:49 UTC (rev 181064)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp 2015-03-05 04:54:08 UTC (rev 181065)
@@ -52,6 +52,12 @@
for (unsigned ruleIndex = 0; ruleIndex < ruleList.size(); ++ruleIndex) {
const ContentExtensionRule& rule = ruleList[ruleIndex];
+
+ // Identical sequential actions should not be rewritten.
+ if (ruleIndex && rule.action() == ruleList[ruleIndex - 1].action()) {
+ actionLocations.append(actionLocations[ruleIndex - 1]);
+ continue;
+ }
actionLocations.append(actions.size());
switch (rule.action().type()) {
Modified: trunk/Source/WebCore/contentextensions/ContentExtensionRule.h (181064 => 181065)
--- trunk/Source/WebCore/contentextensions/ContentExtensionRule.h 2015-03-05 04:25:49 UTC (rev 181064)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionRule.h 2015-03-05 04:54:08 UTC (rev 181065)
@@ -61,6 +61,11 @@
{
ASSERT(type != ActionType::CSSDisplayNone);
}
+ bool operator==(const Action& other) const
+ {
+ return m_type == other.m_type
+ && m_cssSelector == other.m_cssSelector;
+ }
static Action deserialize(const Vector<SerializedActionByte>&, unsigned location);
ActionType type() const { return m_type; }
Modified: trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp (181064 => 181065)
--- trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp 2015-03-05 04:25:49 UTC (rev 181064)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp 2015-03-05 04:54:08 UTC (rev 181065)
@@ -86,7 +86,7 @@
break;
actions.append(action);
if (action.type() == ActionType::BlockLoad)
- break;
+ return actions;
}
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes