Skip to content

Commit

Permalink
Merge pull request grpc#8684 from gcasto/change_cronet_interface
Browse files Browse the repository at this point in the history
Change cronet interface
  • Loading branch information
muxi authored Jan 18, 2017
2 parents fc42fd5 + 5c5aa6b commit 5687c2e
Show file tree
Hide file tree
Showing 12 changed files with 341 additions and 305 deletions.
2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ grpc_cc_library(
"src/core/ext/transport/cronet/transport/cronet_transport.c",
],
hdrs = [
"third_party/objective_c/Cronet/cronet_c_for_grpc.h",
"third_party/Cronet/bidirectional_stream_c.h",
],
language = "c",
public_hdrs = [
Expand Down
2 changes: 1 addition & 1 deletion build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ filegroups:
- include/grpc/grpc_security.h
- include/grpc/grpc_security_constants.h
headers:
- third_party/objective_c/Cronet/cronet_c_for_grpc.h
- third_party/Cronet/bidirectional_stream_c.h
src:
- src/core/ext/transport/cronet/client/secure/cronet_channel_create.c
- src/core/ext/transport/cronet/transport/cronet_api_dummy.c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ GRPCAPI grpc_channel *grpc_cronet_secure_channel_create(
ct->host = gpr_malloc(strlen(target) + 1);
strcpy(ct->host, target);
gpr_log(GPR_DEBUG,
"grpc_create_cronet_transport: cronet_engine = %p, target=%s", engine,
"grpc_create_cronet_transport: stream_engine = %p, target=%s", engine,
ct->host);

grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
Expand Down
30 changes: 14 additions & 16 deletions src/core/ext/transport/cronet/transport/cronet_api_dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,48 +38,46 @@ library, so we can build it in all environments */

#include <grpc/support/log.h>

#include "third_party/objective_c/Cronet/cronet_c_for_grpc.h"
#include "third_party/Cronet/bidirectional_stream_c.h"

#ifdef GRPC_COMPILE_WITH_CRONET
/* link with the real CRONET library in the build system */
#else
/* Dummy implementation of cronet API just to test for build-ability */
cronet_bidirectional_stream* cronet_bidirectional_stream_create(
cronet_engine* engine, void* annotation,
cronet_bidirectional_stream_callback* callback) {
bidirectional_stream* bidirectional_stream_create(
stream_engine* engine, void* annotation,
bidirectional_stream_callback* callback) {
GPR_ASSERT(0);
return NULL;
}

int cronet_bidirectional_stream_destroy(cronet_bidirectional_stream* stream) {
int bidirectional_stream_destroy(bidirectional_stream* stream) {
GPR_ASSERT(0);
return 0;
}

int cronet_bidirectional_stream_start(
cronet_bidirectional_stream* stream, const char* url, int priority,
const char* method, const cronet_bidirectional_stream_header_array* headers,
bool end_of_stream) {
int bidirectional_stream_start(bidirectional_stream* stream, const char* url,
int priority, const char* method,
const bidirectional_stream_header_array* headers,
bool end_of_stream) {
GPR_ASSERT(0);
return 0;
}

int cronet_bidirectional_stream_read(cronet_bidirectional_stream* stream,
char* buffer, int capacity) {
int bidirectional_stream_read(bidirectional_stream* stream, char* buffer,
int capacity) {
GPR_ASSERT(0);
return 0;
}

int cronet_bidirectional_stream_write(cronet_bidirectional_stream* stream,
const char* buffer, int count,
bool end_of_stream) {
int bidirectional_stream_write(bidirectional_stream* stream, const char* buffer,
int count, bool end_of_stream) {
GPR_ASSERT(0);
return 0;
}

int cronet_bidirectional_stream_cancel(cronet_bidirectional_stream* stream) {
void bidirectional_stream_cancel(bidirectional_stream* stream) {
GPR_ASSERT(0);
return 0;
}

#endif /* GRPC_COMPILE_WITH_CRONET */
Loading

0 comments on commit 5687c2e

Please sign in to comment.