Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit 0944aa2

Browse files
Consistently use Obj-C boolean literals
https://bugs.webkit.org/show_bug.cgi?id=200405 <rdar://problem/53880043> Reviewed by Simon Fraser, Joseph Pecoraro. There are places where we use equivalent but different expressions for Obj-C boolean objects. For example, we use both [NSNumber numberWithBool:YES] and @yES. There are places where both are used in the same function, such as -[WebPreferences initialize]. The boolean literal is in greater use and is more succinct, so standardize on that. Also, change @(YES/NO) to @YES/NO. Examples: * NetscapeCoreAnimationMoviePlugin/main.m: (NPP_GetValue): Source/WebCore: No new tests -- no new or changed functionality. * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): * platform/graphics/cv/ImageTransferSessionVT.mm: (WebCore::ImageTransferSessionVT::ImageTransferSessionVT): (WebCore::ImageTransferSessionVT::setSize): (WebCore::ImageTransferSessionVT::ioSurfacePixelBufferCreationOptions): * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferPool): * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm: (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): * platform/network/mac/ResourceHandleMac.mm: (WebCore::ResourceHandle::applySniffingPoliciesIfNeeded): Source/WebKit: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: (WebKit::LocalConnection::getAttestation const): Source/WebKitLegacy/mac: * History/WebHistoryItem.mm: * WebView/WebFrame.mm: (-[WebFrame _cacheabilityDictionary]): * WebView/WebPreferences.mm: (+[WebPreferences initialize]): Tools: * DumpRenderTree/mac/ObjCController.m: (-[ObjCController objectOfClass:]): * TestWebKitAPI/Tests/WebKitCocoa/BundleEditingDelegate.mm: (TEST): * TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm: (overrideAddObserverForName): * TestWebKitAPI/ios/mainIOS.mm: (main): * TestWebKitAPI/mac/InjectedBundleControllerMac.mm: (TestWebKitAPI::InjectedBundleController::platformInitialize): * TestWebKitAPI/mac/mainMac.mm: (main): * WebKitLauncher/WebKitNightlyEnabler.m: (enableWebKitNightlyBehaviour): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@248190 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 1ffa7b9 commit 0944aa2

File tree

24 files changed

+322
-201
lines changed

24 files changed

+322
-201
lines changed

Examples/ChangeLog

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
2019-08-02 Keith Rollin <[email protected]>
2+
3+
Consistently use Obj-C boolean literals
4+
https://bugs.webkit.org/show_bug.cgi?id=200405
5+
<rdar://problem/53880043>
6+
7+
Reviewed by Simon Fraser, Joseph Pecoraro.
8+
9+
There are places where we use equivalent but different expressions for
10+
Obj-C boolean objects. For example, we use both [NSNumber
11+
numberWithBool:YES] and @YES. There are places where both are used in
12+
the same function, such as -[WebPreferences initialize]. The boolean
13+
literal is in greater use and is more succinct, so standardize on
14+
that. Also, change @(YES/NO) to @YES/NO.
15+
16+
* NetscapeCoreAnimationMoviePlugin/main.m:
17+
(NPP_GetValue):
18+
119
2014-12-03 Ada Chan <[email protected]>
220

321
Add a sample plugin to demonstrate the mute plugin API.

Examples/NetscapeCoreAnimationMoviePlugin/main.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,8 @@ NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
364364

365365
if (obj->movieURL) {
366366
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:obj->movieURL, QTMovieURLAttribute,
367-
[NSNumber numberWithBool:YES], QTMovieOpenForPlaybackAttribute,
368-
[NSNumber numberWithBool:YES], QTMovieLoopsAttribute,
367+
@YES, QTMovieOpenForPlaybackAttribute,
368+
@YES, QTMovieLoopsAttribute,
369369
nil];
370370
obj->movie = [QTMovie movieWithAttributes:attributes error:nil];
371371

Source/WebCore/ChangeLog

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
2019-08-02 Keith Rollin <[email protected]>
2+
3+
Consistently use Obj-C boolean literals
4+
https://bugs.webkit.org/show_bug.cgi?id=200405
5+
<rdar://problem/53880043>
6+
7+
Reviewed by Simon Fraser, Joseph Pecoraro.
8+
9+
There are places where we use equivalent but different expressions for
10+
Obj-C boolean objects. For example, we use both [NSNumber
11+
numberWithBool:YES] and @YES. There are places where both are used in
12+
the same function, such as -[WebPreferences initialize]. The boolean
13+
literal is in greater use and is more succinct, so standardize on
14+
that. Also, change @(YES/NO) to @YES/NO.
15+
16+
No new tests -- no new or changed functionality.
17+
18+
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
19+
(WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
20+
* platform/graphics/cv/ImageTransferSessionVT.mm:
21+
(WebCore::ImageTransferSessionVT::ImageTransferSessionVT):
22+
(WebCore::ImageTransferSessionVT::setSize):
23+
(WebCore::ImageTransferSessionVT::ioSurfacePixelBufferCreationOptions):
24+
* platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
25+
(WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferPool):
26+
* platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
27+
(WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
28+
* platform/network/mac/ResourceHandleMac.mm:
29+
(WebCore::ResourceHandle::applySniffingPoliciesIfNeeded):
30+
131
2019-08-02 Andres Gonzalez <[email protected]>
232

333
Add accessibility object method to determine whether an element is inside a table cell. Needed for iOS accessibility client.

Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ static dispatch_queue_t globalDataParserQueue()
11311131
CMSampleBufferRef rawSampleCopy;
11321132
CMSampleBufferCreateCopy(kCFAllocatorDefault, platformSample.sample.cmSampleBuffer, &rawSampleCopy);
11331133
auto sampleCopy = adoptCF(rawSampleCopy);
1134-
CMSetAttachment(sampleCopy.get(), kCMSampleBufferAttachmentKey_PostNotificationWhenConsumed, (__bridge CFDictionaryRef)@{ (__bridge NSString *)kCMSampleBufferAttachmentKey_PostNotificationWhenConsumed : @(YES) }, kCMAttachmentMode_ShouldNotPropagate);
1134+
CMSetAttachment(sampleCopy.get(), kCMSampleBufferAttachmentKey_PostNotificationWhenConsumed, (__bridge CFDictionaryRef)@{ (__bridge NSString *)kCMSampleBufferAttachmentKey_PostNotificationWhenConsumed : @YES }, kCMAttachmentMode_ShouldNotPropagate);
11351135
[m_displayLayer enqueueSampleBuffer:sampleCopy.get()];
11361136
#if PLATFORM(IOS_FAMILY)
11371137
m_mediaSource->player()->setHasAvailableVideoFrame(true);

Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ static inline CFStringRef cvPixelFormatOpenGLKey()
6363
if (status != kCVReturnSuccess)
6464
RELEASE_LOG(Media, "ImageTransferSessionVT::ImageTransferSessionVT: VTSessionSetProperty(kVTPixelTransferPropertyKey_ScalingMode) failed with error %d", static_cast<int>(status));
6565

66-
status = VTSessionSetProperty(transferSession, kVTPixelTransferPropertyKey_EnableHighSpeedTransfer, @(YES));
66+
status = VTSessionSetProperty(transferSession, kVTPixelTransferPropertyKey_EnableHighSpeedTransfer, @YES);
6767
if (status != kCVReturnSuccess)
6868
RELEASE_LOG(Media, "ImageTransferSessionVT::ImageTransferSessionVT: VTSessionSetProperty(kVTPixelTransferPropertyKey_EnableHighSpeedTransfer) failed with error %d", static_cast<int>(status));
6969

70-
status = VTSessionSetProperty(transferSession, kVTPixelTransferPropertyKey_RealTime, @(YES));
70+
status = VTSessionSetProperty(transferSession, kVTPixelTransferPropertyKey_RealTime, @YES);
7171
if (status != kCVReturnSuccess)
7272
RELEASE_LOG(Media, "ImageTransferSessionVT::ImageTransferSessionVT: VTSessionSetProperty(kVTPixelTransferPropertyKey_RealTime) failed with error %d", static_cast<int>(status));
7373

7474
#if PLATFORM(IOS_FAMILY) && !PLATFORM(MACCATALYST)
75-
status = VTSessionSetProperty(transferSession, kVTPixelTransferPropertyKey_EnableHardwareAcceleratedTransfer, @(YES));
75+
status = VTSessionSetProperty(transferSession, kVTPixelTransferPropertyKey_EnableHardwareAcceleratedTransfer, @YES);
7676
if (status != kCVReturnSuccess)
7777
RELEASE_LOG(Media, "ImageTransferSessionVT::ImageTransferSessionVT: VTSessionSetProperty(kVTPixelTransferPropertyKey_EnableHardwareAcceleratedTransfer) failed with error %d", static_cast<int>(status));
7878
#endif
@@ -89,7 +89,7 @@ static inline CFStringRef cvPixelFormatOpenGLKey()
8989
(__bridge NSString *)kCVPixelBufferWidthKey : @(size.width()),
9090
(__bridge NSString *)kCVPixelBufferHeightKey : @(size.height()),
9191
(__bridge NSString *)kCVPixelBufferPixelFormatTypeKey : @(m_pixelFormat),
92-
(__bridge NSString *)cvPixelFormatOpenGLKey() : @(YES),
92+
(__bridge NSString *)cvPixelFormatOpenGLKey() : @YES,
9393
(__bridge NSString *)kCVPixelBufferIOSurfacePropertiesKey : @{ /*empty dictionary*/ },
9494
};
9595

@@ -280,7 +280,7 @@ static int32_t roundUpToMacroblockMultiple(int32_t size)
280280
return m_ioSurfaceBufferAttributes.get();
281281

282282
m_ioSurfaceBufferAttributes = (__bridge CFDictionaryRef) @{
283-
(__bridge NSString *)cvPixelFormatOpenGLKey() : @(YES),
283+
(__bridge NSString *)cvPixelFormatOpenGLKey() : @YES,
284284
};
285285

286286
#if PLATFORM(MAC)
@@ -295,7 +295,7 @@ static int32_t roundUpToMacroblockMultiple(int32_t size)
295295
&& (IOSurfaceGetBytesPerRowOfPlane(surface, 1) >= width + extendedRight)
296296
&& (IOSurfaceGetAllocSize(surface) >= (height + extendedBottom) * IOSurfaceGetBytesPerRowOfPlane(surface, 0) * 3 / 2)) {
297297
m_ioSurfaceBufferAttributes = (__bridge CFDictionaryRef) @{
298-
(__bridge NSString *)kCVPixelBufferOpenGLCompatibilityKey : @(YES),
298+
(__bridge NSString *)kCVPixelBufferOpenGLCompatibilityKey : @YES,
299299
(__bridge NSString *)kCVPixelBufferExtendedPixelsRightKey : @(extendedRight),
300300
(__bridge NSString *)kCVPixelBufferExtendedPixelsBottomKey : @(extendedBottom)
301301
};

Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@
100100
(__bridge NSString *)kCVPixelBufferWidthKey: @(width),
101101
(__bridge NSString *)kCVPixelBufferHeightKey: @(height),
102102
(__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(videoCaptureFormat),
103-
(__bridge NSString *)kCVPixelBufferCGImageCompatibilityKey: @(NO),
103+
(__bridge NSString *)kCVPixelBufferCGImageCompatibilityKey: @NO,
104104
#if PLATFORM(IOS_FAMILY)
105-
(__bridge NSString *)kCVPixelFormatOpenGLESCompatibility : @(YES),
105+
(__bridge NSString *)kCVPixelFormatOpenGLESCompatibility : @YES,
106106
#else
107-
(__bridge NSString *)kCVPixelBufferOpenGLCompatibilityKey : @(YES),
107+
(__bridge NSString *)kCVPixelBufferOpenGLCompatibilityKey : @YES,
108108
#endif
109109
(__bridge NSString *)kCVPixelBufferIOSurfacePropertiesKey : @{ }
110110
};

Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
(__bridge NSString *)kCGDisplayStreamMinimumFrameTime : @(1 / frameRate()),
150150
(__bridge NSString *)kCGDisplayStreamQueueDepth : @(screenQueueMaximumLength),
151151
(__bridge NSString *)kCGDisplayStreamColorSpace : (__bridge id)sRGBColorSpaceRef(),
152-
(__bridge NSString *)kCGDisplayStreamShowCursor : @(YES),
152+
(__bridge NSString *)kCGDisplayStreamShowCursor : @YES,
153153
};
154154

155155
auto weakThis = makeWeakPtr(*this);

Source/WebCore/platform/network/mac/ResourceHandleMac.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ static bool synchronousWillSendRequestEnabled()
124124

125125
#if USE(CFNETWORK_CONTENT_ENCODING_SNIFFING_OVERRIDE)
126126
if (!shouldContentEncodingSniff)
127-
[mutableRequest _setProperty:@(YES) forKey:(__bridge NSString *)kCFURLRequestContentDecoderSkipURLCheck];
127+
[mutableRequest _setProperty:@YES forKey:(__bridge NSString *)kCFURLRequestContentDecoderSkipURLCheck];
128128
#endif
129129

130130
if (!shouldContentSniff)
131-
[mutableRequest _setProperty:@(NO) forKey:(__bridge NSString *)_kCFURLConnectionPropertyShouldSniff];
131+
[mutableRequest _setProperty:@NO forKey:(__bridge NSString *)_kCFURLConnectionPropertyShouldSniff];
132132

133133
return mutableRequest.autorelease();
134134
}

Source/WebKit/ChangeLog

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
2019-08-02 Keith Rollin <[email protected]>
2+
3+
Consistently use Obj-C boolean literals
4+
https://bugs.webkit.org/show_bug.cgi?id=200405
5+
<rdar://problem/53880043>
6+
7+
Reviewed by Simon Fraser, Joseph Pecoraro.
8+
9+
There are places where we use equivalent but different expressions for
10+
Obj-C boolean objects. For example, we use both [NSNumber
11+
numberWithBool:YES] and @YES. There are places where both are used in
12+
the same function, such as -[WebPreferences initialize]. The boolean
13+
literal is in greater use and is more succinct, so standardize on
14+
that. Also, change @(YES/NO) to @YES/NO.
15+
16+
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
17+
(WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):
18+
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
19+
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
20+
* UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
21+
(WebKit::LocalConnection::getAttestation const):
22+
123
2019-08-02 Sihui Liu <[email protected]>
224

325
API tests using permanent credentials should clear credentials left by previous tests

Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ static float toNSURLSessionTaskPriority(WebCore::ResourceLoadPriority priority)
9898

9999
#if USE(CFNETWORK_CONTENT_ENCODING_SNIFFING_OVERRIDE)
100100
if (!shouldContentEncodingSniff)
101-
[mutableRequest _setProperty:@(YES) forKey:(NSString *)kCFURLRequestContentDecoderSkipURLCheck];
101+
[mutableRequest _setProperty:@YES forKey:(NSString *)kCFURLRequestContentDecoderSkipURLCheck];
102102
#endif
103103

104104
if (!shouldContentSniff)
105-
[mutableRequest _setProperty:@(NO) forKey:(NSString *)_kCFURLConnectionPropertyShouldSniff];
105+
[mutableRequest _setProperty:@NO forKey:(NSString *)_kCFURLConnectionPropertyShouldSniff];
106106

107107
if (!cocoaSession.m_boundInterfaceIdentifier.isNull())
108108
[mutableRequest setBoundInterfaceIdentifier:cocoaSession.m_boundInterfaceIdentifier];

0 commit comments

Comments
 (0)