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

Side by Side Diff: third_party/grpc/src/objective-c/RxLibrary/GRXConcurrentWriteable.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
(Empty)
1 /*
2 *
3 * Copyright 2015, Google Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following disclaimer
14 * in the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Google Inc. nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
33
34 #import <Foundation/Foundation.h>
35
36 #import "GRXWriter.h"
37 #import "GRXWriteable.h"
38
39 /**
40 * This is a thread-safe wrapper over a GRXWriteable instance. It lets one enque ue calls to a
41 * GRXWriteable instance for the main thread, guaranteeing that writesFinishedWi thError: is the last
42 * message sent to it (no matter what messages are sent to the wrapper, in what order, nor from
43 * which thread). It also guarantees that, if cancelWithError: is called from th e main thread (e.g.
44 * by the app cancelling the writes), no further messages are sent to the writea ble except
45 * writesFinishedWithError:.
46 *
47 * TODO(jcanizales): Let the user specify another queue for the writeable callba cks.
48 */
49 @interface GRXConcurrentWriteable : NSObject
50
51 /**
52 * The GRXWriteable passed is the wrapped writeable.
53 * The GRXWriteable instance is retained until writesFinishedWithError: is sent to it, and released
54 * after that.
55 */
56 - (instancetype)initWithWriteable:(id<GRXWriteable>)writeable NS_DESIGNATED_INIT IALIZER;
57
58 /**
59 * Enqueues writeValue: to be sent to the writeable in the main thread.
60 * The passed handler is invoked from the main thread after writeValue: returns.
61 */
62 - (void)enqueueValue:(id)value completionHandler:(void (^)())handler;
63
64 /**
65 * Enqueues writesFinishedWithError:nil to be sent to the writeable in the main thread. After that
66 * message is sent to the writeable, all other methods of this object are effect ively noops.
67 */
68 - (void)enqueueSuccessfulCompletion;
69
70 /**
71 * If the writeable has not yet received a writesFinishedWithError: message, thi s will enqueue one
72 * to be sent to it in the main thread, and cancel all other pending messages to the writeable
73 * enqueued by this object (both past and future).
74 * The error argument cannot be nil.
75 */
76 - (void)cancelWithError:(NSError *)error;
77
78 /**
79 * Cancels all pending messages to the writeable enqueued by this object (both p ast and future).
80 * Because the writeable won't receive writesFinishedWithError:, this also relea ses the writeable.
81 */
82 - (void)cancelSilently;
83 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698