Index: third_party/grpc/src/objective-c/RxLibrary/GRXWriteable.h |
diff --git a/third_party/WebKit/public/platform/WebMediaStreamCenter.h b/third_party/grpc/src/objective-c/RxLibrary/GRXWriteable.h |
similarity index 55% |
copy from third_party/WebKit/public/platform/WebMediaStreamCenter.h |
copy to third_party/grpc/src/objective-c/RxLibrary/GRXWriteable.h |
index b805d075a35ad720d9e56ae8ece728e8b2a26431..7fe805c6638978051a37ac3aae96a77bc7c5ab31 100644 |
--- a/third_party/WebKit/public/platform/WebMediaStreamCenter.h |
+++ b/third_party/grpc/src/objective-c/RxLibrary/GRXWriteable.h |
@@ -1,5 +1,7 @@ |
/* |
- * Copyright (C) 2012 Google Inc. All rights reserved. |
+ * |
+ * Copyright 2015, Google Inc. |
+ * All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions are |
@@ -26,40 +28,43 @@ |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+ * |
*/ |
-#ifndef WebMediaStreamCenter_h |
-#define WebMediaStreamCenter_h |
- |
-#include "WebVector.h" |
- |
-namespace blink { |
+#import <Foundation/Foundation.h> |
-class WebAudioSourceProvider; |
-class WebMediaStream; |
-class WebMediaStreamTrack; |
- |
-class WebMediaStreamCenter { |
-public: |
- virtual ~WebMediaStreamCenter() { } |
+/** |
+ * A GRXWriteable is an object to which a sequence of values can be sent. The |
+ * sequence finishes with an optional error. |
+ */ |
+@protocol GRXWriteable <NSObject> |
- // Stream functionality. |
- virtual void didCreateMediaStream(WebMediaStream&) = 0; |
- virtual bool didAddMediaStreamTrack(const WebMediaStream&, const WebMediaStreamTrack&) = 0; |
- virtual bool didRemoveMediaStreamTrack(const WebMediaStream&, const WebMediaStreamTrack&) = 0; |
- virtual void didStopLocalMediaStream(const WebMediaStream&) = 0; |
+/** Push the next value of the sequence to the receiving object. */ |
+- (void)writeValue:(id)value; |
- // Track functionality. |
- virtual void didCreateMediaStreamTrack(const WebMediaStreamTrack&) { } |
- virtual void didEnableMediaStreamTrack(const WebMediaStreamTrack&) { } |
- virtual void didDisableMediaStreamTrack(const WebMediaStreamTrack&) { } |
- virtual bool didStopMediaStreamTrack(const WebMediaStreamTrack&) { return false; } |
+/** |
+ * Signal that the sequence is completed, or that an error ocurred. After this |
+ * message is sent to the instance, neither it nor writeValue: may be |
+ * called again. |
+ */ |
+- (void)writesFinishedWithError:(NSError *)errorOrNil; |
+@end |
- // Caller must take the ownership of the returned |WebAudioSourceProvider| object. |
- virtual WebAudioSourceProvider* createWebAudioSourceFromMediaStreamTrack(const WebMediaStreamTrack&) { return nullptr; } |
-}; |
+typedef void (^GRXValueHandler)(id value); |
+typedef void (^GRXCompletionHandler)(NSError *errorOrNil); |
+typedef void (^GRXSingleHandler)(id value, NSError *errorOrNil); |
+typedef void (^GRXEventHandler)(BOOL done, id value, NSError *error); |
-} // namespace blink |
+/** |
+ * Utility to create objects that conform to the GRXWriteable protocol, from |
+ * blocks that handle each of the two methods of the protocol. |
+ */ |
+@interface GRXWriteable : NSObject<GRXWriteable> |
-#endif // WebMediaStreamCenter_h |
++ (instancetype)writeableWithSingleHandler:(GRXSingleHandler)handler; |
++ (instancetype)writeableWithEventHandler:(GRXEventHandler)handler; |
+- (instancetype)initWithValueHandler:(GRXValueHandler)valueHandler |
+ completionHandler:(GRXCompletionHandler)completionHandler |
+ NS_DESIGNATED_INITIALIZER; |
+@end |