Summary: As we've now finally got rid if the need for this abstraction, we can remove it entirely.

Reviewed By: dtorres, marekcirkos

Differential Revision: D6468396

fbshipit-source-id: 2239b89b755e3958d8c778319e93016907ccfc20
This commit is contained in:
Lawrence Lomax 2017-12-06 06:01:04 -08:00 коммит произвёл Facebook Github Bot
Родитель 2099a6b05e
Коммит 0115ae0228
11 изменённых файлов: 41 добавлений и 99 удалений

Просмотреть файл

@ -12,7 +12,6 @@
#import <FBControlCore/FBEventReporter.h>
#import <FBControlCore/FBFuture.h>
#import <FBControlCore/FBiOSTargetFuture.h>
#import <FBControlCore/FBTerminationHandle.h>
NS_ASSUME_NONNULL_BEGIN

Просмотреть файл

@ -1,38 +0,0 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <Foundation/Foundation.h>
#import <FBControlCore/FBFuture.h>
NS_ASSUME_NONNULL_BEGIN
/**
Extensible Diagnostic Name Enumeration.
*/
typedef NSString *FBTerminationHandleType NS_EXTENSIBLE_STRING_ENUM;
/**
Simple protocol that allows asynchronous operations to be terminated.
*/
@protocol FBTerminationHandle <NSObject>
/**
Terminates the asynchronous operation.
*/
- (void)terminate;
/**
The Type of Termination Handle.
*/
@property (nonatomic, copy, readonly) FBTerminationHandleType handleType;
@end
NS_ASSUME_NONNULL_END

Просмотреть файл

@ -11,10 +11,10 @@
#import <FBControlCore/FBFuture.h>
#import <FBControlCore/FBTestLaunchConfiguration.h>
#import <FBControlCore/FBTerminationHandle.h>
NS_ASSUME_NONNULL_BEGIN
@class FBTestLaunchConfiguration;
@protocol FBControlCoreLogger;
@protocol FBTestManagerTestReporter;
@ -23,8 +23,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
extern FBiOSTargetFutureType const FBiOSTargetFutureTypeTestOperation;
@class FBTestLaunchConfiguration;
/**
Commands to perform on an iOS Target, related to XCTest.
*/
@ -40,6 +38,7 @@ extern FBiOSTargetFutureType const FBiOSTargetFutureTypeTestOperation;
@return a Future, wrapping a test operation.
*/
- (FBFuture<id<FBiOSTargetContinuation>> *)startTestWithLaunchConfiguration:(FBTestLaunchConfiguration *)testLaunchConfiguration reporter:(nullable id<FBTestManagerTestReporter>)reporter logger:(id<FBControlCoreLogger>)logger;
/**
Lists the testables for a provided test bundle.

Просмотреть файл

@ -74,7 +74,6 @@
#import <FBControlCore/FBSubstringUtilities.h>
#import <FBControlCore/FBTask.h>
#import <FBControlCore/FBTaskBuilder.h>
#import <FBControlCore/FBTerminationHandle.h>
#import <FBControlCore/FBTestLaunchConfiguration.h>
#import <FBControlCore/FBUploadBuffer.h>
#import <FBControlCore/FBVideoRecordingCommands.h>

Просмотреть файл

@ -9,7 +9,6 @@
#import <Foundation/Foundation.h>
#import <FBControlCore/FBTerminationHandle.h>
#import <FBControlCore/FBFuture.h>
NS_ASSUME_NONNULL_BEGIN
@ -22,15 +21,10 @@ NS_ASSUME_NONNULL_BEGIN
*/
extern NSString *const FBTaskErrorDomain;
/**
The Termination Handle Type for a Task.
*/
extern FBTerminationHandleType const FBTerminationHandleTypeTask;
/**
Programmatic interface to a Task.
*/
@interface FBTask : NSObject <FBTerminationHandle>
@interface FBTask : NSObject
#pragma mark Initializers
@ -117,6 +111,11 @@ extern FBTerminationHandleType const FBTerminationHandleTypeTask;
*/
- (nullable NSError *)error;
/**
Cancels the Task.
*/
- (void)terminate;
/**
Returns YES if the task has terminated, NO otherwise.
*/

Просмотреть файл

@ -21,7 +21,6 @@
#pragma clang diagnostic ignored "-Warc-retain-cycles"
NSString *const FBTaskErrorDomain = @"com.facebook.FBControlCore.task";
FBTerminationHandleType const FBTerminationHandleTypeTask = @"Task";
@protocol FBTaskOutput <NSObject>
@ -424,19 +423,7 @@ FBTerminationHandleType const FBTerminationHandleTypeTask = @"Task";
return self;
}
#pragma mark - FBTerminationHandle Protocol
- (void)terminate
{
[self terminateWithErrorMessage:nil];
}
- (FBTerminationHandleType)handleType
{
return FBTerminationHandleTypeTask;
}
#pragma mark - FBTask Protocl
#pragma mark - FBTask Protocol
#pragma mark Starting
@ -516,6 +503,11 @@ FBTerminationHandleType const FBTerminationHandleTypeTask = @"Task";
return [error build];
}
- (void)terminate
{
[self terminateWithErrorMessage:nil];
}
- (BOOL)hasTerminated
{
return self.completedTeardown;

Просмотреть файл

@ -9,19 +9,14 @@
#import <Foundation/Foundation.h>
#import <FBControlCore/FBTerminationHandle.h>
NS_ASSUME_NONNULL_BEGIN
/**
The Termination Handle type for a Dispatch Source.
*/
extern FBTerminationHandleType const FBTerminationHandleTypeDispatchSource;
/**
A class for wrapping `dispatch_source` with some conveniences.
*/
@interface FBDispatchSourceNotifier : NSObject <FBTerminationHandle>
@interface FBDispatchSourceNotifier : NSObject
#pragma mark Constructors
/**
Creates and returns an `FBDispatchSourceNotifier` that will call the `handler` when the provided `processIdentifier` quits
@ -41,6 +36,15 @@ extern FBTerminationHandleType const FBTerminationHandleTypeDispatchSource;
*/
+ (instancetype)timerNotifierNotifierWithTimeInterval:(uint64_t)timeInterval queue:(dispatch_queue_t)queue handler:(void (^)(FBDispatchSourceNotifier *))handler;
#pragma mark Public Methods
/**
Stops the Notifier.
*/
- (void)terminate;
#pragma mark Properties
/**
The Wrapped Dispatch Source.
*/

Просмотреть файл

@ -9,10 +9,10 @@
#import "FBDispatchSourceNotifier.h"
FBTerminationHandleType const FBTerminationHandleTypeDispatchSource = @"DispatchSource";
@implementation FBDispatchSourceNotifier
#pragma mark Initializers
+ (instancetype)processTerminationNotifierForProcessIdentifier:(pid_t)processIdentifier queue:(dispatch_queue_t)queue handler:(void (^)(FBDispatchSourceNotifier *))handler
{
dispatch_source_t dispatchSource = dispatch_source_create(
@ -53,6 +53,8 @@ FBTerminationHandleType const FBTerminationHandleTypeDispatchSource = @"Dispatch
return self;
}
#pragma mark Public
- (void)terminate
{
if (self.dispatchSource) {
@ -61,11 +63,6 @@ FBTerminationHandleType const FBTerminationHandleTypeDispatchSource = @"Dispatch
}
}
- (FBTerminationHandleType)handleType
{
return FBTerminationHandleTypeDispatchSource;
}
- (void)dealloc
{
[self terminate];

Просмотреть файл

@ -259,7 +259,6 @@
AA719E4A1D672D6300947611 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AAC8B2621CEC55370034A865 /* Foundation.framework */; };
AA71A1171FA8E49D00BB10DA /* FBControlCoreRunLoopTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71A1161FA8E49D00BB10DA /* FBControlCoreRunLoopTests.m */; };
AA7219F41D82973E002668BF /* FBSimulatorConfigurationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AA7219F31D82973E002668BF /* FBSimulatorConfigurationTests.m */; };
AA722D981F588022000FB6D3 /* FBTerminationHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = AA722D961F58801A000FB6D3 /* FBTerminationHandle.h */; settings = {ATTRIBUTES = (Public, ); }; };
AA7414F01CE3102F00C9641D /* FBTestBundleConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7414EE1CE3102F00C9641D /* FBTestBundleConnection.h */; };
AA7414F11CE3102F00C9641D /* FBTestBundleConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = AA7414EF1CE3102F00C9641D /* FBTestBundleConnection.m */; };
AA7728AE1E5238A6008FCF7C /* FBFileWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7728AC1E5238A6008FCF7C /* FBFileWriter.h */; settings = {ATTRIBUTES = (Public, ); }; };
@ -1179,7 +1178,6 @@
AA6F98EA1D2B9C8E00464B0F /* FBBinaryDescriptor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBBinaryDescriptor.m; sourceTree = "<group>"; };
AA71A1161FA8E49D00BB10DA /* FBControlCoreRunLoopTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FBControlCoreRunLoopTests.m; sourceTree = "<group>"; };
AA7219F31D82973E002668BF /* FBSimulatorConfigurationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSimulatorConfigurationTests.m; sourceTree = "<group>"; };
AA722D961F58801A000FB6D3 /* FBTerminationHandle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FBTerminationHandle.h; sourceTree = "<group>"; };
AA7414EE1CE3102F00C9641D /* FBTestBundleConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBTestBundleConnection.h; sourceTree = "<group>"; };
AA7414EF1CE3102F00C9641D /* FBTestBundleConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBTestBundleConnection.m; sourceTree = "<group>"; };
AA7728AC1E5238A6008FCF7C /* FBFileWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBFileWriter.h; sourceTree = "<group>"; };
@ -1718,7 +1716,6 @@
children = (
AA0848791F3F499800A4BA60 /* FBFuture.h */,
AA08487A1F3F499800A4BA60 /* FBFuture.m */,
AA722D961F58801A000FB6D3 /* FBTerminationHandle.h */,
AAD0FA161FA1CA9200EBCEA8 /* NSRunLoop+FBControlCore.h */,
AAD0FA151FA1CA9200EBCEA8 /* NSRunLoop+FBControlCore.m */,
);
@ -3427,7 +3424,6 @@
AABBF32B1DAC112900E2B6AF /* FBTaskConfiguration.h in Headers */,
EE2EC7AC1CAC3F97009A7BB1 /* FBWeakFramework.h in Headers */,
AAEA9C251DB4EB16009642CB /* FBDiagnosticQuery.h in Headers */,
AA722D981F588022000FB6D3 /* FBTerminationHandle.h in Headers */,
EEBD606A1C9062E900298A07 /* FBDebugDescribeable.h in Headers */,
D76F950D1F56D6700003D341 /* FBTestLaunchConfiguration.h in Headers */,
D76F95091F56D65C0003D341 /* FBXCTestCommands.h in Headers */,

Просмотреть файл

@ -9,23 +9,18 @@
#import <Foundation/Foundation.h>
#import <FBControlCore/FBTerminationHandle.h>
NS_ASSUME_NONNULL_BEGIN
@class FBSimulator;
@class FBSimulatorSet;
@class SimDevice;
NS_ASSUME_NONNULL_BEGIN
/**
The Termination Handle Type.
A Notifies of Lifecycle events in CoreSimulator.
*/
extern FBTerminationHandleType const FBTerminationHandleTypeCoreSimulatorNotifier;
@interface FBCoreSimulatorNotifier : NSObject
/**
A class for wrapping Core Simulator Notifiers in a `FBTerminationHandle`
*/
@interface FBCoreSimulatorNotifier : NSObject <FBTerminationHandle>
#pragma mark Initializers
/**
Creates and returns an FBSimDeviceNotifier for the lifecycle events that SimDevice broadcasts.
@ -47,6 +42,13 @@ extern FBTerminationHandleType const FBTerminationHandleTypeCoreSimulatorNotifie
*/
+ (instancetype)notifierForSet:(FBSimulatorSet *)set queue:(dispatch_queue_t)queue block:(void (^)(NSDictionary *info))block;
#pragma mark Public Methods
/**
Terminates the Notifier.
*/
- (void)terminate;
@end
NS_ASSUME_NONNULL_END

Просмотреть файл

@ -17,8 +17,6 @@
#import "FBSimulator.h"
#import "FBSimulatorSet.h"
FBTerminationHandleType const FBTerminationHandleTypeCoreSimulatorNotifier = @"CoreSimulatorNotifier";
@interface FBCoreSimulatorNotifier ()
@property (nonatomic, readonly, assign) unsigned long long handle;
@ -62,9 +60,4 @@ FBTerminationHandleType const FBTerminationHandleTypeCoreSimulatorNotifier = @"C
[self.notifier unregisterNotificationHandler:self.handle error:nil];
}
- (FBTerminationHandleType)handleType
{
return FBTerminationHandleTypeCoreSimulatorNotifier;
}
@end