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

Side by Side 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, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 *
3 * Copyright 2015, Google Inc.
4 * All rights reserved.
3 * 5 *
4 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 7 * modification, are permitted provided that the following conditions are
6 * met: 8 * met:
7 * 9 *
8 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 12 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer 13 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the 14 * in the documentation and/or other materials provided with the
13 * distribution. 15 * distribution.
14 * * Neither the name of Google Inc. nor the names of its 16 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from 17 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission. 18 * this software without specific prior written permission.
17 * 19 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
29 */ 32 */
30 33
31 #ifndef WebMediaStreamCenter_h 34 #import <Foundation/Foundation.h>
32 #define WebMediaStreamCenter_h
33 35
34 #include "WebVector.h" 36 /**
37 * A GRXWriteable is an object to which a sequence of values can be sent. The
38 * sequence finishes with an optional error.
39 */
40 @protocol GRXWriteable <NSObject>
35 41
36 namespace blink { 42 /** Push the next value of the sequence to the receiving object. */
43 - (void)writeValue:(id)value;
37 44
38 class WebAudioSourceProvider; 45 /**
39 class WebMediaStream; 46 * Signal that the sequence is completed, or that an error ocurred. After this
40 class WebMediaStreamTrack; 47 * message is sent to the instance, neither it nor writeValue: may be
48 * called again.
49 */
50 - (void)writesFinishedWithError:(NSError *)errorOrNil;
51 @end
41 52
42 class WebMediaStreamCenter { 53 typedef void (^GRXValueHandler)(id value);
43 public: 54 typedef void (^GRXCompletionHandler)(NSError *errorOrNil);
44 virtual ~WebMediaStreamCenter() { } 55 typedef void (^GRXSingleHandler)(id value, NSError *errorOrNil);
56 typedef void (^GRXEventHandler)(BOOL done, id value, NSError *error);
45 57
46 // Stream functionality. 58 /**
47 virtual void didCreateMediaStream(WebMediaStream&) = 0; 59 * Utility to create objects that conform to the GRXWriteable protocol, from
48 virtual bool didAddMediaStreamTrack(const WebMediaStream&, const WebMediaStr eamTrack&) = 0; 60 * blocks that handle each of the two methods of the protocol.
49 virtual bool didRemoveMediaStreamTrack(const WebMediaStream&, const WebMedia StreamTrack&) = 0; 61 */
50 virtual void didStopLocalMediaStream(const WebMediaStream&) = 0; 62 @interface GRXWriteable : NSObject<GRXWriteable>
51 63
52 // Track functionality. 64 + (instancetype)writeableWithSingleHandler:(GRXSingleHandler)handler;
53 virtual void didCreateMediaStreamTrack(const WebMediaStreamTrack&) { } 65 + (instancetype)writeableWithEventHandler:(GRXEventHandler)handler;
54 virtual void didEnableMediaStreamTrack(const WebMediaStreamTrack&) { }
55 virtual void didDisableMediaStreamTrack(const WebMediaStreamTrack&) { }
56 virtual bool didStopMediaStreamTrack(const WebMediaStreamTrack&) { return fa lse; }
57 66
58 // Caller must take the ownership of the returned |WebAudioSourceProvider| o bject. 67 - (instancetype)initWithValueHandler:(GRXValueHandler)valueHandler
59 virtual WebAudioSourceProvider* createWebAudioSourceFromMediaStreamTrack(con st WebMediaStreamTrack&) { return nullptr; } 68 completionHandler:(GRXCompletionHandler)completionHandler
60 }; 69 NS_DESIGNATED_INITIALIZER;
61 70 @end
62 } // namespace blink
63
64 #endif // WebMediaStreamCenter_h
65
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698