WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
142710
[Content Filtering] Adopt new NEFilterSource SPI
https://bugs.webkit.org/show_bug.cgi?id=142710
Summary
[Content Filtering] Adopt new NEFilterSource SPI
Andy Estes
Reported
2015-03-15 02:54:30 PDT
[Content Filtering] Adopt new NEFilterSource SPI
Attachments
Patch
(15.22 KB, patch)
2015-03-15 03:24 PDT
,
Andy Estes
mitz: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Andy Estes
Comment 1
2015-03-15 02:55:05 PDT
rdar://problem/19023855
Andy Estes
Comment 2
2015-03-15 03:24:52 PDT
Created
attachment 248676
[details]
Patch
WebKit Commit Bot
Comment 3
2015-03-15 03:27:49 PDT
Attachment 248676
[details]
did not pass style-queue: ERROR: Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm:77: Code inside a namespace should not be indented. [whitespace/indent] [4] ERROR: Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm:85: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm:113: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm:117: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm:131: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm:135: Place brace on its own line for function definitions. [whitespace/braces] [4] Total errors found: 6 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
mitz
Comment 4
2015-03-15 19:27:14 PDT
Comment on
attachment 248676
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=248676&action=review
> Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.h:30 > +#include <objc/NSObjCRuntime.h>
What is this used for here?
> Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm:44 > +static inline NSData *decisionInfoReplacementData(NSDictionary *decisionInfo)
I’d call this replacementDataFromDecisionInfo, but that’s just a matter of taste.
> Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm:85 > + [m_neFilterSource receivedResponse:response.nsURLResponse() decisionHandler:^(NEFilterSourceStatus status, NSDictionary *decisionInfo) {
I think we prefer to use lambdas in C++ code, because it makes captures explicit.
> Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm:99 > + dispatch_release(m_queue); > + dispatch_release(m_semaphore);
Can we use OSObjectPtr for these things so that we don’t have to manage them manually?
> Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm:118 > + [m_neFilterSource receivedData:copiedData.get() decisionHandler:^(NEFilterSourceStatus status, NSDictionary *decisionInfo) { > + handleDecision(status, decisionInfoReplacementData(decisionInfo)); > + }]; > +#else > + [m_neFilterSource addData:copiedData.get() withCompletionQueue:m_queue completionHandler:^(NEFilterSourceStatus status, NSData *replacementData) { > + handleDecision(status, replacementData);
Same comment about lambdas vs. blocks.
> Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm:137 > + [m_neFilterSource finishedLoadingWithDecisionHandler:^(NEFilterSourceStatus status, NSDictionary *decisionInfo) { > + handleDecision(status, decisionInfoReplacementData(decisionInfo)); > }]; > +#else > + [m_neFilterSource dataCompleteWithCompletionQueue:m_queue completionHandler:^(NEFilterSourceStatus status, NSData *replacementData) { > + handleDecision(status, replacementData); > + }];
Ditto.
> Source/WebCore/platform/spi/cocoa/NEFilterSourceSPI.h:26 > +#define HAVE_MODERN_NE_FILTER_SOURCE (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000)
Hopefully we can retire this macro before modern becomes old.
> Source/WebCore/platform/spi/cocoa/NEFilterSourceSPI.h:49 > +@interface NEFilterSource (LegacyDetails)
Even though this class is SPI, best practice is for categories added by WebKit to be prefixed with Web (or WK).
> Source/WebCore/platform/spi/cocoa/NEFilterSourceSPI.h:63 > +@interface NEFilterSource (ModernDetails)
Ditto.
Andy Estes
Comment 5
2015-03-15 21:59:26 PDT
Comment on
attachment 248676
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=248676&action=review
>> Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.h:30 >> +#include <objc/NSObjCRuntime.h> > > What is this used for here?
For NSInteger.
>> Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm:85 >> + [m_neFilterSource receivedResponse:response.nsURLResponse() decisionHandler:^(NEFilterSourceStatus status, NSDictionary *decisionInfo) { > > I think we prefer to use lambdas in C++ code, because it makes captures explicit.
Ok, I'll do that.
>> Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm:99 >> + dispatch_release(m_semaphore); > > Can we use OSObjectPtr for these things so that we don’t have to manage them manually?
I had no idea this class existed! I can and will use it.
>> Source/WebCore/platform/spi/cocoa/NEFilterSourceSPI.h:49 >> +@interface NEFilterSource (LegacyDetails) > > Even though this class is SPI, best practice is for categories added by WebKit to be prefixed with Web (or WK).
You're right. I'll change this. I've also updated our document on using SPI in WebKit to reflect this.
Andy Estes
Comment 6
2015-03-15 22:44:36 PDT
Committed
r181523
: <
http://trac.webkit.org/changeset/181523
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug