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

Side by Side Diff: components/cronet/ios/cronet_c_for_grpc.h

Issue 1915683002: Export only Cronet API symbols and hide all others. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Canceled auto-formatting 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_CRONET_IOS_CRONET_C_FOR_GRPC_H_ 5 #ifndef COMPONENTS_CRONET_IOS_CRONET_C_FOR_GRPC_H_
6 #define COMPONENTS_CRONET_IOS_CRONET_C_FOR_GRPC_H_ 6 #define COMPONENTS_CRONET_IOS_CRONET_C_FOR_GRPC_H_
7 7
8 #ifdef __cplusplus 8 #ifdef __cplusplus
9 extern "C" { 9 extern "C" {
10 #endif 10 #endif
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 * methods are invoked synchronously on the |engine| network thread, but must 119 * methods are invoked synchronously on the |engine| network thread, but must
120 * not run tasks on the current thread to prevent blocking networking operations 120 * not run tasks on the current thread to prevent blocking networking operations
121 * and causing exceptions during shutdown. The |annotation| is stored in 121 * and causing exceptions during shutdown. The |annotation| is stored in
122 * bidirectional stream for arbitrary use by application. 122 * bidirectional stream for arbitrary use by application.
123 * 123 *
124 * Returned |cronet_bidirectional_stream*| is owned by the caller, and must be 124 * Returned |cronet_bidirectional_stream*| is owned by the caller, and must be
125 * destroyed using |cronet_bidirectional_stream_destroy|. 125 * destroyed using |cronet_bidirectional_stream_destroy|.
126 * 126 *
127 * Both |calback| and |engine| must remain valid until stream is destroyed. 127 * Both |calback| and |engine| must remain valid until stream is destroyed.
128 */ 128 */
129 __attribute__((visibility("default")))
129 cronet_bidirectional_stream* cronet_bidirectional_stream_create( 130 cronet_bidirectional_stream* cronet_bidirectional_stream_create(
130 cronet_engine* engine, 131 cronet_engine* engine,
131 void* annotation, 132 void* annotation,
132 cronet_bidirectional_stream_callback* callback); 133 cronet_bidirectional_stream_callback* callback);
133 134
134 /* TBD: The following methods return int. Should it be a custom type? */ 135 /* TBD: The following methods return int. Should it be a custom type? */
135 136
136 /* Destroy stream object. Destroy could be called from any thread, including 137 /* Destroy stream object. Destroy could be called from any thread, including
137 * network thread, but is posted, so |stream| is valid until calling task is 138 * network thread, but is posted, so |stream| is valid until calling task is
138 * complete. 139 * complete.
139 */ 140 */
141 __attribute__((visibility("default")))
140 int cronet_bidirectional_stream_destroy(cronet_bidirectional_stream* stream); 142 int cronet_bidirectional_stream_destroy(cronet_bidirectional_stream* stream);
141 143
142 /* Start the stream by sending request to |url| using |method| and |headers|. If 144 /* Start the stream by sending request to |url| using |method| and |headers|. If
143 * |end_of_stream| is true, then no data is expected to be written. The |method| 145 * |end_of_stream| is true, then no data is expected to be written. The |method|
144 * is HTTP verb, with PUT having a special meaning to mark idempotent request, 146 * is HTTP verb, with PUT having a special meaning to mark idempotent request,
145 * which could use QUIC 0-RTT. 147 * which could use QUIC 0-RTT.
146 */ 148 */
149 __attribute__((visibility("default")))
147 int cronet_bidirectional_stream_start( 150 int cronet_bidirectional_stream_start(
148 cronet_bidirectional_stream* stream, 151 cronet_bidirectional_stream* stream,
149 const char* url, 152 const char* url,
150 int priority, 153 int priority,
151 const char* method, 154 const char* method,
152 const cronet_bidirectional_stream_header_array* headers, 155 const cronet_bidirectional_stream_header_array* headers,
153 bool end_of_stream); 156 bool end_of_stream);
154 157
155 /* Read response data into |buffer| of |capacity| length. Must only be called at 158 /* Read response data into |buffer| of |capacity| length. Must only be called at
156 * most once in response to each invocation of the 159 * most once in response to each invocation of the
157 * on_response_headers_received() and on_read_completed() methods of the 160 * on_response_headers_received() and on_read_completed() methods of the
158 * cronet_bidirectional_stream_callback. 161 * cronet_bidirectional_stream_callback.
159 * Each call will result in an invocation of the callback's 162 * Each call will result in an invocation of the callback's
160 * on_read_completed() method if data is read, or its on_failed() method if 163 * on_read_completed() method if data is read, or its on_failed() method if
161 * there's an error. The callback's on_succeeded() method is also invoked if 164 * there's an error. The callback's on_succeeded() method is also invoked if
162 * there is no more data to read and |end_of_stream| was previously sent. 165 * there is no more data to read and |end_of_stream| was previously sent.
163 */ 166 */
167 __attribute__((visibility("default")))
164 int cronet_bidirectional_stream_read(cronet_bidirectional_stream* stream, 168 int cronet_bidirectional_stream_read(cronet_bidirectional_stream* stream,
165 char* buffer, 169 char* buffer,
166 int capacity); 170 int capacity);
167 171
168 /* Write request data from |buffer| of |buffer_length| length. Must only be 172 /* Write request data from |buffer| of |buffer_length| length. Must only be
169 * called at most once in response to each invocation of the 173 * called at most once in response to each invocation of the
170 * on_request_headers_sent() and on_write_completed() methods of the 174 * on_request_headers_sent() and on_write_completed() methods of the
171 * cronet_bidirectional_stream_callback. 175 * cronet_bidirectional_stream_callback.
172 * Each call will result in an invocation the callback's on_write_completed() 176 * Each call will result in an invocation the callback's on_write_completed()
173 * method if data is sent, or its on_failed() method if there's an error. 177 * method if data is sent, or its on_failed() method if there's an error.
174 * The callback's on_succeeded() method is also invoked if |end_of_stream| is 178 * The callback's on_succeeded() method is also invoked if |end_of_stream| is
175 * set and all response data has been read. 179 * set and all response data has been read.
176 */ 180 */
181 __attribute__((visibility("default")))
177 int cronet_bidirectional_stream_write(cronet_bidirectional_stream* stream, 182 int cronet_bidirectional_stream_write(cronet_bidirectional_stream* stream,
178 const char* buffer, 183 const char* buffer,
179 int buffer_length, 184 int buffer_length,
180 bool end_of_stream); 185 bool end_of_stream);
181 186
182 /* Cancels the stream. Can be called at any time after 187 /* Cancels the stream. Can be called at any time after
183 * cronet_bidirectional_stream_start(). The on_canceled() method of 188 * cronet_bidirectional_stream_start(). The on_canceled() method of
184 * cronet_bidirectional_stream_callback will be invoked when cancelation 189 * cronet_bidirectional_stream_callback will be invoked when cancelation
185 * is complete and no further callback methods will be invoked. If the 190 * is complete and no further callback methods will be invoked. If the
186 * stream has completed or has not started, calling 191 * stream has completed or has not started, calling
187 * cronet_bidirectional_stream_cancel() has no effect and on_canceled() will not 192 * cronet_bidirectional_stream_cancel() has no effect and on_canceled() will not
188 * be invoked. At most one callback method may be invoked after 193 * be invoked. At most one callback method may be invoked after
189 * cronet_bidirectional_stream_cancel() has completed. 194 * cronet_bidirectional_stream_cancel() has completed.
190 */ 195 */
196 __attribute__((visibility("default")))
191 int cronet_bidirectional_stream_cancel(cronet_bidirectional_stream* stream); 197 int cronet_bidirectional_stream_cancel(cronet_bidirectional_stream* stream);
192 198
193 /* Returns true if the |stream| was successfully started and is now done 199 /* Returns true if the |stream| was successfully started and is now done
194 * (succeeded, canceled, or failed). 200 * (succeeded, canceled, or failed).
195 * Returns false if the |stream| stream is not yet started or is in progress. 201 * Returns false if the |stream| stream is not yet started or is in progress.
196 */ 202 */
203 __attribute__((visibility("default")))
197 bool cronet_bidirectional_stream_is_done(cronet_bidirectional_stream* stream); 204 bool cronet_bidirectional_stream_is_done(cronet_bidirectional_stream* stream);
198 205
199 #ifdef __cplusplus 206 #ifdef __cplusplus
200 } 207 }
201 #endif 208 #endif
202 209
203 #endif // COMPONENTS_CRONET_IOS_CRONET_C_FOR_GRPC_H_ 210 #endif // COMPONENTS_CRONET_IOS_CRONET_C_FOR_GRPC_H_
OLDNEW
« components/cronet/ios/Cronet.h ('K') | « components/cronet/ios/Cronet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698