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

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: Defined CRONET_EXPORT 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
« no previous file with comments | « components/cronet/ios/Cronet.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #define CRONET_EXPORT __attribute__((visibility("default")))
9
8 #ifdef __cplusplus 10 #ifdef __cplusplus
9 extern "C" { 11 extern "C" {
10 #endif 12 #endif
11 13
12 #include <stddef.h> 14 #include <stddef.h>
13 15
14 /* Cronet Engine API. */ 16 /* Cronet Engine API. */
15 17
16 /* Opaque object representing Cronet Engine. Created and configured outside 18 /* Opaque object representing Cronet Engine. Created and configured outside
17 * of this API to facilitate sharing with other components */ 19 * of this API to facilitate sharing with other components */
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 * methods are invoked synchronously on the |engine| network thread, but must 121 * methods are invoked synchronously on the |engine| network thread, but must
120 * not run tasks on the current thread to prevent blocking networking operations 122 * not run tasks on the current thread to prevent blocking networking operations
121 * and causing exceptions during shutdown. The |annotation| is stored in 123 * and causing exceptions during shutdown. The |annotation| is stored in
122 * bidirectional stream for arbitrary use by application. 124 * bidirectional stream for arbitrary use by application.
123 * 125 *
124 * Returned |cronet_bidirectional_stream*| is owned by the caller, and must be 126 * Returned |cronet_bidirectional_stream*| is owned by the caller, and must be
125 * destroyed using |cronet_bidirectional_stream_destroy|. 127 * destroyed using |cronet_bidirectional_stream_destroy|.
126 * 128 *
127 * Both |calback| and |engine| must remain valid until stream is destroyed. 129 * Both |calback| and |engine| must remain valid until stream is destroyed.
128 */ 130 */
131 CRONET_EXPORT
129 cronet_bidirectional_stream* cronet_bidirectional_stream_create( 132 cronet_bidirectional_stream* cronet_bidirectional_stream_create(
130 cronet_engine* engine, 133 cronet_engine* engine,
131 void* annotation, 134 void* annotation,
132 cronet_bidirectional_stream_callback* callback); 135 cronet_bidirectional_stream_callback* callback);
133 136
134 /* TBD: The following methods return int. Should it be a custom type? */ 137 /* TBD: The following methods return int. Should it be a custom type? */
135 138
136 /* Destroy stream object. Destroy could be called from any thread, including 139 /* 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 140 * network thread, but is posted, so |stream| is valid until calling task is
138 * complete. 141 * complete.
139 */ 142 */
143 CRONET_EXPORT
140 int cronet_bidirectional_stream_destroy(cronet_bidirectional_stream* stream); 144 int cronet_bidirectional_stream_destroy(cronet_bidirectional_stream* stream);
141 145
142 /* Start the stream by sending request to |url| using |method| and |headers|. If 146 /* 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| 147 * |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, 148 * is HTTP verb, with PUT having a special meaning to mark idempotent request,
145 * which could use QUIC 0-RTT. 149 * which could use QUIC 0-RTT.
146 */ 150 */
151 CRONET_EXPORT
147 int cronet_bidirectional_stream_start( 152 int cronet_bidirectional_stream_start(
148 cronet_bidirectional_stream* stream, 153 cronet_bidirectional_stream* stream,
149 const char* url, 154 const char* url,
150 int priority, 155 int priority,
151 const char* method, 156 const char* method,
152 const cronet_bidirectional_stream_header_array* headers, 157 const cronet_bidirectional_stream_header_array* headers,
153 bool end_of_stream); 158 bool end_of_stream);
154 159
155 /* Read response data into |buffer| of |capacity| length. Must only be called at 160 /* Read response data into |buffer| of |capacity| length. Must only be called at
156 * most once in response to each invocation of the 161 * most once in response to each invocation of the
157 * on_response_headers_received() and on_read_completed() methods of the 162 * on_response_headers_received() and on_read_completed() methods of the
158 * cronet_bidirectional_stream_callback. 163 * cronet_bidirectional_stream_callback.
159 * Each call will result in an invocation of the callback's 164 * 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 165 * 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 166 * 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. 167 * there is no more data to read and |end_of_stream| was previously sent.
163 */ 168 */
169 CRONET_EXPORT
164 int cronet_bidirectional_stream_read(cronet_bidirectional_stream* stream, 170 int cronet_bidirectional_stream_read(cronet_bidirectional_stream* stream,
165 char* buffer, 171 char* buffer,
166 int capacity); 172 int capacity);
167 173
168 /* Write request data from |buffer| of |buffer_length| length. Must only be 174 /* Write request data from |buffer| of |buffer_length| length. Must only be
169 * called at most once in response to each invocation of the 175 * called at most once in response to each invocation of the
170 * on_request_headers_sent() and on_write_completed() methods of the 176 * on_request_headers_sent() and on_write_completed() methods of the
171 * cronet_bidirectional_stream_callback. 177 * cronet_bidirectional_stream_callback.
172 * Each call will result in an invocation the callback's on_write_completed() 178 * 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. 179 * 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 180 * The callback's on_succeeded() method is also invoked if |end_of_stream| is
175 * set and all response data has been read. 181 * set and all response data has been read.
176 */ 182 */
183 CRONET_EXPORT
177 int cronet_bidirectional_stream_write(cronet_bidirectional_stream* stream, 184 int cronet_bidirectional_stream_write(cronet_bidirectional_stream* stream,
178 const char* buffer, 185 const char* buffer,
179 int buffer_length, 186 int buffer_length,
180 bool end_of_stream); 187 bool end_of_stream);
181 188
182 /* Cancels the stream. Can be called at any time after 189 /* Cancels the stream. Can be called at any time after
183 * cronet_bidirectional_stream_start(). The on_canceled() method of 190 * cronet_bidirectional_stream_start(). The on_canceled() method of
184 * cronet_bidirectional_stream_callback will be invoked when cancelation 191 * cronet_bidirectional_stream_callback will be invoked when cancelation
185 * is complete and no further callback methods will be invoked. If the 192 * is complete and no further callback methods will be invoked. If the
186 * stream has completed or has not started, calling 193 * stream has completed or has not started, calling
187 * cronet_bidirectional_stream_cancel() has no effect and on_canceled() will not 194 * cronet_bidirectional_stream_cancel() has no effect and on_canceled() will not
188 * be invoked. At most one callback method may be invoked after 195 * be invoked. At most one callback method may be invoked after
189 * cronet_bidirectional_stream_cancel() has completed. 196 * cronet_bidirectional_stream_cancel() has completed.
190 */ 197 */
198 CRONET_EXPORT
191 int cronet_bidirectional_stream_cancel(cronet_bidirectional_stream* stream); 199 int cronet_bidirectional_stream_cancel(cronet_bidirectional_stream* stream);
192 200
193 /* Returns true if the |stream| was successfully started and is now done 201 /* Returns true if the |stream| was successfully started and is now done
194 * (succeeded, canceled, or failed). 202 * (succeeded, canceled, or failed).
195 * Returns false if the |stream| stream is not yet started or is in progress. 203 * Returns false if the |stream| stream is not yet started or is in progress.
196 */ 204 */
205 CRONET_EXPORT
197 bool cronet_bidirectional_stream_is_done(cronet_bidirectional_stream* stream); 206 bool cronet_bidirectional_stream_is_done(cronet_bidirectional_stream* stream);
198 207
199 #ifdef __cplusplus 208 #ifdef __cplusplus
200 } 209 }
201 #endif 210 #endif
202 211
203 #endif // COMPONENTS_CRONET_IOS_CRONET_C_FOR_GRPC_H_ 212 #endif // COMPONENTS_CRONET_IOS_CRONET_C_FOR_GRPC_H_
OLDNEW
« no previous file with comments | « components/cronet/ios/Cronet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698