Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: third_party/grpc/src/objective-c/RxLibrary/GRXWriteable.h

Issue 1932353002: Initial checkin of gRPC to third_party/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698