Summary: | [Content Filtering] Adopt new NEFilterSource SPI | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Andy Estes <aestes> | ||||
Component: | New Bugs | Assignee: | Andy Estes <aestes> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | commit-queue, ddkilzer, kling, mitz, sam | ||||
Priority: | P2 | Keywords: | InRadar | ||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Bug Depends on: | |||||||
Bug Blocks: | 128858 | ||||||
Attachments: |
|
Description
Andy Estes
2015-03-15 02:54:30 PDT
Created attachment 248676 [details]
Patch
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.
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. 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. Committed r181523: <http://trac.webkit.org/changeset/181523> |