diff
stringlengths 41
2.03M
| msg
stringlengths 1
1.5k
⌀ | repo
stringlengths 5
40
| sha
stringlengths 40
40
| time
stringlengths 20
20
|
---|---|---|---|---|
mmm a / THCGeneral . c <nl> ppp b / THCGeneral . c <nl> void THCudaInit ( THCState * state ) <nl> <nl> state - > cutorchGCFunction = NULL ; <nl> state - > cutorchGCData = NULL ; <nl> - state - > heapSoftmax = 300000000 ; / / 300MB , adjusted upward dynamically <nl> + state - > heapSoftmax = 3e8 ; / / 300MB , adjusted upward dynamically <nl> + state - > heapDelta = 0 ; <nl> } <nl> <nl> void THCudaShutdown ( THCState * state ) <nl> void __THCublasCheck ( cublasStatus_t status , const char * file , const int line ) <nl> } <nl> <nl> static long heapSize = 0 ; / / not thread - local <nl> + static const long heapMaxDelta = 1e6 ; <nl> static const double heapSoftmaxGrowthThresh = 0 . 8 ; / / grow softmax if > 80 % max after GC <nl> static const double heapSoftmaxGrowthFactor = 1 . 4 ; / / grow softmax by 40 % <nl> <nl> cudaError_t THCudaFree ( THCState * state , void * ptr ) <nl> return err ; <nl> } <nl> <nl> + static long applyHeapDelta ( THCState * state ) { <nl> + long newHeapSize = THAtomicAddLong ( & heapSize , state - > heapDelta ) + state - > heapDelta ; <nl> + state - > heapDelta = 0 ; <nl> + return newHeapSize ; <nl> + } <nl> + <nl> / / Here we maintain a dynamic softmax threshold for THC - allocated storages . <nl> / / When THC heap size goes above this softmax , the GC hook is triggered . <nl> / / If heap size is above 80 % of the softmax after GC , then the softmax is <nl> cudaError_t THCudaFree ( THCState * state , void * ptr ) <nl> static void maybeTriggerGC ( THCState * state , long curHeapSize ) { <nl> if ( state - > cutorchGCFunction ! = NULL & & curHeapSize > state - > heapSoftmax ) { <nl> ( state - > cutorchGCFunction ) ( state - > cutorchGCData ) ; <nl> - long newHeapSize = THAtomicGetLong ( & heapSize ) ; <nl> + <nl> + / / ensure heapSize is accurate before updating heapSoftmax <nl> + long newHeapSize = applyHeapDelta ( state ) ; <nl> + <nl> if ( newHeapSize > state - > heapSoftmax * heapSoftmaxGrowthThresh ) { <nl> state - > heapSoftmax = state - > heapSoftmax * heapSoftmaxGrowthFactor ; <nl> } <nl> static void maybeTriggerGC ( THCState * state , long curHeapSize ) { <nl> } <nl> <nl> void THCHeapUpdate ( THCState * state , long size ) { <nl> - long newHeapSize = THAtomicAddLong ( & heapSize , size ) + size ; <nl> - # ifdef THC_CHECK_HEAP_UPDATE <nl> - if ( newHeapSize < 0 ) { <nl> - THError ( " Internal error : THC heapSize < 0 " ) ; <nl> + state - > heapDelta + = size ; <nl> + / / batch updates to global heapSize to minimize thread contention <nl> + if ( abs ( state - > heapDelta ) < heapMaxDelta ) { <nl> + return ; <nl> } <nl> - # endif <nl> + <nl> + long newHeapSize = applyHeapDelta ( state ) ; <nl> if ( size > 0 ) { <nl> maybeTriggerGC ( state , newHeapSize ) ; <nl> } <nl> mmm a / THCGeneral . h . in <nl> ppp b / THCGeneral . h . in <nl> typedef struct THCState <nl> void ( * cutorchGCFunction ) ( void * data ) ; <nl> void * cutorchGCData ; <nl> long heapSoftmax ; <nl> + long heapDelta ; <nl> } THCState ; <nl> <nl> THC_API void THCudaInit ( THCState * state ) ; <nl>
|
Merge pull request from adamlerer / gc_heapsize_batch
|
pytorch/pytorch
|
d42a3fb3c7bda939f5b0edefa68f336a326b989e
|
2015-09-09T22:08:53Z
|
mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> add_library ( grpc_test_util <nl> test / core / util / port . cc <nl> test / core / util / port_server_client . cc <nl> test / core / util / slice_splitter . cc <nl> + test / core / util / tracer_util . cc <nl> test / core / util / trickle_endpoint . cc <nl> src / core / lib / backoff / backoff . cc <nl> src / core / lib / channel / channel_args . cc <nl> add_library ( grpc_test_util_unsecure <nl> test / core / util / port . cc <nl> test / core / util / port_server_client . cc <nl> test / core / util / slice_splitter . cc <nl> + test / core / util / tracer_util . cc <nl> test / core / util / trickle_endpoint . cc <nl> src / core / lib / backoff / backoff . cc <nl> src / core / lib / channel / channel_args . cc <nl> mmm a / Makefile <nl> ppp b / Makefile <nl> LIBGRPC_TEST_UTIL_SRC = \ <nl> test / core / util / port . cc \ <nl> test / core / util / port_server_client . cc \ <nl> test / core / util / slice_splitter . cc \ <nl> + test / core / util / tracer_util . cc \ <nl> test / core / util / trickle_endpoint . cc \ <nl> src / core / lib / backoff / backoff . cc \ <nl> src / core / lib / channel / channel_args . cc \ <nl> LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ <nl> test / core / util / port . cc \ <nl> test / core / util / port_server_client . cc \ <nl> test / core / util / slice_splitter . cc \ <nl> + test / core / util / tracer_util . cc \ <nl> test / core / util / trickle_endpoint . cc \ <nl> src / core / lib / backoff / backoff . cc \ <nl> src / core / lib / channel / channel_args . cc \ <nl> mmm a / build . yaml <nl> ppp b / build . yaml <nl> filegroups : <nl> - test / core / util / port . h <nl> - test / core / util / port_server_client . h <nl> - test / core / util / slice_splitter . h <nl> + - test / core / util / tracer_util . h <nl> - test / core / util / trickle_endpoint . h <nl> src : <nl> - src / core / ext / filters / client_channel / resolver / fake / fake_resolver . cc <nl> filegroups : <nl> - test / core / util / port . cc <nl> - test / core / util / port_server_client . cc <nl> - test / core / util / slice_splitter . cc <nl> + - test / core / util / tracer_util . cc <nl> - test / core / util / trickle_endpoint . cc <nl> deps : <nl> - gpr_test_util <nl> mmm a / grpc . gyp <nl> ppp b / grpc . gyp <nl> <nl> ' test / core / util / port . cc ' , <nl> ' test / core / util / port_server_client . cc ' , <nl> ' test / core / util / slice_splitter . cc ' , <nl> + ' test / core / util / tracer_util . cc ' , <nl> ' test / core / util / trickle_endpoint . cc ' , <nl> ' src / core / lib / backoff / backoff . cc ' , <nl> ' src / core / lib / channel / channel_args . cc ' , <nl> <nl> ' test / core / util / port . cc ' , <nl> ' test / core / util / port_server_client . cc ' , <nl> ' test / core / util / slice_splitter . cc ' , <nl> + ' test / core / util / tracer_util . cc ' , <nl> ' test / core / util / trickle_endpoint . cc ' , <nl> ' src / core / lib / backoff / backoff . cc ' , <nl> ' src / core / lib / channel / channel_args . cc ' , <nl> mmm a / src / core / ext / filters / client_channel / channel_connectivity . cc <nl> ppp b / src / core / ext / filters / client_channel / channel_connectivity . cc <nl> static void partly_done ( grpc_exec_ctx * exec_ctx , state_watcher * w , <nl> gpr_mu_lock ( & w - > mu ) ; <nl> <nl> if ( due_to_completion ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_operation_failures ) ) { <nl> + if ( grpc_trace_operation_failures . enabled ( ) ) { <nl> GRPC_LOG_IF_ERROR ( " watch_completion_error " , GRPC_ERROR_REF ( error ) ) ; <nl> } <nl> GRPC_ERROR_UNREF ( error ) ; <nl> mmm a / src / core / ext / filters / client_channel / client_channel . cc <nl> ppp b / src / core / ext / filters / client_channel / client_channel . cc <nl> <nl> <nl> / * Client channel implementation * / <nl> <nl> - grpc_tracer_flag grpc_client_channel_trace = <nl> - GRPC_TRACER_INITIALIZER ( false , " client_channel " ) ; <nl> + grpc_core : : TraceFlag grpc_client_channel_trace ( false , " client_channel " ) ; <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * METHOD - CONFIG TABLE <nl> static void set_channel_connectivity_state_locked ( grpc_exec_ctx * exec_ctx , <nl> GRPC_ERROR_REF ( error ) ) ; <nl> } <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p : setting connectivity state to % s " , chand , <nl> grpc_connectivity_state_name ( state ) ) ; <nl> } <nl> static void on_lb_policy_state_changed_locked ( grpc_exec_ctx * exec_ctx , <nl> grpc_connectivity_state publish_state = w - > state ; <nl> / * check if the notification is for the latest policy * / <nl> if ( w - > lb_policy = = w - > chand - > lb_policy ) { <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p : lb_policy = % p state changed to % s " , w - > chand , <nl> w - > lb_policy , grpc_connectivity_state_name ( w - > state ) ) ; <nl> } <nl> static void watch_lb_policy_locked ( grpc_exec_ctx * exec_ctx , channel_data * chand , <nl> <nl> static void start_resolving_locked ( grpc_exec_ctx * exec_ctx , <nl> channel_data * chand ) { <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p : starting name resolution " , chand ) ; <nl> } <nl> GPR_ASSERT ( ! chand - > started_resolving ) ; <nl> static void parse_retry_throttle_params ( const grpc_json * field , void * arg ) { <nl> static void on_resolver_result_changed_locked ( grpc_exec_ctx * exec_ctx , <nl> void * arg , grpc_error * error ) { <nl> channel_data * chand = ( channel_data * ) arg ; <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p : got resolver result : error = % s " , chand , <nl> grpc_error_string ( error ) ) ; <nl> } <nl> static void on_resolver_result_changed_locked ( grpc_exec_ctx * exec_ctx , <nl> grpc_channel_args_destroy ( exec_ctx , chand - > resolver_result ) ; <nl> chand - > resolver_result = nullptr ; <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " chand = % p : resolver result : lb_policy_name = \ " % s \ " % s , " <nl> " service_config = \ " % s \ " " , <nl> static void on_resolver_result_changed_locked ( grpc_exec_ctx * exec_ctx , <nl> if ( new_lb_policy ! = nullptr | | error ! = GRPC_ERROR_NONE | | <nl> chand - > resolver = = nullptr ) { <nl> if ( chand - > lb_policy ! = nullptr ) { <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p : unreffing lb_policy = % p " , chand , <nl> chand - > lb_policy ) ; <nl> } <nl> static void on_resolver_result_changed_locked ( grpc_exec_ctx * exec_ctx , <nl> / / Now that we ' ve swapped out the relevant fields of chand , check for <nl> / / error or shutdown . <nl> if ( error ! = GRPC_ERROR_NONE | | chand - > resolver = = nullptr ) { <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p : shutting down " , chand ) ; <nl> } <nl> if ( chand - > resolver ! = nullptr ) { <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p : shutting down resolver " , chand ) ; <nl> } <nl> grpc_resolver_shutdown_locked ( exec_ctx , chand - > resolver ) ; <nl> static void on_resolver_result_changed_locked ( grpc_exec_ctx * exec_ctx , <nl> grpc_error * state_error = <nl> GRPC_ERROR_CREATE_FROM_STATIC_STRING ( " No load balancing policy " ) ; <nl> if ( new_lb_policy ! = nullptr ) { <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p : initializing new LB policy " , chand ) ; <nl> } <nl> GRPC_ERROR_UNREF ( state_error ) ; <nl> static void waiting_for_pick_batches_fail ( grpc_exec_ctx * exec_ctx , <nl> grpc_call_element * elem , <nl> grpc_error * error ) { <nl> call_data * calld = ( call_data * ) elem - > call_data ; <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " chand = % p calld = % p : failing % " PRIuPTR " pending batches : % s " , <nl> elem - > channel_data , calld , calld - > waiting_for_pick_batches_count , <nl> static void waiting_for_pick_batches_resume ( grpc_exec_ctx * exec_ctx , <nl> grpc_call_element * elem ) { <nl> channel_data * chand = ( channel_data * ) elem - > channel_data ; <nl> call_data * calld = ( call_data * ) elem - > call_data ; <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " chand = % p calld = % p : sending % " PRIuPTR <nl> " pending batches to subchannel_call = % p " , <nl> static void apply_service_config_to_call_locked ( grpc_exec_ctx * exec_ctx , <nl> grpc_call_element * elem ) { <nl> channel_data * chand = ( channel_data * ) elem - > channel_data ; <nl> call_data * calld = ( call_data * ) elem - > call_data ; <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p calld = % p : applying service config to call " , <nl> chand , calld ) ; <nl> } <nl> static void create_subchannel_call_locked ( grpc_exec_ctx * exec_ctx , <nl> grpc_error * new_error = grpc_connected_subchannel_create_call ( <nl> exec_ctx , calld - > connected_subchannel , & call_args , <nl> & calld - > subchannel_call ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p calld = % p : create subchannel_call = % p : error = % s " , <nl> chand , calld , calld - > subchannel_call , grpc_error_string ( new_error ) ) ; <nl> } <nl> static void pick_done_locked ( grpc_exec_ctx * exec_ctx , grpc_call_element * elem , <nl> " Call dropped by load balancing policy " ) <nl> : GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING ( <nl> " Failed to create subchannel " , & error , 1 ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " chand = % p calld = % p : failed to create subchannel : error = % s " , chand , <nl> calld , grpc_error_string ( calld - > error ) ) ; <nl> static void pick_callback_cancel_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> channel_data * chand = ( channel_data * ) elem - > channel_data ; <nl> call_data * calld = ( call_data * ) elem - > call_data ; <nl> if ( calld - > lb_policy ! = nullptr ) { <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p calld = % p : cancelling pick from LB policy % p " , <nl> chand , calld , calld - > lb_policy ) ; <nl> } <nl> static void pick_callback_done_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> grpc_call_element * elem = ( grpc_call_element * ) arg ; <nl> channel_data * chand = ( channel_data * ) elem - > channel_data ; <nl> call_data * calld = ( call_data * ) elem - > call_data ; <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p calld = % p : pick completed asynchronously " , <nl> chand , calld ) ; <nl> } <nl> static bool pick_callback_start_locked ( grpc_exec_ctx * exec_ctx , <nl> grpc_call_element * elem ) { <nl> channel_data * chand = ( channel_data * ) elem - > channel_data ; <nl> call_data * calld = ( call_data * ) elem - > call_data ; <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p calld = % p : starting pick on lb_policy = % p " , <nl> chand , calld , chand - > lb_policy ) ; <nl> } <nl> static bool pick_callback_start_locked ( grpc_exec_ctx * exec_ctx , <nl> calld - > subchannel_call_context , nullptr , & calld - > lb_pick_closure ) ; <nl> if ( pick_done ) { <nl> / * synchronous grpc_lb_policy_pick call . Unref the LB policy . * / <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p calld = % p : pick completed synchronously " , <nl> chand , calld ) ; <nl> } <nl> static void pick_after_resolver_result_cancel_locked ( grpc_exec_ctx * exec_ctx , <nl> grpc_call_element * elem = args - > elem ; <nl> channel_data * chand = ( channel_data * ) elem - > channel_data ; <nl> call_data * calld = ( call_data * ) elem - > call_data ; <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " chand = % p calld = % p : cancelling pick waiting for resolver result " , <nl> chand , calld ) ; <nl> static void pick_after_resolver_result_done_locked ( grpc_exec_ctx * exec_ctx , <nl> pick_after_resolver_result_args * args = ( pick_after_resolver_result_args * ) arg ; <nl> if ( args - > finished ) { <nl> / * cancelled , do nothing * / <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " call cancelled before resolver result " ) ; <nl> } <nl> gpr_free ( args ) ; <nl> static void pick_after_resolver_result_done_locked ( grpc_exec_ctx * exec_ctx , <nl> channel_data * chand = ( channel_data * ) elem - > channel_data ; <nl> call_data * calld = ( call_data * ) elem - > call_data ; <nl> if ( error ! = GRPC_ERROR_NONE ) { <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p calld = % p : resolver failed to return data " , <nl> chand , calld ) ; <nl> } <nl> async_pick_done_locked ( exec_ctx , elem , GRPC_ERROR_REF ( error ) ) ; <nl> } else if ( chand - > lb_policy ! = nullptr ) { <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p calld = % p : resolver returned , doing pick " , <nl> chand , calld ) ; <nl> } <nl> static void pick_after_resolver_result_done_locked ( grpc_exec_ctx * exec_ctx , <nl> / / right way to deal with it . <nl> else if ( chand - > resolver ! = nullptr ) { <nl> / / No LB policy , so try again . <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " chand = % p calld = % p : resolver returned but no LB policy , " <nl> " trying again " , <nl> static void pick_after_resolver_result_done_locked ( grpc_exec_ctx * exec_ctx , <nl> } <nl> pick_after_resolver_result_start_locked ( exec_ctx , elem ) ; <nl> } else { <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p calld = % p : resolver disconnected " , chand , <nl> calld ) ; <nl> } <nl> static void pick_after_resolver_result_start_locked ( grpc_exec_ctx * exec_ctx , <nl> grpc_call_element * elem ) { <nl> channel_data * chand = ( channel_data * ) elem - > channel_data ; <nl> call_data * calld = ( call_data * ) elem - > call_data ; <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " chand = % p calld = % p : deferring pick pending resolver result " , chand , <nl> calld ) ; <nl> static void cc_start_transport_stream_op_batch ( <nl> GPR_TIMER_BEGIN ( " cc_start_transport_stream_op_batch " , 0 ) ; <nl> / / If we ' ve previously been cancelled , immediately fail any new batches . <nl> if ( calld - > error ! = GRPC_ERROR_NONE ) { <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p calld = % p : failing batch with error : % s " , <nl> chand , calld , grpc_error_string ( calld - > error ) ) ; <nl> } <nl> static void cc_start_transport_stream_op_batch ( <nl> / / error to the caller when the first batch does get passed down . <nl> GRPC_ERROR_UNREF ( calld - > error ) ; <nl> calld - > error = GRPC_ERROR_REF ( batch - > payload - > cancel_stream . cancel_error ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p calld = % p : recording cancel_error = % s " , chand , <nl> calld , grpc_error_string ( calld - > error ) ) ; <nl> } <nl> static void cc_start_transport_stream_op_batch ( <nl> / / the channel combiner , which is more efficient ( especially for <nl> / / streaming calls ) . <nl> if ( calld - > subchannel_call ! = nullptr ) { <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " chand = % p calld = % p : sending batch to subchannel_call = % p " , chand , <nl> calld , calld - > subchannel_call ) ; <nl> static void cc_start_transport_stream_op_batch ( <nl> / / For batches containing a send_initial_metadata op , enter the channel <nl> / / combiner to start a pick . <nl> if ( batch - > send_initial_metadata ) { <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " chand = % p calld = % p : entering client_channel combiner " , <nl> chand , calld ) ; <nl> } <nl> static void cc_start_transport_stream_op_batch ( <nl> GRPC_ERROR_NONE ) ; <nl> } else { <nl> / / For all other batches , release the call combiner . <nl> - if ( GRPC_TRACER_ON ( grpc_client_channel_trace ) ) { <nl> + if ( grpc_client_channel_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " chand = % p calld = % p : saved batch , yeilding call combiner " , chand , <nl> calld ) ; <nl> mmm a / src / core / ext / filters / client_channel / client_channel . h <nl> ppp b / src / core / ext / filters / client_channel / client_channel . h <nl> <nl> # include " src / core / ext / filters / client_channel / resolver . h " <nl> # include " src / core / lib / channel / channel_stack . h " <nl> <nl> - extern grpc_tracer_flag grpc_client_channel_trace ; <nl> + extern grpc_core : : TraceFlag grpc_client_channel_trace ; <nl> <nl> / / Channel arg key for server URI string . <nl> # define GRPC_ARG_SERVER_URI " grpc . server_uri " <nl> mmm a / src / core / ext / filters / client_channel / client_channel_plugin . cc <nl> ppp b / src / core / ext / filters / client_channel / client_channel_plugin . cc <nl> extern " C " void grpc_client_channel_init ( void ) { <nl> GRPC_CLIENT_CHANNEL , GRPC_CHANNEL_INIT_BUILTIN_PRIORITY , append_filter , <nl> ( void * ) & grpc_client_channel_filter ) ; <nl> grpc_http_connect_register_handshaker_factory ( ) ; <nl> - grpc_register_tracer ( & grpc_client_channel_trace ) ; <nl> - # ifndef NDEBUG <nl> - grpc_register_tracer ( & grpc_trace_resolver_refcount ) ; <nl> - # endif <nl> } <nl> <nl> extern " C " void grpc_client_channel_shutdown ( void ) { <nl> mmm a / src / core / ext / filters / client_channel / lb_policy . cc <nl> ppp b / src / core / ext / filters / client_channel / lb_policy . cc <nl> <nl> <nl> # define WEAK_REF_BITS 16 <nl> <nl> - # ifndef NDEBUG <nl> - grpc_tracer_flag grpc_trace_lb_policy_refcount = <nl> - GRPC_TRACER_INITIALIZER ( false , " lb_policy_refcount " ) ; <nl> - # endif <nl> + grpc_core : : DebugOnlyTraceFlag grpc_trace_lb_policy_refcount ( <nl> + false , " lb_policy_refcount " ) ; <nl> <nl> void grpc_lb_policy_init ( grpc_lb_policy * policy , <nl> const grpc_lb_policy_vtable * vtable , <nl> static gpr_atm ref_mutate ( grpc_lb_policy * c , gpr_atm delta , <nl> gpr_atm old_val = barrier ? gpr_atm_full_fetch_add ( & c - > ref_pair , delta ) <nl> : gpr_atm_no_barrier_fetch_add ( & c - > ref_pair , delta ) ; <nl> # ifndef NDEBUG <nl> - if ( GRPC_TRACER_ON ( grpc_trace_lb_policy_refcount ) ) { <nl> + if ( grpc_trace_lb_policy_refcount . enabled ( ) ) { <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " LB_POLICY : % p % 12s 0x % " PRIxPTR " - > 0x % " PRIxPTR " [ % s ] " , c , <nl> purpose , old_val , old_val + delta , reason ) ; <nl> mmm a / src / core / ext / filters / client_channel / lb_policy . h <nl> ppp b / src / core / ext / filters / client_channel / lb_policy . h <nl> typedef struct grpc_lb_policy grpc_lb_policy ; <nl> typedef struct grpc_lb_policy_vtable grpc_lb_policy_vtable ; <nl> typedef struct grpc_lb_policy_args grpc_lb_policy_args ; <nl> <nl> - # ifndef NDEBUG <nl> - extern grpc_tracer_flag grpc_trace_lb_policy_refcount ; <nl> - # endif <nl> + extern grpc_core : : DebugOnlyTraceFlag grpc_trace_lb_policy_refcount ; <nl> <nl> struct grpc_lb_policy { <nl> const grpc_lb_policy_vtable * vtable ; <nl> mmm a / src / core / ext / filters / client_channel / lb_policy / grpclb / grpclb . cc <nl> ppp b / src / core / ext / filters / client_channel / lb_policy / grpclb / grpclb . cc <nl> <nl> # define GRPC_GRPCLB_RECONNECT_JITTER 0 . 2 <nl> # define GRPC_GRPCLB_DEFAULT_FALLBACK_TIMEOUT_MS 10000 <nl> <nl> - grpc_tracer_flag grpc_lb_glb_trace = GRPC_TRACER_INITIALIZER ( false , " glb " ) ; <nl> + grpc_core : : TraceFlag grpc_lb_glb_trace ( false , " glb " ) ; <nl> <nl> / * add lb_token of selected subchannel ( address ) to the call ' s initial <nl> * metadata * / <nl> static void wrapped_rr_closure ( grpc_exec_ctx * exec_ctx , void * arg , <nl> } else { <nl> grpc_grpclb_client_stats_unref ( wc_arg - > client_stats ) ; <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , " [ grpclb % p ] Unreffing RR % p " , wc_arg - > glb_policy , <nl> wc_arg - > rr_policy ) ; <nl> } <nl> static void update_lb_connectivity_status_locked ( <nl> GPR_ASSERT ( rr_state_error = = GRPC_ERROR_NONE ) ; <nl> } <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( <nl> GPR_INFO , <nl> " [ grpclb % p ] Setting grpclb ' s state to % s from new RR policy % p state . " , <nl> static bool pick_from_internal_rr_locked ( <nl> } <nl> if ( server - > drop ) { <nl> / / Not using the RR policy , so unref it . <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , " [ grpclb % p ] Unreffing RR % p for drop " , glb_policy , <nl> wc_arg - > rr_policy ) ; <nl> } <nl> static bool pick_from_internal_rr_locked ( <nl> ( void * * ) & wc_arg - > lb_token , & wc_arg - > wrapper_closure ) ; <nl> if ( pick_done ) { <nl> / * synchronous grpc_lb_policy_pick call . Unref the RR policy . * / <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , " [ grpclb % p ] Unreffing RR % p " , glb_policy , <nl> wc_arg - > rr_policy ) ; <nl> } <nl> static void create_rr_locked ( grpc_exec_ctx * exec_ctx , glb_lb_policy * glb_policy , <nl> pp - > wrapped_on_complete_arg . rr_policy = glb_policy - > rr_policy ; <nl> pp - > wrapped_on_complete_arg . client_stats = <nl> grpc_grpclb_client_stats_ref ( glb_policy - > client_stats ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " [ grpclb % p ] Pending pick about to ( async ) PICK from RR % p " , <nl> glb_policy , glb_policy - > rr_policy ) ; <nl> static void create_rr_locked ( grpc_exec_ctx * exec_ctx , glb_lb_policy * glb_policy , <nl> glb_policy - > pending_pings = pping - > next ; <nl> GRPC_LB_POLICY_REF ( glb_policy - > rr_policy , " rr_handover_pending_ping " ) ; <nl> pping - > wrapped_notify_arg . rr_policy = glb_policy - > rr_policy ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , " [ grpclb % p ] Pending ping about to PING from RR % p " , <nl> glb_policy , glb_policy - > rr_policy ) ; <nl> } <nl> static void rr_handover_locked ( grpc_exec_ctx * exec_ctx , <nl> grpc_lb_policy_args * args = lb_policy_args_create ( exec_ctx , glb_policy ) ; <nl> GPR_ASSERT ( args ! = nullptr ) ; <nl> if ( glb_policy - > rr_policy ! = nullptr ) { <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " [ grpclb % p ] Updating RR policy % p " , glb_policy , <nl> glb_policy - > rr_policy ) ; <nl> } <nl> grpc_lb_policy_update_locked ( exec_ctx , glb_policy - > rr_policy , args ) ; <nl> } else { <nl> create_rr_locked ( exec_ctx , glb_policy , args ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " [ grpclb % p ] Created new RR policy % p " , glb_policy , <nl> glb_policy - > rr_policy ) ; <nl> } <nl> static int glb_pick_locked ( grpc_exec_ctx * exec_ctx , grpc_lb_policy * pol , <nl> / / need to make sure we aren ' t trying to pick from a RR policy instance <nl> / / that ' s in shutdown . <nl> if ( rr_connectivity_state = = GRPC_CHANNEL_SHUTDOWN ) { <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " [ grpclb % p ] NOT picking from from RR % p : RR conn state = % s " , <nl> glb_policy , glb_policy - > rr_policy , <nl> static int glb_pick_locked ( grpc_exec_ctx * exec_ctx , grpc_lb_policy * pol , <nl> on_complete ) ; <nl> pick_done = false ; <nl> } else { / / RR not in shutdown <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , " [ grpclb % p ] about to PICK from RR % p " , glb_policy , <nl> glb_policy - > rr_policy ) ; <nl> } <nl> static int glb_pick_locked ( grpc_exec_ctx * exec_ctx , grpc_lb_policy * pol , <nl> false / * force_async * / , target , wc_arg ) ; <nl> } <nl> } else { / / glb_policy - > rr_policy = = NULL <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " [ grpclb % p ] No RR policy . Adding to grpclb ' s pending picks " , <nl> glb_policy ) ; <nl> static void lb_call_on_retry_timer_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> glb_policy - > retry_timer_active = false ; <nl> if ( ! glb_policy - > shutting_down & & glb_policy - > lb_call = = nullptr & & <nl> error = = GRPC_ERROR_NONE ) { <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , " [ grpclb % p ] Restarting call to LB server " , glb_policy ) ; <nl> } <nl> query_for_backends_locked ( exec_ctx , glb_policy ) ; <nl> static void maybe_restart_lb_call ( grpc_exec_ctx * exec_ctx , <nl> grpc_millis next_try = <nl> grpc_backoff_step ( exec_ctx , & glb_policy - > lb_call_backoff_state ) <nl> . next_attempt_start_time ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " [ grpclb % p ] Connection to LB server lost . . . " , <nl> glb_policy ) ; <nl> grpc_millis timeout = next_try - grpc_exec_ctx_now ( exec_ctx ) ; <nl> static void query_for_backends_locked ( grpc_exec_ctx * exec_ctx , <nl> <nl> lb_call_init_locked ( exec_ctx , glb_policy ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " [ grpclb % p ] Query for backends ( lb_channel : % p , lb_call : % p ) " , <nl> glb_policy , glb_policy - > lb_channel , glb_policy - > lb_call ) ; <nl> static void lb_on_response_received_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> glb_policy - > client_stats_report_interval = GPR_MAX ( <nl> GPR_MS_PER_SEC , grpc_grpclb_duration_to_millis ( <nl> & response - > client_stats_report_interval ) ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " [ grpclb % p ] Received initial LB response message ; " <nl> " client load reporting interval = % " PRIdPTR " milliseconds " , <nl> static void lb_on_response_received_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> glb_policy - > client_load_report_timer_pending = true ; <nl> GRPC_LB_POLICY_WEAK_REF ( & glb_policy - > base , " client_load_report " ) ; <nl> schedule_next_client_load_report ( exec_ctx , glb_policy ) ; <nl> - } else if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + } else if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " [ grpclb % p ] Received initial LB response message ; client load " <nl> " reporting NOT enabled " , <nl> static void lb_on_response_received_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> grpc_grpclb_response_parse_serverlist ( response_slice ) ; <nl> if ( serverlist ! = nullptr ) { <nl> GPR_ASSERT ( glb_policy - > lb_call ! = nullptr ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " [ grpclb % p ] Serverlist with % " PRIuPTR " servers received " , <nl> glb_policy , serverlist - > num_servers ) ; <nl> static void lb_on_response_received_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> if ( serverlist - > num_servers > 0 ) { <nl> if ( grpc_grpclb_serverlist_equals ( glb_policy - > serverlist , <nl> serverlist ) ) { <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " [ grpclb % p ] Incoming server list identical to current , " <nl> " ignoring . " , <nl> static void lb_on_response_received_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> rr_handover_locked ( exec_ctx , glb_policy ) ; <nl> } <nl> } else { <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " [ grpclb % p ] Received empty server list , ignoring . " , <nl> glb_policy ) ; <nl> static void lb_on_fallback_timer_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> * actually runs , don ' t fall back . * / <nl> if ( glb_policy - > serverlist = = nullptr ) { <nl> if ( ! glb_policy - > shutting_down & & error = = GRPC_ERROR_NONE ) { <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " [ grpclb % p ] Falling back to use backends from resolver " , <nl> glb_policy ) ; <nl> static void lb_on_server_status_received_locked ( grpc_exec_ctx * exec_ctx , <nl> void * arg , grpc_error * error ) { <nl> glb_lb_policy * glb_policy = ( glb_lb_policy * ) arg ; <nl> GPR_ASSERT ( glb_policy - > lb_call ! = nullptr ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> char * status_details = <nl> grpc_slice_to_c_string ( glb_policy - > lb_call_status_details ) ; <nl> gpr_log ( GPR_INFO , <nl> static grpc_lb_policy * glb_create ( grpc_exec_ctx * exec_ctx , <nl> GPR_ASSERT ( uri - > path [ 0 ] ! = ' \ 0 ' ) ; <nl> glb_policy - > server_name = <nl> gpr_strdup ( uri - > path [ 0 ] = = ' / ' ? uri - > path + 1 : uri - > path ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_glb_trace ) ) { <nl> + if ( grpc_lb_glb_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " [ grpclb % p ] Will use ' % s ' as the server name for LB request . " , <nl> glb_policy , glb_policy - > server_name ) ; <nl> static bool maybe_add_client_load_reporting_filter ( <nl> <nl> extern " C " void grpc_lb_policy_grpclb_init ( ) { <nl> grpc_register_lb_policy ( grpc_glb_lb_factory_create ( ) ) ; <nl> - grpc_register_tracer ( & grpc_lb_glb_trace ) ; <nl> - # ifndef NDEBUG <nl> - grpc_register_tracer ( & grpc_trace_lb_policy_refcount ) ; <nl> - # endif <nl> grpc_channel_init_register_stage ( GRPC_CLIENT_SUBCHANNEL , <nl> GRPC_CHANNEL_INIT_BUILTIN_PRIORITY , <nl> maybe_add_client_load_reporting_filter , <nl> mmm a / src / core / ext / filters / client_channel / lb_policy / pick_first / pick_first . cc <nl> ppp b / src / core / ext / filters / client_channel / lb_policy / pick_first / pick_first . cc <nl> <nl> # include " src / core / lib / iomgr / sockaddr_utils . h " <nl> # include " src / core / lib / transport / connectivity_state . h " <nl> <nl> - grpc_tracer_flag grpc_lb_pick_first_trace = <nl> - GRPC_TRACER_INITIALIZER ( false , " pick_first " ) ; <nl> + grpc_core : : TraceFlag grpc_lb_pick_first_trace ( false , " pick_first " ) ; <nl> <nl> typedef struct pending_pick { <nl> struct pending_pick * next ; <nl> static void pf_destroy ( grpc_exec_ctx * exec_ctx , grpc_lb_policy * pol ) { <nl> grpc_connectivity_state_destroy ( exec_ctx , & p - > state_tracker ) ; <nl> gpr_free ( p ) ; <nl> grpc_subchannel_index_unref ( ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_pick_first_trace ) ) { <nl> + if ( grpc_lb_pick_first_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " Pick First % p destroyed . " , ( void * ) p ) ; <nl> } <nl> } <nl> <nl> static void shutdown_locked ( grpc_exec_ctx * exec_ctx , pick_first_lb_policy * p , <nl> grpc_error * error ) { <nl> - if ( GRPC_TRACER_ON ( grpc_lb_pick_first_trace ) ) { <nl> + if ( grpc_lb_pick_first_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " Pick First % p Shutting down " , p ) ; <nl> } <nl> p - > shutdown = true ; <nl> static void pf_update_locked ( grpc_exec_ctx * exec_ctx , grpc_lb_policy * policy , <nl> } <nl> const grpc_lb_addresses * addresses = <nl> ( const grpc_lb_addresses * ) arg - > value . pointer . p ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_pick_first_trace ) ) { <nl> + if ( grpc_lb_pick_first_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , " Pick First % p received update with % lu addresses " , <nl> ( void * ) p , ( unsigned long ) addresses - > num_addresses ) ; <nl> } <nl> static void pf_update_locked ( grpc_exec_ctx * exec_ctx , grpc_lb_policy * policy , <nl> grpc_lb_subchannel_data * sd = & subchannel_list - > subchannels [ i ] ; <nl> if ( sd - > subchannel = = p - > selected - > subchannel ) { <nl> / / The currently selected subchannel is in the update : we are done . <nl> - if ( GRPC_TRACER_ON ( grpc_lb_pick_first_trace ) ) { <nl> + if ( grpc_lb_pick_first_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " Pick First % p found already selected subchannel % p " <nl> " at update index % " PRIuPTR " of % " PRIuPTR " ; update done " , <nl> static void pf_update_locked ( grpc_exec_ctx * exec_ctx , grpc_lb_policy * policy , <nl> / / for it to report READY before swapping it into the current <nl> / / subchannel list . <nl> if ( p - > latest_pending_subchannel_list ! = nullptr ) { <nl> - if ( GRPC_TRACER_ON ( grpc_lb_pick_first_trace ) ) { <nl> + if ( grpc_lb_pick_first_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " Pick First % p Shutting down latest pending subchannel list " <nl> " % p , about to be replaced by newer latest % p " , <nl> static void pf_connectivity_changed_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> grpc_error * error ) { <nl> grpc_lb_subchannel_data * sd = ( grpc_lb_subchannel_data * ) arg ; <nl> pick_first_lb_policy * p = ( pick_first_lb_policy * ) sd - > subchannel_list - > policy ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_pick_first_trace ) ) { <nl> + if ( grpc_lb_pick_first_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " Pick First % p connectivity changed for subchannel % p ( % " PRIuPTR <nl> " of % " PRIuPTR <nl> static void pf_connectivity_changed_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> grpc_subchannel_get_connected_subchannel ( sd - > subchannel ) , <nl> " connected " ) ; <nl> p - > selected = sd ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_pick_first_trace ) ) { <nl> + if ( grpc_lb_pick_first_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , " Pick First % p selected subchannel % p " , ( void * ) p , <nl> ( void * ) sd - > subchannel ) ; <nl> } <nl> static void pf_connectivity_changed_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> p - > pending_picks = pp - > next ; <nl> * pp - > target = GRPC_CONNECTED_SUBCHANNEL_REF ( <nl> p - > selected - > connected_subchannel , " picked " ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_pick_first_trace ) ) { <nl> + if ( grpc_lb_pick_first_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " Servicing pending pick with selected subchannel % p " , <nl> ( void * ) p - > selected ) ; <nl> static grpc_lb_policy * create_pick_first ( grpc_exec_ctx * exec_ctx , <nl> grpc_lb_policy_args * args ) { <nl> GPR_ASSERT ( args - > client_channel_factory ! = nullptr ) ; <nl> pick_first_lb_policy * p = ( pick_first_lb_policy * ) gpr_zalloc ( sizeof ( * p ) ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_pick_first_trace ) ) { <nl> + if ( grpc_lb_pick_first_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " Pick First % p created . " , ( void * ) p ) ; <nl> } <nl> pf_update_locked ( exec_ctx , & p - > base , args ) ; <nl> static grpc_lb_policy_factory * pick_first_lb_factory_create ( ) { <nl> <nl> extern " C " void grpc_lb_policy_pick_first_init ( ) { <nl> grpc_register_lb_policy ( pick_first_lb_factory_create ( ) ) ; <nl> - grpc_register_tracer ( & grpc_lb_pick_first_trace ) ; <nl> } <nl> <nl> extern " C " void grpc_lb_policy_pick_first_shutdown ( ) { } <nl> mmm a / src / core / ext / filters / client_channel / lb_policy / round_robin / round_robin . cc <nl> ppp b / src / core / ext / filters / client_channel / lb_policy / round_robin / round_robin . cc <nl> <nl> # include " src / core / lib / transport / connectivity_state . h " <nl> # include " src / core / lib / transport / static_metadata . h " <nl> <nl> - grpc_tracer_flag grpc_lb_round_robin_trace = <nl> - GRPC_TRACER_INITIALIZER ( false , " round_robin " ) ; <nl> + grpc_core : : TraceFlag grpc_lb_round_robin_trace ( false , " round_robin " ) ; <nl> <nl> / * * List of entities waiting for a pick . <nl> * <nl> typedef struct round_robin_lb_policy { <nl> static size_t get_next_ready_subchannel_index_locked ( <nl> const round_robin_lb_policy * p ) { <nl> GPR_ASSERT ( p - > subchannel_list ! = nullptr ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_round_robin_trace ) ) { <nl> + if ( grpc_lb_round_robin_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " [ RR % p ] getting next ready subchannel ( out of % lu ) , " <nl> " last_ready_subchannel_index = % lu " , <nl> static size_t get_next_ready_subchannel_index_locked ( <nl> for ( size_t i = 0 ; i < p - > subchannel_list - > num_subchannels ; + + i ) { <nl> const size_t index = ( i + p - > last_ready_subchannel_index + 1 ) % <nl> p - > subchannel_list - > num_subchannels ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_round_robin_trace ) ) { <nl> + if ( grpc_lb_round_robin_trace . enabled ( ) ) { <nl> gpr_log ( <nl> GPR_DEBUG , <nl> " [ RR % p ] checking subchannel % p , subchannel_list % p , index % lu : " <nl> static size_t get_next_ready_subchannel_index_locked ( <nl> } <nl> if ( p - > subchannel_list - > subchannels [ index ] . curr_connectivity_state = = <nl> GRPC_CHANNEL_READY ) { <nl> - if ( GRPC_TRACER_ON ( grpc_lb_round_robin_trace ) ) { <nl> + if ( grpc_lb_round_robin_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " [ RR % p ] found next ready subchannel ( % p ) at index % lu of " <nl> " subchannel_list % p " , <nl> static size_t get_next_ready_subchannel_index_locked ( <nl> return index ; <nl> } <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_lb_round_robin_trace ) ) { <nl> + if ( grpc_lb_round_robin_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " [ RR % p ] no subchannels in ready state " , ( void * ) p ) ; <nl> } <nl> return p - > subchannel_list - > num_subchannels ; <nl> static void update_last_ready_subchannel_index_locked ( round_robin_lb_policy * p , <nl> size_t last_ready_index ) { <nl> GPR_ASSERT ( last_ready_index < p - > subchannel_list - > num_subchannels ) ; <nl> p - > last_ready_subchannel_index = last_ready_index ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_round_robin_trace ) ) { <nl> + if ( grpc_lb_round_robin_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " [ RR % p ] setting last_ready_subchannel_index = % lu ( SC % p , CSC % p ) " , <nl> ( void * ) p , ( unsigned long ) last_ready_index , <nl> static void update_last_ready_subchannel_index_locked ( round_robin_lb_policy * p , <nl> <nl> static void rr_destroy ( grpc_exec_ctx * exec_ctx , grpc_lb_policy * pol ) { <nl> round_robin_lb_policy * p = ( round_robin_lb_policy * ) pol ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_round_robin_trace ) ) { <nl> + if ( grpc_lb_round_robin_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " [ RR % p ] Destroying Round Robin policy at % p " , <nl> ( void * ) pol , ( void * ) pol ) ; <nl> } <nl> static void rr_destroy ( grpc_exec_ctx * exec_ctx , grpc_lb_policy * pol ) { <nl> <nl> static void shutdown_locked ( grpc_exec_ctx * exec_ctx , round_robin_lb_policy * p , <nl> grpc_error * error ) { <nl> - if ( GRPC_TRACER_ON ( grpc_lb_round_robin_trace ) ) { <nl> + if ( grpc_lb_round_robin_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " [ RR % p ] Shutting down " , p ) ; <nl> } <nl> p - > shutdown = true ; <nl> static int rr_pick_locked ( grpc_exec_ctx * exec_ctx , grpc_lb_policy * pol , <nl> grpc_call_context_element * context , void * * user_data , <nl> grpc_closure * on_complete ) { <nl> round_robin_lb_policy * p = ( round_robin_lb_policy * ) pol ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_round_robin_trace ) ) { <nl> + if ( grpc_lb_round_robin_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , " [ RR % p ] Trying to pick ( shutdown : % d ) " , ( void * ) pol , <nl> p - > shutdown ) ; <nl> } <nl> static int rr_pick_locked ( grpc_exec_ctx * exec_ctx , grpc_lb_policy * pol , <nl> if ( user_data ! = nullptr ) { <nl> * user_data = sd - > user_data ; <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_lb_round_robin_trace ) ) { <nl> + if ( grpc_lb_round_robin_trace . enabled ( ) ) { <nl> gpr_log ( <nl> GPR_DEBUG , <nl> " [ RR % p ] Picked target < - - Subchannel % p ( connected % p ) ( sl % p , " <nl> static grpc_connectivity_state update_lb_connectivity_status_locked ( <nl> " rr_shutdown " ) ; <nl> p - > shutdown = true ; <nl> new_state = GRPC_CHANNEL_SHUTDOWN ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_round_robin_trace ) ) { <nl> + if ( grpc_lb_round_robin_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " [ RR % p ] Shutting down : all subchannels have gone into shutdown " , <nl> ( void * ) p ) ; <nl> static void rr_connectivity_changed_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> grpc_lb_subchannel_data * sd = ( grpc_lb_subchannel_data * ) arg ; <nl> round_robin_lb_policy * p = <nl> ( round_robin_lb_policy * ) sd - > subchannel_list - > policy ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_round_robin_trace ) ) { <nl> + if ( grpc_lb_round_robin_trace . enabled ( ) ) { <nl> gpr_log ( <nl> GPR_DEBUG , <nl> " [ RR % p ] connectivity changed for subchannel % p , subchannel_list % p : " <nl> static void rr_connectivity_changed_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> / / for sds belonging to outdated subchannel lists . <nl> GPR_ASSERT ( sd - > subchannel_list = = p - > latest_pending_subchannel_list ) ; <nl> GPR_ASSERT ( ! sd - > subchannel_list - > shutting_down ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_round_robin_trace ) ) { <nl> + if ( grpc_lb_round_robin_trace . enabled ( ) ) { <nl> const unsigned long num_subchannels = <nl> p - > subchannel_list ! = nullptr <nl> ? ( unsigned long ) p - > subchannel_list - > num_subchannels <nl> static void rr_connectivity_changed_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> if ( pp - > user_data ! = nullptr ) { <nl> * pp - > user_data = selected - > user_data ; <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_lb_round_robin_trace ) ) { <nl> + if ( grpc_lb_round_robin_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " [ RR % p ] Fulfilling pending pick . Target < - - subchannel % p " <nl> " ( subchannel_list % p , index % lu ) " , <nl> static void rr_update_locked ( grpc_exec_ctx * exec_ctx , grpc_lb_policy * policy , <nl> return ; <nl> } <nl> grpc_lb_addresses * addresses = ( grpc_lb_addresses * ) arg - > value . pointer . p ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_round_robin_trace ) ) { <nl> + if ( grpc_lb_round_robin_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " [ RR % p ] received update with % " PRIuPTR " addresses " , p , <nl> addresses - > num_addresses ) ; <nl> } <nl> static void rr_update_locked ( grpc_exec_ctx * exec_ctx , grpc_lb_policy * policy , <nl> } <nl> if ( p - > started_picking ) { <nl> if ( p - > latest_pending_subchannel_list ! = nullptr ) { <nl> - if ( GRPC_TRACER_ON ( grpc_lb_round_robin_trace ) ) { <nl> + if ( grpc_lb_round_robin_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " [ RR % p ] Shutting down latest pending subchannel list % p , " <nl> " about to be replaced by newer latest % p " , <nl> static grpc_lb_policy * round_robin_create ( grpc_exec_ctx * exec_ctx , <nl> grpc_connectivity_state_init ( & p - > state_tracker , GRPC_CHANNEL_IDLE , <nl> " round_robin " ) ; <nl> rr_update_locked ( exec_ctx , & p - > base , args ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_lb_round_robin_trace ) ) { <nl> + if ( grpc_lb_round_robin_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " [ RR % p ] Created with % lu subchannels " , ( void * ) p , <nl> ( unsigned long ) p - > subchannel_list - > num_subchannels ) ; <nl> } <nl> static grpc_lb_policy_factory * round_robin_lb_factory_create ( ) { <nl> <nl> extern " C " void grpc_lb_policy_round_robin_init ( ) { <nl> grpc_register_lb_policy ( round_robin_lb_factory_create ( ) ) ; <nl> - grpc_register_tracer ( & grpc_lb_round_robin_trace ) ; <nl> } <nl> <nl> extern " C " void grpc_lb_policy_round_robin_shutdown ( ) { } <nl> mmm a / src / core / ext / filters / client_channel / lb_policy / subchannel_list . cc <nl> ppp b / src / core / ext / filters / client_channel / lb_policy / subchannel_list . cc <nl> void grpc_lb_subchannel_data_unref_subchannel ( grpc_exec_ctx * exec_ctx , <nl> grpc_lb_subchannel_data * sd , <nl> const char * reason ) { <nl> if ( sd - > subchannel ! = nullptr ) { <nl> - if ( GRPC_TRACER_ON ( * sd - > subchannel_list - > tracer ) ) { <nl> + if ( sd - > subchannel_list - > tracer - > enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " [ % s % p ] subchannel list % p index % " PRIuPTR " of % " PRIuPTR <nl> " ( subchannel % p ) : unreffing subchannel " , <nl> - sd - > subchannel_list - > tracer - > name , sd - > subchannel_list - > policy , <nl> + sd - > subchannel_list - > tracer - > name ( ) , sd - > subchannel_list - > policy , <nl> sd - > subchannel_list , <nl> ( size_t ) ( sd - sd - > subchannel_list - > subchannels ) , <nl> sd - > subchannel_list - > num_subchannels , sd - > subchannel ) ; <nl> void grpc_lb_subchannel_data_unref_subchannel ( grpc_exec_ctx * exec_ctx , <nl> <nl> void grpc_lb_subchannel_data_start_connectivity_watch ( <nl> grpc_exec_ctx * exec_ctx , grpc_lb_subchannel_data * sd ) { <nl> - if ( GRPC_TRACER_ON ( * sd - > subchannel_list - > tracer ) ) { <nl> + if ( sd - > subchannel_list - > tracer - > enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " [ % s % p ] subchannel list % p index % " PRIuPTR " of % " PRIuPTR <nl> " ( subchannel % p ) : requesting connectivity change notification " , <nl> - sd - > subchannel_list - > tracer - > name , sd - > subchannel_list - > policy , <nl> + sd - > subchannel_list - > tracer - > name ( ) , sd - > subchannel_list - > policy , <nl> sd - > subchannel_list , <nl> ( size_t ) ( sd - sd - > subchannel_list - > subchannels ) , <nl> sd - > subchannel_list - > num_subchannels , sd - > subchannel ) ; <nl> void grpc_lb_subchannel_data_start_connectivity_watch ( <nl> <nl> void grpc_lb_subchannel_data_stop_connectivity_watch ( <nl> grpc_exec_ctx * exec_ctx , grpc_lb_subchannel_data * sd ) { <nl> - if ( GRPC_TRACER_ON ( * sd - > subchannel_list - > tracer ) ) { <nl> + if ( sd - > subchannel_list - > tracer - > enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " [ % s % p ] subchannel list % p index % " PRIuPTR " of % " PRIuPTR <nl> " ( subchannel % p ) : stopping connectivity watch " , <nl> - sd - > subchannel_list - > tracer - > name , sd - > subchannel_list - > policy , <nl> + sd - > subchannel_list - > tracer - > name ( ) , sd - > subchannel_list - > policy , <nl> sd - > subchannel_list , <nl> ( size_t ) ( sd - sd - > subchannel_list - > subchannels ) , <nl> sd - > subchannel_list - > num_subchannels , sd - > subchannel ) ; <nl> void grpc_lb_subchannel_data_stop_connectivity_watch ( <nl> } <nl> <nl> grpc_lb_subchannel_list * grpc_lb_subchannel_list_create ( <nl> - grpc_exec_ctx * exec_ctx , grpc_lb_policy * p , grpc_tracer_flag * tracer , <nl> + grpc_exec_ctx * exec_ctx , grpc_lb_policy * p , grpc_core : : TraceFlag * tracer , <nl> const grpc_lb_addresses * addresses , const grpc_lb_policy_args * args , <nl> grpc_iomgr_cb_func connectivity_changed_cb ) { <nl> grpc_lb_subchannel_list * subchannel_list = <nl> ( grpc_lb_subchannel_list * ) gpr_zalloc ( sizeof ( * subchannel_list ) ) ; <nl> - if ( GRPC_TRACER_ON ( * tracer ) ) { <nl> + if ( tracer - > enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " [ % s % p ] Creating subchannel list % p for % " PRIuPTR " subchannels " , <nl> - tracer - > name , p , subchannel_list , addresses - > num_addresses ) ; <nl> + tracer - > name ( ) , p , subchannel_list , addresses - > num_addresses ) ; <nl> } <nl> subchannel_list - > policy = p ; <nl> subchannel_list - > tracer = tracer ; <nl> grpc_lb_subchannel_list * grpc_lb_subchannel_list_create ( <nl> grpc_channel_args_destroy ( exec_ctx , new_args ) ; <nl> if ( subchannel = = nullptr ) { <nl> / / Subchannel could not be created . <nl> - if ( GRPC_TRACER_ON ( * tracer ) ) { <nl> + if ( tracer - > enabled ( ) ) { <nl> char * address_uri = <nl> grpc_sockaddr_to_uri ( & addresses - > addresses [ i ] . address ) ; <nl> gpr_log ( GPR_DEBUG , <nl> " [ % s % p ] could not create subchannel for address uri % s , " <nl> " ignoring " , <nl> - tracer - > name , subchannel_list - > policy , address_uri ) ; <nl> + tracer - > name ( ) , subchannel_list - > policy , address_uri ) ; <nl> gpr_free ( address_uri ) ; <nl> } <nl> continue ; <nl> } <nl> - if ( GRPC_TRACER_ON ( * tracer ) ) { <nl> + if ( tracer - > enabled ( ) ) { <nl> char * address_uri = <nl> grpc_sockaddr_to_uri ( & addresses - > addresses [ i ] . address ) ; <nl> gpr_log ( GPR_DEBUG , <nl> " [ % s % p ] subchannel list % p index % " PRIuPTR <nl> " : Created subchannel % p for address uri % s " , <nl> - tracer - > name , p , subchannel_list , subchannel_index , subchannel , <nl> + tracer - > name ( ) , p , subchannel_list , subchannel_index , subchannel , <nl> address_uri ) ; <nl> gpr_free ( address_uri ) ; <nl> } <nl> grpc_lb_subchannel_list * grpc_lb_subchannel_list_create ( <nl> <nl> static void subchannel_list_destroy ( grpc_exec_ctx * exec_ctx , <nl> grpc_lb_subchannel_list * subchannel_list ) { <nl> - if ( GRPC_TRACER_ON ( * subchannel_list - > tracer ) ) { <nl> + if ( subchannel_list - > tracer - > enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " [ % s % p ] Destroying subchannel_list % p " , <nl> - subchannel_list - > tracer - > name , subchannel_list - > policy , <nl> + subchannel_list - > tracer - > name ( ) , subchannel_list - > policy , <nl> subchannel_list ) ; <nl> } <nl> for ( size_t i = 0 ; i < subchannel_list - > num_subchannels ; i + + ) { <nl> static void subchannel_list_destroy ( grpc_exec_ctx * exec_ctx , <nl> void grpc_lb_subchannel_list_ref ( grpc_lb_subchannel_list * subchannel_list , <nl> const char * reason ) { <nl> gpr_ref_non_zero ( & subchannel_list - > refcount ) ; <nl> - if ( GRPC_TRACER_ON ( * subchannel_list - > tracer ) ) { <nl> + if ( subchannel_list - > tracer - > enabled ( ) ) { <nl> const gpr_atm count = gpr_atm_acq_load ( & subchannel_list - > refcount . count ) ; <nl> gpr_log ( GPR_DEBUG , " [ % s % p ] subchannel_list % p REF % lu - > % lu ( % s ) " , <nl> - subchannel_list - > tracer - > name , subchannel_list - > policy , <nl> + subchannel_list - > tracer - > name ( ) , subchannel_list - > policy , <nl> subchannel_list , ( unsigned long ) ( count - 1 ) , ( unsigned long ) count , <nl> reason ) ; <nl> } <nl> void grpc_lb_subchannel_list_unref ( grpc_exec_ctx * exec_ctx , <nl> grpc_lb_subchannel_list * subchannel_list , <nl> const char * reason ) { <nl> const bool done = gpr_unref ( & subchannel_list - > refcount ) ; <nl> - if ( GRPC_TRACER_ON ( * subchannel_list - > tracer ) ) { <nl> + if ( subchannel_list - > tracer - > enabled ( ) ) { <nl> const gpr_atm count = gpr_atm_acq_load ( & subchannel_list - > refcount . count ) ; <nl> gpr_log ( GPR_DEBUG , " [ % s % p ] subchannel_list % p UNREF % lu - > % lu ( % s ) " , <nl> - subchannel_list - > tracer - > name , subchannel_list - > policy , <nl> + subchannel_list - > tracer - > name ( ) , subchannel_list - > policy , <nl> subchannel_list , ( unsigned long ) ( count + 1 ) , ( unsigned long ) count , <nl> reason ) ; <nl> } <nl> void grpc_lb_subchannel_list_unref_for_connectivity_watch ( <nl> <nl> static void subchannel_data_cancel_connectivity_watch ( <nl> grpc_exec_ctx * exec_ctx , grpc_lb_subchannel_data * sd , const char * reason ) { <nl> - if ( GRPC_TRACER_ON ( * sd - > subchannel_list - > tracer ) ) { <nl> + if ( sd - > subchannel_list - > tracer - > enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " [ % s % p ] subchannel list % p index % " PRIuPTR " of % " PRIuPTR <nl> " ( subchannel % p ) : canceling connectivity watch ( % s ) " , <nl> - sd - > subchannel_list - > tracer - > name , sd - > subchannel_list - > policy , <nl> + sd - > subchannel_list - > tracer - > name ( ) , sd - > subchannel_list - > policy , <nl> sd - > subchannel_list , <nl> ( size_t ) ( sd - sd - > subchannel_list - > subchannels ) , <nl> sd - > subchannel_list - > num_subchannels , sd - > subchannel , reason ) ; <nl> static void subchannel_data_cancel_connectivity_watch ( <nl> void grpc_lb_subchannel_list_shutdown_and_unref ( <nl> grpc_exec_ctx * exec_ctx , grpc_lb_subchannel_list * subchannel_list , <nl> const char * reason ) { <nl> - if ( GRPC_TRACER_ON ( * subchannel_list - > tracer ) ) { <nl> + if ( subchannel_list - > tracer - > enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " [ % s % p ] Shutting down subchannel_list % p ( % s ) " , <nl> - subchannel_list - > tracer - > name , subchannel_list - > policy , <nl> + subchannel_list - > tracer - > name ( ) , subchannel_list - > policy , <nl> subchannel_list , reason ) ; <nl> } <nl> GPR_ASSERT ( ! subchannel_list - > shutting_down ) ; <nl> mmm a / src / core / ext / filters / client_channel / lb_policy / subchannel_list . h <nl> ppp b / src / core / ext / filters / client_channel / lb_policy / subchannel_list . h <nl> struct grpc_lb_subchannel_list { <nl> / * * backpointer to owning policy * / <nl> grpc_lb_policy * policy ; <nl> <nl> - grpc_tracer_flag * tracer ; <nl> + grpc_core : : TraceFlag * tracer ; <nl> <nl> / * * all our subchannels * / <nl> size_t num_subchannels ; <nl> struct grpc_lb_subchannel_list { <nl> } ; <nl> <nl> grpc_lb_subchannel_list * grpc_lb_subchannel_list_create ( <nl> - grpc_exec_ctx * exec_ctx , grpc_lb_policy * p , grpc_tracer_flag * tracer , <nl> + grpc_exec_ctx * exec_ctx , grpc_lb_policy * p , grpc_core : : TraceFlag * tracer , <nl> const grpc_lb_addresses * addresses , const grpc_lb_policy_args * args , <nl> grpc_iomgr_cb_func connectivity_changed_cb ) ; <nl> <nl> mmm a / src / core / ext / filters / client_channel / resolver . cc <nl> ppp b / src / core / ext / filters / client_channel / resolver . cc <nl> <nl> # include " src / core / ext / filters / client_channel / resolver . h " <nl> # include " src / core / lib / iomgr / combiner . h " <nl> <nl> - # ifndef NDEBUG <nl> - grpc_tracer_flag grpc_trace_resolver_refcount = <nl> - GRPC_TRACER_INITIALIZER ( false , " resolver_refcount " ) ; <nl> - # endif <nl> + grpc_core : : DebugOnlyTraceFlag grpc_trace_resolver_refcount ( false , <nl> + " resolver_refcount " ) ; <nl> <nl> void grpc_resolver_init ( grpc_resolver * resolver , <nl> const grpc_resolver_vtable * vtable , <nl> void grpc_resolver_init ( grpc_resolver * resolver , <nl> # ifndef NDEBUG <nl> void grpc_resolver_ref ( grpc_resolver * resolver , const char * file , int line , <nl> const char * reason ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_resolver_refcount ) ) { <nl> + if ( grpc_trace_resolver_refcount . enabled ( ) ) { <nl> gpr_atm old_refs = gpr_atm_no_barrier_load ( & resolver - > refs . count ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " RESOLVER : % p ref % " PRIdPTR " - > % " PRIdPTR " % s " , resolver , <nl> void grpc_resolver_ref ( grpc_resolver * resolver ) { <nl> # ifndef NDEBUG <nl> void grpc_resolver_unref ( grpc_exec_ctx * exec_ctx , grpc_resolver * resolver , <nl> const char * file , int line , const char * reason ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_resolver_refcount ) ) { <nl> + if ( grpc_trace_resolver_refcount . enabled ( ) ) { <nl> gpr_atm old_refs = gpr_atm_no_barrier_load ( & resolver - > refs . count ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " RESOLVER : % p unref % " PRIdPTR " - > % " PRIdPTR " % s " , resolver , <nl> mmm a / src / core / ext / filters / client_channel / resolver . h <nl> ppp b / src / core / ext / filters / client_channel / resolver . h <nl> extern " C " { <nl> typedef struct grpc_resolver grpc_resolver ; <nl> typedef struct grpc_resolver_vtable grpc_resolver_vtable ; <nl> <nl> - # ifndef NDEBUG <nl> - extern grpc_tracer_flag grpc_trace_resolver_refcount ; <nl> - # endif <nl> + extern grpc_core : : DebugOnlyTraceFlag grpc_trace_resolver_refcount ; <nl> <nl> / * * \ a grpc_resolver provides \ a grpc_channel_args objects to its caller * / <nl> struct grpc_resolver { <nl> mmm a / src / core / ext / filters / client_channel / subchannel . cc <nl> ppp b / src / core / ext / filters / client_channel / subchannel . cc <nl> static gpr_atm ref_mutate ( grpc_subchannel * c , gpr_atm delta , <nl> gpr_atm old_val = barrier ? gpr_atm_full_fetch_add ( & c - > ref_pair , delta ) <nl> : gpr_atm_no_barrier_fetch_add ( & c - > ref_pair , delta ) ; <nl> # ifndef NDEBUG <nl> - if ( GRPC_TRACER_ON ( grpc_trace_stream_refcount ) ) { <nl> + if ( grpc_trace_stream_refcount . enabled ( ) ) { <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " SUBCHANNEL : % p % 12s 0x % " PRIxPTR " - > 0x % " PRIxPTR " [ % s ] " , c , <nl> purpose , old_val , old_val + delta , reason ) ; <nl> mmm a / src / core / ext / filters / http / http_filters_plugin . cc <nl> ppp b / src / core / ext / filters / http / http_filters_plugin . cc <nl> static bool maybe_add_required_filter ( grpc_exec_ctx * exec_ctx , <nl> } <nl> <nl> extern " C " void grpc_http_filters_init ( void ) { <nl> - grpc_register_tracer ( & grpc_compression_trace ) ; <nl> grpc_channel_init_register_stage ( GRPC_CLIENT_SUBCHANNEL , <nl> GRPC_CHANNEL_INIT_BUILTIN_PRIORITY , <nl> maybe_add_optional_filter , & compress_filter ) ; <nl> mmm a / src / core / ext / filters / http / message_compress / message_compress_filter . cc <nl> ppp b / src / core / ext / filters / http / message_compress / message_compress_filter . cc <nl> static void finish_send_message ( grpc_exec_ctx * exec_ctx , <nl> bool did_compress = grpc_msg_compress ( exec_ctx , calld - > compression_algorithm , <nl> & calld - > slices , & tmp ) ; <nl> if ( did_compress ) { <nl> - if ( GRPC_TRACER_ON ( grpc_compression_trace ) ) { <nl> + if ( grpc_compression_trace . enabled ( ) ) { <nl> const char * algo_name ; <nl> const size_t before_size = calld - > slices . length ; <nl> const size_t after_size = tmp . length ; <nl> static void finish_send_message ( grpc_exec_ctx * exec_ctx , <nl> grpc_slice_buffer_swap ( & calld - > slices , & tmp ) ; <nl> send_flags | = GRPC_WRITE_INTERNAL_COMPRESS ; <nl> } else { <nl> - if ( GRPC_TRACER_ON ( grpc_compression_trace ) ) { <nl> + if ( grpc_compression_trace . enabled ( ) ) { <nl> const char * algo_name ; <nl> GPR_ASSERT ( grpc_compression_algorithm_name ( calld - > compression_algorithm , <nl> & algo_name ) ) ; <nl> mmm a / src / core / ext / transport / chttp2 / transport / chttp2_plugin . cc <nl> ppp b / src / core / ext / transport / chttp2 / transport / chttp2_plugin . cc <nl> <nl> # include " src / core / lib / debug / trace . h " <nl> # include " src / core / lib / transport / metadata . h " <nl> <nl> - extern " C " void grpc_chttp2_plugin_init ( void ) { <nl> - grpc_register_tracer ( & grpc_http_trace ) ; <nl> - grpc_register_tracer ( & grpc_flowctl_trace ) ; <nl> - grpc_register_tracer ( & grpc_trace_http2_stream_state ) ; <nl> - # ifndef NDEBUG <nl> - grpc_register_tracer ( & grpc_trace_chttp2_refcount ) ; <nl> - # endif <nl> - } <nl> + extern " C " void grpc_chttp2_plugin_init ( void ) { } <nl> <nl> extern " C " void grpc_chttp2_plugin_shutdown ( void ) { } <nl> mmm a / src / core / ext / transport / chttp2 / transport / chttp2_transport . cc <nl> ppp b / src / core / ext / transport / chttp2 / transport / chttp2_transport . cc <nl> static int g_default_max_pings_without_data = DEFAULT_MAX_PINGS_BETWEEN_DATA ; <nl> static int g_default_max_ping_strikes = DEFAULT_MAX_PING_STRIKES ; <nl> <nl> # define MAX_CLIENT_STREAM_ID 0x7fffffffu <nl> - grpc_tracer_flag grpc_http_trace = GRPC_TRACER_INITIALIZER ( false , " http " ) ; <nl> - grpc_tracer_flag grpc_flowctl_trace = GRPC_TRACER_INITIALIZER ( false , " flowctl " ) ; <nl> - <nl> - # ifndef NDEBUG <nl> - grpc_tracer_flag grpc_trace_chttp2_refcount = <nl> - GRPC_TRACER_INITIALIZER ( false , " chttp2_refcount " ) ; <nl> - # endif <nl> + grpc_core : : TraceFlag grpc_http_trace ( false , " http " ) ; <nl> + grpc_core : : DebugOnlyTraceFlag grpc_trace_chttp2_refcount ( false , <nl> + " chttp2_refcount " ) ; <nl> <nl> / * forward declarations of various callbacks that we ' ll build closures around * / <nl> static void write_action_begin_locked ( grpc_exec_ctx * exec_ctx , void * t , <nl> static void destruct_transport ( grpc_exec_ctx * exec_ctx , <nl> void grpc_chttp2_unref_transport ( grpc_exec_ctx * exec_ctx , <nl> grpc_chttp2_transport * t , const char * reason , <nl> const char * file , int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_chttp2_refcount ) ) { <nl> + if ( grpc_trace_chttp2_refcount . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & t - > refs . count ) ; <nl> gpr_log ( GPR_DEBUG , " chttp2 : unref : % p % " PRIdPTR " - > % " PRIdPTR " % s [ % s : % d ] " , <nl> t , val , val - 1 , reason , file , line ) ; <nl> void grpc_chttp2_unref_transport ( grpc_exec_ctx * exec_ctx , <nl> <nl> void grpc_chttp2_ref_transport ( grpc_chttp2_transport * t , const char * reason , <nl> const char * file , int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_chttp2_refcount ) ) { <nl> + if ( grpc_trace_chttp2_refcount . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & t - > refs . count ) ; <nl> gpr_log ( GPR_DEBUG , " chttp2 : ref : % p % " PRIdPTR " - > % " PRIdPTR " % s [ % s : % d ] " , <nl> t , val , val + 1 , reason , file , line ) ; <nl> void grpc_chttp2_complete_closure_step ( grpc_exec_ctx * exec_ctx , <nl> return ; <nl> } <nl> closure - > next_data . scratch - = CLOSURE_BARRIER_FIRST_REF_BIT ; <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) ) { <nl> const char * errstr = grpc_error_string ( error ) ; <nl> gpr_log ( <nl> GPR_DEBUG , <nl> static void perform_stream_op_locked ( grpc_exec_ctx * exec_ctx , void * stream_op , <nl> <nl> GRPC_STATS_INC_HTTP2_OP_BATCHES ( exec_ctx ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) ) { <nl> char * str = grpc_transport_stream_op_batch_string ( op ) ; <nl> gpr_log ( GPR_DEBUG , " perform_stream_op_locked : % s ; on_complete = % p " , str , <nl> op - > on_complete ) ; <nl> static void perform_stream_op ( grpc_exec_ctx * exec_ctx , grpc_transport * gt , <nl> } <nl> } <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) ) { <nl> char * str = grpc_transport_stream_op_batch_string ( op ) ; <nl> gpr_log ( GPR_DEBUG , " perform_stream_op [ s = % p ] : % s " , s , str ) ; <nl> gpr_free ( str ) ; <nl> static void schedule_bdp_ping_locked ( grpc_exec_ctx * exec_ctx , <nl> static void start_bdp_ping_locked ( grpc_exec_ctx * exec_ctx , void * tp , <nl> grpc_error * error ) { <nl> grpc_chttp2_transport * t = ( grpc_chttp2_transport * ) tp ; <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " % s : Start BDP ping err = % s " , t - > peer_string , <nl> grpc_error_string ( error ) ) ; <nl> } <nl> static void start_bdp_ping_locked ( grpc_exec_ctx * exec_ctx , void * tp , <nl> static void finish_bdp_ping_locked ( grpc_exec_ctx * exec_ctx , void * tp , <nl> grpc_error * error ) { <nl> grpc_chttp2_transport * t = ( grpc_chttp2_transport * ) tp ; <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " % s : Complete BDP ping err = % s " , t - > peer_string , <nl> grpc_error_string ( error ) ) ; <nl> } <nl> static void benign_reclaimer_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> grpc_chttp2_stream_map_size ( & t - > stream_map ) = = 0 ) { <nl> / * Channel with no active streams : send a goaway to try and make it <nl> * disconnect cleanly * / <nl> - if ( GRPC_TRACER_ON ( grpc_resource_quota_trace ) ) { <nl> + if ( grpc_resource_quota_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " HTTP2 : % s - send goaway to free memory " , <nl> t - > peer_string ) ; <nl> } <nl> static void benign_reclaimer_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> grpc_error_set_int ( <nl> GRPC_ERROR_CREATE_FROM_STATIC_STRING ( " Buffers full " ) , <nl> GRPC_ERROR_INT_HTTP2_ERROR , GRPC_HTTP2_ENHANCE_YOUR_CALM ) ) ; <nl> - } else if ( error = = GRPC_ERROR_NONE & & <nl> - GRPC_TRACER_ON ( grpc_resource_quota_trace ) ) { <nl> + } else if ( error = = GRPC_ERROR_NONE & & grpc_resource_quota_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " HTTP2 : % s - skip benign reclamation , there are still % " PRIdPTR <nl> " streams " , <nl> static void destructive_reclaimer_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> if ( error = = GRPC_ERROR_NONE & & n > 0 ) { <nl> grpc_chttp2_stream * s = <nl> ( grpc_chttp2_stream * ) grpc_chttp2_stream_map_rand ( & t - > stream_map ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_resource_quota_trace ) ) { <nl> + if ( grpc_resource_quota_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " HTTP2 : % s - abandon stream id % d " , t - > peer_string , <nl> s - > id ) ; <nl> } <nl> mmm a / src / core / ext / transport / chttp2 / transport / chttp2_transport . h <nl> ppp b / src / core / ext / transport / chttp2 / transport / chttp2_transport . h <nl> <nl> # include " src / core / lib / iomgr / endpoint . h " <nl> # include " src / core / lib / transport / transport . h " <nl> <nl> + extern grpc_core : : TraceFlag grpc_http_trace ; <nl> + extern grpc_core : : TraceFlag grpc_trace_http2_stream_state ; <nl> + extern grpc_core : : DebugOnlyTraceFlag grpc_trace_chttp2_refcount ; <nl> + <nl> # ifdef __cplusplus <nl> extern " C " { <nl> # endif <nl> <nl> - extern grpc_tracer_flag grpc_http_trace ; <nl> - extern grpc_tracer_flag grpc_flowctl_trace ; <nl> - extern grpc_tracer_flag grpc_trace_http2_stream_state ; <nl> - <nl> - # ifndef NDEBUG <nl> - extern grpc_tracer_flag grpc_trace_chttp2_refcount ; <nl> - # endif <nl> - <nl> grpc_transport * grpc_create_chttp2_transport ( <nl> grpc_exec_ctx * exec_ctx , const grpc_channel_args * channel_args , <nl> grpc_endpoint * ep , int is_client ) ; <nl> mmm a / src / core / ext / transport / chttp2 / transport / flow_control . cc <nl> ppp b / src / core / ext / transport / chttp2 / transport / flow_control . cc <nl> <nl> # include " src / core / ext / transport / chttp2 / transport / internal . h " <nl> # include " src / core / lib / support / string . h " <nl> <nl> + grpc_core : : TraceFlag grpc_flowctl_trace ( false , " flowctl " ) ; <nl> + <nl> namespace grpc_core { <nl> namespace chttp2 { <nl> <nl> mmm a / src / core / ext / transport / chttp2 / transport / flow_control . h <nl> ppp b / src / core / ext / transport / chttp2 / transport / flow_control . h <nl> <nl> struct grpc_chttp2_transport ; <nl> struct grpc_chttp2_stream ; <nl> <nl> - extern " C " grpc_tracer_flag grpc_flowctl_trace ; <nl> + extern grpc_core : : TraceFlag grpc_flowctl_trace ; <nl> <nl> namespace grpc { <nl> namespace testing { <nl> class FlowControlTrace { <nl> StreamFlowControl * sfc ) ; <nl> void Finish ( ) ; <nl> <nl> - const bool enabled_ = GRPC_TRACER_ON ( grpc_flowctl_trace ) ; <nl> + const bool enabled_ = grpc_flowctl_trace . enabled ( ) ; <nl> <nl> TransportFlowControl * tfc_ ; <nl> StreamFlowControl * sfc_ ; <nl> mmm a / src / core / ext / transport / chttp2 / transport / frame_settings . cc <nl> ppp b / src / core / ext / transport / chttp2 / transport / frame_settings . cc <nl> grpc_error * grpc_chttp2_settings_parser_parse ( grpc_exec_ctx * exec_ctx , void * p , <nl> parser - > incoming_settings [ id ] ! = parser - > value ) { <nl> t - > initial_window_update + = <nl> ( int64_t ) parser - > value - parser - > incoming_settings [ id ] ; <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) | | <nl> - GRPC_TRACER_ON ( grpc_flowctl_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) | | grpc_flowctl_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " % p [ % s ] adding % d for initial_window change " , <nl> t , t - > is_client ? " cli " : " svr " , <nl> ( int ) t - > initial_window_update ) ; <nl> } <nl> } <nl> parser - > incoming_settings [ id ] = parser - > value ; <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " CHTTP2 : % s : % s : got setting % s = % d " , <nl> t - > is_client ? " CLI " : " SVR " , t - > peer_string , sp - > name , <nl> parser - > value ) ; <nl> } <nl> - } else if ( GRPC_TRACER_ON ( grpc_http_trace ) ) { <nl> + } else if ( grpc_http_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " CHTTP2 : Ignoring unknown setting % d ( value % d ) " , <nl> parser - > id , parser - > value ) ; <nl> } <nl> mmm a / src / core / ext / transport / chttp2 / transport / hpack_encoder . cc <nl> ppp b / src / core / ext / transport / chttp2 / transport / hpack_encoder . cc <nl> static const grpc_slice terminal_slice = { <nl> { { nullptr , 0 } } / * data . refcounted * / <nl> } ; <nl> <nl> - extern " C " grpc_tracer_flag grpc_http_trace ; <nl> - <nl> typedef struct { <nl> int is_first_frame ; <nl> / * number of bytes in ' output ' when we started the frame - used to calculate <nl> static void hpack_enc ( grpc_exec_ctx * exec_ctx , grpc_chttp2_hpack_compressor * c , <nl> " Reserved header ( colon - prefixed ) happening after regular ones . " ) ; <nl> } <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) ) { <nl> char * k = grpc_slice_to_c_string ( GRPC_MDKEY ( elem ) ) ; <nl> char * v = nullptr ; <nl> if ( grpc_is_binary_header ( GRPC_MDKEY ( elem ) ) ) { <nl> void grpc_chttp2_hpack_compressor_set_max_table_size ( <nl> } <nl> } <nl> c - > advertise_table_size_change = 1 ; <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " set max table size from encoder to % d " , max_table_size ) ; <nl> } <nl> } <nl> mmm a / src / core / ext / transport / chttp2 / transport / hpack_encoder . h <nl> ppp b / src / core / ext / transport / chttp2 / transport / hpack_encoder . h <nl> <nl> / * maximum table size we ' ll actually use * / <nl> # define GRPC_CHTTP2_HPACKC_MAX_TABLE_SIZE ( 1024 * 1024 ) <nl> <nl> + extern grpc_core : : TraceFlag grpc_http_trace ; <nl> + <nl> # ifdef __cplusplus <nl> extern " C " { <nl> # endif <nl> mmm a / src / core / ext / transport / chttp2 / transport / hpack_parser . cc <nl> ppp b / src / core / ext / transport / chttp2 / transport / hpack_parser . cc <nl> static const uint8_t inverse_base64 [ 256 ] = { <nl> / * emission helpers * / <nl> static grpc_error * on_hdr ( grpc_exec_ctx * exec_ctx , grpc_chttp2_hpack_parser * p , <nl> grpc_mdelem md , int add_to_table ) { <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) ) { <nl> char * k = grpc_slice_to_c_string ( GRPC_MDKEY ( md ) ) ; <nl> char * v = nullptr ; <nl> if ( grpc_is_binary_header ( GRPC_MDKEY ( md ) ) ) { <nl> static grpc_error * parse_lithdr_nvridx_v ( grpc_exec_ctx * exec_ctx , <nl> static grpc_error * finish_max_tbl_size ( grpc_exec_ctx * exec_ctx , <nl> grpc_chttp2_hpack_parser * p , <nl> const uint8_t * cur , const uint8_t * end ) { <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , " MAX TABLE SIZE : % d " , p - > index ) ; <nl> } <nl> grpc_error * err = <nl> mmm a / src / core / ext / transport / chttp2 / transport / hpack_table . cc <nl> ppp b / src / core / ext / transport / chttp2 / transport / hpack_table . cc <nl> <nl> # include " src / core / lib / debug / trace . h " <nl> # include " src / core / lib / support / murmur_hash . h " <nl> <nl> - extern " C " grpc_tracer_flag grpc_http_trace ; <nl> + extern grpc_core : : TraceFlag grpc_http_trace ; <nl> <nl> static struct { <nl> const char * key ; <nl> void grpc_chttp2_hptbl_set_max_bytes ( grpc_exec_ctx * exec_ctx , <nl> if ( tbl - > max_bytes = = max_bytes ) { <nl> return ; <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " Update hpack parser max size to % d " , max_bytes ) ; <nl> } <nl> while ( tbl - > mem_used > max_bytes ) { <nl> grpc_error * grpc_chttp2_hptbl_set_current_table_size ( grpc_exec_ctx * exec_ctx , <nl> gpr_free ( msg ) ; <nl> return err ; <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " Update hpack parser table size to % d " , bytes ) ; <nl> } <nl> while ( tbl - > mem_used > bytes ) { <nl> mmm a / src / core / ext / transport / chttp2 / transport / internal . h <nl> ppp b / src / core / ext / transport / chttp2 / transport / internal . h <nl> void grpc_chttp2_complete_closure_step ( grpc_exec_ctx * exec_ctx , <nl> # define GRPC_CHTTP2_CLIENT_CONNECT_STRLEN \ <nl> ( sizeof ( GRPC_CHTTP2_CLIENT_CONNECT_STRING ) - 1 ) <nl> <nl> - extern grpc_tracer_flag grpc_http_trace ; <nl> - extern grpc_tracer_flag grpc_flowctl_trace ; <nl> + / / extern grpc_core : : TraceFlag grpc_http_trace ; <nl> + / / extern grpc_core : : TraceFlag grpc_flowctl_trace ; <nl> <nl> - # define GRPC_CHTTP2_IF_TRACING ( stmt ) \ <nl> - if ( ! ( GRPC_TRACER_ON ( grpc_http_trace ) ) ) \ <nl> - ; \ <nl> - else \ <nl> + # define GRPC_CHTTP2_IF_TRACING ( stmt ) \ <nl> + if ( ! ( grpc_http_trace . enabled ( ) ) ) \ <nl> + ; \ <nl> + else \ <nl> stmt <nl> <nl> void grpc_chttp2_fake_status ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> mmm a / src / core / ext / transport / chttp2 / transport / parsing . cc <nl> ppp b / src / core / ext / transport / chttp2 / transport / parsing . cc <nl> static grpc_error * init_frame_parser ( grpc_exec_ctx * exec_ctx , <nl> case GRPC_CHTTP2_FRAME_GOAWAY : <nl> return init_goaway_parser ( exec_ctx , t ) ; <nl> default : <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " Unknown frame type % 02x " , t - > incoming_frame_type ) ; <nl> } <nl> return init_skip_frame_parser ( exec_ctx , t , 0 ) ; <nl> static void on_initial_header ( grpc_exec_ctx * exec_ctx , void * tp , <nl> <nl> GPR_ASSERT ( s ! = nullptr ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) ) { <nl> char * key = grpc_slice_to_c_string ( GRPC_MDKEY ( md ) ) ; <nl> char * value = <nl> grpc_dump_slice ( GRPC_MDVALUE ( md ) , GPR_DUMP_HEX | GPR_DUMP_ASCII ) ; <nl> static void on_trailing_header ( grpc_exec_ctx * exec_ctx , void * tp , <nl> <nl> GPR_ASSERT ( s ! = nullptr ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) ) { <nl> char * key = grpc_slice_to_c_string ( GRPC_MDKEY ( md ) ) ; <nl> char * value = <nl> grpc_dump_slice ( GRPC_MDVALUE ( md ) , GPR_DUMP_HEX | GPR_DUMP_ASCII ) ; <nl> static grpc_error * parse_frame_slice ( grpc_exec_ctx * exec_ctx , <nl> if ( err = = GRPC_ERROR_NONE ) { <nl> return err ; <nl> } else if ( grpc_error_get_int ( err , GRPC_ERROR_INT_STREAM_ID , nullptr ) ) { <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) ) { <nl> const char * msg = grpc_error_string ( err ) ; <nl> gpr_log ( GPR_ERROR , " % s " , msg ) ; <nl> } <nl> mmm a / src / core / ext / transport / chttp2 / transport / stream_lists . cc <nl> ppp b / src / core / ext / transport / chttp2 / transport / stream_lists . cc <nl> static const char * stream_list_id_string ( grpc_chttp2_stream_list_id id ) { <nl> GPR_UNREACHABLE_CODE ( return " unknown " ) ; <nl> } <nl> <nl> - grpc_tracer_flag grpc_trace_http2_stream_state = <nl> - GRPC_TRACER_INITIALIZER ( false , " http2_stream_state " ) ; <nl> + grpc_core : : TraceFlag grpc_trace_http2_stream_state ( false , " http2_stream_state " ) ; <nl> <nl> / * core list management * / <nl> <nl> static bool stream_list_pop ( grpc_chttp2_transport * t , <nl> s - > included [ id ] = 0 ; <nl> } <nl> * stream = s ; <nl> - if ( s & & GRPC_TRACER_ON ( grpc_trace_http2_stream_state ) ) { <nl> + if ( s & & grpc_trace_http2_stream_state . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " % p [ % d ] [ % s ] : pop from % s " , t , s - > id , <nl> t - > is_client ? " cli " : " svr " , stream_list_id_string ( id ) ) ; <nl> } <nl> static void stream_list_remove ( grpc_chttp2_transport * t , grpc_chttp2_stream * s , <nl> } else { <nl> t - > lists [ id ] . tail = s - > links [ id ] . prev ; <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_trace_http2_stream_state ) ) { <nl> + if ( grpc_trace_http2_stream_state . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " % p [ % d ] [ % s ] : remove from % s " , t , s - > id , <nl> t - > is_client ? " cli " : " svr " , stream_list_id_string ( id ) ) ; <nl> } <nl> static void stream_list_add_tail ( grpc_chttp2_transport * t , <nl> } <nl> t - > lists [ id ] . tail = s ; <nl> s - > included [ id ] = 1 ; <nl> - if ( GRPC_TRACER_ON ( grpc_trace_http2_stream_state ) ) { <nl> + if ( grpc_trace_http2_stream_state . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " % p [ % d ] [ % s ] : add to % s " , t , s - > id , <nl> t - > is_client ? " cli " : " svr " , stream_list_id_string ( id ) ) ; <nl> } <nl> mmm a / src / core / ext / transport / chttp2 / transport / writing . cc <nl> ppp b / src / core / ext / transport / chttp2 / transport / writing . cc <nl> static void maybe_initiate_ping ( grpc_exec_ctx * exec_ctx , <nl> } <nl> if ( ! grpc_closure_list_empty ( pq - > lists [ GRPC_CHTTP2_PCL_INFLIGHT ] ) ) { <nl> / * ping already in - flight : wait * / <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) | | <nl> - GRPC_TRACER_ON ( grpc_bdp_estimator_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) | | grpc_bdp_estimator_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " % s : Ping delayed [ % p ] : already pinging " , <nl> t - > is_client ? " CLIENT " : " SERVER " , t - > peer_string ) ; <nl> } <nl> static void maybe_initiate_ping ( grpc_exec_ctx * exec_ctx , <nl> if ( t - > ping_state . pings_before_data_required = = 0 & & <nl> t - > ping_policy . max_pings_without_data ! = 0 ) { <nl> / * need to receive something of substance before sending a ping again * / <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) | | <nl> - GRPC_TRACER_ON ( grpc_bdp_estimator_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) | | grpc_bdp_estimator_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " % s : Ping delayed [ % p ] : too many recent pings : % d / % d " , <nl> t - > is_client ? " CLIENT " : " SERVER " , t - > peer_string , <nl> t - > ping_state . pings_before_data_required , <nl> static void maybe_initiate_ping ( grpc_exec_ctx * exec_ctx , <nl> } <nl> if ( next_allowed_ping > now ) { <nl> / * not enough elapsed time between successive pings * / <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) | | <nl> - GRPC_TRACER_ON ( grpc_bdp_estimator_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) | | grpc_bdp_estimator_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " % s : Ping delayed [ % p ] : not enough time elapsed since last ping " , <nl> t - > is_client ? " CLIENT " : " SERVER " , t - > peer_string ) ; <nl> static void maybe_initiate_ping ( grpc_exec_ctx * exec_ctx , <nl> grpc_chttp2_ping_create ( false , pq - > inflight_id ) ) ; <nl> GRPC_STATS_INC_HTTP2_PINGS_SENT ( exec_ctx ) ; <nl> t - > ping_state . last_ping_sent_time = now ; <nl> - if ( GRPC_TRACER_ON ( grpc_http_trace ) | | <nl> - GRPC_TRACER_ON ( grpc_bdp_estimator_trace ) ) { <nl> + if ( grpc_http_trace . enabled ( ) | | grpc_bdp_estimator_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " % s : Ping sent [ % p ] : % d / % d " , <nl> t - > is_client ? " CLIENT " : " SERVER " , t - > peer_string , <nl> t - > ping_state . pings_before_data_required , <nl> mmm a / src / core / ext / transport / inproc / inproc_plugin . cc <nl> ppp b / src / core / ext / transport / inproc / inproc_plugin . cc <nl> <nl> # include " src / core / ext / transport / inproc / inproc_transport . h " <nl> # include " src / core / lib / debug / trace . h " <nl> <nl> - grpc_tracer_flag grpc_inproc_trace = GRPC_TRACER_INITIALIZER ( false , " inproc " ) ; <nl> + grpc_core : : TraceFlag grpc_inproc_trace ( false , " inproc " ) ; <nl> <nl> - extern " C " void grpc_inproc_plugin_init ( void ) { <nl> - grpc_register_tracer ( & grpc_inproc_trace ) ; <nl> - grpc_inproc_transport_init ( ) ; <nl> - } <nl> + extern " C " void grpc_inproc_plugin_init ( void ) { grpc_inproc_transport_init ( ) ; } <nl> <nl> extern " C " void grpc_inproc_plugin_shutdown ( void ) { <nl> grpc_inproc_transport_shutdown ( ) ; <nl> mmm a / src / core / ext / transport / inproc / inproc_transport . cc <nl> ppp b / src / core / ext / transport / inproc / inproc_transport . cc <nl> <nl> # include " src / core / lib / transport / error_utils . h " <nl> # include " src / core / lib / transport / transport_impl . h " <nl> <nl> - # define INPROC_LOG ( . . . ) \ <nl> - do { \ <nl> - if ( GRPC_TRACER_ON ( grpc_inproc_trace ) ) gpr_log ( __VA_ARGS__ ) ; \ <nl> + # define INPROC_LOG ( . . . ) \ <nl> + do { \ <nl> + if ( grpc_inproc_trace . enabled ( ) ) gpr_log ( __VA_ARGS__ ) ; \ <nl> } while ( 0 ) <nl> <nl> static grpc_slice g_empty_slice ; <nl> static grpc_error * fill_in_metadata ( grpc_exec_ctx * exec_ctx , inproc_stream * s , <nl> const grpc_metadata_batch * metadata , <nl> uint32_t flags , grpc_metadata_batch * out_md , <nl> uint32_t * outflags , bool * markfilled ) { <nl> - if ( GRPC_TRACER_ON ( grpc_inproc_trace ) ) { <nl> + if ( grpc_inproc_trace . enabled ( ) ) { <nl> log_metadata ( metadata , s - > t - > is_client , outflags ! = nullptr ) ; <nl> } <nl> <nl> static void perform_stream_op ( grpc_exec_ctx * exec_ctx , grpc_transport * gt , <nl> gpr_mu * mu = & s - > t - > mu - > mu ; / / save aside in case s gets closed <nl> gpr_mu_lock ( mu ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_inproc_trace ) ) { <nl> + if ( grpc_inproc_trace . enabled ( ) ) { <nl> if ( op - > send_initial_metadata ) { <nl> log_metadata ( op - > payload - > send_initial_metadata . send_initial_metadata , <nl> s - > t - > is_client , true ) ; <nl> mmm a / src / core / ext / transport / inproc / inproc_transport . h <nl> ppp b / src / core / ext / transport / inproc / inproc_transport . h <nl> grpc_channel * grpc_inproc_channel_create ( grpc_server * server , <nl> grpc_channel_args * args , <nl> void * reserved ) ; <nl> <nl> - extern grpc_tracer_flag grpc_inproc_trace ; <nl> + extern grpc_core : : TraceFlag grpc_inproc_trace ; <nl> <nl> void grpc_inproc_transport_init ( void ) ; <nl> void grpc_inproc_transport_shutdown ( void ) ; <nl> mmm a / src / core / lib / channel / channel_stack . cc <nl> ppp b / src / core / lib / channel / channel_stack . cc <nl> <nl> # include < stdlib . h > <nl> # include < string . h > <nl> <nl> - grpc_tracer_flag grpc_trace_channel = GRPC_TRACER_INITIALIZER ( false , " channel " ) ; <nl> + grpc_core : : TraceFlag grpc_trace_channel ( false , " channel " ) ; <nl> <nl> / * Memory layouts . <nl> <nl> mmm a / src / core / lib / channel / channel_stack . h <nl> ppp b / src / core / lib / channel / channel_stack . h <nl> void grpc_call_log_op ( const char * file , int line , gpr_log_severity severity , <nl> grpc_call_element * elem , <nl> grpc_transport_stream_op_batch * op ) ; <nl> <nl> - extern grpc_tracer_flag grpc_trace_channel ; <nl> + extern grpc_core : : TraceFlag grpc_trace_channel ; <nl> <nl> # define GRPC_CALL_LOG_OP ( sev , elem , op ) \ <nl> - if ( GRPC_TRACER_ON ( grpc_trace_channel ) ) grpc_call_log_op ( sev , elem , op ) <nl> + if ( grpc_trace_channel . enabled ( ) ) grpc_call_log_op ( sev , elem , op ) <nl> <nl> # ifdef __cplusplus <nl> } <nl> mmm a / src / core / lib / channel / channel_stack_builder . cc <nl> ppp b / src / core / lib / channel / channel_stack_builder . cc <nl> <nl> # include < grpc / support / alloc . h > <nl> # include < grpc / support / string_util . h > <nl> <nl> - grpc_tracer_flag grpc_trace_channel_stack_builder = <nl> - GRPC_TRACER_INITIALIZER ( false , " channel_stack_builder " ) ; <nl> + grpc_core : : TraceFlag grpc_trace_channel_stack_builder ( false , <nl> + " channel_stack_builder " ) ; <nl> <nl> typedef struct filter_node { <nl> struct filter_node * next ; <nl> mmm a / src / core / lib / channel / channel_stack_builder . h <nl> ppp b / src / core / lib / channel / channel_stack_builder . h <nl> grpc_error * grpc_channel_stack_builder_finish ( <nl> void grpc_channel_stack_builder_destroy ( grpc_exec_ctx * exec_ctx , <nl> grpc_channel_stack_builder * builder ) ; <nl> <nl> - extern grpc_tracer_flag grpc_trace_channel_stack_builder ; <nl> + extern grpc_core : : TraceFlag grpc_trace_channel_stack_builder ; <nl> <nl> # ifdef __cplusplus <nl> } <nl> mmm a / src / core / lib / debug / trace . cc <nl> ppp b / src / core / lib / debug / trace . cc <nl> <nl> <nl> int grpc_tracer_set_enabled ( const char * name , int enabled ) ; <nl> <nl> - typedef struct tracer { <nl> - grpc_tracer_flag * flag ; <nl> - struct tracer * next ; <nl> - } tracer ; <nl> - static tracer * tracers ; <nl> - <nl> - # ifdef GRPC_THREADSAFE_TRACER <nl> - # define TRACER_SET ( flag , on ) gpr_atm_no_barrier_store ( & ( flag ) . value , ( on ) ) <nl> - # else <nl> - # define TRACER_SET ( flag , on ) ( flag ) . value = ( on ) <nl> - # endif <nl> - <nl> - void grpc_register_tracer ( grpc_tracer_flag * flag ) { <nl> - tracer * t = ( tracer * ) gpr_malloc ( sizeof ( * t ) ) ; <nl> - t - > flag = flag ; <nl> - t - > next = tracers ; <nl> - TRACER_SET ( * flag , false ) ; <nl> - tracers = t ; <nl> + namespace grpc_core { <nl> + <nl> + TraceFlag * TraceFlagList : : root_tracer_ = nullptr ; <nl> + <nl> + bool TraceFlagList : : Set ( const char * name , bool enabled ) { <nl> + TraceFlag * t ; <nl> + if ( 0 = = strcmp ( name , " all " ) ) { <nl> + for ( t = root_tracer_ ; t ; t = t - > next_tracer_ ) { <nl> + t - > set_enabled ( enabled ) ; <nl> + } <nl> + } else if ( 0 = = strcmp ( name , " list_tracers " ) ) { <nl> + LogAllTracers ( ) ; <nl> + } else if ( 0 = = strcmp ( name , " refcount " ) ) { <nl> + for ( t = root_tracer_ ; t ; t = t - > next_tracer_ ) { <nl> + if ( strstr ( t - > name_ , " refcount " ) ! = nullptr ) { <nl> + t - > set_enabled ( enabled ) ; <nl> + } <nl> + } <nl> + } else { <nl> + bool found = false ; <nl> + for ( t = root_tracer_ ; t ; t = t - > next_tracer_ ) { <nl> + if ( 0 = = strcmp ( name , t - > name_ ) ) { <nl> + t - > set_enabled ( enabled ) ; <nl> + found = true ; <nl> + } <nl> + } <nl> + if ( ! found ) { <nl> + gpr_log ( GPR_ERROR , " Unknown trace var : ' % s ' " , name ) ; <nl> + return false ; / * early return * / <nl> + } <nl> + } <nl> + return true ; <nl> + } <nl> + <nl> + void TraceFlagList : : Add ( TraceFlag * flag ) { <nl> + flag - > next_tracer_ = root_tracer_ ; <nl> + root_tracer_ = flag ; <nl> } <nl> <nl> + void TraceFlagList : : LogAllTracers ( ) { <nl> + gpr_log ( GPR_DEBUG , " available tracers : " ) ; <nl> + TraceFlag * t ; <nl> + for ( t = root_tracer_ ; t ! = nullptr ; t = t - > next_tracer_ ) { <nl> + gpr_log ( GPR_DEBUG , " \ t % s " , t - > name_ ) ; <nl> + } <nl> + } <nl> + <nl> + / / Flags register themselves on the list during construction <nl> + TraceFlag : : TraceFlag ( bool default_enabled , const char * name ) <nl> + : name_ ( name ) , value_ ( default_enabled ) { <nl> + TraceFlagList : : Add ( this ) ; <nl> + } <nl> + <nl> + } / / namespace grpc_core <nl> + <nl> static void add ( const char * beg , const char * end , char * * * ss , size_t * ns ) { <nl> size_t n = * ns ; <nl> size_t np = n + 1 ; <nl> static void parse ( const char * s ) { <nl> <nl> for ( i = 0 ; i < nstrings ; i + + ) { <nl> if ( strings [ i ] [ 0 ] = = ' - ' ) { <nl> - grpc_tracer_set_enabled ( strings [ i ] + 1 , 0 ) ; <nl> + grpc_core : : TraceFlagList : : Set ( strings [ i ] + 1 , false ) ; <nl> } else { <nl> - grpc_tracer_set_enabled ( strings [ i ] , 1 ) ; <nl> + grpc_core : : TraceFlagList : : Set ( strings [ i ] , true ) ; <nl> } <nl> } <nl> <nl> static void parse ( const char * s ) { <nl> gpr_free ( strings ) ; <nl> } <nl> <nl> - static void list_tracers ( ) { <nl> - gpr_log ( GPR_DEBUG , " available tracers : " ) ; <nl> - tracer * t ; <nl> - for ( t = tracers ; t ; t = t - > next ) { <nl> - gpr_log ( GPR_DEBUG , " \ t % s " , t - > flag - > name ) ; <nl> - } <nl> - } <nl> - <nl> void grpc_tracer_init ( const char * env_var ) { <nl> char * e = gpr_getenv ( env_var ) ; <nl> if ( e ! = nullptr ) { <nl> void grpc_tracer_init ( const char * env_var ) { <nl> } <nl> } <nl> <nl> - void grpc_tracer_shutdown ( void ) { <nl> - while ( tracers ) { <nl> - tracer * t = tracers ; <nl> - tracers = t - > next ; <nl> - gpr_free ( t ) ; <nl> - } <nl> - } <nl> + void grpc_tracer_shutdown ( void ) { } <nl> <nl> int grpc_tracer_set_enabled ( const char * name , int enabled ) { <nl> - tracer * t ; <nl> - if ( 0 = = strcmp ( name , " all " ) ) { <nl> - for ( t = tracers ; t ; t = t - > next ) { <nl> - TRACER_SET ( * t - > flag , enabled ) ; <nl> - } <nl> - } else if ( 0 = = strcmp ( name , " list_tracers " ) ) { <nl> - list_tracers ( ) ; <nl> - } else if ( 0 = = strcmp ( name , " refcount " ) ) { <nl> - for ( t = tracers ; t ; t = t - > next ) { <nl> - if ( strstr ( t - > flag - > name , " refcount " ) ! = nullptr ) { <nl> - TRACER_SET ( * t - > flag , enabled ) ; <nl> - } <nl> - } <nl> - } else { <nl> - int found = 0 ; <nl> - for ( t = tracers ; t ; t = t - > next ) { <nl> - if ( 0 = = strcmp ( name , t - > flag - > name ) ) { <nl> - TRACER_SET ( * t - > flag , enabled ) ; <nl> - found = 1 ; <nl> - } <nl> - } <nl> - if ( ! found ) { <nl> - gpr_log ( GPR_ERROR , " Unknown trace var : ' % s ' " , name ) ; <nl> - return 0 ; / * early return * / <nl> - } <nl> - } <nl> - return 1 ; <nl> + return grpc_core : : TraceFlagList : : Set ( name , enabled ! = 0 ) ; <nl> } <nl> mmm a / src / core / lib / debug / trace . h <nl> ppp b / src / core / lib / debug / trace . h <nl> <nl> extern " C " { <nl> # endif <nl> <nl> + void grpc_tracer_init ( const char * env_var_name ) ; <nl> + void grpc_tracer_shutdown ( void ) ; <nl> + <nl> + # ifdef __cplusplus <nl> + } <nl> + # endif <nl> + <nl> # if defined ( __has_feature ) <nl> # if __has_feature ( thread_sanitizer ) <nl> # define GRPC_THREADSAFE_TRACER <nl> # endif <nl> # endif <nl> <nl> - typedef struct { <nl> + # ifdef __cplusplus <nl> + <nl> + namespace grpc_core { <nl> + <nl> + class TraceFlag ; <nl> + class TraceFlagList { <nl> + public : <nl> + static bool Set ( const char * name , bool enabled ) ; <nl> + static void Add ( TraceFlag * flag ) ; <nl> + <nl> + private : <nl> + static void LogAllTracers ( ) ; <nl> + static TraceFlag * root_tracer_ ; <nl> + } ; <nl> + <nl> + namespace testing { <nl> + void grpc_tracer_enable_flag ( grpc_core : : TraceFlag * flag ) ; <nl> + } <nl> + <nl> + class TraceFlag { <nl> + public : <nl> + TraceFlag ( bool default_enabled , const char * name ) ; <nl> + ~ TraceFlag ( ) { } <nl> + <nl> + const char * name ( ) const { return name_ ; } <nl> + <nl> + bool enabled ( ) { <nl> + # ifdef GRPC_THREADSAFE_TRACER <nl> + return gpr_atm_no_barrier_load ( & value_ ) ! = 0 ; <nl> + # else <nl> + return value_ ; <nl> + # endif <nl> + } <nl> + <nl> + private : <nl> + friend void grpc_core : : testing : : grpc_tracer_enable_flag ( TraceFlag * flag ) ; <nl> + friend class TraceFlagList ; <nl> + <nl> + void set_enabled ( bool enabled ) { <nl> # ifdef GRPC_THREADSAFE_TRACER <nl> - gpr_atm value ; <nl> + gpr_atm_no_barrier_store ( & value_ , enabled ) ; <nl> # else <nl> - bool value ; <nl> + value_ = enabled ; <nl> # endif <nl> - const char * name ; <nl> - } grpc_tracer_flag ; <nl> + } <nl> <nl> + TraceFlag * next_tracer_ ; <nl> + const char * const name_ ; <nl> # ifdef GRPC_THREADSAFE_TRACER <nl> - # define GRPC_TRACER_ON ( flag ) ( gpr_atm_no_barrier_load ( & ( flag ) . value ) ! = 0 ) <nl> - # define GRPC_TRACER_INITIALIZER ( on , name ) \ <nl> - { ( gpr_atm ) ( on ) , ( name ) } <nl> + gpr_atm value_ ; <nl> # else <nl> - # define GRPC_TRACER_ON ( flag ) ( ( flag ) . value ) <nl> - # define GRPC_TRACER_INITIALIZER ( on , name ) \ <nl> - { ( on ) , ( name ) } <nl> + bool value_ ; <nl> # endif <nl> + } ; <nl> <nl> - void grpc_register_tracer ( grpc_tracer_flag * flag ) ; <nl> - void grpc_tracer_init ( const char * env_var_name ) ; <nl> - void grpc_tracer_shutdown ( void ) ; <nl> + # ifndef NDEBUG <nl> + typedef TraceFlag DebugOnlyTraceFlag ; <nl> + # else <nl> + class DebugOnlyTraceFlag { <nl> + public : <nl> + DebugOnlyTraceFlag ( bool default_enabled , const char * name ) { } <nl> + bool enabled ( ) { return false ; } <nl> <nl> - # ifdef __cplusplus <nl> - } <nl> + private : <nl> + void set_enabled ( bool enabled ) { } <nl> + } ; <nl> # endif <nl> <nl> + } / / namespace grpc_core <nl> + <nl> + # endif / / __cplusplus <nl> + <nl> # endif / * GRPC_CORE_LIB_DEBUG_TRACE_H * / <nl> mmm a / src / core / lib / http / parser . cc <nl> ppp b / src / core / lib / http / parser . cc <nl> <nl> # include < grpc / support / log . h > <nl> # include < grpc / support / useful . h > <nl> <nl> - grpc_tracer_flag grpc_http1_trace = GRPC_TRACER_INITIALIZER ( false , " http1 " ) ; <nl> + grpc_core : : TraceFlag grpc_http1_trace ( false , " http1 " ) ; <nl> <nl> static char * buf2str ( void * buffer , size_t length ) { <nl> char * out = ( char * ) gpr_malloc ( length + 1 ) ; <nl> static grpc_error * addbyte ( grpc_http_parser * parser , uint8_t byte , <nl> case GRPC_HTTP_FIRST_LINE : <nl> case GRPC_HTTP_HEADERS : <nl> if ( parser - > cur_line_length > = GRPC_HTTP_PARSER_MAX_HEADER_LENGTH ) { <nl> - if ( GRPC_TRACER_ON ( grpc_http1_trace ) ) <nl> + if ( grpc_http1_trace . enabled ( ) ) <nl> gpr_log ( GPR_ERROR , " HTTP header max line length ( % d ) exceeded " , <nl> GRPC_HTTP_PARSER_MAX_HEADER_LENGTH ) ; <nl> return GRPC_ERROR_CREATE_FROM_STATIC_STRING ( <nl> mmm a / src / core / lib / http / parser . h <nl> ppp b / src / core / lib / http / parser . h <nl> grpc_error * grpc_http_parser_eof ( grpc_http_parser * parser ) ; <nl> void grpc_http_request_destroy ( grpc_http_request * request ) ; <nl> void grpc_http_response_destroy ( grpc_http_response * response ) ; <nl> <nl> - extern grpc_tracer_flag grpc_http1_trace ; <nl> + extern grpc_core : : TraceFlag grpc_http1_trace ; <nl> <nl> # ifdef __cplusplus <nl> } <nl> mmm a / src / core / lib / iomgr / call_combiner . cc <nl> ppp b / src / core / lib / iomgr / call_combiner . cc <nl> <nl> # include " src / core / lib / debug / stats . h " <nl> # include " src / core / lib / profiling / timers . h " <nl> <nl> - grpc_tracer_flag grpc_call_combiner_trace = <nl> - GRPC_TRACER_INITIALIZER ( false , " call_combiner " ) ; <nl> + grpc_core : : TraceFlag grpc_call_combiner_trace ( false , " call_combiner " ) ; <nl> <nl> static grpc_error * decode_cancel_state_error ( gpr_atm cancel_state ) { <nl> if ( cancel_state & 1 ) { <nl> void grpc_call_combiner_start ( grpc_exec_ctx * exec_ctx , <nl> grpc_error * error DEBUG_ARGS , <nl> const char * reason ) { <nl> GPR_TIMER_BEGIN ( " call_combiner_start " , 0 ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_call_combiner_trace ) ) { <nl> + if ( grpc_call_combiner_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " = = > grpc_call_combiner_start ( ) [ % p ] closure = % p [ " DEBUG_FMT_STR <nl> " % s ] error = % s " , <nl> void grpc_call_combiner_start ( grpc_exec_ctx * exec_ctx , <nl> } <nl> size_t prev_size = <nl> ( size_t ) gpr_atm_full_fetch_add ( & call_combiner - > size , ( gpr_atm ) 1 ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_call_combiner_trace ) ) { <nl> + if ( grpc_call_combiner_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " size : % " PRIdPTR " - > % " PRIdPTR , prev_size , <nl> prev_size + 1 ) ; <nl> } <nl> void grpc_call_combiner_start ( grpc_exec_ctx * exec_ctx , <nl> if ( prev_size = = 0 ) { <nl> GRPC_STATS_INC_CALL_COMBINER_LOCKS_INITIATED ( exec_ctx ) ; <nl> GPR_TIMER_MARK ( " call_combiner_initiate " , 0 ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_call_combiner_trace ) ) { <nl> + if ( grpc_call_combiner_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " EXECUTING IMMEDIATELY " ) ; <nl> } <nl> / / Queue was empty , so execute this closure immediately . <nl> GRPC_CLOSURE_SCHED ( exec_ctx , closure , error ) ; <nl> } else { <nl> - if ( GRPC_TRACER_ON ( grpc_call_combiner_trace ) ) { <nl> + if ( grpc_call_combiner_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , " QUEUING " ) ; <nl> } <nl> / / Queue was not empty , so add closure to queue . <nl> void grpc_call_combiner_stop ( grpc_exec_ctx * exec_ctx , <nl> grpc_call_combiner * call_combiner DEBUG_ARGS , <nl> const char * reason ) { <nl> GPR_TIMER_BEGIN ( " call_combiner_stop " , 0 ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_call_combiner_trace ) ) { <nl> + if ( grpc_call_combiner_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " = = > grpc_call_combiner_stop ( ) [ % p ] [ " DEBUG_FMT_STR " % s ] " , <nl> call_combiner DEBUG_FMT_ARGS , reason ) ; <nl> } <nl> size_t prev_size = <nl> ( size_t ) gpr_atm_full_fetch_add ( & call_combiner - > size , ( gpr_atm ) - 1 ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_call_combiner_trace ) ) { <nl> + if ( grpc_call_combiner_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " size : % " PRIdPTR " - > % " PRIdPTR , prev_size , <nl> prev_size - 1 ) ; <nl> } <nl> GPR_ASSERT ( prev_size > = 1 ) ; <nl> if ( prev_size > 1 ) { <nl> while ( true ) { <nl> - if ( GRPC_TRACER_ON ( grpc_call_combiner_trace ) ) { <nl> + if ( grpc_call_combiner_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " checking queue " ) ; <nl> } <nl> bool empty ; <nl> void grpc_call_combiner_stop ( grpc_exec_ctx * exec_ctx , <nl> if ( closure = = nullptr ) { <nl> / / This can happen either due to a race condition within the mpscq <nl> / / code or because of a race with grpc_call_combiner_start ( ) . <nl> - if ( GRPC_TRACER_ON ( grpc_call_combiner_trace ) ) { <nl> + if ( grpc_call_combiner_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " queue returned no result ; checking again " ) ; <nl> } <nl> continue ; <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_call_combiner_trace ) ) { <nl> + if ( grpc_call_combiner_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " EXECUTING FROM QUEUE : closure = % p error = % s " , <nl> closure , grpc_error_string ( closure - > error_data . error ) ) ; <nl> } <nl> GRPC_CLOSURE_SCHED ( exec_ctx , closure , closure - > error_data . error ) ; <nl> break ; <nl> } <nl> - } else if ( GRPC_TRACER_ON ( grpc_call_combiner_trace ) ) { <nl> + } else if ( grpc_call_combiner_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " queue empty " ) ; <nl> } <nl> GPR_TIMER_END ( " call_combiner_stop " , 0 ) ; <nl> void grpc_call_combiner_set_notify_on_cancel ( grpc_exec_ctx * exec_ctx , <nl> / / If error is set , invoke the cancellation closure immediately . <nl> / / Otherwise , store the new closure . <nl> if ( original_error ! = GRPC_ERROR_NONE ) { <nl> - if ( GRPC_TRACER_ON ( grpc_call_combiner_trace ) ) { <nl> + if ( grpc_call_combiner_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " call_combiner = % p : scheduling notify_on_cancel callback = % p " <nl> " for pre - existing cancellation " , <nl> void grpc_call_combiner_set_notify_on_cancel ( grpc_exec_ctx * exec_ctx , <nl> } else { <nl> if ( gpr_atm_full_cas ( & call_combiner - > cancel_state , original_state , <nl> ( gpr_atm ) closure ) ) { <nl> - if ( GRPC_TRACER_ON ( grpc_call_combiner_trace ) ) { <nl> + if ( grpc_call_combiner_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " call_combiner = % p : setting notify_on_cancel = % p " , <nl> call_combiner , closure ) ; <nl> } <nl> void grpc_call_combiner_set_notify_on_cancel ( grpc_exec_ctx * exec_ctx , <nl> / / up any resources they may be holding for the callback . <nl> if ( original_state ! = 0 ) { <nl> closure = ( grpc_closure * ) original_state ; <nl> - if ( GRPC_TRACER_ON ( grpc_call_combiner_trace ) ) { <nl> + if ( grpc_call_combiner_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " call_combiner = % p : scheduling old cancel callback = % p " , <nl> call_combiner , closure ) ; <nl> void grpc_call_combiner_cancel ( grpc_exec_ctx * exec_ctx , <nl> encode_cancel_state_error ( error ) ) ) { <nl> if ( original_state ! = 0 ) { <nl> grpc_closure * notify_on_cancel = ( grpc_closure * ) original_state ; <nl> - if ( GRPC_TRACER_ON ( grpc_call_combiner_trace ) ) { <nl> + if ( grpc_call_combiner_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " call_combiner = % p : scheduling notify_on_cancel callback = % p " , <nl> call_combiner , notify_on_cancel ) ; <nl> mmm a / src / core / lib / iomgr / call_combiner . h <nl> ppp b / src / core / lib / iomgr / call_combiner . h <nl> extern " C " { <nl> / / when it is done with the action that was kicked off by the original <nl> / / callback . <nl> <nl> - extern grpc_tracer_flag grpc_call_combiner_trace ; <nl> + extern grpc_core : : TraceFlag grpc_call_combiner_trace ; <nl> <nl> typedef struct { <nl> gpr_atm size ; / / size_t , num closures in queue or currently executing <nl> mmm a / src / core / lib / iomgr / closure . h <nl> ppp b / src / core / lib / iomgr / closure . h <nl> <nl> struct grpc_closure ; <nl> typedef struct grpc_closure grpc_closure ; <nl> <nl> - # ifndef NDEBUG <nl> - extern grpc_tracer_flag grpc_trace_closure ; <nl> - # endif <nl> + extern grpc_core : : DebugOnlyTraceFlag grpc_trace_closure ; <nl> <nl> typedef struct grpc_closure_list { <nl> grpc_closure * head ; <nl> mmm a / src / core / lib / iomgr / combiner . cc <nl> ppp b / src / core / lib / iomgr / combiner . cc <nl> <nl> # include " src / core / lib / iomgr / executor . h " <nl> # include " src / core / lib / profiling / timers . h " <nl> <nl> - grpc_tracer_flag grpc_combiner_trace = <nl> - GRPC_TRACER_INITIALIZER ( false , " combiner " ) ; <nl> - <nl> - # define GRPC_COMBINER_TRACE ( fn ) \ <nl> - do { \ <nl> - if ( GRPC_TRACER_ON ( grpc_combiner_trace ) ) { \ <nl> - fn ; \ <nl> - } \ <nl> + grpc_core : : TraceFlag grpc_combiner_trace ( false , " combiner " ) ; <nl> + <nl> + # define GRPC_COMBINER_TRACE ( fn ) \ <nl> + do { \ <nl> + if ( grpc_combiner_trace . enabled ( ) ) { \ <nl> + fn ; \ <nl> + } \ <nl> } while ( 0 ) <nl> <nl> # define STATE_UNORPHANED 1 <nl> static void start_destroy ( grpc_exec_ctx * exec_ctx , grpc_combiner * lock ) { <nl> <nl> # ifndef NDEBUG <nl> # define GRPC_COMBINER_DEBUG_SPAM ( op , delta ) \ <nl> - if ( GRPC_TRACER_ON ( grpc_combiner_trace ) ) { \ <nl> + if ( grpc_combiner_trace . enabled ( ) ) { \ <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , \ <nl> " C : % p % s % " PRIdPTR " - - > % " PRIdPTR " % s " , lock , ( op ) , \ <nl> gpr_atm_no_barrier_load ( & lock - > refs . count ) , \ <nl> mmm a / src / core / lib / iomgr / combiner . h <nl> ppp b / src / core / lib / iomgr / combiner . h <nl> grpc_closure_scheduler * grpc_combiner_finally_scheduler ( grpc_combiner * lock ) ; <nl> <nl> bool grpc_combiner_continue_exec_ctx ( grpc_exec_ctx * exec_ctx ) ; <nl> <nl> - extern grpc_tracer_flag grpc_combiner_trace ; <nl> + extern grpc_core : : TraceFlag grpc_combiner_trace ; <nl> <nl> # ifdef __cplusplus <nl> } <nl> mmm a / src / core / lib / iomgr / error . cc <nl> ppp b / src / core / lib / iomgr / error . cc <nl> <nl> # include " src / core / lib / profiling / timers . h " <nl> # include " src / core / lib / slice / slice_internal . h " <nl> <nl> - # ifndef NDEBUG <nl> - grpc_tracer_flag grpc_trace_error_refcount = <nl> - GRPC_TRACER_INITIALIZER ( false , " error_refcount " ) ; <nl> - grpc_tracer_flag grpc_trace_closure = GRPC_TRACER_INITIALIZER ( false , " closure " ) ; <nl> - # endif <nl> + grpc_core : : DebugOnlyTraceFlag grpc_trace_error_refcount ( false , <nl> + " error_refcount " ) ; <nl> + grpc_core : : DebugOnlyTraceFlag grpc_trace_closure ( false , " closure " ) ; <nl> <nl> static const char * error_int_name ( grpc_error_ints key ) { <nl> switch ( key ) { <nl> bool grpc_error_is_special ( grpc_error * err ) { <nl> # ifndef NDEBUG <nl> grpc_error * grpc_error_ref ( grpc_error * err , const char * file , int line ) { <nl> if ( grpc_error_is_special ( err ) ) return err ; <nl> - if ( GRPC_TRACER_ON ( grpc_trace_error_refcount ) ) { <nl> + if ( grpc_trace_error_refcount . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " % p : % " PRIdPTR " - > % " PRIdPTR " [ % s : % d ] " , err , <nl> gpr_atm_no_barrier_load ( & err - > atomics . refs . count ) , <nl> gpr_atm_no_barrier_load ( & err - > atomics . refs . count ) + 1 , file , line ) ; <nl> static void error_destroy ( grpc_error * err ) { <nl> # ifndef NDEBUG <nl> void grpc_error_unref ( grpc_error * err , const char * file , int line ) { <nl> if ( grpc_error_is_special ( err ) ) return ; <nl> - if ( GRPC_TRACER_ON ( grpc_trace_error_refcount ) ) { <nl> + if ( grpc_trace_error_refcount . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " % p : % " PRIdPTR " - > % " PRIdPTR " [ % s : % d ] " , err , <nl> gpr_atm_no_barrier_load ( & err - > atomics . refs . count ) , <nl> gpr_atm_no_barrier_load ( & err - > atomics . refs . count ) - 1 , file , line ) ; <nl> static uint8_t get_placement ( grpc_error * * err , size_t size ) { <nl> * err = ( grpc_error * ) gpr_realloc ( <nl> * err , sizeof ( grpc_error ) + ( * err ) - > arena_capacity * sizeof ( intptr_t ) ) ; <nl> # ifndef NDEBUG <nl> - if ( GRPC_TRACER_ON ( grpc_trace_error_refcount ) ) { <nl> + if ( grpc_trace_error_refcount . enabled ( ) ) { <nl> if ( * err ! = orig ) { <nl> gpr_log ( GPR_DEBUG , " realloc % p - > % p " , orig , * err ) ; <nl> } <nl> grpc_error * grpc_error_create ( const char * file , int line , grpc_slice desc , <nl> return GRPC_ERROR_OOM ; <nl> } <nl> # ifndef NDEBUG <nl> - if ( GRPC_TRACER_ON ( grpc_trace_error_refcount ) ) { <nl> + if ( grpc_trace_error_refcount . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " % p create [ % s : % d ] " , err , file , line ) ; <nl> } <nl> # endif <nl> static grpc_error * copy_error_and_unref ( grpc_error * in ) { <nl> out = ( grpc_error * ) gpr_malloc ( sizeof ( * in ) + <nl> new_arena_capacity * sizeof ( intptr_t ) ) ; <nl> # ifndef NDEBUG <nl> - if ( GRPC_TRACER_ON ( grpc_trace_error_refcount ) ) { <nl> + if ( grpc_trace_error_refcount . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " % p create copying % p " , out , in ) ; <nl> } <nl> # endif <nl> mmm a / src / core / lib / iomgr / error . h <nl> ppp b / src / core / lib / iomgr / error . h <nl> extern " C " { <nl> <nl> typedef struct grpc_error grpc_error ; <nl> <nl> - # ifndef NDEBUG <nl> - extern grpc_tracer_flag grpc_trace_error_refcount ; <nl> - # endif <nl> + extern grpc_core : : DebugOnlyTraceFlag grpc_trace_error_refcount ; <nl> <nl> typedef enum { <nl> / / / ' errno ' from the operating system <nl> mmm a / src / core / lib / iomgr / ev_epoll1_linux . cc <nl> ppp b / src / core / lib / iomgr / ev_epoll1_linux . cc <nl> static grpc_fd * fd_create ( int fd , const char * name ) { <nl> gpr_asprintf ( & fd_name , " % s fd = % d " , name , fd ) ; <nl> grpc_iomgr_register_object ( & new_fd - > iomgr_object , fd_name ) ; <nl> # ifndef NDEBUG <nl> - if ( GRPC_TRACER_ON ( grpc_trace_fd_refcount ) ) { <nl> + if ( grpc_trace_fd_refcount . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " FD % d % p create % s " , fd , new_fd , fd_name ) ; <nl> } <nl> # endif <nl> static grpc_error * do_epoll_wait ( grpc_exec_ctx * exec_ctx , grpc_pollset * ps , <nl> <nl> GRPC_STATS_INC_POLL_EVENTS_RETURNED ( exec_ctx , r ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " ps : % p poll got % d events " , ps , r ) ; <nl> } <nl> <nl> static bool begin_worker ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> worker - > schedule_on_end_work = ( grpc_closure_list ) GRPC_CLOSURE_LIST_INIT ; <nl> pollset - > begin_refs + + ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " PS : % p BEGIN_STARTS : % p " , pollset , worker ) ; <nl> } <nl> <nl> static bool begin_worker ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> retry_lock_neighborhood : <nl> gpr_mu_lock ( & neighborhood - > mu ) ; <nl> gpr_mu_lock ( & pollset - > mu ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " PS : % p BEGIN_REORG : % p kick_state = % s is_reassigning = % d " , <nl> pollset , worker , kick_state_string ( worker - > state ) , <nl> is_reassigning ) ; <nl> static bool begin_worker ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> worker - > initialized_cv = true ; <nl> gpr_cv_init ( & worker - > cv ) ; <nl> while ( worker - > state = = UNKICKED & & ! pollset - > shutting_down ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " PS : % p BEGIN_WAIT : % p kick_state = % s shutdown = % d " , <nl> pollset , worker , kick_state_string ( worker - > state ) , <nl> pollset - > shutting_down ) ; <nl> static bool begin_worker ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> grpc_exec_ctx_invalidate_now ( exec_ctx ) ; <nl> } <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , <nl> " PS : % p BEGIN_DONE : % p kick_state = % s shutdown = % d " <nl> " kicked_without_poller : % d " , <nl> static bool check_neighborhood_for_available_poller ( <nl> case UNKICKED : <nl> if ( gpr_atm_no_barrier_cas ( & g_active_poller , 0 , <nl> ( gpr_atm ) inspect_worker ) ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " . . choose next poller to be % p " , <nl> inspect_worker ) ; <nl> } <nl> static bool check_neighborhood_for_available_poller ( <nl> gpr_cv_signal ( & inspect_worker - > cv ) ; <nl> } <nl> } else { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " . . beaten to choose next poller " ) ; <nl> } <nl> } <nl> static bool check_neighborhood_for_available_poller ( <nl> } while ( ! found_worker & & inspect_worker ! = inspect - > root_worker ) ; <nl> } <nl> if ( ! found_worker ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " . . mark pollset % p inactive " , inspect ) ; <nl> } <nl> inspect - > seen_inactive = true ; <nl> static void end_worker ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> grpc_pollset_worker * worker , <nl> grpc_pollset_worker * * worker_hdl ) { <nl> GPR_TIMER_BEGIN ( " end_worker " , 0 ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " PS : % p END_WORKER : % p " , pollset , worker ) ; <nl> } <nl> if ( worker_hdl ! = nullptr ) * worker_hdl = nullptr ; <nl> static void end_worker ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> & exec_ctx - > closure_list ) ; <nl> if ( gpr_atm_no_barrier_load ( & g_active_poller ) = = ( gpr_atm ) worker ) { <nl> if ( worker - > next ! = worker & & worker - > next - > state = = UNKICKED ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " . . choose next poller to be peer % p " , worker ) ; <nl> } <nl> GPR_ASSERT ( worker - > next - > initialized_cv ) ; <nl> static void end_worker ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> if ( worker - > initialized_cv ) { <nl> gpr_cv_destroy ( & worker - > cv ) ; <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " . . remove worker " ) ; <nl> } <nl> if ( EMPTIED = = worker_remove ( pollset , worker ) ) { <nl> static grpc_error * pollset_kick ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> GPR_TIMER_BEGIN ( " pollset_kick " , 0 ) ; <nl> GRPC_STATS_INC_POLLSET_KICK ( exec_ctx ) ; <nl> grpc_error * ret_err = GRPC_ERROR_NONE ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_strvec log ; <nl> gpr_strvec_init ( & log ) ; <nl> char * tmp ; <nl> static grpc_error * pollset_kick ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> if ( root_worker = = nullptr ) { <nl> GRPC_STATS_INC_POLLSET_KICKED_WITHOUT_POLLER ( exec_ctx ) ; <nl> pollset - > kicked_without_poller = true ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " . . kicked_without_poller " ) ; <nl> } <nl> goto done ; <nl> static grpc_error * pollset_kick ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> grpc_pollset_worker * next_worker = root_worker - > next ; <nl> if ( root_worker - > state = = KICKED ) { <nl> GRPC_STATS_INC_POLLSET_KICKED_AGAIN ( exec_ctx ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " . . already kicked % p " , root_worker ) ; <nl> } <nl> SET_KICK_STATE ( root_worker , KICKED ) ; <nl> goto done ; <nl> } else if ( next_worker - > state = = KICKED ) { <nl> GRPC_STATS_INC_POLLSET_KICKED_AGAIN ( exec_ctx ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " . . already kicked % p " , next_worker ) ; <nl> } <nl> SET_KICK_STATE ( next_worker , KICKED ) ; <nl> static grpc_error * pollset_kick ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> root_worker = = ( grpc_pollset_worker * ) gpr_atm_no_barrier_load ( <nl> & g_active_poller ) ) { <nl> GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD ( exec_ctx ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " . . kicked % p " , root_worker ) ; <nl> } <nl> SET_KICK_STATE ( root_worker , KICKED ) ; <nl> static grpc_error * pollset_kick ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> goto done ; <nl> } else if ( next_worker - > state = = UNKICKED ) { <nl> GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV ( exec_ctx ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " . . kicked % p " , next_worker ) ; <nl> } <nl> GPR_ASSERT ( next_worker - > initialized_cv ) ; <nl> static grpc_error * pollset_kick ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> goto done ; <nl> } else if ( next_worker - > state = = DESIGNATED_POLLER ) { <nl> if ( root_worker - > state ! = DESIGNATED_POLLER ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( <nl> GPR_ERROR , <nl> " . . kicked root non - poller % p ( initialized_cv = % d ) ( poller = % p ) " , <nl> static grpc_error * pollset_kick ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> goto done ; <nl> } else { <nl> GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD ( exec_ctx ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " . . non - root poller % p ( root = % p ) " , next_worker , <nl> root_worker ) ; <nl> } <nl> static grpc_error * pollset_kick ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> } <nl> } else { <nl> GRPC_STATS_INC_POLLSET_KICK_OWN_THREAD ( exec_ctx ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " . . kicked while waking up " ) ; <nl> } <nl> goto done ; <nl> static grpc_error * pollset_kick ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> } <nl> <nl> if ( specific_worker - > state = = KICKED ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " . . specific worker already kicked " ) ; <nl> } <nl> goto done ; <nl> } else if ( gpr_tls_get ( & g_current_thread_worker ) = = <nl> ( intptr_t ) specific_worker ) { <nl> GRPC_STATS_INC_POLLSET_KICK_OWN_THREAD ( exec_ctx ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " . . mark % p kicked " , specific_worker ) ; <nl> } <nl> SET_KICK_STATE ( specific_worker , KICKED ) ; <nl> static grpc_error * pollset_kick ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> } else if ( specific_worker = = <nl> ( grpc_pollset_worker * ) gpr_atm_no_barrier_load ( & g_active_poller ) ) { <nl> GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD ( exec_ctx ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " . . kick active poller " ) ; <nl> } <nl> SET_KICK_STATE ( specific_worker , KICKED ) ; <nl> static grpc_error * pollset_kick ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> goto done ; <nl> } else if ( specific_worker - > initialized_cv ) { <nl> GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV ( exec_ctx ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " . . kick waiting worker " ) ; <nl> } <nl> SET_KICK_STATE ( specific_worker , KICKED ) ; <nl> static grpc_error * pollset_kick ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> goto done ; <nl> } else { <nl> GRPC_STATS_INC_POLLSET_KICKED_AGAIN ( exec_ctx ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " . . kick non - waiting worker " ) ; <nl> } <nl> SET_KICK_STATE ( specific_worker , KICKED ) ; <nl> mmm a / src / core / lib / iomgr / ev_epollex_linux . cc <nl> ppp b / src / core / lib / iomgr / ev_epollex_linux . cc <nl> <nl> # define MAX_EPOLL_EVENTS 100 <nl> # define MAX_EPOLL_EVENTS_HANDLED_EACH_POLL_CALL 5 <nl> <nl> - # ifndef NDEBUG <nl> - grpc_tracer_flag grpc_trace_pollable_refcount = <nl> - GRPC_TRACER_INITIALIZER ( false , " pollable_refcount " ) ; <nl> - # endif <nl> + grpc_core : : DebugOnlyTraceFlag grpc_trace_pollable_refcount ( false , <nl> + " pollable_refcount " ) ; <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * pollable Declarations <nl> static gpr_mu fd_freelist_mu ; <nl> unref_by ( ec , fd , n , reason , __FILE__ , __LINE__ ) <nl> static void ref_by ( grpc_fd * fd , int n , const char * reason , const char * file , <nl> int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_fd_refcount ) ) { <nl> + if ( grpc_trace_fd_refcount . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " FD % d % p ref % d % " PRIdPTR " - > % " PRIdPTR " [ % s ; % s : % d ] " , <nl> fd - > fd , fd , n , gpr_atm_no_barrier_load ( & fd - > refst ) , <nl> static void fd_destroy ( grpc_exec_ctx * exec_ctx , void * arg , grpc_error * error ) { <nl> # ifndef NDEBUG <nl> static void unref_by ( grpc_exec_ctx * exec_ctx , grpc_fd * fd , int n , <nl> const char * reason , const char * file , int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_fd_refcount ) ) { <nl> + if ( grpc_trace_fd_refcount . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " FD % d % p unref % d % " PRIdPTR " - > % " PRIdPTR " [ % s ; % s : % d ] " , <nl> fd - > fd , fd , n , gpr_atm_no_barrier_load ( & fd - > refst ) , <nl> static grpc_fd * fd_create ( int fd , const char * name ) { <nl> gpr_asprintf ( & fd_name , " % s fd = % d " , name , fd ) ; <nl> grpc_iomgr_register_object ( & new_fd - > iomgr_object , fd_name ) ; <nl> # ifndef NDEBUG <nl> - if ( GRPC_TRACER_ON ( grpc_trace_fd_refcount ) ) { <nl> + if ( grpc_trace_fd_refcount . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " FD % d % p create % s " , fd , new_fd , fd_name ) ; <nl> } <nl> # endif <nl> static grpc_error * pollable_create ( pollable_type type , pollable * * p ) { <nl> static pollable * pollable_ref ( pollable * p ) { <nl> # else <nl> static pollable * pollable_ref ( pollable * p , int line , const char * reason ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_pollable_refcount ) ) { <nl> + if ( grpc_trace_pollable_refcount . enabled ( ) ) { <nl> int r = ( int ) gpr_atm_no_barrier_load ( & p - > refs . count ) ; <nl> gpr_log ( __FILE__ , line , GPR_LOG_SEVERITY_DEBUG , <nl> " POLLABLE : % p ref % d - > % d % s " , p , r , r + 1 , reason ) ; <nl> static void pollable_unref ( pollable * p ) { <nl> # else <nl> static void pollable_unref ( pollable * p , int line , const char * reason ) { <nl> if ( p = = nullptr ) return ; <nl> - if ( GRPC_TRACER_ON ( grpc_trace_pollable_refcount ) ) { <nl> + if ( grpc_trace_pollable_refcount . enabled ( ) ) { <nl> int r = ( int ) gpr_atm_no_barrier_load ( & p - > refs . count ) ; <nl> gpr_log ( __FILE__ , line , GPR_LOG_SEVERITY_DEBUG , <nl> " POLLABLE : % p unref % d - > % d % s " , p , r , r - 1 , reason ) ; <nl> static grpc_error * pollable_add_fd ( pollable * p , grpc_fd * fd ) { <nl> static const char * err_desc = " pollable_add_fd " ; <nl> const int epfd = p - > epfd ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " add fd % p ( % d ) to pollable % p " , fd , fd - > fd , p ) ; <nl> } <nl> <nl> static void pollset_global_shutdown ( void ) { <nl> / * pollset - > mu must be held while calling this function * / <nl> static void pollset_maybe_finish_shutdown ( grpc_exec_ctx * exec_ctx , <nl> grpc_pollset * pollset ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " PS : % p ( pollable : % p ) maybe_finish_shutdown sc = % p ( target : ! NULL ) " <nl> " rw = % p ( target : NULL ) cpsc = % d ( target : 0 ) " , <nl> static grpc_error * kick_one_worker ( grpc_exec_ctx * exec_ctx , <nl> grpc_core : : mu_guard lock ( & p - > mu ) ; <nl> GPR_ASSERT ( specific_worker ! = nullptr ) ; <nl> if ( specific_worker - > kicked ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " PS : % p kicked_specific_but_already_kicked " , p ) ; <nl> } <nl> GRPC_STATS_INC_POLLSET_KICKED_AGAIN ( exec_ctx ) ; <nl> return GRPC_ERROR_NONE ; <nl> } <nl> if ( gpr_tls_get ( & g_current_thread_worker ) = = ( intptr_t ) specific_worker ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " PS : % p kicked_specific_but_awake " , p ) ; <nl> } <nl> GRPC_STATS_INC_POLLSET_KICK_OWN_THREAD ( exec_ctx ) ; <nl> static grpc_error * kick_one_worker ( grpc_exec_ctx * exec_ctx , <nl> } <nl> if ( specific_worker = = p - > root_worker ) { <nl> GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD ( exec_ctx ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " PS : % p kicked_specific_via_wakeup_fd " , p ) ; <nl> } <nl> specific_worker - > kicked = true ; <nl> static grpc_error * kick_one_worker ( grpc_exec_ctx * exec_ctx , <nl> } <nl> if ( specific_worker - > initialized_cv ) { <nl> GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV ( exec_ctx ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " PS : % p kicked_specific_via_cv " , p ) ; <nl> } <nl> specific_worker - > kicked = true ; <nl> static grpc_error * kick_one_worker ( grpc_exec_ctx * exec_ctx , <nl> static grpc_error * pollset_kick ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> grpc_pollset_worker * specific_worker ) { <nl> GRPC_STATS_INC_POLLSET_KICK ( exec_ctx ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " PS : % p kick % p tls_pollset = % p tls_worker = % p pollset . root_worker = % p " , <nl> pollset , specific_worker , <nl> static grpc_error * pollset_kick ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> if ( specific_worker = = nullptr ) { <nl> if ( gpr_tls_get ( & g_current_thread_pollset ) ! = ( intptr_t ) pollset ) { <nl> if ( pollset - > root_worker = = nullptr ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " PS : % p kicked_any_without_poller " , pollset ) ; <nl> } <nl> GRPC_STATS_INC_POLLSET_KICKED_WITHOUT_POLLER ( exec_ctx ) ; <nl> static grpc_error * pollset_kick ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> exec_ctx , pollset - > root_worker - > links [ PWLINK_POLLSET ] . next ) ; <nl> } <nl> } else { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " PS : % p kicked_any_but_awake " , pollset ) ; <nl> } <nl> GRPC_STATS_INC_POLLSET_KICK_OWN_THREAD ( exec_ctx ) ; <nl> static grpc_error * pollable_process_events ( grpc_exec_ctx * exec_ctx , <nl> struct epoll_event * ev = & pollable_obj - > events [ n ] ; <nl> void * data_ptr = ev - > data . ptr ; <nl> if ( 1 & ( intptr_t ) data_ptr ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " PS : % p got pollset_wakeup % p " , pollset , data_ptr ) ; <nl> } <nl> append_error ( & error , <nl> static grpc_error * pollable_process_events ( grpc_exec_ctx * exec_ctx , <nl> bool cancel = ( ev - > events & ( EPOLLERR | EPOLLHUP ) ) ! = 0 ; <nl> bool read_ev = ( ev - > events & ( EPOLLIN | EPOLLPRI ) ) ! = 0 ; <nl> bool write_ev = ( ev - > events & EPOLLOUT ) ! = 0 ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " PS : % p got fd % p : cancel = % d read = % d " <nl> " write = % d " , <nl> static grpc_error * pollable_epoll ( grpc_exec_ctx * exec_ctx , pollable * p , <nl> grpc_millis deadline ) { <nl> int timeout = poll_deadline_to_millis_timeout ( exec_ctx , deadline ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> char * desc = pollable_desc ( p ) ; <nl> gpr_log ( GPR_DEBUG , " POLLABLE : % p [ % s ] poll for % dms " , p , desc , timeout ) ; <nl> gpr_free ( desc ) ; <nl> static grpc_error * pollable_epoll ( grpc_exec_ctx * exec_ctx , pollable * p , <nl> <nl> if ( r < 0 ) return GRPC_OS_ERROR ( errno , " epoll_wait " ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " POLLABLE : % p got % d events " , p , r ) ; <nl> } <nl> <nl> static bool begin_worker ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> worker - > initialized_cv = true ; <nl> gpr_cv_init ( & worker - > cv ) ; <nl> gpr_mu_unlock ( & pollset - > mu ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) & & <nl> + if ( grpc_polling_trace . enabled ( ) & & <nl> worker - > pollable_obj - > root_worker ! = worker ) { <nl> gpr_log ( GPR_DEBUG , " PS : % p wait % p w = % p for % dms " , pollset , <nl> worker - > pollable_obj , worker , <nl> static bool begin_worker ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> while ( do_poll & & worker - > pollable_obj - > root_worker ! = worker ) { <nl> if ( gpr_cv_wait ( & worker - > cv , & worker - > pollable_obj - > mu , <nl> grpc_millis_to_timespec ( deadline , GPR_CLOCK_REALTIME ) ) ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " PS : % p timeout_wait % p w = % p " , pollset , <nl> worker - > pollable_obj , worker ) ; <nl> } <nl> do_poll = false ; <nl> } else if ( worker - > kicked ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " PS : % p wakeup % p w = % p " , pollset , <nl> worker - > pollable_obj , worker ) ; <nl> } <nl> do_poll = false ; <nl> - } else if ( GRPC_TRACER_ON ( grpc_polling_trace ) & & <nl> + } else if ( grpc_polling_trace . enabled ( ) & & <nl> worker - > pollable_obj - > root_worker ! = worker ) { <nl> gpr_log ( GPR_DEBUG , " PS : % p spurious_wakeup % p w = % p " , pollset , <nl> worker - > pollable_obj , worker ) ; <nl> static grpc_error * pollset_work ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> # ifndef NDEBUG <nl> WORKER_PTR - > originator = gettid ( ) ; <nl> # endif <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " PS : % p work hdl = % p worker = % p now = % " PRIdPTR " deadline = % " PRIdPTR <nl> " kwp = % d pollable = % p " , <nl> static grpc_error * pollset_transition_pollable_from_empty_to_fd_locked ( <nl> grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , grpc_fd * fd ) { <nl> static const char * err_desc = " pollset_transition_pollable_from_empty_to_fd " ; <nl> grpc_error * error = GRPC_ERROR_NONE ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " PS : % p add fd % p ( % d ) ; transition pollable from empty to fd " , <nl> pollset , fd , fd - > fd ) ; <nl> static grpc_error * pollset_transition_pollable_from_fd_to_multi_locked ( <nl> grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , grpc_fd * and_add_fd ) { <nl> static const char * err_desc = " pollset_transition_pollable_from_fd_to_multi " ; <nl> grpc_error * error = GRPC_ERROR_NONE ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( <nl> GPR_DEBUG , <nl> " PS : % p add fd % p ( % d ) ; transition pollable from fd % p to multipoller " , <nl> static void pollset_set_unref ( grpc_exec_ctx * exec_ctx , grpc_pollset_set * pss ) { <nl> <nl> static void pollset_set_add_fd ( grpc_exec_ctx * exec_ctx , grpc_pollset_set * pss , <nl> grpc_fd * fd ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " PSS : % p : add fd % p ( % d ) " , pss , fd , fd - > fd ) ; <nl> } <nl> grpc_error * error = GRPC_ERROR_NONE ; <nl> static void pollset_set_add_fd ( grpc_exec_ctx * exec_ctx , grpc_pollset_set * pss , <nl> <nl> static void pollset_set_del_fd ( grpc_exec_ctx * exec_ctx , grpc_pollset_set * pss , <nl> grpc_fd * fd ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " PSS : % p : del fd % p " , pss , fd ) ; <nl> } <nl> pss = pss_lock_adam ( pss ) ; <nl> static void pollset_set_del_fd ( grpc_exec_ctx * exec_ctx , grpc_pollset_set * pss , <nl> <nl> static void pollset_set_del_pollset ( grpc_exec_ctx * exec_ctx , <nl> grpc_pollset_set * pss , grpc_pollset * ps ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " PSS : % p : del pollset % p " , pss , ps ) ; <nl> } <nl> pss = pss_lock_adam ( pss ) ; <nl> static grpc_error * add_fds_to_pollsets ( grpc_exec_ctx * exec_ctx , grpc_fd * * fds , <nl> <nl> static void pollset_set_add_pollset ( grpc_exec_ctx * exec_ctx , <nl> grpc_pollset_set * pss , grpc_pollset * ps ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " PSS : % p : add pollset % p " , pss , ps ) ; <nl> } <nl> grpc_error * error = GRPC_ERROR_NONE ; <nl> static void pollset_set_add_pollset ( grpc_exec_ctx * exec_ctx , <nl> static void pollset_set_add_pollset_set ( grpc_exec_ctx * exec_ctx , <nl> grpc_pollset_set * a , <nl> grpc_pollset_set * b ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " PSS : merge ( % p , % p ) " , a , b ) ; <nl> } <nl> grpc_error * error = GRPC_ERROR_NONE ; <nl> static void pollset_set_add_pollset_set ( grpc_exec_ctx * exec_ctx , <nl> if ( b_size > a_size ) { <nl> GPR_SWAP ( grpc_pollset_set * , a , b ) ; <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " PSS : parent % p to % p " , b , a ) ; <nl> } <nl> gpr_ref ( & a - > refs ) ; <nl> const grpc_event_engine_vtable * grpc_init_epollex_linux ( <nl> return nullptr ; <nl> } <nl> <nl> - # ifndef NDEBUG <nl> - grpc_register_tracer ( & grpc_trace_pollable_refcount ) ; <nl> - # endif <nl> - <nl> fd_global_init ( ) ; <nl> <nl> if ( ! GRPC_LOG_IF_ERROR ( " pollset_global_init " , pollset_global_init ( ) ) ) { <nl> mmm a / src / core / lib / iomgr / ev_epollsig_linux . cc <nl> ppp b / src / core / lib / iomgr / ev_epollsig_linux . cc <nl> <nl> <nl> # define GRPC_POLLSET_KICK_BROADCAST ( ( grpc_pollset_worker * ) 1 ) <nl> <nl> - # define GRPC_POLLING_TRACE ( . . . ) \ <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { \ <nl> - gpr_log ( GPR_INFO , __VA_ARGS__ ) ; \ <nl> + # define GRPC_POLLING_TRACE ( . . . ) \ <nl> + if ( grpc_polling_trace . enabled ( ) ) { \ <nl> + gpr_log ( GPR_INFO , __VA_ARGS__ ) ; \ <nl> } <nl> <nl> static int grpc_wakeup_signal = - 1 ; <nl> static void pi_unref ( grpc_exec_ctx * exec_ctx , polling_island * pi ) ; <nl> # ifndef NDEBUG <nl> static void pi_add_ref_dbg ( polling_island * pi , const char * reason , <nl> const char * file , int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_atm old_cnt = gpr_atm_acq_load ( & pi - > ref_count ) ; <nl> gpr_log ( GPR_DEBUG , <nl> " Add ref pi : % p , old : % " PRIdPTR " - > new : % " PRIdPTR <nl> static void pi_add_ref_dbg ( polling_island * pi , const char * reason , <nl> <nl> static void pi_unref_dbg ( grpc_exec_ctx * exec_ctx , polling_island * pi , <nl> const char * reason , const char * file , int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_atm old_cnt = gpr_atm_acq_load ( & pi - > ref_count ) ; <nl> gpr_log ( GPR_DEBUG , <nl> " Unref pi : % p , old : % " PRIdPTR " - > new : % " PRIdPTR <nl> static gpr_mu fd_freelist_mu ; <nl> # define UNREF_BY ( fd , n , reason ) unref_by ( fd , n , reason , __FILE__ , __LINE__ ) <nl> static void ref_by ( grpc_fd * fd , int n , const char * reason , const char * file , <nl> int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_fd_refcount ) ) { <nl> + if ( grpc_trace_fd_refcount . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " FD % d % p ref % d % " PRIdPTR " - > % " PRIdPTR " [ % s ; % s : % d ] " , <nl> fd - > fd , fd , n , gpr_atm_no_barrier_load ( & fd - > refst ) , <nl> static void ref_by ( grpc_fd * fd , int n ) { <nl> # ifndef NDEBUG <nl> static void unref_by ( grpc_fd * fd , int n , const char * reason , const char * file , <nl> int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_fd_refcount ) ) { <nl> + if ( grpc_trace_fd_refcount . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " FD % d % p unref % d % " PRIdPTR " - > % " PRIdPTR " [ % s ; % s : % d ] " , <nl> fd - > fd , fd , n , gpr_atm_no_barrier_load ( & fd - > refst ) , <nl> mmm a / src / core / lib / iomgr / ev_poll_posix . cc <nl> ppp b / src / core / lib / iomgr / ev_poll_posix . cc <nl> cv_fd_table g_cvfds ; <nl> # define UNREF_BY ( fd , n , reason ) unref_by ( fd , n , reason , __FILE__ , __LINE__ ) <nl> static void ref_by ( grpc_fd * fd , int n , const char * reason , const char * file , <nl> int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_fd_refcount ) ) { <nl> + if ( grpc_trace_fd_refcount . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " FD % d % p ref % d % " PRIdPTR " - > % " PRIdPTR " [ % s ; % s : % d ] " , <nl> fd - > fd , fd , n , gpr_atm_no_barrier_load ( & fd - > refst ) , <nl> static void ref_by ( grpc_fd * fd , int n ) { <nl> # ifndef NDEBUG <nl> static void unref_by ( grpc_fd * fd , int n , const char * reason , const char * file , <nl> int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_fd_refcount ) ) { <nl> + if ( grpc_trace_fd_refcount . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " FD % d % p unref % d % " PRIdPTR " - > % " PRIdPTR " [ % s ; % s : % d ] " , <nl> fd - > fd , fd , n , gpr_atm_no_barrier_load ( & fd - > refst ) , <nl> static grpc_error * pollset_work ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> r = grpc_poll_function ( pfds , pfd_count , timeout ) ; <nl> GRPC_SCHEDULING_END_BLOCKING_REGION_WITH_EXEC_CTX ( exec_ctx ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " % p poll = % d " , pollset , r ) ; <nl> } <nl> <nl> static grpc_error * pollset_work ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> } <nl> } else { <nl> if ( pfds [ 0 ] . revents & POLLIN_CHECK ) { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " % p : got_wakeup " , pollset ) ; <nl> } <nl> work_combine_error ( <nl> static grpc_error * pollset_work ( grpc_exec_ctx * exec_ctx , grpc_pollset * pollset , <nl> if ( watchers [ i ] . fd = = nullptr ) { <nl> fd_end_poll ( exec_ctx , & watchers [ i ] , 0 , 0 , nullptr ) ; <nl> } else { <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " % p got_event : % d r : % d w : % d [ % d ] " , pollset , <nl> pfds [ i ] . fd , ( pfds [ i ] . revents & POLLIN_CHECK ) ! = 0 , <nl> ( pfds [ i ] . revents & POLLOUT_CHECK ) ! = 0 , pfds [ i ] . revents ) ; <nl> mmm a / src / core / lib / iomgr / ev_posix . cc <nl> ppp b / src / core / lib / iomgr / ev_posix . cc <nl> <nl> # include " src / core / lib / iomgr / ev_poll_posix . h " <nl> # include " src / core / lib / support / env . h " <nl> <nl> - grpc_tracer_flag grpc_polling_trace = <nl> - GRPC_TRACER_INITIALIZER ( false , " polling " ) ; / * Disabled by default * / <nl> - <nl> - # ifndef NDEBUG <nl> - grpc_tracer_flag grpc_trace_fd_refcount = <nl> - GRPC_TRACER_INITIALIZER ( false , " fd_refcount " ) ; <nl> - # endif <nl> + grpc_core : : TraceFlag grpc_polling_trace ( false , <nl> + " polling " ) ; / * Disabled by default * / <nl> + grpc_core : : DebugOnlyTraceFlag grpc_trace_fd_refcount ( false , " fd_refcount " ) ; <nl> <nl> / * * Default poll ( ) function - a pointer so that it can be overridden by some <nl> * tests * / <nl> const grpc_event_engine_vtable * grpc_get_event_engine_test_only ( ) { <nl> const char * grpc_get_poll_strategy_name ( ) { return g_poll_strategy_name ; } <nl> <nl> void grpc_event_engine_init ( void ) { <nl> - grpc_register_tracer ( & grpc_polling_trace ) ; <nl> - <nl> char * s = gpr_getenv ( " GRPC_POLL_STRATEGY " ) ; <nl> if ( s = = nullptr ) { <nl> s = gpr_strdup ( " all " ) ; <nl> mmm a / src / core / lib / iomgr / ev_posix . h <nl> ppp b / src / core / lib / iomgr / ev_posix . h <nl> <nl> extern " C " { <nl> # endif <nl> <nl> - extern grpc_tracer_flag grpc_polling_trace ; / * Disabled by default * / <nl> + extern grpc_core : : TraceFlag grpc_polling_trace ; / * Disabled by default * / <nl> <nl> typedef struct grpc_fd grpc_fd ; <nl> <nl> mmm a / src / core / lib / iomgr / ev_windows . cc <nl> ppp b / src / core / lib / iomgr / ev_windows . cc <nl> <nl> <nl> # include " src / core / lib / debug / trace . h " <nl> <nl> - grpc_tracer_flag grpc_polling_trace = <nl> - GRPC_TRACER_INITIALIZER ( false , " polling " ) ; / * Disabled by default * / <nl> + grpc_core : : TraceFlag grpc_polling_trace ( false , <nl> + " polling " ) ; / * Disabled by default * / <nl> <nl> # endif / / GRPC_WINSOCK_SOCKET <nl> mmm a / src / core / lib / iomgr / exec_ctx . cc <nl> ppp b / src / core / lib / iomgr / exec_ctx . cc <nl> static void exec_ctx_run ( grpc_exec_ctx * exec_ctx , grpc_closure * closure , <nl> grpc_error * error ) { <nl> # ifndef NDEBUG <nl> closure - > scheduled = false ; <nl> - if ( GRPC_TRACER_ON ( grpc_trace_closure ) ) { <nl> + if ( grpc_trace_closure . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " running closure % p : created [ % s : % d ] : % s [ % s : % d ] " , <nl> closure , closure - > file_created , closure - > line_created , <nl> closure - > run ? " run " : " scheduled " , closure - > file_initiated , <nl> static void exec_ctx_run ( grpc_exec_ctx * exec_ctx , grpc_closure * closure , <nl> # endif <nl> closure - > cb ( exec_ctx , closure - > cb_arg , error ) ; <nl> # ifndef NDEBUG <nl> - if ( GRPC_TRACER_ON ( grpc_trace_closure ) ) { <nl> + if ( grpc_trace_closure . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " closure % p finished " , closure ) ; <nl> } <nl> # endif <nl> mmm a / src / core / lib / iomgr / executor . cc <nl> ppp b / src / core / lib / iomgr / executor . cc <nl> static gpr_spinlock g_adding_thread_lock = GPR_SPINLOCK_STATIC_INITIALIZER ; <nl> <nl> GPR_TLS_DECL ( g_this_thread_state ) ; <nl> <nl> - static grpc_tracer_flag executor_trace = <nl> - GRPC_TRACER_INITIALIZER ( false , " executor " ) ; <nl> + grpc_core : : TraceFlag executor_trace ( false , " executor " ) ; <nl> <nl> static void executor_thread ( void * arg ) ; <nl> <nl> static size_t run_closures ( grpc_exec_ctx * exec_ctx , grpc_closure_list list ) { <nl> while ( c ! = nullptr ) { <nl> grpc_closure * next = c - > next_data . next ; <nl> grpc_error * error = c - > error_data . error ; <nl> - if ( GRPC_TRACER_ON ( executor_trace ) ) { <nl> + if ( executor_trace . enabled ( ) ) { <nl> # ifndef NDEBUG <nl> gpr_log ( GPR_DEBUG , " EXECUTOR : run % p [ created by % s : % d ] " , c , <nl> c - > file_created , c - > line_created ) ; <nl> void grpc_executor_set_threading ( grpc_exec_ctx * exec_ctx , bool threading ) { <nl> } <nl> <nl> void grpc_executor_init ( grpc_exec_ctx * exec_ctx ) { <nl> - grpc_register_tracer ( & executor_trace ) ; <nl> gpr_atm_no_barrier_store ( & g_cur_threads , 0 ) ; <nl> grpc_executor_set_threading ( exec_ctx , true ) ; <nl> } <nl> static void executor_thread ( void * arg ) { <nl> <nl> size_t subtract_depth = 0 ; <nl> for ( ; ; ) { <nl> - if ( GRPC_TRACER_ON ( executor_trace ) ) { <nl> + if ( executor_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " EXECUTOR [ % d ] : step ( sub_depth = % " PRIdPTR " ) " , <nl> ( int ) ( ts - g_thread_state ) , subtract_depth ) ; <nl> } <nl> static void executor_thread ( void * arg ) { <nl> gpr_cv_wait ( & ts - > cv , & ts - > mu , gpr_inf_future ( GPR_CLOCK_REALTIME ) ) ; <nl> } <nl> if ( ts - > shutdown ) { <nl> - if ( GRPC_TRACER_ON ( executor_trace ) ) { <nl> + if ( executor_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " EXECUTOR [ % d ] : shutdown " , <nl> ( int ) ( ts - g_thread_state ) ) ; <nl> } <nl> static void executor_thread ( void * arg ) { <nl> grpc_closure_list exec = ts - > elems ; <nl> ts - > elems = GRPC_CLOSURE_LIST_INIT ; <nl> gpr_mu_unlock ( & ts - > mu ) ; <nl> - if ( GRPC_TRACER_ON ( executor_trace ) ) { <nl> + if ( executor_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " EXECUTOR [ % d ] : execute " , ( int ) ( ts - g_thread_state ) ) ; <nl> } <nl> <nl> static void executor_push ( grpc_exec_ctx * exec_ctx , grpc_closure * closure , <nl> retry_push = false ; <nl> size_t cur_thread_count = ( size_t ) gpr_atm_no_barrier_load ( & g_cur_threads ) ; <nl> if ( cur_thread_count = = 0 ) { <nl> - if ( GRPC_TRACER_ON ( executor_trace ) ) { <nl> + if ( executor_trace . enabled ( ) ) { <nl> # ifndef NDEBUG <nl> gpr_log ( GPR_DEBUG , " EXECUTOR : schedule % p ( created % s : % d ) inline " , <nl> closure , closure - > file_created , closure - > line_created ) ; <nl> static void executor_push ( grpc_exec_ctx * exec_ctx , grpc_closure * closure , <nl> <nl> bool try_new_thread ; <nl> for ( ; ; ) { <nl> - if ( GRPC_TRACER_ON ( executor_trace ) ) { <nl> + if ( executor_trace . enabled ( ) ) { <nl> # ifndef NDEBUG <nl> gpr_log ( <nl> GPR_DEBUG , <nl> mmm a / src / core / lib / iomgr / iomgr_posix . cc <nl> ppp b / src / core / lib / iomgr / iomgr_posix . cc <nl> <nl> void grpc_iomgr_platform_init ( void ) { <nl> grpc_wakeup_fd_global_init ( ) ; <nl> grpc_event_engine_init ( ) ; <nl> - grpc_register_tracer ( & grpc_tcp_trace ) ; <nl> } <nl> <nl> void grpc_iomgr_platform_flush ( void ) { } <nl> mmm a / src / core / lib / iomgr / iomgr_uv . cc <nl> ppp b / src / core / lib / iomgr / iomgr_uv . cc <nl> gpr_thd_id g_init_thread ; <nl> void grpc_iomgr_platform_init ( void ) { <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> grpc_pollset_global_init ( ) ; <nl> - grpc_register_tracer ( & grpc_tcp_trace ) ; <nl> + <nl> grpc_executor_set_threading ( & exec_ctx , false ) ; <nl> g_init_thread = gpr_thd_currentid ( ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> mmm a / src / core / lib / iomgr / lockfree_event . cc <nl> ppp b / src / core / lib / iomgr / lockfree_event . cc <nl> <nl> <nl> # include " src / core / lib / debug / trace . h " <nl> <nl> - extern grpc_tracer_flag grpc_polling_trace ; <nl> + extern grpc_core : : TraceFlag grpc_polling_trace ; <nl> <nl> / * ' state ' holds the to call when the fd is readable or writable respectively . <nl> It can contain one of the following values : <nl> LockfreeEvent : : ~ LockfreeEvent ( ) { <nl> void LockfreeEvent : : NotifyOn ( grpc_exec_ctx * exec_ctx , grpc_closure * closure ) { <nl> while ( true ) { <nl> gpr_atm curr = gpr_atm_no_barrier_load ( & state_ ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " LockfreeEvent : : NotifyOn : % p curr = % p closure = % p " , this , <nl> ( void * ) curr , closure ) ; <nl> } <nl> bool LockfreeEvent : : SetShutdown ( grpc_exec_ctx * exec_ctx , <nl> <nl> while ( true ) { <nl> gpr_atm curr = gpr_atm_no_barrier_load ( & state_ ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " LockfreeEvent : : SetShutdown : % p curr = % p err = % s " , <nl> & state_ , ( void * ) curr , grpc_error_string ( shutdown_err ) ) ; <nl> } <nl> void LockfreeEvent : : SetReady ( grpc_exec_ctx * exec_ctx ) { <nl> while ( true ) { <nl> gpr_atm curr = gpr_atm_no_barrier_load ( & state_ ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_polling_trace ) ) { <nl> + if ( grpc_polling_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " LockfreeEvent : : SetReady : % p curr = % p " , & state_ , <nl> ( void * ) curr ) ; <nl> } <nl> mmm a / src / core / lib / iomgr / pollset . h <nl> ppp b / src / core / lib / iomgr / pollset . h <nl> <nl> extern " C " { <nl> # endif <nl> <nl> - # ifndef NDEBUG <nl> - extern grpc_tracer_flag grpc_trace_fd_refcount ; <nl> - # endif <nl> + extern grpc_core : : DebugOnlyTraceFlag grpc_trace_fd_refcount ; <nl> <nl> / * A grpc_pollset is a set of file descriptors that a higher level item is <nl> interested in . For example : <nl> mmm a / src / core / lib / iomgr / pollset_uv . cc <nl> ppp b / src / core / lib / iomgr / pollset_uv . cc <nl> <nl> <nl> # include " src / core / lib / debug / trace . h " <nl> <nl> - # ifndef NDEBUG <nl> - grpc_tracer_flag grpc_trace_fd_refcount = <nl> - GRPC_TRACER_INITIALIZER ( false , " fd_refcount " ) ; <nl> - # endif <nl> + grpc_core : : DebugOnlyTraceFlag grpc_trace_fd_refcount ( false , " fd_refcount " ) ; <nl> <nl> struct grpc_pollset { <nl> uv_timer_t * timer ; <nl> mmm a / src / core / lib / iomgr / pollset_windows . cc <nl> ppp b / src / core / lib / iomgr / pollset_windows . cc <nl> <nl> <nl> # define GRPC_POLLSET_KICK_BROADCAST ( ( grpc_pollset_worker * ) 1 ) <nl> <nl> - # ifndef NDEBUG <nl> - grpc_tracer_flag grpc_trace_fd_refcount = <nl> - GRPC_TRACER_INITIALIZER ( false , " fd_refcount " ) ; <nl> - # endif <nl> + grpc_core : : DebugOnlyTraceFlag grpc_trace_fd_refcount ( false , " fd_refcount " ) ; <nl> <nl> gpr_mu grpc_polling_mu ; <nl> static grpc_pollset_worker * g_active_poller ; <nl> mmm a / src / core / lib / iomgr / resource_quota . cc <nl> ppp b / src / core / lib / iomgr / resource_quota . cc <nl> <nl> <nl> # include " src / core / lib / iomgr / combiner . h " <nl> <nl> - grpc_tracer_flag grpc_resource_quota_trace = <nl> - GRPC_TRACER_INITIALIZER ( false , " resource_quota " ) ; <nl> + grpc_core : : TraceFlag grpc_resource_quota_trace ( false , " resource_quota " ) ; <nl> <nl> # define MEMORY_USAGE_ESTIMATION_MAX 65536 <nl> <nl> static bool rq_alloc ( grpc_exec_ctx * exec_ctx , <nl> while ( ( resource_user = rulist_pop_head ( resource_quota , <nl> GRPC_RULIST_AWAITING_ALLOCATION ) ) ) { <nl> gpr_mu_lock ( & resource_user - > mu ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_resource_quota_trace ) ) { <nl> + if ( grpc_resource_quota_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " RQ : check allocation for user % p shutdown = % " PRIdPTR <nl> " free_pool = % " PRId64 , <nl> static bool rq_alloc ( grpc_exec_ctx * exec_ctx , <nl> resource_user - > free_pool = 0 ; <nl> resource_quota - > free_pool - = amt ; <nl> rq_update_estimate ( resource_quota ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_resource_quota_trace ) ) { <nl> + if ( grpc_resource_quota_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " RQ % s % s : grant alloc % " PRId64 <nl> " bytes ; rq_free_pool - > % " PRId64 , <nl> resource_quota - > name , resource_user - > name , amt , <nl> resource_quota - > free_pool ) ; <nl> } <nl> - } else if ( GRPC_TRACER_ON ( grpc_resource_quota_trace ) & & <nl> + } else if ( grpc_resource_quota_trace . enabled ( ) & & <nl> resource_user - > free_pool > = 0 ) { <nl> gpr_log ( GPR_DEBUG , " RQ % s % s : discard already satisfied alloc request " , <nl> resource_quota - > name , resource_user - > name ) ; <nl> static bool rq_reclaim_from_per_user_free_pool ( <nl> resource_user - > free_pool = 0 ; <nl> resource_quota - > free_pool + = amt ; <nl> rq_update_estimate ( resource_quota ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_resource_quota_trace ) ) { <nl> + if ( grpc_resource_quota_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " RQ % s % s : reclaim_from_per_user_free_pool % " PRId64 <nl> " bytes ; rq_free_pool - > % " PRId64 , <nl> static bool rq_reclaim ( grpc_exec_ctx * exec_ctx , <nl> : GRPC_RULIST_RECLAIMER_BENIGN ; <nl> grpc_resource_user * resource_user = rulist_pop_head ( resource_quota , list ) ; <nl> if ( resource_user = = nullptr ) return false ; <nl> - if ( GRPC_TRACER_ON ( grpc_resource_quota_trace ) ) { <nl> + if ( grpc_resource_quota_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " RQ % s % s : initiate % s reclamation " , <nl> resource_quota - > name , resource_user - > name , <nl> destructive ? " destructive " : " benign " ) ; <nl> static void ru_post_destructive_reclaimer ( grpc_exec_ctx * exec_ctx , void * ru , <nl> } <nl> <nl> static void ru_shutdown ( grpc_exec_ctx * exec_ctx , void * ru , grpc_error * error ) { <nl> - if ( GRPC_TRACER_ON ( grpc_resource_quota_trace ) ) { <nl> + if ( grpc_resource_quota_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " RU shutdown % p " , ru ) ; <nl> } <nl> grpc_resource_user * resource_user = ( grpc_resource_user * ) ru ; <nl> void grpc_resource_user_alloc ( grpc_exec_ctx * exec_ctx , <nl> ru_ref_by ( resource_user , ( gpr_atm ) size ) ; <nl> resource_user - > free_pool - = ( int64_t ) size ; <nl> resource_user - > outstanding_allocations + = ( int64_t ) size ; <nl> - if ( GRPC_TRACER_ON ( grpc_resource_quota_trace ) ) { <nl> + if ( grpc_resource_quota_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " RQ % s % s : alloc % " PRIdPTR " ; free_pool - > % " PRId64 , <nl> resource_user - > resource_quota - > name , resource_user - > name , size , <nl> resource_user - > free_pool ) ; <nl> void grpc_resource_user_free ( grpc_exec_ctx * exec_ctx , <nl> gpr_mu_lock ( & resource_user - > mu ) ; <nl> bool was_zero_or_negative = resource_user - > free_pool < = 0 ; <nl> resource_user - > free_pool + = ( int64_t ) size ; <nl> - if ( GRPC_TRACER_ON ( grpc_resource_quota_trace ) ) { <nl> + if ( grpc_resource_quota_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " RQ % s % s : free % " PRIdPTR " ; free_pool - > % " PRId64 , <nl> resource_user - > resource_quota - > name , resource_user - > name , size , <nl> resource_user - > free_pool ) ; <nl> void grpc_resource_user_post_reclaimer ( grpc_exec_ctx * exec_ctx , <nl> <nl> void grpc_resource_user_finish_reclamation ( grpc_exec_ctx * exec_ctx , <nl> grpc_resource_user * resource_user ) { <nl> - if ( GRPC_TRACER_ON ( grpc_resource_quota_trace ) ) { <nl> + if ( grpc_resource_quota_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " RQ % s % s : reclamation complete " , <nl> resource_user - > resource_quota - > name , resource_user - > name ) ; <nl> } <nl> mmm a / src / core / lib / iomgr / resource_quota . h <nl> ppp b / src / core / lib / iomgr / resource_quota . h <nl> extern " C " { <nl> maintain lists of users ( which users arrange to leave before they are <nl> destroyed ) * / <nl> <nl> - extern grpc_tracer_flag grpc_resource_quota_trace ; <nl> + extern grpc_core : : TraceFlag grpc_resource_quota_trace ; <nl> <nl> grpc_resource_quota * grpc_resource_quota_ref_internal ( <nl> grpc_resource_quota * resource_quota ) ; <nl> mmm a / src / core / lib / iomgr / tcp_client_posix . cc <nl> ppp b / src / core / lib / iomgr / tcp_client_posix . cc <nl> <nl> # include " src / core / lib / iomgr / unix_sockets_posix . h " <nl> # include " src / core / lib / support / string . h " <nl> <nl> - extern grpc_tracer_flag grpc_tcp_trace ; <nl> + extern grpc_core : : TraceFlag grpc_tcp_trace ; <nl> <nl> typedef struct { <nl> gpr_mu mu ; <nl> static grpc_error * prepare_socket ( const grpc_resolved_address * addr , int fd , <nl> static void tc_on_alarm ( grpc_exec_ctx * exec_ctx , void * acp , grpc_error * error ) { <nl> int done ; <nl> async_connect * ac = ( async_connect * ) acp ; <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> const char * str = grpc_error_string ( error ) ; <nl> gpr_log ( GPR_DEBUG , " CLIENT_CONNECT : % s : on_alarm : error = % s " , ac - > addr_str , <nl> str ) ; <nl> static void on_writable ( grpc_exec_ctx * exec_ctx , void * acp , grpc_error * error ) { <nl> <nl> GRPC_ERROR_REF ( error ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> const char * str = grpc_error_string ( error ) ; <nl> gpr_log ( GPR_DEBUG , " CLIENT_CONNECT : % s : on_writable : error = % s " , <nl> ac - > addr_str , str ) ; <nl> static void tcp_client_connect_impl ( grpc_exec_ctx * exec_ctx , <nl> grpc_schedule_on_exec_ctx ) ; <nl> ac - > channel_args = grpc_channel_args_copy ( channel_args ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " CLIENT_CONNECT : % s : asynchronously connecting fd % p " , <nl> ac - > addr_str , fdobj ) ; <nl> } <nl> mmm a / src / core / lib / iomgr / tcp_client_uv . cc <nl> ppp b / src / core / lib / iomgr / tcp_client_uv . cc <nl> <nl> # include " src / core / lib / iomgr / tcp_uv . h " <nl> # include " src / core / lib / iomgr / timer . h " <nl> <nl> - extern grpc_tracer_flag grpc_tcp_trace ; <nl> + extern grpc_core : : TraceFlag grpc_tcp_trace ; <nl> <nl> typedef struct grpc_uv_tcp_connect { <nl> uv_connect_t connect_req ; <nl> static void uv_tc_on_alarm ( grpc_exec_ctx * exec_ctx , void * acp , <nl> grpc_error * error ) { <nl> int done ; <nl> grpc_uv_tcp_connect * connect = ( grpc_uv_tcp_connect * ) acp ; <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> const char * str = grpc_error_string ( error ) ; <nl> gpr_log ( GPR_DEBUG , " CLIENT_CONNECT : % s : on_alarm : error = % s " , <nl> connect - > addr_name , str ) ; <nl> static void tcp_client_connect_impl ( grpc_exec_ctx * exec_ctx , <nl> connect - > connect_req . data = connect ; <nl> connect - > refs = 2 ; / / One for the connect operation , one for the timer . <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " CLIENT_CONNECT : % s : asynchronously connecting " , <nl> connect - > addr_name ) ; <nl> } <nl> mmm a / src / core / lib / iomgr / tcp_posix . cc <nl> ppp b / src / core / lib / iomgr / tcp_posix . cc <nl> typedef GRPC_MSG_IOVLEN_TYPE msg_iovlen_type ; <nl> typedef size_t msg_iovlen_type ; <nl> # endif <nl> <nl> - grpc_tracer_flag grpc_tcp_trace = GRPC_TRACER_INITIALIZER ( false , " tcp " ) ; <nl> + grpc_core : : TraceFlag grpc_tcp_trace ( false , " tcp " ) ; <nl> <nl> typedef struct { <nl> grpc_endpoint base ; <nl> static void tcp_drop_uncovered_then_handle_write ( grpc_exec_ctx * exec_ctx , <nl> static void done_poller ( grpc_exec_ctx * exec_ctx , void * bp , <nl> grpc_error * error_ignored ) { <nl> backup_poller * p = ( backup_poller * ) bp ; <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " BACKUP_POLLER : % p destroy " , p ) ; <nl> } <nl> grpc_pollset_destroy ( exec_ctx , BACKUP_POLLER_POLLSET ( p ) ) ; <nl> static void done_poller ( grpc_exec_ctx * exec_ctx , void * bp , <nl> static void run_poller ( grpc_exec_ctx * exec_ctx , void * bp , <nl> grpc_error * error_ignored ) { <nl> backup_poller * p = ( backup_poller * ) bp ; <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " BACKUP_POLLER : % p run " , p ) ; <nl> } <nl> gpr_mu_lock ( p - > pollset_mu ) ; <nl> static void run_poller ( grpc_exec_ctx * exec_ctx , void * bp , <nl> gpr_atm_full_cas ( & g_uncovered_notifications_pending , 1 , 0 ) ) { <nl> gpr_mu_lock ( p - > pollset_mu ) ; <nl> bool cas_ok = gpr_atm_full_cas ( & g_backup_poller , ( gpr_atm ) p , 0 ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " BACKUP_POLLER : % p done cas_ok = % d " , p , cas_ok ) ; <nl> } <nl> gpr_mu_unlock ( p - > pollset_mu ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " BACKUP_POLLER : % p shutdown " , p ) ; <nl> } <nl> grpc_pollset_shutdown ( exec_ctx , BACKUP_POLLER_POLLSET ( p ) , <nl> GRPC_CLOSURE_INIT ( & p - > run_poller , done_poller , p , <nl> grpc_schedule_on_exec_ctx ) ) ; <nl> } else { <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " BACKUP_POLLER : % p reschedule " , p ) ; <nl> } <nl> GRPC_CLOSURE_SCHED ( exec_ctx , & p - > run_poller , GRPC_ERROR_NONE ) ; <nl> static void drop_uncovered ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp ) { <nl> backup_poller * p = ( backup_poller * ) gpr_atm_acq_load ( & g_backup_poller ) ; <nl> gpr_atm old_count = <nl> gpr_atm_no_barrier_fetch_add ( & g_uncovered_notifications_pending , - 1 ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " BACKUP_POLLER : % p uncover cnt % d - > % d " , p , ( int ) old_count , <nl> ( int ) old_count - 1 ) ; <nl> } <nl> static void cover_self ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp ) { <nl> backup_poller * p ; <nl> gpr_atm old_count = <nl> gpr_atm_no_barrier_fetch_add ( & g_uncovered_notifications_pending , 2 ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " BACKUP_POLLER : cover cnt % d - > % d " , ( int ) old_count , <nl> 2 + ( int ) old_count ) ; <nl> } <nl> if ( old_count = = 0 ) { <nl> GRPC_STATS_INC_TCP_BACKUP_POLLERS_CREATED ( exec_ctx ) ; <nl> p = ( backup_poller * ) gpr_zalloc ( sizeof ( * p ) + grpc_pollset_size ( ) ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " BACKUP_POLLER : % p create " , p ) ; <nl> } <nl> grpc_pollset_init ( BACKUP_POLLER_POLLSET ( p ) , & p - > pollset_mu ) ; <nl> static void cover_self ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp ) { <nl> / / spin waiting for backup poller <nl> } <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " BACKUP_POLLER : % p add % p " , p , tcp ) ; <nl> } <nl> grpc_pollset_add_fd ( exec_ctx , BACKUP_POLLER_POLLSET ( p ) , tcp - > em_fd ) ; <nl> static void cover_self ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp ) { <nl> } <nl> <nl> static void notify_on_read ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp ) { <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " TCP : % p notify_on_read " , tcp ) ; <nl> } <nl> GRPC_CLOSURE_INIT ( & tcp - > read_done_closure , tcp_handle_read , tcp , <nl> static void notify_on_read ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp ) { <nl> } <nl> <nl> static void notify_on_write ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp ) { <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " TCP : % p notify_on_write " , tcp ) ; <nl> } <nl> cover_self ( exec_ctx , tcp ) ; <nl> static void notify_on_write ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp ) { <nl> <nl> static void tcp_drop_uncovered_then_handle_write ( grpc_exec_ctx * exec_ctx , <nl> void * arg , grpc_error * error ) { <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " TCP : % p got_write : % s " , arg , grpc_error_string ( error ) ) ; <nl> } <nl> drop_uncovered ( exec_ctx , ( grpc_tcp * ) arg ) ; <nl> static void tcp_free ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp ) { <nl> # define TCP_REF ( tcp , reason ) tcp_ref ( ( tcp ) , ( reason ) , __FILE__ , __LINE__ ) <nl> static void tcp_unref ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp , <nl> const char * reason , const char * file , int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & tcp - > refcount . count ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " TCP unref % p : % s % " PRIdPTR " - > % " PRIdPTR , tcp , reason , val , <nl> static void tcp_unref ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp , <nl> <nl> static void tcp_ref ( grpc_tcp * tcp , const char * reason , const char * file , <nl> int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & tcp - > refcount . count ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " TCP ref % p : % s % " PRIdPTR " - > % " PRIdPTR , tcp , reason , val , <nl> static void call_read_cb ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp , <nl> grpc_error * error ) { <nl> grpc_closure * cb = tcp - > read_cb ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " TCP : % p call_cb % p % p : % p " , tcp , cb , cb - > cb , cb - > cb_arg ) ; <nl> size_t i ; <nl> const char * str = grpc_error_string ( error ) ; <nl> static void tcp_do_read ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp ) { <nl> static void tcp_read_allocation_done ( grpc_exec_ctx * exec_ctx , void * tcpp , <nl> grpc_error * error ) { <nl> grpc_tcp * tcp = ( grpc_tcp * ) tcpp ; <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " TCP : % p read_allocation_done : % s " , tcp , <nl> grpc_error_string ( error ) ) ; <nl> } <nl> static void tcp_continue_read ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp ) { <nl> size_t target_read_size = get_target_read_size ( tcp ) ; <nl> if ( tcp - > incoming_buffer - > length < target_read_size & & <nl> tcp - > incoming_buffer - > count < MAX_READ_IOVEC ) { <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " TCP : % p alloc_slices " , tcp ) ; <nl> } <nl> grpc_resource_user_alloc_slices ( exec_ctx , & tcp - > slice_allocator , <nl> target_read_size , 1 , tcp - > incoming_buffer ) ; <nl> } else { <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " TCP : % p do_read " , tcp ) ; <nl> } <nl> tcp_do_read ( exec_ctx , tcp ) ; <nl> static void tcp_handle_read ( grpc_exec_ctx * exec_ctx , void * arg / * grpc_tcp * / , <nl> grpc_error * error ) { <nl> grpc_tcp * tcp = ( grpc_tcp * ) arg ; <nl> GPR_ASSERT ( ! tcp - > finished_edge ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " TCP : % p got_read : % s " , tcp , grpc_error_string ( error ) ) ; <nl> } <nl> <nl> static void tcp_handle_write ( grpc_exec_ctx * exec_ctx , void * arg / * grpc_tcp * / , <nl> } <nl> <nl> if ( ! tcp_flush ( exec_ctx , tcp , & error ) ) { <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " write : delayed " ) ; <nl> } <nl> notify_on_write ( exec_ctx , tcp ) ; <nl> } else { <nl> cb = tcp - > write_cb ; <nl> tcp - > write_cb = nullptr ; <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> const char * str = grpc_error_string ( error ) ; <nl> gpr_log ( GPR_DEBUG , " write : % s " , str ) ; <nl> } <nl> static void tcp_write ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> grpc_tcp * tcp = ( grpc_tcp * ) ep ; <nl> grpc_error * error = GRPC_ERROR_NONE ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> size_t i ; <nl> <nl> for ( i = 0 ; i < buf - > count ; i + + ) { <nl> static void tcp_write ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> if ( ! tcp_flush ( exec_ctx , tcp , & error ) ) { <nl> TCP_REF ( tcp , " write " ) ; <nl> tcp - > write_cb = cb ; <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " write : delayed " ) ; <nl> } <nl> notify_on_write ( exec_ctx , tcp ) ; <nl> } else { <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> const char * str = grpc_error_string ( error ) ; <nl> gpr_log ( GPR_DEBUG , " write : % s " , str ) ; <nl> } <nl> mmm a / src / core / lib / iomgr / tcp_posix . h <nl> ppp b / src / core / lib / iomgr / tcp_posix . h <nl> <nl> extern " C " { <nl> # endif <nl> <nl> - extern grpc_tracer_flag grpc_tcp_trace ; <nl> + extern grpc_core : : TraceFlag grpc_tcp_trace ; <nl> <nl> / * Create a tcp endpoint given a file desciptor and a read slice size . <nl> Takes ownership of fd . * / <nl> mmm a / src / core / lib / iomgr / tcp_server_posix . cc <nl> ppp b / src / core / lib / iomgr / tcp_server_posix . cc <nl> static void on_read ( grpc_exec_ctx * exec_ctx , void * arg , grpc_error * err ) { <nl> addr_str = grpc_sockaddr_to_uri ( & addr ) ; <nl> gpr_asprintf ( & name , " tcp - server - connection : % s " , addr_str ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " SERVER_CONNECT : incoming connection : % s " , addr_str ) ; <nl> } <nl> <nl> mmm a / src / core / lib / iomgr / tcp_server_uv . cc <nl> ppp b / src / core / lib / iomgr / tcp_server_uv . cc <nl> static void finish_accept ( grpc_exec_ctx * exec_ctx , grpc_tcp_listener * sp ) { <nl> } else { <nl> gpr_log ( GPR_INFO , " uv_tcp_getpeername error : % s " , uv_strerror ( err ) ) ; <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> if ( peer_name_string ) { <nl> gpr_log ( GPR_DEBUG , " SERVER_CONNECT : % p accepted connection : % s " , <nl> sp - > server , peer_name_string ) ; <nl> static void on_connect ( uv_stream_t * server , int status ) { <nl> <nl> GPR_ASSERT ( ! sp - > has_pending_connection ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " SERVER_CONNECT : % p incoming connection " , sp - > server ) ; <nl> } <nl> <nl> grpc_error * grpc_tcp_server_add_port ( grpc_tcp_server * s , <nl> <nl> gpr_free ( allocated_addr ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> char * port_string ; <nl> grpc_sockaddr_to_string ( & port_string , addr , 0 ) ; <nl> const char * str = grpc_error_string ( error ) ; <nl> void grpc_tcp_server_start ( grpc_exec_ctx * exec_ctx , grpc_tcp_server * server , <nl> ( void ) pollsets ; <nl> ( void ) pollset_count ; <nl> GRPC_UV_ASSERT_SAME_THREAD ( ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " SERVER_START % p " , server ) ; <nl> } <nl> GPR_ASSERT ( on_accept_cb ) ; <nl> mmm a / src / core / lib / iomgr / tcp_uv . cc <nl> ppp b / src / core / lib / iomgr / tcp_uv . cc <nl> <nl> # include " src / core / lib / slice / slice_string_helpers . h " <nl> # include " src / core / lib / support / string . h " <nl> <nl> - grpc_tracer_flag grpc_tcp_trace = GRPC_TRACER_INITIALIZER ( false , " tcp " ) ; <nl> + grpc_core : : TraceFlag grpc_tcp_trace ( false , " tcp " ) ; <nl> <nl> typedef struct { <nl> grpc_endpoint base ; <nl> static void tcp_free ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp ) { <nl> # define TCP_REF ( tcp , reason ) tcp_ref ( ( tcp ) , ( reason ) , __FILE__ , __LINE__ ) <nl> static void tcp_unref ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp , <nl> const char * reason , const char * file , int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & tcp - > refcount . count ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " TCP unref % p : % s % " PRIdPTR " - > % " PRIdPTR , tcp , reason , val , <nl> static void tcp_unref ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp , <nl> <nl> static void tcp_ref ( grpc_tcp * tcp , const char * reason , const char * file , <nl> int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & tcp - > refcount . count ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " TCP ref % p : % s % " PRIdPTR " - > % " PRIdPTR , tcp , reason , val , <nl> static void alloc_uv_buf ( uv_handle_t * handle , size_t suggested_size , <nl> static void call_read_cb ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp , <nl> grpc_error * error ) { <nl> grpc_closure * cb = tcp - > read_cb ; <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " TCP : % p call_cb % p % p : % p " , tcp , cb , cb - > cb , cb - > cb_arg ) ; <nl> size_t i ; <nl> const char * str = grpc_error_string ( error ) ; <nl> static void tcp_read_allocation_done ( grpc_exec_ctx * exec_ctx , void * tcpp , <nl> grpc_error * error ) { <nl> int status ; <nl> grpc_tcp * tcp = ( grpc_tcp * ) tcpp ; <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " TCP : % p read_allocation_done : % s " , tcp , <nl> grpc_error_string ( error ) ) ; <nl> } <nl> static void tcp_read_allocation_done ( grpc_exec_ctx * exec_ctx , void * tcpp , <nl> call_read_cb ( exec_ctx , tcp , GRPC_ERROR_REF ( error ) ) ; <nl> TCP_UNREF ( exec_ctx , tcp , " read " ) ; <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> const char * str = grpc_error_string ( error ) ; <nl> gpr_log ( GPR_DEBUG , " Initiating read on % p : error = % s " , tcp , str ) ; <nl> } <nl> static void write_callback ( uv_write_t * req , int status ) { <nl> } else { <nl> error = GRPC_ERROR_CREATE_FROM_STATIC_STRING ( " TCP Write failed " ) ; <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> const char * str = grpc_error_string ( error ) ; <nl> gpr_log ( GPR_DEBUG , " write complete on % p : error = % s " , tcp , str ) ; <nl> } <nl> static void uv_endpoint_write ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> uv_write_t * write_req ; <nl> GRPC_UV_ASSERT_SAME_THREAD ( ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> size_t j ; <nl> <nl> for ( j = 0 ; j < write_slices - > count ; j + + ) { <nl> static void uv_endpoint_shutdown ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> grpc_error * why ) { <nl> grpc_tcp * tcp = ( grpc_tcp * ) ep ; <nl> if ( ! tcp - > shutting_down ) { <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> const char * str = grpc_error_string ( why ) ; <nl> gpr_log ( GPR_DEBUG , " TCP % p shutdown why = % s " , tcp - > handle , str ) ; <nl> } <nl> grpc_endpoint * grpc_tcp_create ( uv_tcp_t * handle , <nl> grpc_tcp * tcp = ( grpc_tcp * ) gpr_malloc ( sizeof ( grpc_tcp ) ) ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " Creating TCP endpoint % p " , tcp ) ; <nl> } <nl> <nl> mmm a / src / core / lib / iomgr / tcp_uv . h <nl> ppp b / src / core / lib / iomgr / tcp_uv . h <nl> <nl> <nl> # include < uv . h > <nl> <nl> - extern grpc_tracer_flag grpc_tcp_trace ; <nl> + extern grpc_core : : TraceFlag grpc_tcp_trace ; <nl> <nl> # define GRPC_TCP_DEFAULT_READ_SLICE_SIZE 8192 <nl> <nl> mmm a / src / core / lib / iomgr / tcp_windows . cc <nl> ppp b / src / core / lib / iomgr / tcp_windows . cc <nl> <nl> # define GRPC_FIONBIO FIONBIO <nl> # endif <nl> <nl> - grpc_tracer_flag grpc_tcp_trace = GRPC_TRACER_INITIALIZER ( false , " tcp " ) ; <nl> + grpc_core : : TraceFlag grpc_tcp_trace ( false , " tcp " ) ; <nl> <nl> static grpc_error * set_non_block ( SOCKET sock ) { <nl> int status ; <nl> static void tcp_free ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp ) { <nl> # define TCP_REF ( tcp , reason ) tcp_ref ( ( tcp ) , ( reason ) , __FILE__ , __LINE__ ) <nl> static void tcp_unref ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp , <nl> const char * reason , const char * file , int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & tcp - > refcount . count ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " TCP unref % p : % s % " PRIdPTR " - > % " PRIdPTR , tcp , reason , val , <nl> static void tcp_unref ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp , <nl> <nl> static void tcp_ref ( grpc_tcp * tcp , const char * reason , const char * file , <nl> int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_tcp_trace ) ) { <nl> + if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & tcp - > refcount . count ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " TCP ref % p : % s % " PRIdPTR " - > % " PRIdPTR , tcp , reason , val , <nl> mmm a / src / core / lib / iomgr / timer_generic . cc <nl> ppp b / src / core / lib / iomgr / timer_generic . cc <nl> <nl> # define MIN_QUEUE_WINDOW_DURATION 0 . 01 <nl> # define MAX_QUEUE_WINDOW_DURATION 1 <nl> <nl> - extern " C " { <nl> - grpc_tracer_flag grpc_timer_trace = GRPC_TRACER_INITIALIZER ( false , " timer " ) ; <nl> - grpc_tracer_flag grpc_timer_check_trace = <nl> - GRPC_TRACER_INITIALIZER ( false , " timer_check " ) ; <nl> - } <nl> + grpc_core : : TraceFlag grpc_timer_trace ( false , " timer " ) ; <nl> + grpc_core : : TraceFlag grpc_timer_check_trace ( false , " timer_check " ) ; <nl> <nl> / * A " timer shard " . Contains a ' heap ' and a ' list ' of timers . All timers with <nl> * deadlines earlier than ' queue_deadline " cap are maintained in the heap and <nl> void grpc_timer_list_init ( grpc_exec_ctx * exec_ctx ) { <nl> g_shared_mutables . min_timer = grpc_exec_ctx_now ( exec_ctx ) ; <nl> gpr_tls_init ( & g_last_seen_min_timer ) ; <nl> gpr_tls_set ( & g_last_seen_min_timer , 0 ) ; <nl> - grpc_register_tracer ( & grpc_timer_trace ) ; <nl> - grpc_register_tracer ( & grpc_timer_check_trace ) ; <nl> <nl> for ( i = 0 ; i < g_num_shards ; i + + ) { <nl> timer_shard * shard = & g_shards [ i ] ; <nl> void grpc_timer_init ( grpc_exec_ctx * exec_ctx , grpc_timer * timer , <nl> timer - > hash_table_next = nullptr ; <nl> # endif <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_timer_trace ) ) { <nl> + if ( grpc_timer_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " TIMER % p : SET % " PRIdPTR " now % " PRIdPTR " call % p [ % p ] " , timer , <nl> deadline , grpc_exec_ctx_now ( exec_ctx ) , closure , closure - > cb ) ; <nl> void grpc_timer_init ( grpc_exec_ctx * exec_ctx , grpc_timer * timer , <nl> timer - > heap_index = INVALID_HEAP_INDEX ; <nl> list_join ( & shard - > list , timer ) ; <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_timer_trace ) ) { <nl> + if ( grpc_timer_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " . . add to shard % d with queue_deadline_cap = % " PRIdPTR <nl> " = > is_first_timer = % s " , <nl> void grpc_timer_init ( grpc_exec_ctx * exec_ctx , grpc_timer * timer , <nl> grpc_timer_check . * / <nl> if ( is_first_timer ) { <nl> gpr_mu_lock ( & g_shared_mutables . mu ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_timer_trace ) ) { <nl> + if ( grpc_timer_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " . . old shard min_deadline = % " PRIdPTR , <nl> shard - > min_deadline ) ; <nl> } <nl> void grpc_timer_cancel ( grpc_exec_ctx * exec_ctx , grpc_timer * timer ) { <nl> <nl> timer_shard * shard = & g_shards [ GPR_HASH_POINTER ( timer , g_num_shards ) ] ; <nl> gpr_mu_lock ( & shard - > mu ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_timer_trace ) ) { <nl> + if ( grpc_timer_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " TIMER % p : CANCEL pending = % s " , timer , <nl> timer - > pending ? " true " : " false " ) ; <nl> } <nl> static int refill_heap ( timer_shard * shard , gpr_atm now ) { <nl> saturating_add ( GPR_MAX ( now , shard - > queue_deadline_cap ) , <nl> ( gpr_atm ) ( deadline_delta * 1000 . 0 ) ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " . . shard [ % d ] - > queue_deadline_cap - - > % " PRIdPTR , <nl> ( int ) ( shard - g_shards ) , shard - > queue_deadline_cap ) ; <nl> } <nl> static int refill_heap ( timer_shard * shard , gpr_atm now ) { <nl> next = timer - > next ; <nl> <nl> if ( timer - > deadline < shard - > queue_deadline_cap ) { <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " . . add timer with deadline % " PRIdPTR " to heap " , <nl> timer - > deadline ) ; <nl> } <nl> static int refill_heap ( timer_shard * shard , gpr_atm now ) { <nl> static grpc_timer * pop_one ( timer_shard * shard , gpr_atm now ) { <nl> grpc_timer * timer ; <nl> for ( ; ; ) { <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " . . shard [ % d ] : heap_empty = % s " , <nl> ( int ) ( shard - g_shards ) , <nl> grpc_timer_heap_is_empty ( & shard - > heap ) ? " true " : " false " ) ; <nl> static grpc_timer * pop_one ( timer_shard * shard , gpr_atm now ) { <nl> if ( ! refill_heap ( shard , now ) ) return nullptr ; <nl> } <nl> timer = grpc_timer_heap_top ( & shard - > heap ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " . . check top timer deadline = % " PRIdPTR " now = % " PRIdPTR , <nl> timer - > deadline , now ) ; <nl> } <nl> if ( timer - > deadline > now ) return nullptr ; <nl> - if ( GRPC_TRACER_ON ( grpc_timer_trace ) ) { <nl> + if ( grpc_timer_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " TIMER % p : FIRE % " PRIdPTR " ms late via % s scheduler " , <nl> timer , now - timer - > deadline , <nl> timer - > closure - > scheduler - > vtable - > name ) ; <nl> static size_t pop_timers ( grpc_exec_ctx * exec_ctx , timer_shard * shard , <nl> } <nl> * new_min_deadline = compute_min_deadline ( shard ) ; <nl> gpr_mu_unlock ( & shard - > mu ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " . . shard [ % d ] popped % " PRIdPTR , <nl> ( int ) ( shard - g_shards ) , n ) ; <nl> } <nl> static grpc_timer_check_result run_some_expired_timers ( grpc_exec_ctx * exec_ctx , <nl> gpr_mu_lock ( & g_shared_mutables . mu ) ; <nl> result = GRPC_TIMERS_CHECKED_AND_EMPTY ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " . . shard [ % d ] - > min_deadline = % " PRIdPTR , <nl> ( int ) ( g_shard_queue [ 0 ] - g_shards ) , <nl> g_shard_queue [ 0 ] - > min_deadline ) ; <nl> static grpc_timer_check_result run_some_expired_timers ( grpc_exec_ctx * exec_ctx , <nl> result = GRPC_TIMERS_FIRED ; <nl> } <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " . . result - - > % d " <nl> " , shard [ % d ] - > min_deadline % " PRIdPTR " - - > % " PRIdPTR <nl> grpc_timer_check_result grpc_timer_check ( grpc_exec_ctx * exec_ctx , <nl> if ( next ! = nullptr ) { <nl> * next = GPR_MIN ( * next , min_timer ) ; <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " TIMER CHECK SKIP : now = % " PRIdPTR " min_timer = % " PRIdPTR , now , <nl> min_timer ) ; <nl> grpc_timer_check_result grpc_timer_check ( grpc_exec_ctx * exec_ctx , <nl> : GRPC_ERROR_CREATE_FROM_STATIC_STRING ( " Shutting down timer system " ) ; <nl> <nl> / / tracing <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> char * next_str ; <nl> if ( next = = nullptr ) { <nl> next_str = gpr_strdup ( " NULL " ) ; <nl> grpc_timer_check_result grpc_timer_check ( grpc_exec_ctx * exec_ctx , <nl> grpc_timer_check_result r = <nl> run_some_expired_timers ( exec_ctx , now , next , shutdown_error ) ; <nl> / / tracing <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> char * next_str ; <nl> if ( next = = nullptr ) { <nl> next_str = gpr_strdup ( " NULL " ) ; <nl> mmm a / src / core / lib / iomgr / timer_manager . cc <nl> ppp b / src / core / lib / iomgr / timer_manager . cc <nl> typedef struct completed_thread { <nl> struct completed_thread * next ; <nl> } completed_thread ; <nl> <nl> - extern " C " grpc_tracer_flag grpc_timer_check_trace ; <nl> + extern grpc_core : : TraceFlag grpc_timer_check_trace ; <nl> <nl> / / global mutex <nl> static gpr_mu g_mu ; <nl> static void start_timer_thread_and_unlock ( void ) { <nl> + + g_waiter_count ; <nl> + + g_thread_count ; <nl> gpr_mu_unlock ( & g_mu ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " Spawn timer thread " ) ; <nl> } <nl> gpr_thd_options opt = gpr_thd_options_default ( ) ; <nl> static void run_some_timers ( grpc_exec_ctx * exec_ctx ) { <nl> / / if there ' s no thread waiting with a timeout , kick an existing <nl> / / waiter so that the next deadline is not missed <nl> if ( ! g_has_timed_waiter ) { <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " kick untimed waiter " ) ; <nl> } <nl> gpr_cv_signal ( & g_cv_wait ) ; <nl> static void run_some_timers ( grpc_exec_ctx * exec_ctx ) { <nl> gpr_mu_unlock ( & g_mu ) ; <nl> } <nl> / / without our lock , flush the exec_ctx <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " flush exec_ctx " ) ; <nl> } <nl> grpc_exec_ctx_flush ( exec_ctx ) ; <nl> static bool wait_until ( grpc_exec_ctx * exec_ctx , grpc_millis next ) { <nl> g_has_timed_waiter = true ; <nl> g_timed_waiter_deadline = next ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> grpc_millis wait_time = next - grpc_exec_ctx_now ( exec_ctx ) ; <nl> gpr_log ( GPR_DEBUG , " sleep for a % " PRIdPTR " milliseconds " , <nl> wait_time ) ; <nl> static bool wait_until ( grpc_exec_ctx * exec_ctx , grpc_millis next ) { <nl> } <nl> } <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) & & <nl> - next = = GRPC_MILLIS_INF_FUTURE ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) & & next = = GRPC_MILLIS_INF_FUTURE ) { <nl> gpr_log ( GPR_DEBUG , " sleep until kicked " ) ; <nl> } <nl> <nl> gpr_cv_wait ( & g_cv_wait , & g_mu , <nl> grpc_millis_to_timespec ( next , GPR_CLOCK_REALTIME ) ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " wait ended : was_timed : % d kicked : % d " , <nl> my_timed_waiter_generation = = g_timed_waiter_generation , <nl> g_kicked ) ; <nl> static void timer_main_loop ( grpc_exec_ctx * exec_ctx ) { <nl> <nl> Consequently , we can just sleep forever here and be happy at some <nl> saved wakeup cycles . * / <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " timers not checked : expect another thread to " ) ; <nl> } <nl> next = GRPC_MILLIS_INF_FUTURE ; <nl> static void timer_thread_cleanup ( completed_thread * ct ) { <nl> ct - > next = g_completed_threads ; <nl> g_completed_threads = ct ; <nl> gpr_mu_unlock ( & g_mu ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " End timer thread " ) ; <nl> } <nl> } <nl> void grpc_timer_manager_init ( void ) { <nl> <nl> static void stop_threads ( void ) { <nl> gpr_mu_lock ( & g_mu ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " stop timer threads : threaded = % d " , g_threaded ) ; <nl> } <nl> if ( g_threaded ) { <nl> g_threaded = false ; <nl> gpr_cv_broadcast ( & g_cv_wait ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " num timer threads : % d " , g_thread_count ) ; <nl> } <nl> while ( g_thread_count > 0 ) { <nl> gpr_cv_wait ( & g_cv_shutdown , & g_mu , gpr_inf_future ( GPR_CLOCK_REALTIME ) ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_timer_check_trace ) ) { <nl> + if ( grpc_timer_check_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " num timer threads : % d " , g_thread_count ) ; <nl> } <nl> gc_completed_threads ( ) ; <nl> mmm a / src / core / lib / iomgr / timer_uv . cc <nl> ppp b / src / core / lib / iomgr / timer_uv . cc <nl> <nl> <nl> # include < uv . h > <nl> <nl> - extern " C " { <nl> - grpc_tracer_flag grpc_timer_trace = GRPC_TRACER_INITIALIZER ( false , " timer " ) ; <nl> - grpc_tracer_flag grpc_timer_check_trace = <nl> - GRPC_TRACER_INITIALIZER ( false , " timer_check " ) ; <nl> - } <nl> + grpc_core : : TraceFlag grpc_timer_trace ( false , " timer " ) ; <nl> + grpc_core : : TraceFlag grpc_timer_check_trace ( false , " timer_check " ) ; <nl> <nl> static void timer_close_callback ( uv_handle_t * handle ) { gpr_free ( handle ) ; } <nl> <nl> mmm a / src / core / lib / security / context / security_context . cc <nl> ppp b / src / core / lib / security / context / security_context . cc <nl> <nl> # include < grpc / support / log . h > <nl> # include < grpc / support / string_util . h > <nl> <nl> - # ifndef NDEBUG <nl> - grpc_tracer_flag grpc_trace_auth_context_refcount = <nl> - GRPC_TRACER_INITIALIZER ( false , " auth_context_refcount " ) ; <nl> - # endif <nl> + grpc_core : : DebugOnlyTraceFlag grpc_trace_auth_context_refcount ( <nl> + false , " auth_context_refcount " ) ; <nl> <nl> / * mmm grpc_call mmm * / <nl> <nl> grpc_auth_context * grpc_auth_context_ref ( grpc_auth_context * ctx , <nl> const char * file , int line , <nl> const char * reason ) { <nl> if ( ctx = = nullptr ) return nullptr ; <nl> - if ( GRPC_TRACER_ON ( grpc_trace_auth_context_refcount ) ) { <nl> + if ( grpc_trace_auth_context_refcount . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & ctx - > refcount . count ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " AUTH_CONTEXT : % p ref % " PRIdPTR " - > % " PRIdPTR " % s " , ctx , val , <nl> grpc_auth_context * grpc_auth_context_ref ( grpc_auth_context * ctx ) { <nl> void grpc_auth_context_unref ( grpc_auth_context * ctx , const char * file , int line , <nl> const char * reason ) { <nl> if ( ctx = = nullptr ) return ; <nl> - if ( GRPC_TRACER_ON ( grpc_trace_auth_context_refcount ) ) { <nl> + if ( grpc_trace_auth_context_refcount . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & ctx - > refcount . count ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " AUTH_CONTEXT : % p unref % " PRIdPTR " - > % " PRIdPTR " % s " , ctx , val , <nl> mmm a / src / core / lib / security / context / security_context . h <nl> ppp b / src / core / lib / security / context / security_context . h <nl> <nl> # include " src / core / lib / iomgr / pollset . h " <nl> # include " src / core / lib / security / credentials / credentials . h " <nl> <nl> - # ifndef NDEBUG <nl> - extern grpc_tracer_flag grpc_trace_auth_context_refcount ; <nl> - # endif <nl> + extern grpc_core : : DebugOnlyTraceFlag grpc_trace_auth_context_refcount ; <nl> <nl> # ifdef __cplusplus <nl> extern " C " { <nl> mmm a / src / core / lib / security / credentials / jwt / jwt_credentials . cc <nl> ppp b / src / core / lib / security / credentials / jwt / jwt_credentials . cc <nl> static char * redact_private_key ( const char * json_key ) { <nl> <nl> grpc_call_credentials * grpc_service_account_jwt_access_credentials_create ( <nl> const char * json_key , gpr_timespec token_lifetime , void * reserved ) { <nl> - if ( GRPC_TRACER_ON ( grpc_api_trace ) ) { <nl> + if ( grpc_api_trace . enabled ( ) ) { <nl> char * clean_json = redact_private_key ( json_key ) ; <nl> gpr_log ( GPR_INFO , <nl> " grpc_service_account_jwt_access_credentials_create ( " <nl> mmm a / src / core / lib / security / credentials / oauth2 / oauth2_credentials . cc <nl> ppp b / src / core / lib / security / credentials / oauth2 / oauth2_credentials . cc <nl> grpc_call_credentials * grpc_google_refresh_token_credentials_create ( <nl> const char * json_refresh_token , void * reserved ) { <nl> grpc_auth_refresh_token token = <nl> grpc_auth_refresh_token_create_from_string ( json_refresh_token ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_api_trace ) ) { <nl> + if ( grpc_api_trace . enabled ( ) ) { <nl> char * loggable_token = create_loggable_refresh_token ( & token ) ; <nl> gpr_log ( GPR_INFO , <nl> " grpc_refresh_token_credentials_create ( json_refresh_token = % s , " <nl> mmm a / src / core / lib / security / credentials / plugin / plugin_credentials . cc <nl> ppp b / src / core / lib / security / credentials / plugin / plugin_credentials . cc <nl> <nl> # include " src / core / lib / surface / api_trace . h " <nl> # include " src / core / lib / surface / validate_metadata . h " <nl> <nl> - grpc_tracer_flag grpc_plugin_credentials_trace = <nl> - GRPC_TRACER_INITIALIZER ( false , " plugin_credentials " ) ; <nl> + grpc_core : : TraceFlag grpc_plugin_credentials_trace ( false , " plugin_credentials " ) ; <nl> <nl> static void plugin_destruct ( grpc_exec_ctx * exec_ctx , <nl> grpc_call_credentials * creds ) { <nl> static void plugin_md_request_metadata_ready ( void * request , <nl> nullptr , nullptr ) ; <nl> grpc_plugin_credentials_pending_request * r = <nl> ( grpc_plugin_credentials_pending_request * ) request ; <nl> - if ( GRPC_TRACER_ON ( grpc_plugin_credentials_trace ) ) { <nl> + if ( grpc_plugin_credentials_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " plugin_credentials [ % p ] : request % p : plugin returned " <nl> " asynchronously " , <nl> static void plugin_md_request_metadata_ready ( void * request , <nl> grpc_error * error = <nl> process_plugin_result ( & exec_ctx , r , md , num_md , status , error_details ) ; <nl> GRPC_CLOSURE_SCHED ( & exec_ctx , r - > on_request_metadata , error ) ; <nl> - } else if ( GRPC_TRACER_ON ( grpc_plugin_credentials_trace ) ) { <nl> + } else if ( grpc_plugin_credentials_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " plugin_credentials [ % p ] : request % p : plugin was previously " <nl> " cancelled " , <nl> static bool plugin_get_request_metadata ( grpc_exec_ctx * exec_ctx , <nl> c - > pending_requests = pending_request ; <nl> gpr_mu_unlock ( & c - > mu ) ; <nl> / / Invoke the plugin . The callback holds a ref to us . <nl> - if ( GRPC_TRACER_ON ( grpc_plugin_credentials_trace ) ) { <nl> + if ( grpc_plugin_credentials_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , " plugin_credentials [ % p ] : request % p : invoking plugin " , <nl> c , pending_request ) ; <nl> } <nl> static bool plugin_get_request_metadata ( grpc_exec_ctx * exec_ctx , <nl> plugin_md_request_metadata_ready , <nl> pending_request , creds_md , & num_creds_md , <nl> & status , & error_details ) ) { <nl> - if ( GRPC_TRACER_ON ( grpc_plugin_credentials_trace ) ) { <nl> + if ( grpc_plugin_credentials_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " plugin_credentials [ % p ] : request % p : plugin will return " <nl> " asynchronously " , <nl> static bool plugin_get_request_metadata ( grpc_exec_ctx * exec_ctx , <nl> / / asynchronously by plugin_cancel_get_request_metadata ( ) , so return <nl> / / false . Otherwise , process the result . <nl> if ( pending_request - > cancelled ) { <nl> - if ( GRPC_TRACER_ON ( grpc_plugin_credentials_trace ) ) { <nl> + if ( grpc_plugin_credentials_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " plugin_credentials [ % p ] : request % p was cancelled , error " <nl> " will be returned asynchronously " , <nl> static bool plugin_get_request_metadata ( grpc_exec_ctx * exec_ctx , <nl> } <nl> retval = false ; <nl> } else { <nl> - if ( GRPC_TRACER_ON ( grpc_plugin_credentials_trace ) ) { <nl> + if ( grpc_plugin_credentials_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , <nl> " plugin_credentials [ % p ] : request % p : plugin returned " <nl> " synchronously " , <nl> static void plugin_cancel_get_request_metadata ( <nl> c - > pending_requests ; <nl> pending_request ! = nullptr ; pending_request = pending_request - > next ) { <nl> if ( pending_request - > md_array = = md_array ) { <nl> - if ( GRPC_TRACER_ON ( grpc_plugin_credentials_trace ) ) { <nl> + if ( grpc_plugin_credentials_trace . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , " plugin_credentials [ % p ] : cancelling request % p " , c , <nl> pending_request ) ; <nl> } <nl> mmm a / src / core / lib / security / credentials / plugin / plugin_credentials . h <nl> ppp b / src / core / lib / security / credentials / plugin / plugin_credentials . h <nl> <nl> <nl> # include " src / core / lib / security / credentials / credentials . h " <nl> <nl> - extern grpc_tracer_flag grpc_plugin_credentials_trace ; <nl> + extern grpc_core : : TraceFlag grpc_plugin_credentials_trace ; <nl> <nl> struct grpc_plugin_credentials ; <nl> <nl> mmm a / src / core / lib / security / transport / secure_endpoint . cc <nl> ppp b / src / core / lib / security / transport / secure_endpoint . cc <nl> typedef struct { <nl> gpr_refcount ref ; <nl> } secure_endpoint ; <nl> <nl> - grpc_tracer_flag grpc_trace_secure_endpoint = <nl> - GRPC_TRACER_INITIALIZER ( false , " secure_endpoint " ) ; <nl> + grpc_core : : TraceFlag grpc_trace_secure_endpoint ( false , " secure_endpoint " ) ; <nl> <nl> static void destroy ( grpc_exec_ctx * exec_ctx , secure_endpoint * secure_ep ) { <nl> secure_endpoint * ep = secure_ep ; <nl> static void destroy ( grpc_exec_ctx * exec_ctx , secure_endpoint * secure_ep ) { <nl> static void secure_endpoint_unref ( grpc_exec_ctx * exec_ctx , secure_endpoint * ep , <nl> const char * reason , const char * file , <nl> int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_secure_endpoint ) ) { <nl> + if ( grpc_trace_secure_endpoint . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & ep - > ref . count ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " SECENDP unref % p : % s % " PRIdPTR " - > % " PRIdPTR , ep , reason , val , <nl> static void secure_endpoint_unref ( grpc_exec_ctx * exec_ctx , secure_endpoint * ep , <nl> <nl> static void secure_endpoint_ref ( secure_endpoint * ep , const char * reason , <nl> const char * file , int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_secure_endpoint ) ) { <nl> + if ( grpc_trace_secure_endpoint . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & ep - > ref . count ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " SECENDP ref % p : % s % " PRIdPTR " - > % " PRIdPTR , ep , reason , val , <nl> static void flush_read_staging_buffer ( secure_endpoint * ep , uint8_t * * cur , <nl> <nl> static void call_read_cb ( grpc_exec_ctx * exec_ctx , secure_endpoint * ep , <nl> grpc_error * error ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_secure_endpoint ) ) { <nl> + if ( grpc_trace_secure_endpoint . enabled ( ) ) { <nl> size_t i ; <nl> for ( i = 0 ; i < ep - > read_buffer - > count ; i + + ) { <nl> char * data = grpc_dump_slice ( ep - > read_buffer - > slices [ i ] , <nl> static void endpoint_write ( grpc_exec_ctx * exec_ctx , grpc_endpoint * secure_ep , <nl> <nl> grpc_slice_buffer_reset_and_unref_internal ( exec_ctx , & ep - > output_buffer ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_trace_secure_endpoint ) ) { <nl> + if ( grpc_trace_secure_endpoint . enabled ( ) ) { <nl> for ( i = 0 ; i < slices - > count ; i + + ) { <nl> char * data = <nl> grpc_dump_slice ( slices - > slices [ i ] , GPR_DUMP_HEX | GPR_DUMP_ASCII ) ; <nl> mmm a / src / core / lib / security / transport / secure_endpoint . h <nl> ppp b / src / core / lib / security / transport / secure_endpoint . h <nl> extern " C " { <nl> struct tsi_frame_protector ; <nl> struct tsi_zero_copy_grpc_protector ; <nl> <nl> - extern grpc_tracer_flag grpc_trace_secure_endpoint ; <nl> + extern grpc_core : : TraceFlag grpc_trace_secure_endpoint ; <nl> <nl> / * Takes ownership of protector , zero_copy_protector , and to_wrap , and refs <nl> * leftover_slices . If zero_copy_protector is not NULL , protector will never be <nl> mmm a / src / core / lib / security / transport / security_connector . cc <nl> ppp b / src / core / lib / security / transport / security_connector . cc <nl> <nl> # include " src / core / tsi / ssl_transport_security . h " <nl> # include " src / core / tsi / transport_security_adapter . h " <nl> <nl> - # ifndef NDEBUG <nl> - grpc_tracer_flag grpc_trace_security_connector_refcount = <nl> - GRPC_TRACER_INITIALIZER ( false , " security_connector_refcount " ) ; <nl> - # endif <nl> + grpc_core : : DebugOnlyTraceFlag grpc_trace_security_connector_refcount ( <nl> + false , " security_connector_refcount " ) ; <nl> <nl> / * - - Constants . - - * / <nl> <nl> grpc_security_connector * grpc_security_connector_ref ( <nl> grpc_security_connector * sc , const char * file , int line , <nl> const char * reason ) { <nl> if ( sc = = nullptr ) return nullptr ; <nl> - if ( GRPC_TRACER_ON ( grpc_trace_security_connector_refcount ) ) { <nl> + if ( grpc_trace_security_connector_refcount . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & sc - > refcount . count ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " SECURITY_CONNECTOR : % p ref % " PRIdPTR " - > % " PRIdPTR " % s " , sc , <nl> void grpc_security_connector_unref ( grpc_exec_ctx * exec_ctx , <nl> const char * file , int line , <nl> const char * reason ) { <nl> if ( sc = = nullptr ) return ; <nl> - if ( GRPC_TRACER_ON ( grpc_trace_security_connector_refcount ) ) { <nl> + if ( grpc_trace_security_connector_refcount . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & sc - > refcount . count ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " SECURITY_CONNECTOR : % p unref % " PRIdPTR " - > % " PRIdPTR " % s " , sc , <nl> mmm a / src / core / lib / security / transport / security_connector . h <nl> ppp b / src / core / lib / security / transport / security_connector . h <nl> <nl> extern " C " { <nl> # endif <nl> <nl> - # ifndef NDEBUG <nl> - extern grpc_tracer_flag grpc_trace_security_connector_refcount ; <nl> - # endif <nl> + extern grpc_core : : DebugOnlyTraceFlag grpc_trace_security_connector_refcount ; <nl> <nl> / * mmm status enum . mmm * / <nl> <nl> mmm a / src / core / lib / surface / alarm . cc <nl> ppp b / src / core / lib / surface / alarm . cc <nl> <nl> # include " src / core / lib / iomgr / timer . h " <nl> # include " src / core / lib / surface / completion_queue . h " <nl> <nl> - # ifndef NDEBUG <nl> - grpc_tracer_flag grpc_trace_alarm_refcount = <nl> - GRPC_TRACER_INITIALIZER ( false , " alarm_refcount " ) ; <nl> - # endif <nl> + grpc_core : : DebugOnlyTraceFlag grpc_trace_alarm_refcount ( false , <nl> + " alarm_refcount " ) ; <nl> <nl> struct grpc_alarm { <nl> gpr_refcount refs ; <nl> static void alarm_unref ( grpc_alarm * alarm ) { <nl> # ifndef NDEBUG <nl> static void alarm_ref_dbg ( grpc_alarm * alarm , const char * reason , <nl> const char * file , int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_alarm_refcount ) ) { <nl> + if ( grpc_trace_alarm_refcount . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & alarm - > refs . count ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " Alarm : % p ref % " PRIdPTR " - > % " PRIdPTR " % s " , alarm , val , <nl> static void alarm_ref_dbg ( grpc_alarm * alarm , const char * reason , <nl> <nl> static void alarm_unref_dbg ( grpc_alarm * alarm , const char * reason , <nl> const char * file , int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_alarm_refcount ) ) { <nl> + if ( grpc_trace_alarm_refcount . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & alarm - > refs . count ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " Alarm : % p Unref % " PRIdPTR " - > % " PRIdPTR " % s " , alarm , val , <nl> grpc_alarm * grpc_alarm_create ( void * reserved ) { <nl> grpc_alarm * alarm = ( grpc_alarm * ) gpr_malloc ( sizeof ( grpc_alarm ) ) ; <nl> <nl> # ifndef NDEBUG <nl> - if ( GRPC_TRACER_ON ( grpc_trace_alarm_refcount ) ) { <nl> + if ( grpc_trace_alarm_refcount . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " Alarm : % p created ( ref : 1 ) " , alarm ) ; <nl> } <nl> # endif <nl> mmm a / src / core / lib / surface / alarm_internal . h <nl> ppp b / src / core / lib / surface / alarm_internal . h <nl> <nl> # include < grpc / support / log . h > <nl> # include " src / core / lib / debug / trace . h " <nl> <nl> + extern grpc_core : : DebugOnlyTraceFlag grpc_trace_alarm_refcount ; <nl> + <nl> # ifdef __cplusplus <nl> extern " C " { <nl> # endif <nl> <nl> # ifndef NDEBUG <nl> <nl> - extern grpc_tracer_flag grpc_trace_alarm_refcount ; <nl> - <nl> # define GRPC_ALARM_REF ( a , reason ) alarm_ref_dbg ( a , reason , __FILE__ , __LINE__ ) <nl> # define GRPC_ALARM_UNREF ( a , reason ) \ <nl> alarm_unref_dbg ( a , reason , __FILE__ , __LINE__ ) <nl> mmm a / src / core / lib / surface / api_trace . cc <nl> ppp b / src / core / lib / surface / api_trace . cc <nl> <nl> # include " src / core / lib / surface / api_trace . h " <nl> # include " src / core / lib / debug / trace . h " <nl> <nl> - grpc_tracer_flag grpc_api_trace = GRPC_TRACER_INITIALIZER ( false , " api " ) ; <nl> + grpc_core : : TraceFlag grpc_api_trace ( false , " api " ) ; <nl> mmm a / src / core / lib / surface / api_trace . h <nl> ppp b / src / core / lib / surface / api_trace . h <nl> <nl> # include < grpc / support / log . h > <nl> # include " src / core / lib / debug / trace . h " <nl> <nl> - # ifdef __cplusplus <nl> - extern " C " { <nl> - # endif <nl> - <nl> - extern grpc_tracer_flag grpc_api_trace ; <nl> + extern grpc_core : : TraceFlag grpc_api_trace ; <nl> <nl> / * Provide unwrapping macros because we ' re in C89 and variadic macros weren ' t <nl> introduced until C99 . . . * / <nl> extern grpc_tracer_flag grpc_api_trace ; <nl> / * Due to the limitations of C89 ' s preprocessor , the arity of the var - arg list <nl> ' nargs ' must be specified . * / <nl> # define GRPC_API_TRACE ( fmt , nargs , args ) \ <nl> - if ( GRPC_TRACER_ON ( grpc_api_trace ) ) { \ <nl> + if ( grpc_api_trace . enabled ( ) ) { \ <nl> gpr_log ( GPR_INFO , fmt GRPC_API_TRACE_UNWRAP # # nargs args ) ; \ <nl> } <nl> <nl> - # ifdef __cplusplus <nl> - } <nl> - # endif <nl> - <nl> # endif / * GRPC_CORE_LIB_SURFACE_API_TRACE_H * / <nl> mmm a / src / core / lib / surface / call . cc <nl> ppp b / src / core / lib / surface / call . cc <nl> struct grpc_call { <nl> gpr_atm recv_state ; <nl> } ; <nl> <nl> - grpc_tracer_flag grpc_call_error_trace = <nl> - GRPC_TRACER_INITIALIZER ( false , " call_error " ) ; <nl> - grpc_tracer_flag grpc_compression_trace = <nl> - GRPC_TRACER_INITIALIZER ( false , " compression " ) ; <nl> + grpc_core : : TraceFlag grpc_call_error_trace ( false , " call_error " ) ; <nl> + grpc_core : : TraceFlag grpc_compression_trace ( false , " compression " ) ; <nl> <nl> # define CALL_STACK_FROM_CALL ( call ) ( ( grpc_call_stack * ) ( ( call ) + 1 ) ) <nl> # define CALL_FROM_CALL_STACK ( call_stack ) ( ( ( grpc_call * ) ( call_stack ) ) - 1 ) <nl> static void get_final_status ( grpc_exec_ctx * exec_ctx , grpc_call * call , <nl> for ( i = 0 ; i < STATUS_SOURCE_COUNT ; i + + ) { <nl> status [ i ] = unpack_received_status ( gpr_atm_acq_load ( & call - > status [ i ] ) ) ; <nl> } <nl> - if ( GRPC_TRACER_ON ( grpc_call_error_trace ) ) { <nl> + if ( grpc_call_error_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " get_final_status % s " , call - > is_client ? " CLI " : " SVR " ) ; <nl> for ( i = 0 ; i < STATUS_SOURCE_COUNT ; i + + ) { <nl> if ( status [ i ] . is_set ) { <nl> static void receiving_slice_ready ( grpc_exec_ctx * exec_ctx , void * bctlp , <nl> } <nl> <nl> if ( error ! = GRPC_ERROR_NONE ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_operation_failures ) ) { <nl> + if ( grpc_trace_operation_failures . enabled ( ) ) { <nl> GRPC_LOG_IF_ERROR ( " receiving_slice_ready " , GRPC_ERROR_REF ( error ) ) ; <nl> } <nl> grpc_byte_stream_destroy ( exec_ctx , call - > receiving_stream ) ; <nl> static void validate_filtered_metadata ( grpc_exec_ctx * exec_ctx , <nl> GPR_ASSERT ( call - > stream_encodings_accepted_by_peer ! = 0 ) ; <nl> if ( ! GPR_BITGET ( call - > stream_encodings_accepted_by_peer , <nl> call - > incoming_stream_compression_algorithm ) ) { <nl> - if ( GRPC_TRACER_ON ( grpc_compression_trace ) ) { <nl> + if ( grpc_compression_trace . enabled ( ) ) { <nl> const char * algo_name = nullptr ; <nl> grpc_stream_compression_algorithm_name ( <nl> call - > incoming_stream_compression_algorithm , & algo_name ) ; <nl> static void validate_filtered_metadata ( grpc_exec_ctx * exec_ctx , <nl> GPR_ASSERT ( call - > encodings_accepted_by_peer ! = 0 ) ; <nl> if ( ! GPR_BITGET ( call - > encodings_accepted_by_peer , <nl> call - > incoming_compression_algorithm ) ) { <nl> - if ( GRPC_TRACER_ON ( grpc_compression_trace ) ) { <nl> + if ( grpc_compression_trace . enabled ( ) ) { <nl> const char * algo_name = nullptr ; <nl> grpc_compression_algorithm_name ( call - > incoming_compression_algorithm , <nl> & algo_name ) ; <nl> mmm a / src / core / lib / surface / call . h <nl> ppp b / src / core / lib / surface / call . h <nl> void grpc_call_context_set ( grpc_call * call , grpc_context_index elem , <nl> void * grpc_call_context_get ( grpc_call * call , grpc_context_index elem ) ; <nl> <nl> # define GRPC_CALL_LOG_BATCH ( sev , call , ops , nops , tag ) \ <nl> - if ( GRPC_TRACER_ON ( grpc_api_trace ) ) \ <nl> - grpc_call_log_batch ( sev , call , ops , nops , tag ) <nl> + if ( grpc_api_trace . enabled ( ) ) grpc_call_log_batch ( sev , call , ops , nops , tag ) <nl> <nl> uint8_t grpc_call_is_client ( grpc_call * call ) ; <nl> <nl> uint8_t grpc_call_is_client ( grpc_call * call ) ; <nl> grpc_compression_algorithm grpc_call_compression_for_level ( <nl> grpc_call * call , grpc_compression_level level ) ; <nl> <nl> - extern grpc_tracer_flag grpc_call_error_trace ; <nl> - extern grpc_tracer_flag grpc_compression_trace ; <nl> + extern grpc_core : : TraceFlag grpc_call_error_trace ; <nl> + extern grpc_core : : TraceFlag grpc_compression_trace ; <nl> <nl> # ifdef __cplusplus <nl> } <nl> mmm a / src / core / lib / surface / completion_queue . cc <nl> ppp b / src / core / lib / surface / completion_queue . cc <nl> <nl> # include " src / core / lib / surface / call . h " <nl> # include " src / core / lib / surface / event_string . h " <nl> <nl> - grpc_tracer_flag grpc_trace_operation_failures = <nl> - GRPC_TRACER_INITIALIZER ( false , " op_failure " ) ; <nl> - # ifndef NDEBUG <nl> - grpc_tracer_flag grpc_trace_pending_tags = <nl> - GRPC_TRACER_INITIALIZER ( false , " pending_tags " ) ; <nl> - grpc_tracer_flag grpc_trace_cq_refcount = <nl> - GRPC_TRACER_INITIALIZER ( false , " cq_refcount " ) ; <nl> - # endif <nl> + grpc_core : : TraceFlag grpc_trace_operation_failures ( false , " op_failure " ) ; <nl> + grpc_core : : DebugOnlyTraceFlag grpc_trace_pending_tags ( false , " pending_tags " ) ; <nl> + grpc_core : : DebugOnlyTraceFlag grpc_trace_cq_refcount ( false , " cq_refcount " ) ; <nl> <nl> / / Specifies a cq thread local cache . <nl> / / The first event that occurs on a thread <nl> static const cq_vtable g_cq_vtable [ ] = { <nl> # define POLLSET_FROM_CQ ( cq ) \ <nl> ( ( grpc_pollset * ) ( cq - > vtable - > data_size + ( char * ) DATA_FROM_CQ ( cq ) ) ) <nl> <nl> - grpc_tracer_flag grpc_cq_pluck_trace = <nl> - GRPC_TRACER_INITIALIZER ( true , " queue_pluck " ) ; <nl> - grpc_tracer_flag grpc_cq_event_timeout_trace = <nl> - GRPC_TRACER_INITIALIZER ( true , " queue_timeout " ) ; <nl> - <nl> - # define GRPC_SURFACE_TRACE_RETURNED_EVENT ( cq , event ) \ <nl> - if ( GRPC_TRACER_ON ( grpc_api_trace ) & & \ <nl> - ( GRPC_TRACER_ON ( grpc_cq_pluck_trace ) | | \ <nl> - ( event ) - > type ! = GRPC_QUEUE_TIMEOUT ) ) { \ <nl> - char * _ev = grpc_event_string ( event ) ; \ <nl> - gpr_log ( GPR_INFO , " RETURN_EVENT [ % p ] : % s " , cq , _ev ) ; \ <nl> - gpr_free ( _ev ) ; \ <nl> + grpc_core : : TraceFlag grpc_cq_pluck_trace ( true , " queue_pluck " ) ; <nl> + grpc_core : : TraceFlag grpc_cq_event_timeout_trace ( true , " queue_timeout " ) ; <nl> + <nl> + # define GRPC_SURFACE_TRACE_RETURNED_EVENT ( cq , event ) \ <nl> + if ( grpc_api_trace . enabled ( ) & & ( grpc_cq_pluck_trace . enabled ( ) | | \ <nl> + ( event ) - > type ! = GRPC_QUEUE_TIMEOUT ) ) { \ <nl> + char * _ev = grpc_event_string ( event ) ; \ <nl> + gpr_log ( GPR_INFO , " RETURN_EVENT [ % p ] : % s " , cq , _ev ) ; \ <nl> + gpr_free ( _ev ) ; \ <nl> } <nl> <nl> static void on_pollset_shutdown_done ( grpc_exec_ctx * exec_ctx , void * cq , <nl> int grpc_get_cq_poll_num ( grpc_completion_queue * cq ) { <nl> # ifndef NDEBUG <nl> void grpc_cq_internal_ref ( grpc_completion_queue * cq , const char * reason , <nl> const char * file , int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_cq_refcount ) ) { <nl> + if ( grpc_trace_cq_refcount . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & cq - > owning_refs . count ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " CQ : % p ref % " PRIdPTR " - > % " PRIdPTR " % s " , cq , val , val + 1 , <nl> static void on_pollset_shutdown_done ( grpc_exec_ctx * exec_ctx , void * arg , <nl> # ifndef NDEBUG <nl> void grpc_cq_internal_unref ( grpc_exec_ctx * exec_ctx , grpc_completion_queue * cq , <nl> const char * reason , const char * file , int line ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_cq_refcount ) ) { <nl> + if ( grpc_trace_cq_refcount . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & cq - > owning_refs . count ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " CQ : % p unref % " PRIdPTR " - > % " PRIdPTR " % s " , cq , val , val - 1 , <nl> static void cq_end_op_for_next ( grpc_exec_ctx * exec_ctx , <nl> void * done_arg , grpc_cq_completion * storage ) { <nl> GPR_TIMER_BEGIN ( " cq_end_op_for_next " , 0 ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_api_trace ) | | <nl> - ( GRPC_TRACER_ON ( grpc_trace_operation_failures ) & & <nl> - error ! = GRPC_ERROR_NONE ) ) { <nl> + if ( grpc_api_trace . enabled ( ) | | <nl> + ( grpc_trace_operation_failures . enabled ( ) & & error ! = GRPC_ERROR_NONE ) ) { <nl> const char * errmsg = grpc_error_string ( error ) ; <nl> GRPC_API_TRACE ( <nl> " cq_end_op_for_next ( exec_ctx = % p , cq = % p , tag = % p , error = % s , " <nl> " done = % p , done_arg = % p , storage = % p ) " , <nl> 7 , ( exec_ctx , cq , tag , errmsg , done , done_arg , storage ) ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_trace_operation_failures ) & & <nl> - error ! = GRPC_ERROR_NONE ) { <nl> + if ( grpc_trace_operation_failures . enabled ( ) & & error ! = GRPC_ERROR_NONE ) { <nl> gpr_log ( GPR_ERROR , " Operation failed : tag = % p , error = % s " , tag , errmsg ) ; <nl> } <nl> } <nl> static void cq_end_op_for_pluck ( grpc_exec_ctx * exec_ctx , <nl> <nl> GPR_TIMER_BEGIN ( " cq_end_op_for_pluck " , 0 ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_api_trace ) | | <nl> - ( GRPC_TRACER_ON ( grpc_trace_operation_failures ) & & <nl> - error ! = GRPC_ERROR_NONE ) ) { <nl> + if ( grpc_api_trace . enabled ( ) | | <nl> + ( grpc_trace_operation_failures . enabled ( ) & & error ! = GRPC_ERROR_NONE ) ) { <nl> const char * errmsg = grpc_error_string ( error ) ; <nl> GRPC_API_TRACE ( <nl> " cq_end_op_for_pluck ( exec_ctx = % p , cq = % p , tag = % p , error = % s , " <nl> " done = % p , done_arg = % p , storage = % p ) " , <nl> 7 , ( exec_ctx , cq , tag , errmsg , done , done_arg , storage ) ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_trace_operation_failures ) & & <nl> - error ! = GRPC_ERROR_NONE ) { <nl> + if ( grpc_trace_operation_failures . enabled ( ) & & error ! = GRPC_ERROR_NONE ) { <nl> gpr_log ( GPR_ERROR , " Operation failed : tag = % p , error = % s " , tag , errmsg ) ; <nl> } <nl> } <nl> static bool cq_is_next_finished ( grpc_exec_ctx * exec_ctx , void * arg ) { <nl> <nl> # ifndef NDEBUG <nl> static void dump_pending_tags ( grpc_completion_queue * cq ) { <nl> - if ( ! GRPC_TRACER_ON ( grpc_trace_pending_tags ) ) return ; <nl> + if ( ! grpc_trace_pending_tags . enabled ( ) ) return ; <nl> <nl> gpr_strvec v ; <nl> gpr_strvec_init ( & v ) ; <nl> static grpc_event cq_pluck ( grpc_completion_queue * cq , void * tag , <nl> <nl> GPR_TIMER_BEGIN ( " grpc_completion_queue_pluck " , 0 ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_cq_pluck_trace ) ) { <nl> + if ( grpc_cq_pluck_trace . enabled ( ) ) { <nl> GRPC_API_TRACE ( <nl> " grpc_completion_queue_pluck ( " <nl> " cq = % p , tag = % p , " <nl> mmm a / src / core / lib / surface / completion_queue . h <nl> ppp b / src / core / lib / surface / completion_queue . h <nl> <nl> <nl> / * These trace flags default to 1 . The corresponding lines are only traced <nl> if grpc_api_trace is also truthy * / <nl> - extern grpc_tracer_flag grpc_cq_pluck_trace ; <nl> - extern grpc_tracer_flag grpc_cq_event_timeout_trace ; <nl> - extern grpc_tracer_flag grpc_trace_operation_failures ; <nl> - <nl> - # ifndef NDEBUG <nl> - extern grpc_tracer_flag grpc_trace_pending_tags ; <nl> - extern grpc_tracer_flag grpc_trace_cq_refcount ; <nl> - # endif <nl> + extern grpc_core : : TraceFlag grpc_cq_pluck_trace ; <nl> + extern grpc_core : : TraceFlag grpc_cq_event_timeout_trace ; <nl> + extern grpc_core : : TraceFlag grpc_trace_operation_failures ; <nl> + extern grpc_core : : DebugOnlyTraceFlag grpc_trace_pending_tags ; <nl> + extern grpc_core : : DebugOnlyTraceFlag grpc_trace_cq_refcount ; <nl> <nl> # ifdef __cplusplus <nl> extern " C " { <nl> mmm a / src / core / lib / surface / init . cc <nl> ppp b / src / core / lib / surface / init . cc <nl> void grpc_init ( void ) { <nl> grpc_slice_intern_init ( ) ; <nl> grpc_mdctx_global_init ( ) ; <nl> grpc_channel_init_init ( ) ; <nl> - grpc_register_tracer ( & grpc_api_trace ) ; <nl> - grpc_register_tracer ( & grpc_trace_channel ) ; <nl> - grpc_register_tracer ( & grpc_connectivity_state_trace ) ; <nl> - grpc_register_tracer ( & grpc_trace_channel_stack_builder ) ; <nl> - grpc_register_tracer ( & grpc_http1_trace ) ; <nl> - grpc_register_tracer ( & grpc_cq_pluck_trace ) ; / / default on <nl> - grpc_register_tracer ( & grpc_call_combiner_trace ) ; <nl> - grpc_register_tracer ( & grpc_combiner_trace ) ; <nl> - grpc_register_tracer ( & grpc_server_channel_trace ) ; <nl> - grpc_register_tracer ( & grpc_bdp_estimator_trace ) ; <nl> - grpc_register_tracer ( & grpc_cq_event_timeout_trace ) ; / / default on <nl> - grpc_register_tracer ( & grpc_trace_operation_failures ) ; <nl> - grpc_register_tracer ( & grpc_resource_quota_trace ) ; <nl> - grpc_register_tracer ( & grpc_call_error_trace ) ; <nl> - # ifndef NDEBUG <nl> - grpc_register_tracer ( & grpc_trace_pending_tags ) ; <nl> - grpc_register_tracer ( & grpc_trace_alarm_refcount ) ; <nl> - grpc_register_tracer ( & grpc_trace_cq_refcount ) ; <nl> - grpc_register_tracer ( & grpc_trace_closure ) ; <nl> - grpc_register_tracer ( & grpc_trace_error_refcount ) ; <nl> - grpc_register_tracer ( & grpc_trace_stream_refcount ) ; <nl> - grpc_register_tracer ( & grpc_trace_fd_refcount ) ; <nl> - grpc_register_tracer ( & grpc_trace_metadata ) ; <nl> - # endif <nl> grpc_security_pre_init ( ) ; <nl> grpc_iomgr_init ( & exec_ctx ) ; <nl> gpr_timers_global_init ( ) ; <nl> mmm a / src / core / lib / surface / init_secure . cc <nl> ppp b / src / core / lib / surface / init_secure . cc <nl> <nl> # include < string . h > <nl> <nl> # include " src / core / lib / debug / trace . h " <nl> + # include " src / core / lib / security / context / security_context . h " <nl> # include " src / core / lib / security / credentials / credentials . h " <nl> # include " src / core / lib / security / credentials / plugin / plugin_credentials . h " <nl> # include " src / core / lib / security / transport / auth_filters . h " <nl> <nl> # include " src / core / lib / surface / channel_init . h " <nl> # include " src / core / tsi / transport_security_interface . h " <nl> <nl> - # ifndef NDEBUG <nl> - # include " src / core / lib / security / context / security_context . h " <nl> - # endif <nl> - <nl> - void grpc_security_pre_init ( void ) { <nl> - grpc_register_tracer ( & grpc_trace_secure_endpoint ) ; <nl> - grpc_register_tracer ( & tsi_tracing_enabled ) ; <nl> - # ifndef NDEBUG <nl> - grpc_register_tracer ( & grpc_trace_auth_context_refcount ) ; <nl> - grpc_register_tracer ( & grpc_trace_security_connector_refcount ) ; <nl> - # endif <nl> - } <nl> + void grpc_security_pre_init ( void ) { } <nl> <nl> static bool maybe_prepend_client_auth_filter ( <nl> grpc_exec_ctx * exec_ctx , grpc_channel_stack_builder * builder , void * arg ) { <nl> void grpc_register_security_filters ( void ) { <nl> maybe_prepend_server_auth_filter , nullptr ) ; <nl> } <nl> <nl> - void grpc_security_init ( ) { <nl> - grpc_security_register_handshaker_factories ( ) ; <nl> - grpc_register_tracer ( & grpc_plugin_credentials_trace ) ; <nl> - } <nl> + void grpc_security_init ( ) { grpc_security_register_handshaker_factories ( ) ; } <nl> mmm a / src / core / lib / surface / lame_client . cc <nl> ppp b / src / core / lib / surface / lame_client . cc <nl> <nl> <nl> # include " src / core / lib / support / atomic . h " <nl> <nl> - extern " C " { <nl> # include " src / core / lib / channel / channel_stack . h " <nl> # include " src / core / lib / support / string . h " <nl> # include " src / core / lib / surface / api_trace . h " <nl> extern " C " { <nl> # include " src / core / lib / surface / channel . h " <nl> # include " src / core / lib / surface / lame_client . h " <nl> # include " src / core / lib / transport / static_metadata . h " <nl> - } <nl> <nl> namespace grpc_core { <nl> <nl> mmm a / src / core / lib / surface / server . cc <nl> ppp b / src / core / lib / surface / server . cc <nl> typedef struct registered_method registered_method ; <nl> <nl> typedef enum { BATCH_CALL , REGISTERED_CALL } requested_call_type ; <nl> <nl> - grpc_tracer_flag grpc_server_channel_trace = <nl> - GRPC_TRACER_INITIALIZER ( false , " server_channel " ) ; <nl> + grpc_core : : TraceFlag grpc_server_channel_trace ( false , " server_channel " ) ; <nl> <nl> typedef struct requested_call { <nl> gpr_mpscq_node request_link ; / * must be first * / <nl> static void destroy_channel ( grpc_exec_ctx * exec_ctx , channel_data * chand , <nl> GRPC_CLOSURE_INIT ( & chand - > finish_destroy_channel_closure , <nl> finish_destroy_channel , chand , grpc_schedule_on_exec_ctx ) ; <nl> <nl> - if ( GRPC_TRACER_ON ( grpc_server_channel_trace ) & & error ! = GRPC_ERROR_NONE ) { <nl> + if ( grpc_server_channel_trace . enabled ( ) & & error ! = GRPC_ERROR_NONE ) { <nl> const char * msg = grpc_error_string ( error ) ; <nl> gpr_log ( GPR_INFO , " Disconnected client : % s " , msg ) ; <nl> } <nl> mmm a / src / core / lib / surface / server . h <nl> ppp b / src / core / lib / surface / server . h <nl> extern " C " { <nl> extern const grpc_channel_filter grpc_server_top_filter ; <nl> <nl> / * * Lightweight tracing of server channel state * / <nl> - extern grpc_tracer_flag grpc_server_channel_trace ; <nl> + extern grpc_core : : TraceFlag grpc_server_channel_trace ; <nl> <nl> / * Add a listener to the server : when the server starts , it will call start , <nl> and when it shuts down , it will call destroy * / <nl> mmm a / src / core / lib / transport / bdp_estimator . cc <nl> ppp b / src / core / lib / transport / bdp_estimator . cc <nl> <nl> <nl> # include < grpc / support / useful . h > <nl> <nl> - grpc_tracer_flag grpc_bdp_estimator_trace = <nl> - GRPC_TRACER_INITIALIZER ( false , " bdp_estimator " ) ; <nl> + grpc_core : : TraceFlag grpc_bdp_estimator_trace ( false , " bdp_estimator " ) ; <nl> <nl> namespace grpc_core { <nl> <nl> grpc_millis BdpEstimator : : CompletePing ( grpc_exec_ctx * exec_ctx ) { <nl> double dt = ( double ) dt_ts . tv_sec + 1e - 9 * ( double ) dt_ts . tv_nsec ; <nl> double bw = dt > 0 ? ( ( double ) accumulator_ / dt ) : 0 ; <nl> int start_inter_ping_delay = inter_ping_delay_ ; <nl> - if ( GRPC_TRACER_ON ( grpc_bdp_estimator_trace ) ) { <nl> + if ( grpc_bdp_estimator_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , <nl> " bdp [ % s ] : complete acc = % " PRId64 " est = % " PRId64 <nl> " dt = % lf bw = % lfMbs bw_est = % lfMbs " , <nl> grpc_millis BdpEstimator : : CompletePing ( grpc_exec_ctx * exec_ctx ) { <nl> if ( accumulator_ > 2 * estimate_ / 3 & & bw > bw_est_ ) { <nl> estimate_ = GPR_MAX ( accumulator_ , estimate_ * 2 ) ; <nl> bw_est_ = bw ; <nl> - if ( GRPC_TRACER_ON ( grpc_bdp_estimator_trace ) ) { <nl> + if ( grpc_bdp_estimator_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " bdp [ % s ] : estimate increased to % " PRId64 , name_ , <nl> estimate_ ) ; <nl> } <nl> grpc_millis BdpEstimator : : CompletePing ( grpc_exec_ctx * exec_ctx ) { <nl> } <nl> if ( start_inter_ping_delay ! = inter_ping_delay_ ) { <nl> stable_estimate_count_ = 0 ; <nl> - if ( GRPC_TRACER_ON ( grpc_bdp_estimator_trace ) ) { <nl> + if ( grpc_bdp_estimator_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " bdp [ % s ] : update_inter_time to % dms " , name_ , <nl> inter_ping_delay_ ) ; <nl> } <nl> mmm a / src / core / lib / transport / bdp_estimator . h <nl> ppp b / src / core / lib / transport / bdp_estimator . h <nl> <nl> # include " src / core / lib / debug / trace . h " <nl> # include " src / core / lib / iomgr / exec_ctx . h " <nl> <nl> - extern grpc_tracer_flag grpc_bdp_estimator_trace ; <nl> + extern grpc_core : : TraceFlag grpc_bdp_estimator_trace ; <nl> <nl> namespace grpc_core { <nl> <nl> class BdpEstimator { <nl> / / grpc_bdp_estimator_add_incoming_bytes once a ping has been scheduled by a <nl> / / transport ( but not necessarily started ) <nl> void SchedulePing ( ) { <nl> - if ( GRPC_TRACER_ON ( grpc_bdp_estimator_trace ) ) { <nl> + if ( grpc_bdp_estimator_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " bdp [ % s ] : sched acc = % " PRId64 " est = % " PRId64 , name_ , <nl> accumulator_ , estimate_ ) ; <nl> } <nl> class BdpEstimator { <nl> / / once <nl> / / the ping is on the wire <nl> void StartPing ( ) { <nl> - if ( GRPC_TRACER_ON ( grpc_bdp_estimator_trace ) ) { <nl> + if ( grpc_bdp_estimator_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " bdp [ % s ] : start acc = % " PRId64 " est = % " PRId64 , name_ , <nl> accumulator_ , estimate_ ) ; <nl> } <nl> mmm a / src / core / lib / transport / connectivity_state . cc <nl> ppp b / src / core / lib / transport / connectivity_state . cc <nl> <nl> # include < grpc / support / log . h > <nl> # include < grpc / support / string_util . h > <nl> <nl> - grpc_tracer_flag grpc_connectivity_state_trace = <nl> - GRPC_TRACER_INITIALIZER ( false , " connectivity_state " ) ; <nl> + grpc_core : : TraceFlag grpc_connectivity_state_trace ( false , " connectivity_state " ) ; <nl> <nl> const char * grpc_connectivity_state_name ( grpc_connectivity_state state ) { <nl> switch ( state ) { <nl> grpc_connectivity_state grpc_connectivity_state_check ( <nl> grpc_connectivity_state cur = <nl> ( grpc_connectivity_state ) gpr_atm_no_barrier_load ( <nl> & tracker - > current_state_atm ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_connectivity_state_trace ) ) { <nl> + if ( grpc_connectivity_state_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " CONWATCH : % p % s : get % s " , tracker , tracker - > name , <nl> grpc_connectivity_state_name ( cur ) ) ; <nl> } <nl> grpc_connectivity_state grpc_connectivity_state_get ( <nl> grpc_connectivity_state cur = <nl> ( grpc_connectivity_state ) gpr_atm_no_barrier_load ( <nl> & tracker - > current_state_atm ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_connectivity_state_trace ) ) { <nl> + if ( grpc_connectivity_state_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " CONWATCH : % p % s : get % s " , tracker , tracker - > name , <nl> grpc_connectivity_state_name ( cur ) ) ; <nl> } <nl> bool grpc_connectivity_state_notify_on_state_change ( <nl> grpc_connectivity_state cur = <nl> ( grpc_connectivity_state ) gpr_atm_no_barrier_load ( <nl> & tracker - > current_state_atm ) ; <nl> - if ( GRPC_TRACER_ON ( grpc_connectivity_state_trace ) ) { <nl> + if ( grpc_connectivity_state_trace . enabled ( ) ) { <nl> if ( current = = nullptr ) { <nl> gpr_log ( GPR_DEBUG , " CONWATCH : % p % s : unsubscribe notify = % p " , tracker , <nl> tracker - > name , notify ) ; <nl> void grpc_connectivity_state_set ( grpc_exec_ctx * exec_ctx , <nl> ( grpc_connectivity_state ) gpr_atm_no_barrier_load ( <nl> & tracker - > current_state_atm ) ; <nl> grpc_connectivity_state_watcher * w ; <nl> - if ( GRPC_TRACER_ON ( grpc_connectivity_state_trace ) ) { <nl> + if ( grpc_connectivity_state_trace . enabled ( ) ) { <nl> const char * error_string = grpc_error_string ( error ) ; <nl> gpr_log ( GPR_DEBUG , " SET : % p % s : % s - - > % s [ % s ] error = % p % s " , tracker , <nl> tracker - > name , grpc_connectivity_state_name ( cur ) , <nl> void grpc_connectivity_state_set ( grpc_exec_ctx * exec_ctx , <nl> while ( ( w = tracker - > watchers ) ! = nullptr ) { <nl> * w - > current = state ; <nl> tracker - > watchers = w - > next ; <nl> - if ( GRPC_TRACER_ON ( grpc_connectivity_state_trace ) ) { <nl> + if ( grpc_connectivity_state_trace . enabled ( ) ) { <nl> gpr_log ( GPR_DEBUG , " NOTIFY : % p % s : % p " , tracker , tracker - > name , <nl> w - > notify ) ; <nl> } <nl> mmm a / src / core / lib / transport / connectivity_state . h <nl> ppp b / src / core / lib / transport / connectivity_state . h <nl> typedef struct { <nl> char * name ; <nl> } grpc_connectivity_state_tracker ; <nl> <nl> - extern grpc_tracer_flag grpc_connectivity_state_trace ; <nl> + extern grpc_core : : TraceFlag grpc_connectivity_state_trace ; <nl> <nl> / * * enum - - > string conversion * / <nl> const char * grpc_connectivity_state_name ( grpc_connectivity_state state ) ; <nl> mmm a / src / core / lib / transport / metadata . cc <nl> ppp b / src / core / lib / transport / metadata . cc <nl> <nl> * used to determine which kind of element a pointer refers to . <nl> * / <nl> <nl> + grpc_core : : DebugOnlyTraceFlag grpc_trace_metadata ( false , " metadata " ) ; <nl> + <nl> # ifndef NDEBUG <nl> - grpc_tracer_flag grpc_trace_metadata = <nl> - GRPC_TRACER_INITIALIZER ( false , " metadata " ) ; <nl> # define DEBUG_ARGS , const char * file , int line <nl> # define FWD_DEBUG_ARGS , file , line <nl> # define REF_MD_LOCKED ( shard , s ) ref_md_locked ( ( shard ) , ( s ) , __FILE__ , __LINE__ ) <nl> static int is_mdelem_static ( grpc_mdelem e ) { <nl> static void ref_md_locked ( mdtab_shard * shard , <nl> interned_metadata * md DEBUG_ARGS ) { <nl> # ifndef NDEBUG <nl> - if ( GRPC_TRACER_ON ( grpc_trace_metadata ) ) { <nl> + if ( grpc_trace_metadata . enabled ( ) ) { <nl> char * key_str = grpc_slice_to_c_string ( md - > key ) ; <nl> char * value_str = grpc_slice_to_c_string ( md - > value ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> grpc_mdelem grpc_mdelem_create ( <nl> allocated - > value = grpc_slice_ref_internal ( value ) ; <nl> gpr_atm_rel_store ( & allocated - > refcnt , 1 ) ; <nl> # ifndef NDEBUG <nl> - if ( GRPC_TRACER_ON ( grpc_trace_metadata ) ) { <nl> + if ( grpc_trace_metadata . enabled ( ) ) { <nl> char * key_str = grpc_slice_to_c_string ( allocated - > key ) ; <nl> char * value_str = grpc_slice_to_c_string ( allocated - > value ) ; <nl> gpr_log ( GPR_DEBUG , " ELM ALLOC : % p : % " PRIdPTR " : ' % s ' = ' % s ' " , <nl> grpc_mdelem grpc_mdelem_create ( <nl> shard - > elems [ idx ] = md ; <nl> gpr_mu_init ( & md - > mu_user_data ) ; <nl> # ifndef NDEBUG <nl> - if ( GRPC_TRACER_ON ( grpc_trace_metadata ) ) { <nl> + if ( grpc_trace_metadata . enabled ( ) ) { <nl> char * key_str = grpc_slice_to_c_string ( md - > key ) ; <nl> char * value_str = grpc_slice_to_c_string ( md - > value ) ; <nl> gpr_log ( GPR_DEBUG , " ELM NEW : % p : % " PRIdPTR " : ' % s ' = ' % s ' " , ( void * ) md , <nl> grpc_mdelem grpc_mdelem_ref ( grpc_mdelem gmd DEBUG_ARGS ) { <nl> case GRPC_MDELEM_STORAGE_INTERNED : { <nl> interned_metadata * md = ( interned_metadata * ) GRPC_MDELEM_DATA ( gmd ) ; <nl> # ifndef NDEBUG <nl> - if ( GRPC_TRACER_ON ( grpc_trace_metadata ) ) { <nl> + if ( grpc_trace_metadata . enabled ( ) ) { <nl> char * key_str = grpc_slice_to_c_string ( md - > key ) ; <nl> char * value_str = grpc_slice_to_c_string ( md - > value ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> grpc_mdelem grpc_mdelem_ref ( grpc_mdelem gmd DEBUG_ARGS ) { <nl> case GRPC_MDELEM_STORAGE_ALLOCATED : { <nl> allocated_metadata * md = ( allocated_metadata * ) GRPC_MDELEM_DATA ( gmd ) ; <nl> # ifndef NDEBUG <nl> - if ( GRPC_TRACER_ON ( grpc_trace_metadata ) ) { <nl> + if ( grpc_trace_metadata . enabled ( ) ) { <nl> char * key_str = grpc_slice_to_c_string ( md - > key ) ; <nl> char * value_str = grpc_slice_to_c_string ( md - > value ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> void grpc_mdelem_unref ( grpc_exec_ctx * exec_ctx , grpc_mdelem gmd DEBUG_ARGS ) { <nl> case GRPC_MDELEM_STORAGE_INTERNED : { <nl> interned_metadata * md = ( interned_metadata * ) GRPC_MDELEM_DATA ( gmd ) ; <nl> # ifndef NDEBUG <nl> - if ( GRPC_TRACER_ON ( grpc_trace_metadata ) ) { <nl> + if ( grpc_trace_metadata . enabled ( ) ) { <nl> char * key_str = grpc_slice_to_c_string ( md - > key ) ; <nl> char * value_str = grpc_slice_to_c_string ( md - > value ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> void grpc_mdelem_unref ( grpc_exec_ctx * exec_ctx , grpc_mdelem gmd DEBUG_ARGS ) { <nl> case GRPC_MDELEM_STORAGE_ALLOCATED : { <nl> allocated_metadata * md = ( allocated_metadata * ) GRPC_MDELEM_DATA ( gmd ) ; <nl> # ifndef NDEBUG <nl> - if ( GRPC_TRACER_ON ( grpc_trace_metadata ) ) { <nl> + if ( grpc_trace_metadata . enabled ( ) ) { <nl> char * key_str = grpc_slice_to_c_string ( md - > key ) ; <nl> char * value_str = grpc_slice_to_c_string ( md - > value ) ; <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> mmm a / src / core / lib / transport / metadata . h <nl> ppp b / src / core / lib / transport / metadata . h <nl> <nl> <nl> # include " src / core / lib / iomgr / exec_ctx . h " <nl> <nl> - # ifndef NDEBUG <nl> - extern grpc_tracer_flag grpc_trace_metadata ; <nl> - # endif <nl> + extern grpc_core : : DebugOnlyTraceFlag grpc_trace_metadata ; <nl> <nl> # ifdef __cplusplus <nl> extern " C " { <nl> mmm a / src / core / lib / transport / transport . cc <nl> ppp b / src / core / lib / transport / transport . cc <nl> <nl> # include " src / core / lib / support / string . h " <nl> # include " src / core / lib / transport / transport_impl . h " <nl> <nl> - # ifndef NDEBUG <nl> - grpc_tracer_flag grpc_trace_stream_refcount = <nl> - GRPC_TRACER_INITIALIZER ( false , " stream_refcount " ) ; <nl> - # endif <nl> + grpc_core : : DebugOnlyTraceFlag grpc_trace_stream_refcount ( false , <nl> + " stream_refcount " ) ; <nl> <nl> # ifndef NDEBUG <nl> void grpc_stream_ref ( grpc_stream_refcount * refcount , const char * reason ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_stream_refcount ) ) { <nl> + if ( grpc_trace_stream_refcount . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & refcount - > refs . count ) ; <nl> gpr_log ( GPR_DEBUG , " % s % p : % p REF % " PRIdPTR " - > % " PRIdPTR " % s " , <nl> refcount - > object_type , refcount , refcount - > destroy . cb_arg , val , <nl> void grpc_stream_ref ( grpc_stream_refcount * refcount ) { <nl> # ifndef NDEBUG <nl> void grpc_stream_unref ( grpc_exec_ctx * exec_ctx , grpc_stream_refcount * refcount , <nl> const char * reason ) { <nl> - if ( GRPC_TRACER_ON ( grpc_trace_stream_refcount ) ) { <nl> + if ( grpc_trace_stream_refcount . enabled ( ) ) { <nl> gpr_atm val = gpr_atm_no_barrier_load ( & refcount - > refs . count ) ; <nl> gpr_log ( GPR_DEBUG , " % s % p : % p UNREF % " PRIdPTR " - > % " PRIdPTR " % s " , <nl> refcount - > object_type , refcount , refcount - > destroy . cb_arg , val , <nl> mmm a / src / core / lib / transport / transport . h <nl> ppp b / src / core / lib / transport / transport . h <nl> typedef struct grpc_transport grpc_transport ; <nl> for a stream . * / <nl> typedef struct grpc_stream grpc_stream ; <nl> <nl> - # ifndef NDEBUG <nl> - extern grpc_tracer_flag grpc_trace_stream_refcount ; <nl> - # endif <nl> + extern grpc_core : : DebugOnlyTraceFlag grpc_trace_stream_refcount ; <nl> <nl> typedef struct grpc_stream_refcount { <nl> gpr_refcount refs ; <nl> mmm a / src / core / tsi / fake_transport_security . cc <nl> ppp b / src / core / tsi / fake_transport_security . cc <nl> static tsi_result fake_handshaker_get_bytes_to_send_to_peer ( <nl> if ( next_message_to_send > TSI_FAKE_HANDSHAKE_MESSAGE_MAX ) { <nl> next_message_to_send = TSI_FAKE_HANDSHAKE_MESSAGE_MAX ; <nl> } <nl> - if ( GRPC_TRACER_ON ( tsi_tracing_enabled ) ) { <nl> + if ( tsi_tracing_enabled . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , " % s prepared % s . " , <nl> impl - > is_client ? " Client " : " Server " , <nl> tsi_fake_handshake_message_to_string ( impl - > next_message_to_send ) ) ; <nl> static tsi_result fake_handshaker_get_bytes_to_send_to_peer ( <nl> if ( ! impl - > is_client & & <nl> impl - > next_message_to_send = = TSI_FAKE_HANDSHAKE_MESSAGE_MAX ) { <nl> / * We ' re done . * / <nl> - if ( GRPC_TRACER_ON ( tsi_tracing_enabled ) ) { <nl> + if ( tsi_tracing_enabled . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , " Server is done . " ) ; <nl> } <nl> impl - > result = TSI_OK ; <nl> static tsi_result fake_handshaker_process_bytes_from_peer ( <nl> tsi_fake_handshake_message_to_string ( received_msg ) , <nl> tsi_fake_handshake_message_to_string ( expected_msg ) ) ; <nl> } <nl> - if ( GRPC_TRACER_ON ( tsi_tracing_enabled ) ) { <nl> + if ( tsi_tracing_enabled . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , " % s received % s . " , impl - > is_client ? " Client " : " Server " , <nl> tsi_fake_handshake_message_to_string ( received_msg ) ) ; <nl> } <nl> static tsi_result fake_handshaker_process_bytes_from_peer ( <nl> impl - > needs_incoming_message = 0 ; <nl> if ( impl - > next_message_to_send = = TSI_FAKE_HANDSHAKE_MESSAGE_MAX ) { <nl> / * We ' re done . * / <nl> - if ( GRPC_TRACER_ON ( tsi_tracing_enabled ) ) { <nl> + if ( tsi_tracing_enabled . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , " % s is done . " , impl - > is_client ? " Client " : " Server " ) ; <nl> } <nl> impl - > result = TSI_OK ; <nl> mmm a / src / core / tsi / ssl_transport_security . cc <nl> ppp b / src / core / tsi / ssl_transport_security . cc <nl> static const char * ssl_error_string ( int error ) { <nl> / * TODO ( jboeuf ) : Remove when we are past the debugging phase with this code . * / <nl> static void ssl_log_where_info ( const SSL * ssl , int where , int flag , <nl> const char * msg ) { <nl> - if ( ( where & flag ) & & GRPC_TRACER_ON ( tsi_tracing_enabled ) ) { <nl> + if ( ( where & flag ) & & tsi_tracing_enabled . enabled ( ) ) { <nl> gpr_log ( GPR_INFO , " % 20 . 20s - % 30 . 30s - % 5 . 10s " , msg , <nl> SSL_state_string_long ( ssl ) , SSL_state_string ( ssl ) ) ; <nl> } <nl> mmm a / src / core / tsi / transport_security . cc <nl> ppp b / src / core / tsi / transport_security . cc <nl> <nl> <nl> / * mmm Tracing . mmm * / <nl> <nl> - grpc_tracer_flag tsi_tracing_enabled = GRPC_TRACER_INITIALIZER ( false , " tsi " ) ; <nl> + grpc_core : : TraceFlag tsi_tracing_enabled ( false , " tsi " ) ; <nl> <nl> / * mmm tsi_result common implementation . mmm * / <nl> <nl> mmm a / src / core / tsi / transport_security . h <nl> ppp b / src / core / tsi / transport_security . h <nl> <nl> extern " C " { <nl> # endif <nl> <nl> - extern grpc_tracer_flag tsi_tracing_enabled ; <nl> + extern grpc_core : : TraceFlag tsi_tracing_enabled ; <nl> <nl> / * Base for tsi_frame_protector implementations . <nl> See transport_security_interface . h for documentation . * / <nl> mmm a / src / core / tsi / transport_security_interface . h <nl> ppp b / src / core / tsi / transport_security_interface . h <nl> const char * tsi_result_to_string ( tsi_result result ) ; <nl> <nl> / * mmm tsi tracing mmm * / <nl> <nl> - extern grpc_tracer_flag tsi_tracing_enabled ; <nl> + extern grpc_core : : TraceFlag tsi_tracing_enabled ; <nl> <nl> / * - - tsi_zero_copy_grpc_protector object - - <nl> <nl> mmm a / test / core / iomgr / timer_list_test . cc <nl> ppp b / test / core / iomgr / timer_list_test . cc <nl> <nl> # include < grpc / support / log . h > <nl> # include " src / core / lib / debug / trace . h " <nl> # include " test / core / util / test_config . h " <nl> + # include " test / core / util / tracer_util . h " <nl> <nl> # define MAX_CB 30 <nl> <nl> - extern " C " grpc_tracer_flag grpc_timer_trace ; <nl> - extern " C " grpc_tracer_flag grpc_timer_check_trace ; <nl> + extern grpc_core : : TraceFlag grpc_timer_trace ; <nl> + extern grpc_core : : TraceFlag grpc_timer_check_trace ; <nl> <nl> static int cb_called [ MAX_CB ] [ 2 ] ; <nl> <nl> static void add_test ( void ) { <nl> gpr_log ( GPR_INFO , " add_test " ) ; <nl> <nl> grpc_timer_list_init ( & exec_ctx ) ; <nl> - grpc_timer_trace . value = 1 ; <nl> - grpc_timer_check_trace . value = 1 ; <nl> + grpc_core : : testing : : grpc_tracer_enable_flag ( & grpc_timer_trace ) ; <nl> + grpc_core : : testing : : grpc_tracer_enable_flag ( & grpc_timer_check_trace ) ; <nl> memset ( cb_called , 0 , sizeof ( cb_called ) ) ; <nl> <nl> grpc_millis start = grpc_exec_ctx_now ( & exec_ctx ) ; <nl> void destruction_test ( void ) { <nl> exec_ctx . now_is_valid = true ; <nl> exec_ctx . now = 0 ; <nl> grpc_timer_list_init ( & exec_ctx ) ; <nl> - grpc_timer_trace . value = 1 ; <nl> - grpc_timer_check_trace . value = 1 ; <nl> + grpc_core : : testing : : grpc_tracer_enable_flag ( & grpc_timer_trace ) ; <nl> + grpc_core : : testing : : grpc_tracer_enable_flag ( & grpc_timer_check_trace ) ; <nl> memset ( cb_called , 0 , sizeof ( cb_called ) ) ; <nl> <nl> grpc_timer_init ( <nl> mmm a / test / core / transport / connectivity_state_test . cc <nl> ppp b / test / core / transport / connectivity_state_test . cc <nl> <nl> # include < grpc / support / log . h > <nl> <nl> # include " test / core / util / test_config . h " <nl> + # include " test / core / util / tracer_util . h " <nl> <nl> # define THE_ARG ( ( void * ) ( size_t ) 0xcafebabe ) <nl> <nl> static void test_subscribe_with_failure_then_destroy ( void ) { <nl> <nl> int main ( int argc , char * * argv ) { <nl> grpc_test_init ( argc , argv ) ; <nl> - grpc_connectivity_state_trace . value = 1 ; <nl> + grpc_core : : testing : : grpc_tracer_enable_flag ( & grpc_connectivity_state_trace ) ; <nl> test_connectivity_state_name ( ) ; <nl> test_check ( ) ; <nl> test_subscribe_then_unsubscribe ( ) ; <nl> mmm a / test / core / util / BUILD <nl> ppp b / test / core / util / BUILD <nl> grpc_cc_library ( <nl> " reconnect_server . cc " , <nl> " slice_splitter . cc " , <nl> " test_tcp_server . cc " , <nl> + " tracer_util . cc " , <nl> " trickle_endpoint . cc " , <nl> ] , <nl> hdrs = [ <nl> grpc_cc_library ( <nl> " reconnect_server . h " , <nl> " slice_splitter . h " , <nl> " test_tcp_server . h " , <nl> + " tracer_util . h " , <nl> " trickle_endpoint . h " , <nl> ] , <nl> language = " C + + " , <nl> new file mode 100644 <nl> index 00000000000 . . 34a132daa78 <nl> mmm / dev / null <nl> ppp b / test / core / util / tracer_util . cc <nl> <nl> + / * <nl> + * <nl> + * Copyright 2015 gRPC authors . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * <nl> + * / <nl> + <nl> + # include " test / core / util / test_config . h " <nl> + <nl> + # include " src / core / lib / debug / trace . h " <nl> + <nl> + namespace grpc_core { <nl> + namespace testing { <nl> + <nl> + void grpc_tracer_enable_flag ( grpc_core : : TraceFlag * flag ) { <nl> + flag - > set_enabled ( 1 ) ; <nl> + } <nl> + <nl> + } / / namespace testing <nl> + } / / namespace grpc_core <nl> new file mode 100644 <nl> index 00000000000 . . 0b432ffa46a <nl> mmm / dev / null <nl> ppp b / test / core / util / tracer_util . h <nl> <nl> + / * <nl> + * <nl> + * Copyright 2015 gRPC authors . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * <nl> + * / <nl> + <nl> + # ifndef GRPC_TEST_CORE_UTIL_TRACER_UTIL_H <nl> + # define GRPC_TEST_CORE_UTIL_TRACER_UTIL_H <nl> + <nl> + namespace grpc_core { <nl> + class TraceFlag ; <nl> + <nl> + namespace testing { <nl> + / / enables the TraceFlag passed to it . Used for testing purposes . <nl> + void grpc_tracer_enable_flag ( grpc_core : : TraceFlag * flag ) ; <nl> + <nl> + } / / namespace testing <nl> + } / / namespace grpc_core <nl> + <nl> + # endif / * GRPC_TEST_CORE_UTIL_TRACER_UTIL_H * / <nl> mmm a / tools / run_tests / generated / sources_and_headers . json <nl> ppp b / tools / run_tests / generated / sources_and_headers . json <nl> <nl> " test / core / util / port . h " , <nl> " test / core / util / port_server_client . h " , <nl> " test / core / util / slice_splitter . h " , <nl> + " test / core / util / tracer_util . h " , <nl> " test / core / util / trickle_endpoint . h " <nl> ] , <nl> " is_filegroup " : true , <nl> <nl> " test / core / util / port_server_client . h " , <nl> " test / core / util / slice_splitter . cc " , <nl> " test / core / util / slice_splitter . h " , <nl> + " test / core / util / tracer_util . cc " , <nl> + " test / core / util / tracer_util . h " , <nl> " test / core / util / trickle_endpoint . cc " , <nl> " test / core / util / trickle_endpoint . h " <nl> ] , <nl>
|
Merge pull request from ncteisen / tracing + +
|
grpc/grpc
|
9addd2eef21a96e52135dc9369566d8452412763
|
2017-11-18T02:32:42Z
|
new file mode 100644 <nl> index 00000000000 . . e309f136b96 <nl> mmm / dev / null <nl> ppp b / test / rql_test / src / regression / 579 . yaml <nl> <nl> + desc : reject non - deterministic secondary indexes ( # 579 ) <nl> + tests : <nl> + <nl> + - cd : r . db ( ' test ' ) . table_create ( ' 579 ' ) <nl> + def : tbl = r . table ( ' 579 ' ) <nl> + <nl> + - cd : tbl . insert ( { ' name ' : ' Jim Brown ' } ) <nl> + <nl> + - js : tbl . sindex_create ( " 579 " , function ( rec ) { return r . js ( " 1 " ) } ) <nl> + py : tbl . sindex_create ( " 579 " , lambda rec : r . js ( " 1 " ) ) <nl> + rb : tbl . sindex_create ( " 579 " ) { | rec | r . js ( " 1 " ) } <nl> + ot : err ( " RqlRuntimeError " , " Could not prove function deterministic . Index functions must be deterministic . " , [ ] ) <nl> + <nl> + - js : tbl . sindex_create ( " 579 " , function ( rec ) { return tbl . get ( 0 ) } ) <nl> + py : tbl . sindex_create ( " 579 " , lambda rec : tbl . get ( 0 ) ) <nl> + rb : tbl . sindex_create ( " 579 " ) { | rec | tbl . get ( 0 ) } <nl> + ot : err ( " RqlRuntimeError " , " Could not prove function deterministic . Index functions must be deterministic . " , [ ] ) <nl> + <nl> + - cd : r . db ( ' test ' ) . table_drop ( ' 579 ' ) <nl>
|
added unit test for issue 579
|
rethinkdb/rethinkdb
|
0a18a0633d7f366a25bd93affc09ecf0a9df3f29
|
2013-04-09T17:53:20Z
|
new file mode 100644 <nl> index 000000000000 . . d7529beeb724 <nl> mmm / dev / null <nl> ppp b / validation - test / compiler_crashers_2 / sr11085 . swift <nl> <nl> + / / RUN : not - - crash % target - swift - frontend - typecheck % s <nl> + / / REQUIRES : asserts <nl> + <nl> + func foo ( x : Int ) { } <nl> + func foo ( line : String = # line ) { } <nl> + foo ( ) <nl>
|
Merge remote - tracking branch ' origin / master ' into master - rebranch
|
apple/swift
|
0529f23f5852e5a88c10d0b6570c15266cefb00b
|
2019-08-31T22:24:04Z
|
mmm a / tensorflow / contrib / eager / python / examples / spinn / BUILD <nl> ppp b / tensorflow / contrib / eager / python / examples / spinn / BUILD <nl> cuda_py_test ( <nl> " / / tensorflow / python : client_testlib " , <nl> " / / tensorflow / python : framework_test_lib " , <nl> ] , <nl> + tags = [ " no_pip " ] , # because spinn . py is under third_party / . <nl> ) <nl>
|
Add no_pip tag to contrib / eager / python / examples / spinn : spinn_test
|
tensorflow/tensorflow
|
798cc84b5696adffb3e3fcd41adb298034f4c746
|
2017-12-04T16:31:39Z
|
mmm a / src / runtime / runtime - wasm . cc <nl> ppp b / src / runtime / runtime - wasm . cc <nl> RUNTIME_FUNCTION ( Runtime_WasmRunInterpreter ) { <nl> DCHECK_NULL ( isolate - > context ( ) ) ; <nl> isolate - > set_context ( instance - > compiled_module ( ) - > ptr_to_native_context ( ) ) ; <nl> <nl> + trap_handler : : ClearThreadInWasm ( ) ; <nl> instance - > debug_info ( ) - > RunInterpreter ( func_index , arg_buffer ) ; <nl> + trap_handler : : SetThreadInWasm ( ) ; <nl> + <nl> return isolate - > heap ( ) - > undefined_value ( ) ; <nl> } <nl> <nl>
|
[ wasm ] Set and reset the ThreadInWasm flag in interpreter entry
|
v8/v8
|
09369c5e47123797e77748833d2234cc9f52fd03
|
2017-03-14T17:09:31Z
|
mmm a / jstests / core / views / views_all_commands . js <nl> ppp b / jstests / core / views / views_all_commands . js <nl> <nl> _configsvrCommitChunkMerge : { skip : isAnInternalCommand } , <nl> _configsvrCommitChunkMigration : { skip : isAnInternalCommand } , <nl> _configsvrCommitChunkSplit : { skip : isAnInternalCommand } , <nl> + _configsvrCommitMovePrimary : { skip : isAnInternalCommand } , <nl> _configsvrCreateCollection : { skip : isAnInternalCommand } , <nl> _configsvrCreateDatabase : { skip : isAnInternalCommand } , <nl> _configsvrDropCollection : { skip : isAnInternalCommand } , <nl> <nl> _isSelf : { skip : isAnInternalCommand } , <nl> _mergeAuthzCollections : { skip : isAnInternalCommand } , <nl> _migrateClone : { skip : isAnInternalCommand } , <nl> + _movePrimary : { skip : isAnInternalCommand } , <nl> _recvChunkAbort : { skip : isAnInternalCommand } , <nl> _recvChunkCommit : { skip : isAnInternalCommand } , <nl> _recvChunkStart : { skip : isAnInternalCommand } , <nl> mmm a / jstests / sharding / move_primary_basic . js <nl> ppp b / jstests / sharding / move_primary_basic . js <nl> <nl> st . ensurePrimaryShard ( kDbName , shard0 ) ; <nl> assert . eq ( shard0 , mongos . getDB ( ' config ' ) . databases . findOne ( { _id : kDbName } ) . primary ) ; <nl> <nl> - / / Can run only on mongos . <nl> - assert . commandFailedWithCode ( <nl> - st . d0 . getDB ( ' admin ' ) . runCommand ( { movePrimary : kDbName , to : shard0 } ) , <nl> - ErrorCodes . CommandNotFound ) ; <nl> + / / Can run on shards . <nl> + assert . commandWorked ( st . d0 . getDB ( ' admin ' ) . runCommand ( { _movePrimary : kDbName , to : shard1 } ) ) ; <nl> <nl> / / Can run only against the admin database . <nl> assert . commandFailedWithCode ( <nl> mmm a / jstests / sharding / safe_secondary_reads_drop_recreate . js <nl> ppp b / jstests / sharding / safe_secondary_reads_drop_recreate . js <nl> <nl> _configsvrCommitChunkMerge : { skip : " primary only " } , <nl> _configsvrCommitChunkMigration : { skip : " primary only " } , <nl> _configsvrCommitChunkSplit : { skip : " primary only " } , <nl> + _configsvrCommitMovePrimary : { skip : " primary only " } , <nl> _configsvrDropCollection : { skip : " primary only " } , <nl> _configsvrDropDatabase : { skip : " primary only " } , <nl> _configsvrMoveChunk : { skip : " primary only " } , <nl> <nl> _isSelf : { skip : " does not return user data " } , <nl> _mergeAuthzCollections : { skip : " primary only " } , <nl> _migrateClone : { skip : " primary only " } , <nl> + _movePrimary : { skip : " primary only " } , <nl> _recvChunkAbort : { skip : " primary only " } , <nl> _recvChunkCommit : { skip : " primary only " } , <nl> _recvChunkStart : { skip : " primary only " } , <nl> mmm a / jstests / sharding / safe_secondary_reads_single_migration_suspend_range_deletion . js <nl> ppp b / jstests / sharding / safe_secondary_reads_single_migration_suspend_range_deletion . js <nl> <nl> _configsvrCommitChunkMerge : { skip : " primary only " } , <nl> _configsvrCommitChunkMigration : { skip : " primary only " } , <nl> _configsvrCommitChunkSplit : { skip : " primary only " } , <nl> + _configsvrCommitMovePrimary : { skip : " primary only " } , <nl> _configsvrDropCollection : { skip : " primary only " } , <nl> _configsvrDropDatabase : { skip : " primary only " } , <nl> _configsvrMoveChunk : { skip : " primary only " } , <nl> <nl> _isSelf : { skip : " does not return user data " } , <nl> _mergeAuthzCollections : { skip : " primary only " } , <nl> _migrateClone : { skip : " primary only " } , <nl> + _movePrimary : { skip : " primary only " } , <nl> _recvChunkAbort : { skip : " primary only " } , <nl> _recvChunkCommit : { skip : " primary only " } , <nl> _recvChunkStart : { skip : " primary only " } , <nl> mmm a / jstests / sharding / safe_secondary_reads_single_migration_waitForDelete . js <nl> ppp b / jstests / sharding / safe_secondary_reads_single_migration_waitForDelete . js <nl> <nl> _configsvrCommitChunkMerge : { skip : " primary only " } , <nl> _configsvrCommitChunkMigration : { skip : " primary only " } , <nl> _configsvrCommitChunkSplit : { skip : " primary only " } , <nl> + _configsvrCommitMovePrimary : { skip : " primary only " } , <nl> _configsvrDropCollection : { skip : " primary only " } , <nl> _configsvrDropDatabase : { skip : " primary only " } , <nl> _configsvrMoveChunk : { skip : " primary only " } , <nl> <nl> _isSelf : { skip : " does not return user data " } , <nl> _mergeAuthzCollections : { skip : " primary only " } , <nl> _migrateClone : { skip : " primary only " } , <nl> + _movePrimary : { skip : " primary only " } , <nl> _recvChunkAbort : { skip : " primary only " } , <nl> _recvChunkCommit : { skip : " primary only " } , <nl> _recvChunkStart : { skip : " primary only " } , <nl> mmm a / src / mongo / db / s / SConscript <nl> ppp b / src / mongo / db / s / SConscript <nl> env . Library ( <nl> ' config / configsvr_add_shard_command . cpp ' , <nl> ' config / configsvr_add_shard_to_zone_command . cpp ' , <nl> ' config / configsvr_commit_chunk_migration_command . cpp ' , <nl> + ' config / configsvr_commit_move_primary_command . cpp ' , <nl> ' config / configsvr_control_balancer_command . cpp ' , <nl> ' config / configsvr_create_collection_command . cpp ' , <nl> ' config / configsvr_create_database_command . cpp ' , <nl> env . Library ( <nl> ' migration_chunk_cloner_source_legacy_commands . cpp ' , <nl> ' migration_destination_manager_legacy_commands . cpp ' , <nl> ' move_chunk_command . cpp ' , <nl> + ' move_primary_command . cpp ' , <nl> ' set_shard_version_command . cpp ' , <nl> ' sharding_server_status . cpp ' , <nl> ' sharding_state_command . cpp ' , <nl> new file mode 100644 <nl> index 000000000000 . . d82b1bcc52b8 <nl> mmm / dev / null <nl> ppp b / src / mongo / db / s / config / configsvr_commit_move_primary_command . cpp <nl> <nl> + / * * <nl> + * Copyright ( C ) 2018 MongoDB Inc . <nl> + * <nl> + * This program is free software : you can redistribute it and / or modify <nl> + * it under the terms of the GNU Affero General Public License , version 3 , <nl> + * as published by the Free Software Foundation . <nl> + * <nl> + * This program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU Affero General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU Affero General Public License <nl> + * along with this program . If not , see < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * As a special exception , the copyright holders give permission to link the <nl> + * code of portions of this program with the OpenSSL library under certain <nl> + * conditions as described in each individual source file and distribute <nl> + * linked combinations including the program with the OpenSSL library . You <nl> + * must comply with the GNU Affero General Public License in all respects <nl> + * for all of the code used other than as permitted herein . If you modify <nl> + * file ( s ) with this exception , you may extend this exception to your <nl> + * version of the file ( s ) , but you are not obligated to do so . If you do not <nl> + * wish to do so , delete this exception statement from your version . If you <nl> + * delete this exception statement from all source files in the program , <nl> + * then also delete it in the license file . <nl> + * / <nl> + <nl> + # define MONGO_LOG_DEFAULT_COMPONENT : : mongo : : logger : : LogComponent : : kSharding <nl> + <nl> + # include " mongo / platform / basic . h " <nl> + <nl> + # include " mongo / db / auth / authorization_session . h " <nl> + # include " mongo / db / commands . h " <nl> + # include " mongo / util / log . h " <nl> + <nl> + namespace mongo { <nl> + namespace { <nl> + <nl> + class ConfigSvrCommitMovePrimaryCommand : public BasicCommand { <nl> + public : <nl> + ConfigSvrCommitMovePrimaryCommand ( ) : BasicCommand ( " _configsvrCommitMovePrimary " ) { } <nl> + <nl> + std : : string help ( ) const override { <nl> + return " should not be calling this directly " ; <nl> + } <nl> + <nl> + AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> + return AllowedOnSecondary : : kNever ; <nl> + } <nl> + <nl> + bool adminOnly ( ) const override { <nl> + return true ; <nl> + } <nl> + <nl> + virtual bool supportsWriteConcern ( const BSONObj & cmd ) const override { <nl> + return true ; <nl> + } <nl> + <nl> + Status checkAuthForCommand ( Client * client , <nl> + const std : : string & dbname , <nl> + const BSONObj & cmdObj ) const override { <nl> + if ( ! AuthorizationSession : : get ( client ) - > isAuthorizedForActionsOnResource ( <nl> + ResourcePattern : : forClusterResource ( ) , ActionType : : internal ) ) { <nl> + return Status ( ErrorCodes : : Unauthorized , " Unauthorized " ) ; <nl> + } <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + std : : string parseNs ( const std : : string & dbname , const BSONObj & cmdObj ) const override { <nl> + return CommandHelpers : : parseNsFullyQualified ( dbname , cmdObj ) ; <nl> + } <nl> + <nl> + bool run ( OperationContext * opCtx , <nl> + const std : : string & dbName , <nl> + const BSONObj & cmdObj , <nl> + BSONObjBuilder & result ) override { <nl> + <nl> + if ( serverGlobalParams . clusterRole ! = ClusterRole : : ConfigServer ) { <nl> + return CommandHelpers : : appendCommandStatus ( <nl> + result , <nl> + Status ( ErrorCodes : : IllegalOperation , <nl> + " _configsvrCommitMovePrimary can only be run on config servers " ) ) ; <nl> + } <nl> + <nl> + uassert ( ErrorCodes : : InvalidOptions , <nl> + str : : stream ( ) < < " commitMovePrimary must be called with majority writeConcern , got " <nl> + < < cmdObj , <nl> + opCtx - > getWriteConcern ( ) . wMode = = WriteConcernOptions : : kMajority ) ; <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + } configsvrCommitMovePrimaryCommand ; <nl> + <nl> + } / / namespace <nl> + } / / namespace mongo <nl> new file mode 100644 <nl> index 000000000000 . . 58ccf871748c <nl> mmm / dev / null <nl> ppp b / src / mongo / db / s / move_primary_command . cpp <nl> <nl> + / * * <nl> + * Copyright ( C ) 2018 MongoDB Inc . <nl> + * <nl> + * This program is free software : you can redistribute it and / or modify <nl> + * it under the terms of the GNU Affero General Public License , version 3 , <nl> + * as published by the Free Software Foundation . <nl> + * <nl> + * This program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU Affero General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU Affero General Public License <nl> + * along with this program . If not , see < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * As a special exception , the copyright holders give permission to link the <nl> + * code of portions of this program with the OpenSSL library under certain <nl> + * conditions as described in each individual source file and distribute <nl> + * linked combinations including the program with the OpenSSL library . You <nl> + * must comply with the GNU Affero General Public License in all respects <nl> + * for all of the code used other than as permitted herein . If you modify <nl> + * file ( s ) with this exception , you may extend this exception to your <nl> + * version of the file ( s ) , but you are not obligated to do so . If you do not <nl> + * wish to do so , delete this exception statement from your version . If you <nl> + * delete this exception statement from all source files in the program , <nl> + * then also delete it in the license file . <nl> + * / <nl> + <nl> + # define MONGO_LOG_DEFAULT_COMPONENT : : mongo : : logger : : LogComponent : : kSharding <nl> + <nl> + # include " mongo / platform / basic . h " <nl> + <nl> + # include " mongo / db / auth / authorization_session . h " <nl> + # include " mongo / db / commands . h " <nl> + # include " mongo / util / log . h " <nl> + <nl> + namespace mongo { <nl> + namespace { <nl> + <nl> + class MovePrimaryCommand : public BasicCommand { <nl> + public : <nl> + MovePrimaryCommand ( ) : BasicCommand ( " _movePrimary " ) { } <nl> + <nl> + std : : string help ( ) const override { <nl> + return " should not be calling this directly " ; <nl> + } <nl> + <nl> + AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> + return AllowedOnSecondary : : kNever ; <nl> + } <nl> + <nl> + bool adminOnly ( ) const override { <nl> + return true ; <nl> + } <nl> + <nl> + bool supportsWriteConcern ( const BSONObj & cmd ) const override { <nl> + return true ; <nl> + } <nl> + <nl> + Status checkAuthForCommand ( Client * client , <nl> + const std : : string & dbname , <nl> + const BSONObj & cmdObj ) const override { <nl> + if ( ! AuthorizationSession : : get ( client ) - > isAuthorizedForActionsOnResource ( <nl> + ResourcePattern : : forClusterResource ( ) , ActionType : : internal ) ) { <nl> + return Status ( ErrorCodes : : Unauthorized , " Unauthorized " ) ; <nl> + } <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + bool run ( OperationContext * opCtx , <nl> + const std : : string & dbname , <nl> + const BSONObj & cmdObj , <nl> + BSONObjBuilder & result ) override { <nl> + if ( serverGlobalParams . clusterRole ! = ClusterRole : : ShardServer ) { <nl> + return CommandHelpers : : appendCommandStatus ( <nl> + result , <nl> + Status ( ErrorCodes : : IllegalOperation , <nl> + " _movePrimary can only be run on shard servers " ) ) ; <nl> + } <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + } movePrimaryCmd ; <nl> + <nl> + } / / namespace <nl> + } / / namespace mongo <nl>
|
SERVER - 33195 create a movePrimary command for shards and _configsvrCommitMovePrimary command for config servers
|
mongodb/mongo
|
e126c24bdc87b79fb98905625c8c1c5b424679e6
|
2018-02-21T17:27:14Z
|
mmm a / src / rdb_protocol / terms / string . cc <nl> ppp b / src / rdb_protocol / terms / string . cc <nl> class match_term_t : public op_term_t { <nl> } else { <nl> regexp = search - > second ; <nl> } <nl> - guarantee ( static_cast < bool > ( regexp ) , " Regex object for % s wasn ' t initialized somehow ! " , re . c_str ( ) ) ; <nl> + r_sanity_check ( static_cast < bool > ( regexp ) ) ; <nl> / / We add 1 to account for $ 0 . <nl> int ngroups = regexp - > NumberOfCapturingGroups ( ) + 1 ; <nl> scoped_array_t < re2 : : StringPiece > groups ( ngroups ) ; <nl>
|
Use ` r_sanity_check ` instead of ` guarantee ` .
|
rethinkdb/rethinkdb
|
6173f810951d7a5c9f84cfb90dd2dfa8456193a5
|
2014-09-09T01:18:19Z
|
mmm a / src / assembler . h <nl> ppp b / src / assembler . h <nl> class AssemblerBase : public Malloced { <nl> } ; <nl> <nl> <nl> + / / Avoids emitting debug code during the lifetime of this scope object . <nl> + class DontEmitDebugCodeScope BASE_EMBEDDED { <nl> + public : <nl> + explicit DontEmitDebugCodeScope ( AssemblerBase * assembler ) <nl> + : assembler_ ( assembler ) , old_value_ ( assembler - > emit_debug_code ( ) ) { <nl> + assembler_ - > set_emit_debug_code ( false ) ; <nl> + } <nl> + ~ DontEmitDebugCodeScope ( ) { <nl> + assembler_ - > set_emit_debug_code ( old_value_ ) ; <nl> + } ; <nl> + private : <nl> + AssemblerBase * assembler_ ; <nl> + bool old_value_ ; <nl> + } ; <nl> + <nl> + <nl> / / Avoids using instructions that vary in size in unpredictable ways between the <nl> / / snapshot and the running VM . <nl> class PredictableCodeSizeScope { <nl> mmm a / src / x64 / full - codegen - x64 . cc <nl> ppp b / src / x64 / full - codegen - x64 . cc <nl> void FullCodeGenerator : : EmitProfilingCounterReset ( ) { <nl> } <nl> <nl> <nl> + static const byte kJnsOffset = kPointerSize = = kInt64Size ? 0x1d : 0x14 ; <nl> + <nl> + <nl> void FullCodeGenerator : : EmitBackEdgeBookkeeping ( IterationStatement * stmt , <nl> Label * back_edge_target ) { <nl> Comment cmnt ( masm_ , " [ Back edge bookkeeping " ) ; <nl> void FullCodeGenerator : : EmitBackEdgeBookkeeping ( IterationStatement * stmt , <nl> int weight = Min ( kMaxBackEdgeWeight , <nl> Max ( 1 , distance / kCodeSizeMultiplier ) ) ; <nl> EmitProfilingCounterDecrement ( weight ) ; <nl> - __ j ( positive , & ok , Label : : kNear ) ; <nl> - __ call ( isolate ( ) - > builtins ( ) - > InterruptCheck ( ) , RelocInfo : : CODE_TARGET ) ; <nl> <nl> - / / Record a mapping of this PC offset to the OSR id . This is used to find <nl> - / / the AST id from the unoptimized code in order to use it as a key into <nl> - / / the deoptimization input data found in the optimized code . <nl> - RecordBackEdge ( stmt - > OsrEntryId ( ) ) ; <nl> + __ j ( positive , & ok , Label : : kNear ) ; <nl> + { <nl> + PredictableCodeSizeScope predictible_code_size_scope ( masm_ , kJnsOffset ) ; <nl> + DontEmitDebugCodeScope dont_emit_debug_code_scope ( masm_ ) ; <nl> + __ call ( isolate ( ) - > builtins ( ) - > InterruptCheck ( ) , RelocInfo : : CODE_TARGET ) ; <nl> <nl> - EmitProfilingCounterReset ( ) ; <nl> + / / Record a mapping of this PC offset to the OSR id . This is used to find <nl> + / / the AST id from the unoptimized code in order to use it as a key into <nl> + / / the deoptimization input data found in the optimized code . <nl> + RecordBackEdge ( stmt - > OsrEntryId ( ) ) ; <nl> <nl> + EmitProfilingCounterReset ( ) ; <nl> + } <nl> __ bind ( & ok ) ; <nl> + <nl> PrepareForBailoutForId ( stmt - > EntryId ( ) , NO_REGISTERS ) ; <nl> / / Record a mapping of the OSR id to this PC . This is used if the OSR <nl> / / entry becomes the target of a bailout . We don ' t expect it to be , but <nl> FullCodeGenerator : : NestedStatement * FullCodeGenerator : : TryFinally : : Exit ( <nl> <nl> <nl> static const byte kJnsInstruction = 0x79 ; <nl> - static const byte kJnsOffset = kPointerSize = = kInt64Size ? 0x1d : 0x14 ; <nl> static const byte kNopByteOne = 0x66 ; <nl> static const byte kNopByteTwo = 0x90 ; <nl> # ifdef DEBUG <nl>
|
Introduce DontEmitDebugCodeScope to fix the x64 nosnapshot build .
|
v8/v8
|
7ffbbbef3c44bc835c17f8346ce35b040ae0ff62
|
2014-04-16T02:06:14Z
|
mmm a / aten / src / ATen / native / RNN . cpp <nl> ppp b / aten / src / ATen / native / RNN . cpp <nl> <nl> # include < ATen / ATen . h > <nl> # include < ATen / NativeFunctions . h > <nl> <nl> + # include < ATen / native / c10_utils . h > <nl> + <nl> namespace at { namespace native { <nl> <nl> namespace { <nl> struct QuantizedCellParams { <nl> } <nl> } ; <nl> <nl> + / / QuantizedCellParams vs . QuantizedCellParamsDynamic <nl> + / / <nl> + / / QuantizedCellParams uses the legacy <nl> + / / fbgemm_linear_int8_weight_fp32_activation API , which requires the explicit <nl> + / / scale and zero point parameters for the weight . QuantizedCellParamsDynamic <nl> + / / uses the new fbgemm_linear_dynamic API , which doesn ' t require the explicit <nl> + / / scale and zero point parameters . These quantization parameters are <nl> + / / encapsulated in the ` PackedLinearWeight ` struct in <nl> + / / aten / src / ATen / native / quantized / cpu / fbgemm_utils . h . <nl> + struct QuantizedCellParamsDynamic { <nl> + QuantizedCellParamsDynamic ( <nl> + const Tensor & _w_ih , / * Prepacked Weight Tensor * / <nl> + const Tensor & _w_hh , / * Prepacked Weight Tensor * / <nl> + const Tensor & _b_ih , / * float Bias Tensor * / <nl> + const Tensor & _b_hh / * float Bias Tensor * / ) <nl> + : w_ih ( _w_ih ) , w_hh ( _w_hh ) , b_ih ( _b_ih ) , b_hh ( _b_hh ) { } <nl> + <nl> + const Tensor & w_ih ; <nl> + const Tensor & w_hh ; <nl> + const Tensor & b_ih ; <nl> + const Tensor & b_hh ; <nl> + <nl> + Tensor matmul_ih ( const Tensor & input ) const { <nl> + TORCH_CHECK ( false , " matmul is not supported with quantized cell params " ) ; <nl> + } <nl> + Tensor matmul_hh ( const Tensor & h ) const { <nl> + TORCH_CHECK ( false , " matmul is not supported with quantized cell params " ) ; <nl> + } <nl> + <nl> + Tensor linear_ih ( const Tensor & input_ih ) const { <nl> + const auto kFuncName = " quantized : : fbgemm_linear_dynamic " ; <nl> + const auto kOvrldName = " " ; <nl> + const std : : vector < c10 : : IValue > output_ih_list = <nl> + callOp ( kFuncName , kOvrldName , input_ih , w_ih , b_ih ) ; <nl> + TORCH_INTERNAL_ASSERT ( <nl> + output_ih_list . size ( ) = = 1 , <nl> + " The output vector should have exact one element " ) ; <nl> + const Tensor output_ih = output_ih_list [ 0 ] . toTensor ( ) ; <nl> + return output_ih ; <nl> + } <nl> + Tensor linear_hh ( const Tensor & input_hh ) const { <nl> + const auto kFuncName = " quantized : : fbgemm_linear_dynamic " ; <nl> + const auto kOvrldName = " " ; <nl> + const std : : vector < c10 : : IValue > output_hh_list = <nl> + callOp ( kFuncName , kOvrldName , input_hh , w_hh , b_hh ) ; <nl> + TORCH_INTERNAL_ASSERT ( <nl> + output_hh_list . size ( ) = = 1 , <nl> + " The output vector should have exact one element " ) ; <nl> + const Tensor output_hh = output_hh_list [ 0 ] . toTensor ( ) ; <nl> + return output_hh ; <nl> + } <nl> + } ; <nl> + <nl> struct QuantizedCellParamsFP16 { <nl> QuantizedCellParamsFP16 ( const Tensor & _packed_ih , const Tensor & _packed_hh , <nl> const Tensor & _b_ih , const Tensor & _b_hh ) <nl> static std : : vector < QuantizedCellParams > gather_quantized_params ( TensorList param <nl> return result ; <nl> } <nl> <nl> + static std : : vector < QuantizedCellParamsDynamic > gather_quantized_params_dynamic ( <nl> + TensorList params ) { <nl> + static at : : Tensor undefined ; <nl> + std : : vector < QuantizedCellParamsDynamic > result ; <nl> + TORCH_CHECK ( <nl> + params . size ( ) % 4 = = 0 , <nl> + " got an incorrect number of quantized RNN parameters " ) ; <nl> + for ( size_t i = 0 ; i < params . size ( ) ; i + = 4 ) { <nl> + result . emplace_back ( params [ i ] , params [ i + 1 ] , params [ i + 2 ] , params [ i + 3 ] ) ; <nl> + } <nl> + return result ; <nl> + } <nl> + <nl> static std : : vector < QuantizedCellParamsFP16 > gather_quantized_params_fp16 ( <nl> TensorList params ) { <nl> static at : : Tensor undefined ; <nl> std : : tuple < Tensor , Tensor , Tensor > quantized_lstm ( <nl> const Tensor & _input , TensorList hx , <nl> TensorList _params , bool has_biases , <nl> int64_t num_layers , double dropout_p , bool train , bool bidirectional , <nl> - bool batch_first , c10 : : optional < ScalarType > dtype ) { <nl> + bool batch_first , c10 : : optional < ScalarType > dtype , bool use_dynamic ) { <nl> TORCH_CHECK ( hx . size ( ) = = 2 , " lstm expects two hidden states " ) ; <nl> if ( at : : cudnn_is_acceptable ( _input ) ) { <nl> Tensor output , hy , cy ; <nl> std : : tuple < Tensor , Tensor , Tensor > quantized_lstm ( <nl> <nl> std : : tuple < Tensor , Tensor , Tensor > results ; <nl> if ( result_dtype = = at : : kChar ) { <nl> - auto params = gather_quantized_params ( _params ) ; <nl> - results = _lstm_impl < FullLayer , FullBidirectionalLayer > ( <nl> - input , params , hx [ 0 ] , hx [ 1 ] , num_layers , <nl> - dropout_p , train , bidirectional ) ; <nl> + if ( use_dynamic ) { <nl> + auto params = gather_quantized_params_dynamic ( _params ) ; <nl> + results = _lstm_impl < FullLayer , FullBidirectionalLayer > ( <nl> + input , params , hx [ 0 ] , hx [ 1 ] , num_layers , <nl> + dropout_p , train , bidirectional ) ; <nl> + } else { <nl> + auto params = gather_quantized_params ( _params ) ; <nl> + results = _lstm_impl < FullLayer , FullBidirectionalLayer > ( <nl> + input , params , hx [ 0 ] , hx [ 1 ] , num_layers , <nl> + dropout_p , train , bidirectional ) ; <nl> + } <nl> } else { <nl> auto params = gather_quantized_params_fp16 ( _params ) ; <nl> results = _lstm_impl < FullLayer , FullBidirectionalLayer > ( <nl> new file mode 100644 <nl> index 000000000000 . . af372677f415 <nl> mmm / dev / null <nl> ppp b / aten / src / ATen / native / c10_utils . h <nl> <nl> + # pragma once <nl> + <nl> + # include < ATen / core / dispatch / Dispatcher . h > <nl> + <nl> + template < class . . . Inputs > <nl> + inline std : : vector < c10 : : IValue > makeStack ( Inputs & & . . . inputs ) { <nl> + return { std : : forward < Inputs > ( inputs ) . . . } ; <nl> + } <nl> + <nl> + template < class . . . Args > <nl> + inline std : : vector < c10 : : IValue > callOp ( <nl> + const c10 : : OperatorHandle & op , <nl> + Args . . . args ) { <nl> + auto stack = makeStack ( std : : forward < Args > ( args ) . . . ) ; <nl> + auto kernel = c10 : : Dispatcher : : singleton ( ) . lookup ( op , & stack ) ; <nl> + kernel . call ( & stack ) ; <nl> + return stack ; <nl> + } <nl> + <nl> + template < class . . . Args > <nl> + inline std : : vector < c10 : : IValue > callOp ( <nl> + const char * func_name , <nl> + const char * overload_name , <nl> + Args . . . args ) { <nl> + const c10 : : optional < c10 : : OperatorHandle > op_handle = <nl> + c10 : : Dispatcher : : singleton ( ) . findSchema ( { func_name , overload_name } ) ; <nl> + assert ( op_handle . has_value ( ) ) ; <nl> + return callOp ( op_handle . value ( ) , args . . . ) ; <nl> + } <nl> mmm a / aten / src / ATen / native / native_functions . yaml <nl> ppp b / aten / src / ATen / native / native_functions . yaml <nl> <nl> - func : rnn_relu_cell ( Tensor input , Tensor hx , Tensor w_ih , Tensor w_hh , Tensor ? b_ih = None , Tensor ? b_hh = None ) - > Tensor <nl> <nl> # Quantized RNN layers <nl> - - func : quantized_lstm ( Tensor input , Tensor [ ] hx , Tensor [ ] params , bool has_biases , int num_layers , float dropout , bool train , bool bidirectional , bool batch_first , * , ScalarType ? dtype = None ) - > ( Tensor , Tensor , Tensor ) <nl> + - func : quantized_lstm ( Tensor input , Tensor [ ] hx , Tensor [ ] params , bool has_biases , int num_layers , float dropout , bool train , bool bidirectional , bool batch_first , * , ScalarType ? dtype = None , bool use_dynamic = False ) - > ( Tensor , Tensor , Tensor ) <nl> <nl> # Quantized GRU layers <nl> <nl> mmm a / test / common_quantization . py <nl> ppp b / test / common_quantization . py <nl> def forward ( self , x ) : <nl> x = self . fc1 ( x ) <nl> return x <nl> <nl> + class LSTMDynamicModel ( torch . nn . Module ) : <nl> + def __init__ ( self ) : <nl> + super ( LSTMDynamicModel , self ) . __init__ ( ) <nl> + self . qconfig = default_qconfig <nl> + self . lstm = torch . nn . LSTM ( 2 , 2 ) . to ( dtype = torch . float ) <nl> + <nl> + def forward ( self , x ) : <nl> + x = self . lstm ( x ) <nl> + return x <nl> + <nl> class TwoLayerLinearModel ( torch . nn . Module ) : <nl> def __init__ ( self ) : <nl> super ( TwoLayerLinearModel , self ) . __init__ ( ) <nl> mmm a / test / test_quantization . py <nl> ppp b / test / test_quantization . py <nl> <nl> ModForWrapping , \ <nl> test_only_eval_fn , test_only_train_fn , \ <nl> prepare_dynamic , convert_dynamic , SingleLayerLinearDynamicModel , \ <nl> - TwoLayerLinearModel , NestedModel , ResNetBase <nl> + TwoLayerLinearModel , NestedModel , ResNetBase , LSTMDynamicModel <nl> <nl> from common_quantization import AnnotatedTwoLayerLinearModel , AnnotatedNestedModel , \ <nl> AnnotatedSubNestedModel , AnnotatedCustomConfigNestedModel <nl> <nl> from hypothesis import given <nl> from hypothesis import strategies as st <nl> import io <nl> + import copy <nl> <nl> @ unittest . skipIf ( <nl> not torch . fbgemm_is_cpu_supported ( ) , <nl> def checkQuantized ( model ) : <nl> model = quantize_dynamic ( NestedModel ( ) . eval ( ) , qconfig_dict ) <nl> checkQuantized ( model ) <nl> <nl> + def test_quantized_rnn ( self ) : <nl> + d_in , d_hid = 2 , 2 <nl> + model = LSTMDynamicModel ( ) . eval ( ) <nl> + cell = model . lstm <nl> + <nl> + # Replace parameter values s . t . the range of values is exactly <nl> + # 255 , thus we will have 0 quantization error in the quantized <nl> + # GEMM call . This i s for testing purposes . <nl> + # <nl> + # Note that the current implementation does not support <nl> + # accumulation values outside of the range representable by a <nl> + # 16 bit integer , instead resulting in a saturated value . We <nl> + # must take care that in our test we do not end up with a dot <nl> + # product that overflows the int16 range , e . g . <nl> + # ( 255 * 127 + 255 * 127 ) = 64770 . So , we hardcode the test values <nl> + # here and ensure a mix of signedness . <nl> + vals = [ [ 100 , - 155 ] , <nl> + [ 100 , - 155 ] , <nl> + [ - 155 , 100 ] , <nl> + [ - 155 , 100 ] , <nl> + [ 100 , - 155 ] , <nl> + [ - 155 , 100 ] , <nl> + [ - 155 , 100 ] , <nl> + [ 100 , - 155 ] ] <nl> + if isinstance ( cell , torch . nn . LSTM ) : <nl> + num_chunks = 4 <nl> + vals = vals [ : d_hid * num_chunks ] <nl> + cell . weight_ih_l0 = torch . nn . Parameter ( <nl> + torch . tensor ( vals , dtype = torch . float ) , <nl> + requires_grad = False ) <nl> + cell . weight_hh_l0 = torch . nn . Parameter ( <nl> + torch . tensor ( vals , dtype = torch . float ) , <nl> + requires_grad = False ) <nl> + <nl> + ref = copy . deepcopy ( cell ) <nl> + <nl> + qconfig_dynamic_dict = { <nl> + torch . nn . LSTM : default_dynamic_qconfig , <nl> + } <nl> + default_dynamic_module_mapping = { <nl> + torch . nn . LSTM : torch . nn . quantized . dynamic . LSTM , <nl> + } <nl> + model_int8 = quantize_dynamic ( <nl> + model , qconfig_dynamic_dict , default_dynamic_module_mapping <nl> + ) <nl> + cell_int8 = model_int8 . lstm <nl> + <nl> + assert type ( cell_int8 ) = = torch . nn . quantized . dynamic . LSTM , \ <nl> + ' torch . nn . LSTM should be converted to torch . nn . quantized . dynamic . LSTM after quantize_dynamic ' <nl> + <nl> + niter = 10 <nl> + x = torch . tensor ( [ [ 100 , - 155 ] , <nl> + [ - 155 , 100 ] , <nl> + [ 100 , - 155 ] ] , dtype = torch . float ) . unsqueeze ( 0 ) . repeat ( niter , 1 , 1 ) <nl> + <nl> + h0_vals = [ [ - 155 , 100 ] , <nl> + [ - 155 , 155 ] , <nl> + [ 100 , - 155 ] ] <nl> + <nl> + hx = torch . tensor ( h0_vals , dtype = torch . float ) . unsqueeze ( 0 ) <nl> + cx = torch . tensor ( h0_vals , dtype = torch . float ) . unsqueeze ( 0 ) <nl> + <nl> + if isinstance ( ref , torch . nn . LSTM ) : <nl> + hiddens = ( hx , cx ) <nl> + <nl> + ref_out , ref_hid = ref ( x , hiddens ) <nl> + <nl> + # Compare int8 quantized to unquantized <nl> + output_int8 , final_hiddens_int8 = cell_int8 ( x , hiddens ) <nl> + <nl> + torch . testing . assert_allclose ( output_int8 , ref_out ) <nl> + self . assertEqual ( output_int8 , ref_out ) <nl> + for out , ref in zip ( final_hiddens_int8 , ref_hid ) : <nl> + torch . testing . assert_allclose ( out , ref ) <nl> <nl> @ unittest . skipIf ( <nl> not torch . fbgemm_is_cpu_supported ( ) , <nl> mmm a / torch / nn / quantized / dynamic / modules / __init__ . py <nl> ppp b / torch / nn / quantized / dynamic / modules / __init__ . py <nl> <nl> # @ lint - ignore - every PYTHON3COMPATIMPORTS <nl> <nl> from . linear import Linear <nl> + from . rnn import LSTM <nl> <nl> __all__ = [ <nl> ' Linear ' , <nl> + ' LSTM ' , <nl> ] <nl> new file mode 100644 <nl> index 000000000000 . . ac1e691ff3c6 <nl> mmm / dev / null <nl> ppp b / torch / nn / quantized / dynamic / modules / rnn . py <nl> <nl> + from __future__ import absolute_import , division , print_function , unicode_literals <nl> + <nl> + import torch <nl> + import torch . nn as nn <nl> + from torch import Tensor # noqa : F401 <nl> + from torch . nn import _VF <nl> + from torch . _jit_internal import Tuple , Optional , List # noqa : F401 <nl> + from torch . _jit_internal import _parameter_list <nl> + from torch . nn . utils . rnn import PackedSequence <nl> + import numbers <nl> + <nl> + <nl> + def apply_permutation ( tensor , permutation , dim = 1 ) : <nl> + # type : ( Tensor , Tensor , int ) - > Tensor <nl> + return tensor . index_select ( dim , permutation ) <nl> + <nl> + <nl> + class RNNBase ( torch . nn . Module ) : <nl> + <nl> + _FLOAT_MODULE = nn . RNNBase <nl> + <nl> + __constants__ = [ ' mode ' , ' input_size ' , ' hidden_size ' , ' num_layers ' , ' bias ' , <nl> + ' batch_first ' , ' dropout ' , ' bidirectional ' , ' _packed_weights ' , <nl> + ' _quantized_weights ' ] <nl> + <nl> + def __init__ ( self , mode , input_size , hidden_size , <nl> + num_layers = 1 , bias = True , batch_first = False , <nl> + dropout = 0 . , bidirectional = False ) : <nl> + super ( RNNBase , self ) . __init__ ( ) <nl> + <nl> + self . mode = mode <nl> + self . input_size = input_size <nl> + self . hidden_size = hidden_size <nl> + self . num_layers = num_layers <nl> + self . bias = bias <nl> + self . batch_first = batch_first <nl> + self . dropout = float ( dropout ) <nl> + self . bidirectional = bidirectional <nl> + num_directions = 2 if bidirectional else 1 <nl> + <nl> + if not isinstance ( dropout , numbers . Number ) or not 0 < = dropout < = 1 or \ <nl> + isinstance ( dropout , bool ) : <nl> + raise ValueError ( " dropout should be a number in range [ 0 , 1 ] " <nl> + " representing the probability of an element being " <nl> + " zeroed " ) <nl> + if dropout > 0 and num_layers = = 1 : <nl> + warnings . warn ( " dropout option adds dropout after all but last " <nl> + " recurrent layer , so non - zero dropout expects " <nl> + " num_layers greater than 1 , but got dropout = { } and " <nl> + " num_layers = { } " . format ( dropout , num_layers ) ) <nl> + <nl> + if mode = = ' LSTM ' : <nl> + gate_size = 4 * hidden_size <nl> + else : <nl> + raise ValueError ( " Unrecognized RNN mode : " + mode ) <nl> + <nl> + self . _all_weights = [ ] <nl> + <nl> + packed_weights = [ ] <nl> + quantized_weights = [ ] <nl> + <nl> + for layer in range ( num_layers ) : <nl> + for direction in range ( num_directions ) : <nl> + layer_input_size = input_size if layer = = 0 else hidden_size * num_directions <nl> + <nl> + def process_weights ( ihhh , layer , suffix , qweight , bias ) : <nl> + weight_name = ' weight_ { } _l { } { } ' . format ( ihhh , layer , suffix ) <nl> + bias_name = ' bias_ { } _l { } { } ' . format ( ihhh , layer , suffix ) <nl> + <nl> + # for each layer , for each direction we need to quantize and pack <nl> + # weights and pack parameters in this order : <nl> + # <nl> + # w_ih , w_hh , b_ih , b_hh <nl> + packed_weight = \ <nl> + torch . ops . quantized . fbgemm_linear_prepack ( qweight ) <nl> + params = [ packed_weight , bias ] <nl> + pos_names = [ ' w ' , ' b ' ] <nl> + ret_name = [ ' { } _ { } _l { } { } ' . format ( <nl> + name , ihhh , layer , suffix ) for name in pos_names ] <nl> + quantized_weights . append ( qweight ) <nl> + packed_weights . append ( ret_name [ 0 ] ) <nl> + return params , ret_name <nl> + <nl> + w_ih = torch . _empty_affine_quantized ( <nl> + [ gate_size , layer_input_size ] , scale = 1 , zero_point = 0 , dtype = torch . qint8 ) <nl> + w_hh = torch . _empty_affine_quantized ( <nl> + [ gate_size , hidden_size ] , scale = 1 , zero_point = 0 , dtype = torch . qint8 ) <nl> + b_ih = torch . _empty_affine_quantized ( <nl> + [ gate_size ] , scale = 1 , zero_point = 0 , dtype = torch . qint32 ) <nl> + # Second bias vector included for CuDNN compatibility . Only one <nl> + # bias vector is needed in standard definition . <nl> + b_hh = torch . _empty_affine_quantized ( <nl> + [ gate_size ] , scale = 1 , zero_point = 0 , dtype = torch . qint32 ) <nl> + <nl> + suffix = ' _reverse ' if direction = = 1 else ' ' <nl> + ih_params , ih_param_names = process_weights ( <nl> + ' ih ' , layer , suffix , w_ih , b_ih ) <nl> + hh_params , hh_param_names = process_weights ( <nl> + ' hh ' , layer , suffix , w_hh , b_hh ) <nl> + <nl> + for ( ih , ih_name ) , ( hh , hh_name ) in zip ( zip ( ih_params , ih_param_names ) , zip ( hh_params , hh_param_names ) ) : <nl> + self . register_buffer ( ih_name , torch . tensor ( <nl> + ih ) if not isinstance ( ih , torch . Tensor ) else ih ) <nl> + self . register_buffer ( hh_name , torch . tensor ( <nl> + hh ) if not isinstance ( hh , torch . Tensor ) else hh ) <nl> + self . _all_weights . extend ( [ ih_name , hh_name ] ) <nl> + <nl> + def check_input ( self , input , batch_sizes ) : <nl> + # type : ( Tensor , Optional [ Tensor ] ) - > None <nl> + expected_input_dim = 2 if batch_sizes is not None else 3 <nl> + if input . dim ( ) ! = expected_input_dim : <nl> + raise RuntimeError ( <nl> + ' input must have { } dimensions , got { } ' . format ( <nl> + expected_input_dim , input . dim ( ) ) ) <nl> + if self . input_size ! = input . size ( - 1 ) : <nl> + raise RuntimeError ( <nl> + ' input . size ( - 1 ) must be equal to input_size . Expected { } , got { } ' . format ( <nl> + self . input_size , input . size ( - 1 ) ) ) <nl> + <nl> + def get_expected_hidden_size ( self , input , batch_sizes ) : <nl> + # type : ( Tensor , Optional [ Tensor ] ) - > Tuple [ int , int , int ] <nl> + if batch_sizes is not None : <nl> + mini_batch = batch_sizes [ 0 ] <nl> + mini_batch = int ( mini_batch ) <nl> + else : <nl> + mini_batch = input . size ( 0 ) if self . batch_first else input . size ( 1 ) <nl> + num_directions = 2 if self . bidirectional else 1 <nl> + expected_hidden_size = ( self . num_layers * num_directions , <nl> + mini_batch , self . hidden_size ) <nl> + return expected_hidden_size <nl> + <nl> + def check_hidden_size ( self , hx , expected_hidden_size , msg = ' Expected hidden size { } , got { } ' ) : <nl> + # type : ( Tensor , Tuple [ int , int , int ] , str ) - > None <nl> + if hx . size ( ) ! = expected_hidden_size : <nl> + raise RuntimeError ( msg . format ( <nl> + expected_hidden_size , tuple ( hx . size ( ) ) ) ) <nl> + <nl> + def check_forward_args ( self , input , hidden , batch_sizes ) : <nl> + # type : ( Tensor , Tensor , Optional [ Tensor ] ) - > None <nl> + self . check_input ( input , batch_sizes ) <nl> + expected_hidden_size = self . get_expected_hidden_size ( input , batch_sizes ) <nl> + self . check_hidden_size ( hidden , expected_hidden_size , <nl> + msg = ' Expected hidden size { } , got { } ' ) <nl> + <nl> + def permute_hidden ( self , hx , permutation ) : <nl> + # type : ( Tensor , Optional [ Tensor ] ) - > Tensor <nl> + if permutation is None : <nl> + return hx <nl> + return apply_permutation ( hx , permutation ) <nl> + <nl> + @ property <nl> + def all_weights ( self ) : <nl> + return [ getattr ( self , weight ) for weight in self . _all_weights ] <nl> + <nl> + def _get_all_weights_names ( self ) : <nl> + return [ weight for weight in self . _all_weights ] <nl> + <nl> + @ _parameter_list ( _get_all_weights_names ) <nl> + def _get_all_weights ( self ) : <nl> + return self . all_weights <nl> + <nl> + def _get_packed_weights_names ( self ) : <nl> + return self . _packed_weights <nl> + <nl> + @ _parameter_list ( _get_packed_weights_names ) <nl> + def _get_packed_weights ( self ) : <nl> + return [ getattr ( self , name ) for name in self . _packed_weights ] <nl> + <nl> + def _get_quantized_weights_names ( self ) : <nl> + return self . _quantized_weights <nl> + <nl> + @ _parameter_list ( _get_quantized_weights_names ) <nl> + def _get_quantized_weights ( self ) : <nl> + return [ getattr ( self , name ) for name in self . _quantized_weights ] <nl> + <nl> + @ classmethod <nl> + def from_float ( cls , mod ) : <nl> + assert type ( mod ) = = torch . nn . LSTM , ' nn . quantized . dynamic . RNNBase . from_float only works for nn . LSTM ' <nl> + assert hasattr ( <nl> + mod , ' qconfig ' ) , ' Input float module must have qconfig defined ' <nl> + if mod . qconfig is not None and mod . qconfig . weight ( ) is not None : <nl> + weight_observer = mod . qconfig . weight ( ) <nl> + else : <nl> + # We have the circular import issues if we import the qconfig in the beginning of this file : <nl> + # https : / / github . com / pytorch / pytorch / pull / 24231 . The current workaround is to postpone the <nl> + # import until we need it . <nl> + from torch . quantization . QConfig import default_dynamic_qconfig <nl> + weight_observer = default_dynamic_qconfig . weight ( ) <nl> + assert weight_observer . dtype = = torch . qint8 , ' Weight observer must have dtype torch . qint8 ' <nl> + <nl> + if mod . mode = = ' LSTM ' : <nl> + qRNNBase = LSTM ( mod . input_size , mod . hidden_size , mod . num_layers , <nl> + mod . bias , mod . batch_first , mod . dropout , mod . bidirectional ) <nl> + <nl> + num_directions = 2 if mod . bidirectional else 1 <nl> + <nl> + assert mod . bias <nl> + <nl> + # TODO : support more than just LSTM <nl> + if qRNNBase . mode ! = ' LSTM ' : <nl> + raise RuntimeError ( ' Only LSTM is supported for QuantizedRNN ' ) <nl> + <nl> + qRNNBase . _all_weights = [ ] <nl> + packed_weights = [ ] <nl> + quantized_weights = [ ] <nl> + for layer in range ( qRNNBase . num_layers ) : <nl> + for direction in range ( num_directions ) : <nl> + layer_input_size = qRNNBase . input_size if layer = = 0 else qRNNBase . hidden_size * num_directions <nl> + <nl> + def process_weights ( ihhh , layer , suffix ) : <nl> + weight_name = ' weight_ { } _l { } { } ' . format ( ihhh , layer , suffix ) <nl> + bias_name = ' bias_ { } _l { } { } ' . format ( ihhh , layer , suffix ) <nl> + <nl> + weight = getattr ( mod , weight_name ) <nl> + bias = getattr ( mod , bias_name ) <nl> + # for each layer , for each direction we need to quantize and pack <nl> + # weights and pack parameters in this order : <nl> + # <nl> + # w_ih , w_hh , b_ih , b_hh <nl> + weight_observer ( weight ) <nl> + wt_scale , wt_zp = weight_observer . calculate_qparams ( ) <nl> + qweight = torch . quantize_linear ( <nl> + weight . float ( ) , float ( wt_scale ) , int ( wt_zp ) , torch . qint8 ) <nl> + packed_weight = \ <nl> + torch . ops . quantized . fbgemm_linear_prepack ( qweight ) <nl> + <nl> + params = [ packed_weight , bias ] <nl> + pos_names = [ ' w ' , ' b ' ] <nl> + ret_name = [ ' { } _ { } _l { } { } ' . format ( <nl> + name , ihhh , layer , suffix ) for name in pos_names ] <nl> + quantized_weights . append ( qweight ) <nl> + packed_weights . append ( ret_name [ 0 ] ) <nl> + return params , ret_name <nl> + <nl> + suffix = ' _reverse ' if direction = = 1 else ' ' <nl> + ih_params , ih_param_names = process_weights ( ' ih ' , layer , suffix ) <nl> + hh_params , hh_param_names = process_weights ( ' hh ' , layer , suffix ) <nl> + <nl> + for ( ih , ih_name ) , ( hh , hh_name ) in zip ( zip ( ih_params , ih_param_names ) , zip ( hh_params , hh_param_names ) ) : <nl> + qRNNBase . register_buffer ( ih_name , torch . tensor ( <nl> + ih ) if not isinstance ( ih , torch . Tensor ) else ih ) <nl> + qRNNBase . register_buffer ( hh_name , torch . tensor ( <nl> + hh ) if not isinstance ( hh , torch . Tensor ) else hh ) <nl> + qRNNBase . _all_weights . extend ( [ ih_name , hh_name ] ) <nl> + <nl> + qRNNBase . _packed_weights = packed_weights <nl> + # DO WE NEED _quantized_weights ? @ jianyuh : will remove _quantized_weight as now we support the fbgemm_linear_unpack function <nl> + qRNNBase . _quantized_weights = quantized_weights <nl> + <nl> + return qRNNBase <nl> + <nl> + <nl> + class LSTM ( RNNBase ) : <nl> + <nl> + _FLOAT_MODULE = nn . LSTM <nl> + <nl> + __overloads__ = { ' forward ' : [ ' forward_packed ' , ' forward_tensor ' ] } <nl> + <nl> + def __init__ ( self , * args , * * kwargs ) : <nl> + super ( LSTM , self ) . __init__ ( ' LSTM ' , * args , * * kwargs ) <nl> + <nl> + def forward_impl ( self , input , hx , batch_sizes , max_batch_size , sorted_indices ) : <nl> + # type : ( Tensor , Optional [ Tuple [ Tensor , Tensor ] ] , Optional [ Tensor ] , int , Optional [ Tensor ] ) - > Tuple [ Tensor , Tuple [ Tensor , Tensor ] ] # noqa <nl> + if hx is None : <nl> + num_directions = 2 if self . bidirectional else 1 <nl> + zeros = torch . zeros ( self . num_layers * num_directions , <nl> + max_batch_size , self . hidden_size , <nl> + dtype = input . dtype , device = input . device ) <nl> + hx = ( zeros , zeros ) <nl> + else : <nl> + # Each batch of the hidden state should match the input sequence that <nl> + # the user believes he / she is passing in . <nl> + hx = self . permute_hidden ( hx , sorted_indices ) <nl> + <nl> + self . check_forward_args ( input , hx , batch_sizes ) <nl> + assert batch_sizes is None <nl> + <nl> + result = _VF . quantized_lstm ( input , hx , self . _get_all_weights ( ) , self . bias , self . num_layers , <nl> + float ( self . dropout ) , self . training , self . bidirectional , <nl> + self . batch_first , dtype = torch . int8 , use_dynamic = True ) <nl> + output = result [ 0 ] <nl> + hidden = result [ 1 : ] <nl> + <nl> + return output , hidden <nl> + <nl> + def forward_tensor ( self , input , hx = None ) : <nl> + # type : ( Tensor , Optional [ Tuple [ Tensor , Tensor ] ] ) - > Tuple [ Tensor , Tuple [ Tensor , Tensor ] ] <nl> + batch_sizes = None <nl> + max_batch_size = input . size ( 0 ) if self . batch_first else input . size ( 1 ) <nl> + sorted_indices = None <nl> + unsorted_indices = None <nl> + <nl> + output , hidden = self . forward_impl ( <nl> + input , hx , batch_sizes , max_batch_size , sorted_indices ) <nl> + <nl> + return output , self . permute_hidden ( hidden , unsorted_indices ) <nl> + <nl> + def forward_packed ( self , input , hx = None ) : <nl> + # type : ( PackedSequence , Optional [ Tuple [ Tensor , Tensor ] ] ) - > Tuple [ PackedSequence , Tuple [ Tensor , Tensor ] ] # noqa <nl> + input , batch_sizes , sorted_indices , unsorted_indices = input <nl> + max_batch_size = batch_sizes [ 0 ] <nl> + max_batch_size = int ( max_batch_size ) <nl> + <nl> + output , hidden = self . forward_impl ( <nl> + input , hx , batch_sizes , max_batch_size , sorted_indices ) <nl> + <nl> + output = PackedSequence ( output , batch_sizes , <nl> + sorted_indices , unsorted_indices ) <nl> + return output , self . permute_hidden ( hidden , unsorted_indices ) <nl> + <nl> + def permute_hidden ( self , hx , permutation ) : <nl> + # type : ( Tuple [ Tensor , Tensor ] , Optional [ Tensor ] ) - > Tuple [ Tensor , Tensor ] <nl> + if permutation is None : <nl> + return hx <nl> + return apply_permutation ( hx [ 0 ] , permutation ) , apply_permutation ( hx [ 1 ] , permutation ) <nl> + <nl> + def check_forward_args ( self , input , hidden , batch_sizes ) : <nl> + # type : ( Tensor , Tuple [ Tensor , Tensor ] , Optional [ Tensor ] ) - > None <nl> + self . check_input ( input , batch_sizes ) <nl> + expected_hidden_size = self . get_expected_hidden_size ( input , batch_sizes ) <nl> + <nl> + self . check_hidden_size ( hidden [ 0 ] , expected_hidden_size , <nl> + ' Expected hidden [ 0 ] size { } , got { } ' ) <nl> + self . check_hidden_size ( hidden [ 1 ] , expected_hidden_size , <nl> + ' Expected hidden [ 1 ] size { } , got { } ' ) <nl> + <nl> + def forward ( self , input , hx = None ) : <nl> + if isinstance ( input , PackedSequence ) : <nl> + return self . forward_packed ( input , hx ) <nl> + else : <nl> + return self . forward_tensor ( input , hx ) <nl> + <nl> + @ classmethod <nl> + def from_float ( cls , mod ) : <nl> + return super ( LSTM , cls ) . from_float ( mod ) <nl> mmm a / torch / quantization / quantize . py <nl> ppp b / torch / quantization / quantize . py <nl> def forward ( self , x ) : <nl> } <nl> <nl> DEFAULT_DYNAMIC_MODULE_MAPPING = { <nl> - nn . Linear : nnqd . Linear <nl> + nn . Linear : nnqd . Linear , <nl> } <nl> <nl> def quantize ( model , run_fn , run_args , mapping = DEFAULT_MODULE_MAPPING ) : <nl> def quantize ( model , run_fn , run_args , mapping = DEFAULT_MODULE_MAPPING ) : <nl> return model <nl> <nl> DEFAULT_QCONFIG_DICT = { <nl> - nn . Linear : default_dynamic_qconfig <nl> + nn . Linear : default_dynamic_qconfig , <nl> } <nl> <nl> def quantize_dynamic ( model , qconfig_dict = DEFAULT_QCONFIG_DICT , mapping = DEFAULT_DYNAMIC_MODULE_MAPPING ) : <nl>
|
Add the dynamic quantized LSTM module ( )
|
pytorch/pytorch
|
0483d537ab694b81a6084474fd29dff197a45097
|
2019-09-04T02:18:28Z
|
mmm a / tensorflow / core / graph / mkl_graph_util . h <nl> ppp b / tensorflow / core / graph / mkl_graph_util . h <nl> static inline bool IsMklNameChangeOp ( const string & op_name , DataType T ) { <nl> search_string + = DataType_Name ( T ) + string ( " ] " ) ; <nl> <nl> / / Temporarily replacing earlier check by adding a type - specific check so <nl> - / / that we can selectively decide which type is support by MKL operators . <nl> + / / that we can selectively decide which type is supported by MKL operators . <nl> / / That way kernel registration does not decide which operators we support . <nl> / / We are using this change to temporarily disable BFLOAT16 support . Once <nl> / / we want to enable it , we will go back to earlier check . <nl>
|
Update tensorflow / core / graph / mkl_graph_util . h
|
tensorflow/tensorflow
|
54dcd64608c5895883b12f3eaa0ed3d775d097ad
|
2019-09-18T18:46:15Z
|
mmm a / hphp / runtime / base / runtime - option . cpp <nl> ppp b / hphp / runtime / base / runtime - option . cpp <nl> void RuntimeOption : : Load ( <nl> high_2m_pages ( EvalMaxHighArenaHugePages ) ; <nl> } <nl> s_enable_static_arena = <nl> - Config : : GetBool ( ini , config , " Eval . UseTLStaticArena " , true ) ; <nl> + Config : : GetBool ( ini , config , " Eval . UseTLStaticArena " , false ) ; <nl> <nl> replacePlaceholders ( EvalHackCompilerExtractPath ) ; <nl> replacePlaceholders ( EvalHackCompilerFallbackPath ) ; <nl>
|
Disable static arena by default
|
facebook/hhvm
|
faf8315bff24ee831a7248d8e1884ffec52a8531
|
2020-09-17T14:48:59Z
|
mmm a / selfdrive / ui / paint . cc <nl> ppp b / selfdrive / ui / paint . cc <nl> static void ui_draw_background ( UIState * s ) { <nl> <nl> void ui_draw ( UIState * s ) { <nl> ui_draw_background ( s ) ; <nl> - if ( s - > vision_connected & & s - > active_app = = cereal_UiLayoutState_App_none & & s - > status ! = STATUS_STOPPED ) { <nl> + if ( s - > started & & s - > active_app = = cereal_UiLayoutState_App_none & & s - > status ! = STATUS_STOPPED ) { <nl> ui_draw_sidebar ( s ) ; <nl> - ui_draw_vision ( s ) ; <nl> + <nl> + if ( s - > vision_seen ) { <nl> + ui_draw_vision ( s ) ; <nl> + } <nl> } else { <nl> if ( ! s - > scene . uilayout_sidebarcollapsed ) { <nl> ui_draw_sidebar ( s ) ; <nl> mmm a / selfdrive / ui / ui . cc <nl> ppp b / selfdrive / ui / ui . cc <nl> static void navigate_to_settings ( UIState * s ) { <nl> <nl> static void navigate_to_home ( UIState * s ) { <nl> # ifdef QCOM <nl> - if ( s - > vision_connected ) { <nl> + if ( s - > started ) { <nl> s - > active_app = cereal_UiLayoutState_App_none ; <nl> } else { <nl> s - > active_app = cereal_UiLayoutState_App_home ; <nl> static void handle_sidebar_touch ( UIState * s , int touch_x , int touch_y ) { <nl> if ( touch_x > = home_btn_x & & touch_x < ( home_btn_x + home_btn_w ) <nl> & & touch_y > = home_btn_y & & touch_y < ( home_btn_y + home_btn_h ) ) { <nl> navigate_to_home ( s ) ; <nl> - if ( s - > vision_connected ) { <nl> + if ( s - > started ) { <nl> s - > scene . uilayout_sidebarcollapsed = true ; <nl> update_offroad_layout_state ( s ) ; <nl> } <nl> static void handle_sidebar_touch ( UIState * s , int touch_x , int touch_y ) { <nl> } <nl> <nl> static void handle_vision_touch ( UIState * s , int touch_x , int touch_y ) { <nl> - if ( s - > vision_connected & & ( touch_x > = s - > scene . ui_viz_rx - bdr_s ) <nl> + if ( s - > started & & ( touch_x > = s - > scene . ui_viz_rx - bdr_s ) <nl> & & ( s - > active_app ! = cereal_UiLayoutState_App_settings ) ) { <nl> s - > scene . uilayout_sidebarcollapsed = ! s - > scene . uilayout_sidebarcollapsed ; <nl> update_offroad_layout_state ( s ) ; <nl> void handle_message ( UIState * s , Message * msg ) { <nl> struct cereal_Event eventd ; <nl> cereal_read_Event ( & eventd , eventp ) ; <nl> <nl> - if ( eventd . which = = cereal_Event_controlsState ) { <nl> + if ( eventd . which = = cereal_Event_controlsState & & s - > started ) { <nl> struct cereal_ControlsState datad ; <nl> cereal_read_ControlsState ( & datad , eventd . controlsState ) ; <nl> <nl> void handle_message ( UIState * s , Message * msg ) { <nl> s - > alert_size = ALERTSIZE_FULL ; <nl> } <nl> <nl> - if ( s - > status ! = STATUS_STOPPED ) { <nl> - if ( datad . alertStatus = = cereal_ControlsState_AlertStatus_userPrompt ) { <nl> - update_status ( s , STATUS_WARNING ) ; <nl> - } else if ( datad . alertStatus = = cereal_ControlsState_AlertStatus_critical ) { <nl> - update_status ( s , STATUS_ALERT ) ; <nl> - } else if ( datad . enabled ) { <nl> - update_status ( s , STATUS_ENGAGED ) ; <nl> - } else { <nl> - update_status ( s , STATUS_DISENGAGED ) ; <nl> - } <nl> + if ( datad . alertStatus = = cereal_ControlsState_AlertStatus_userPrompt ) { <nl> + update_status ( s , STATUS_WARNING ) ; <nl> + } else if ( datad . alertStatus = = cereal_ControlsState_AlertStatus_critical ) { <nl> + update_status ( s , STATUS_ALERT ) ; <nl> + } else if ( datad . enabled ) { <nl> + update_status ( s , STATUS_ENGAGED ) ; <nl> + } else { <nl> + update_status ( s , STATUS_DISENGAGED ) ; <nl> } <nl> <nl> s - > scene . alert_blinkingrate = datad . alertBlinkingRate ; <nl> void handle_message ( UIState * s , Message * msg ) { <nl> s - > scene . freeSpace = datad . freeSpace ; <nl> s - > scene . thermalStatus = datad . thermalStatus ; <nl> s - > scene . paTemp = datad . pa0 ; <nl> + <nl> + s - > started = datad . started ; <nl> + <nl> + / / Handle onroad / offroad transition <nl> + if ( ! datad . started ) { <nl> + if ( s - > status ! = STATUS_STOPPED ) { <nl> + update_status ( s , STATUS_STOPPED ) ; <nl> + s - > alert_sound_timeout = 0 ; <nl> + s - > vision_seen = false ; <nl> + s - > controls_seen = false ; <nl> + s - > active_app = cereal_UiLayoutState_App_home ; <nl> + update_offroad_layout_state ( s ) ; <nl> + } <nl> + } else if ( s - > status = = STATUS_STOPPED ) { <nl> + update_status ( s , STATUS_DISENGAGED ) ; <nl> + <nl> + s - > active_app = cereal_UiLayoutState_App_none ; <nl> + update_offroad_layout_state ( s ) ; <nl> + } <nl> } else if ( eventd . which = = cereal_Event_ubloxGnss ) { <nl> struct cereal_UbloxGnss datad ; <nl> cereal_read_UbloxGnss ( & datad , eventd . ubloxGnss ) ; <nl> static void ui_update ( UIState * s ) { <nl> } <nl> break ; <nl> } <nl> - / / peek and consume all events in the zmq queue , then return . <nl> - check_messages ( s ) ; <nl> } <nl> <nl> static int vision_subscribe ( int fd , VisionPacket * rp , VisionStreamType type ) { <nl> static void * vision_connect_thread ( void * args ) { <nl> front_rp . d . stream_bufs , front_rp . num_fds , front_rp . fds ) ; <nl> <nl> s - > vision_connected = true ; <nl> + s - > vision_seen = true ; <nl> s - > vision_connect_firstrun = true ; <nl> <nl> / / Drain sockets <nl> int main ( int argc , char * argv [ ] ) { <nl> int draws = 0 ; <nl> <nl> s - > scene . satelliteCount = - 1 ; <nl> + s - > started = false ; <nl> + s - > vision_seen = false ; <nl> <nl> while ( ! do_exit ) { <nl> bool should_swap = false ; <nl> - if ( ! s - > vision_connected ) { <nl> + if ( ! s - > started ) { <nl> / / Delay a while to avoid 9 % cpu usage while car is not started and user is keeping touching on the screen . <nl> / / Don ' t hold the lock while sleeping , so that vision_connect_thread have chances to get the lock . <nl> usleep ( 30 * 1000 ) ; <nl> int main ( int argc , char * argv [ ] ) { <nl> handle_vision_touch ( s , touch_x , touch_y ) ; <nl> } <nl> <nl> - if ( ! s - > vision_connected ) { <nl> + if ( ! s - > started ) { <nl> / / always process events offroad <nl> - if ( s - > status ! = STATUS_STOPPED ) { <nl> - update_status ( s , STATUS_STOPPED ) ; <nl> - s - > active_app = cereal_UiLayoutState_App_home ; <nl> - update_offroad_layout_state ( s ) ; <nl> - } <nl> check_messages ( s ) ; <nl> } else { <nl> set_awake ( s , true ) ; <nl> - if ( s - > status = = STATUS_STOPPED ) { <nl> - update_status ( s , STATUS_DISENGAGED ) ; <nl> - s - > active_app = cereal_UiLayoutState_App_none ; <nl> - update_offroad_layout_state ( s ) ; <nl> + / / Car started , fetch a new rgb image from ipc <nl> + if ( s - > vision_connected ) { <nl> + ui_update ( s ) ; <nl> } <nl> - / / Car started , fetch a new rgb image from ipc and peek for zmq events . <nl> - ui_update ( s ) ; <nl> - if ( ! s - > vision_connected ) { <nl> - / / Visiond process is just stopped , force a redraw to make screen blank again . <nl> + <nl> + check_messages ( s ) ; <nl> + <nl> + / / Visiond process is just stopped , force a redraw to make screen blank again . <nl> + if ( ! s - > started ) { <nl> s - > scene . satelliteCount = - 1 ; <nl> s - > scene . uilayout_sidebarcollapsed = false ; <nl> update_offroad_layout_state ( s ) ; <nl> int main ( int argc , char * argv [ ] ) { <nl> s - > volume_timeout = 5 * UI_FREQ ; <nl> } <nl> <nl> + / / If car is started and controlsState times out , display an alert <nl> if ( s - > controls_timeout > 0 ) { <nl> s - > controls_timeout - - ; <nl> } else { <nl> - / / stop playing alert sound <nl> - if ( ( ! s - > vision_connected | | ( s - > vision_connected & & s - > alert_sound_timeout = = 0 ) ) & & <nl> - s - > alert_sound ! = cereal_CarControl_HUDControl_AudibleAlert_none ) { <nl> - stop_alert_sound ( s - > alert_sound ) ; <nl> - s - > alert_sound = cereal_CarControl_HUDControl_AudibleAlert_none ; <nl> - } <nl> - <nl> - / / if visiond is still running and controlsState times out , display an alert <nl> - / / TODO : refactor this to not be here <nl> - if ( s - > controls_seen & & s - > vision_connected & & strcmp ( s - > scene . alert_text2 , " Controls Unresponsive " ) ! = 0 ) { <nl> + if ( s - > started & & s - > controls_seen & & strcmp ( s - > scene . alert_text2 , " Controls Unresponsive " ) ! = 0 ) { <nl> + LOGE ( " Controls unresponsive " ) ; <nl> s - > scene . alert_size = ALERTSIZE_FULL ; <nl> - if ( s - > status ! = STATUS_STOPPED ) { <nl> - update_status ( s , STATUS_ALERT ) ; <nl> - } <nl> + update_status ( s , STATUS_ALERT ) ; <nl> + <nl> snprintf ( s - > scene . alert_text1 , sizeof ( s - > scene . alert_text1 ) , " % s " , " TAKE CONTROL IMMEDIATELY " ) ; <nl> snprintf ( s - > scene . alert_text2 , sizeof ( s - > scene . alert_text2 ) , " % s " , " Controls Unresponsive " ) ; <nl> ui_draw_vision_alert ( s , s - > scene . alert_size , s - > status , s - > scene . alert_text1 , s - > scene . alert_text2 ) ; <nl> <nl> s - > alert_sound_timeout = 2 * UI_FREQ ; <nl> - <nl> s - > alert_sound = cereal_CarControl_HUDControl_AudibleAlert_chimeWarningRepeat ; <nl> play_alert_sound ( s - > alert_sound ) ; <nl> } <nl> + <nl> s - > alert_sound_timeout - - ; <nl> s - > controls_seen = false ; <nl> } <nl> <nl> + / / stop playing alert sound <nl> + if ( ( ! s - > started | | ( s - > started & & s - > alert_sound_timeout = = 0 ) ) & & <nl> + s - > alert_sound ! = cereal_CarControl_HUDControl_AudibleAlert_none ) { <nl> + stop_alert_sound ( s - > alert_sound ) ; <nl> + s - > alert_sound = cereal_CarControl_HUDControl_AudibleAlert_none ; <nl> + } <nl> + <nl> read_param_bool_timeout ( & s - > is_metric , " IsMetric " , & s - > is_metric_timeout ) ; <nl> read_param_bool_timeout ( & s - > longitudinal_control , " LongitudinalControl " , & s - > longitudinal_control_timeout ) ; <nl> read_param_bool_timeout ( & s - > limit_set_speed , " LimitSetSpeed " , & s - > limit_set_speed_timeout ) ; <nl> mmm a / selfdrive / ui / ui . hpp <nl> ppp b / selfdrive / ui / ui . hpp <nl> typedef struct UIState { <nl> int alert_size ; <nl> float alert_blinking_alpha ; <nl> bool alert_blinked ; <nl> + bool started ; <nl> + bool vision_seen ; <nl> <nl> float light_sensor ; <nl> <nl>
|
ui . cc : use thermald to decide when to go onroad ( )
|
commaai/openpilot
|
54d8f9c27b49efe56b813eb2538b3aa9dc1c2897
|
2020-04-10T23:12:39Z
|
mmm a / lib / Parse / Lexer . cpp <nl> ppp b / lib / Parse / Lexer . cpp <nl> void Lexer : : formToken ( tok Kind , const char * TokStart , bool MultilineString ) { <nl> } <nl> unsigned CommentLength = 0 ; <nl> if ( RetainComments = = CommentRetentionMode : : AttachToNextToken ) { <nl> + / / ' CommentLength ' here is the length from the * first * comment to the <nl> + / / token text ( or its backtick if exist ) . <nl> auto Iter = llvm : : find_if ( LeadingTrivia , [ ] ( const TriviaPiece & Piece ) { <nl> return Piece . isComment ( ) ; <nl> } ) ; <nl> for ( auto End = LeadingTrivia . end ( ) ; Iter ! = End ; Iter + + ) { <nl> + if ( Iter - > getKind ( ) = = TriviaKind : : Backtick ) <nl> + / / Since Token : : getCommentRange ( ) doesn ' t take backtick into account , <nl> + / / we cannot include length of backtick . <nl> + break ; <nl> CommentLength + = Iter - > getTextLength ( ) ; <nl> } <nl> } <nl> new file mode 100644 <nl> index 000000000000 . . dbf32e751546 <nl> mmm / dev / null <nl> ppp b / validation - test / IDE / crashers_2_fixed / 0021 - lexer - commentlength . swift <nl> <nl> + / * comment * / ` init ` ( ) <nl> + foo ( ) ; / * comment * / ` var ` ( ) <nl> + <nl> + / / RUN : % target - swift - ide - test - syntax - coloring - source - filename % s <nl>
|
Merge remote - tracking branch ' origin / master ' into master - next
|
apple/swift
|
3f7196f6fb5b6c2689f4fbf589222a9a97b8f3b7
|
2018-07-23T23:09:24Z
|
mmm a / cocos / renderer / CCGLProgram . cpp <nl> ppp b / cocos / renderer / CCGLProgram . cpp <nl> GLProgram : : ~ GLProgram ( ) <nl> <nl> for ( auto e : _hashForUniforms ) <nl> { <nl> - free ( e . second ) ; <nl> + free ( e . second . first ) ; <nl> } <nl> _hashForUniforms . clear ( ) ; <nl> } <nl> bool GLProgram : : updateUniformLocation ( GLint location , const GLvoid * data , unsign <nl> { <nl> GLvoid * value = malloc ( bytes ) ; <nl> memcpy ( value , data , bytes ) ; <nl> - _hashForUniforms . insert ( std : : make_pair ( location , value ) ) ; <nl> + _hashForUniforms . insert ( std : : make_pair ( location , std : : make_pair ( value , bytes ) ) ) ; <nl> } <nl> else <nl> { <nl> - if ( memcmp ( element - > second , data , bytes ) = = 0 ) <nl> + if ( memcmp ( element - > second . first , data , bytes ) = = 0 ) <nl> { <nl> updated = false ; <nl> } <nl> else <nl> { <nl> - memcpy ( element - > second , data , bytes ) ; <nl> + if ( element - > second . second < bytes ) { <nl> + GLvoid * value = realloc ( element - > second . first , bytes ) ; <nl> + memcpy ( value , data , bytes ) ; <nl> + _hashForUniforms [ location ] = std : : make_pair ( value , bytes ) ; <nl> + } else <nl> + memcpy ( element - > second . first , data , bytes ) ; <nl> } <nl> } <nl> <nl> void GLProgram : : reset ( ) <nl> <nl> for ( auto e : _hashForUniforms ) <nl> { <nl> - free ( e . second ) ; <nl> + free ( e . second . first ) ; <nl> } <nl> <nl> _hashForUniforms . clear ( ) ; <nl> mmm a / cocos / renderer / CCGLProgram . h <nl> ppp b / cocos / renderer / CCGLProgram . h <nl> class CC_DLL GLProgram : public Ref <nl> <nl> std : : unordered_map < std : : string , Uniform > _userUniforms ; <nl> std : : unordered_map < std : : string , VertexAttrib > _vertexAttribs ; <nl> - std : : unordered_map < GLint , GLvoid * > _hashForUniforms ; <nl> + std : : unordered_map < GLint , std : : pair < GLvoid * , unsigned int > > _hashForUniforms ; <nl> / / cached director pointer for calling <nl> Director * _director ; <nl> } ; <nl>
|
Merge pull request from lvlonggame / v3
|
cocos2d/cocos2d-x
|
95a4f20a9b9185a90f0a0686429ed5af0096824d
|
2015-01-27T08:23:22Z
|
mmm a / doc / tutorials / calib3d / camera_calibration / camera_calibration . rst <nl> ppp b / doc / tutorials / calib3d / camera_calibration / camera_calibration . rst <nl> For the distortion OpenCV takes into account the radial and tangential factors . <nl> <nl> . . math : : <nl> <nl> - x_ { corrected } = x ( 1 + k_1 r ^ 2 + k_2 r ^ 4 + k ^ 3 r ^ 6 ) \ \ <nl> - y_ { corrected } = y ( 1 + k_1 r ^ 2 + k_2 r ^ 4 + k ^ 3 r ^ 6 ) <nl> + x_ { corrected } = x ( 1 + k_1 r ^ 2 + k_2 r ^ 4 + k_3 r ^ 6 ) \ \ <nl> + y_ { corrected } = y ( 1 + k_1 r ^ 2 + k_2 r ^ 4 + k_3 r ^ 6 ) <nl> <nl> So for an old pixel point at : math : ` ( x , y ) ` coordinate in the input image , for a corrected output image its position will be : math : ` ( x_ { corrected } y_ { corrected } ) ` . The presence of the radial distortion manifests in form of the " barrel " or " fish - eye " effect . <nl> <nl>
|
Merge pull request from alekcac : doc_fix
|
opencv/opencv
|
9cbeea03fafc78bfd9257d247c0fd468c0642958
|
2013-06-14T11:53:36Z
|
mmm a / modules / viz / src / clouds . cpp <nl> ppp b / modules / viz / src / clouds . cpp <nl> void cv : : viz : : WCloudCollection : : addCloud ( InputArray cloud , InputArray colors , co <nl> mapper - > ImmediateModeRenderingOff ( ) ; <nl> VtkUtils : : SetInputData ( mapper , polydata ) ; <nl> <nl> - actor - > SetNumberOfCloudPoints ( std : : max ( 1 , polydata - > GetNumberOfPoints ( ) / 10 ) ) ; <nl> + actor - > SetNumberOfCloudPoints ( std : : max < vtkIdType > ( 1 , polydata - > GetNumberOfPoints ( ) / 10 ) ) ; <nl> actor - > GetProperty ( ) - > SetInterpolationToFlat ( ) ; <nl> actor - > GetProperty ( ) - > BackfaceCullingOn ( ) ; <nl> actor - > SetMapper ( mapper ) ; <nl> void cv : : viz : : WCloudCollection : : addCloud ( InputArray cloud , InputArray colors , co <nl> <nl> VtkUtils : : SetInputData ( mapper , append_filter - > GetOutput ( ) ) ; <nl> <nl> - actor - > SetNumberOfCloudPoints ( std : : max ( 1 , actor - > GetNumberOfCloudPoints ( ) + polydata - > GetNumberOfPoints ( ) / 10 ) ) ; <nl> + actor - > SetNumberOfCloudPoints ( std : : max < vtkIdType > ( 1 , actor - > GetNumberOfCloudPoints ( ) + polydata - > GetNumberOfPoints ( ) / 10 ) ) ; <nl> } <nl> <nl> void cv : : viz : : WCloudCollection : : addCloud ( InputArray cloud , const Color & color , const Affine3d & pose ) <nl> mmm a / modules / viz / src / shapes . cpp <nl> ppp b / modules / viz / src / shapes . cpp <nl> cv : : viz : : WTrajectorySpheres : : WTrajectorySpheres ( InputArray _path , double line_le <nl> line_source - > SetPoint1 ( curr . val ) ; <nl> line_source - > SetPoint2 ( lend . val ) ; <nl> line_source - > Update ( ) ; <nl> - vtkSmartPointer < vtkPolyData > polydata = line_source - > GetOutput ( ) ; <nl> - polydata - > GetCellData ( ) - > SetScalars ( VtkUtils : : FillScalars ( polydata - > GetNumberOfCells ( ) , c ) ) ; <nl> - VtkUtils : : AddInputData ( append_filter , polydata ) ; <nl> + vtkSmartPointer < vtkPolyData > polydata_ = line_source - > GetOutput ( ) ; <nl> + polydata_ - > GetCellData ( ) - > SetScalars ( VtkUtils : : FillScalars ( polydata_ - > GetNumberOfCells ( ) , c ) ) ; <nl> + VtkUtils : : AddInputData ( append_filter , polydata_ ) ; <nl> } <nl> } <nl> append_filter - > Update ( ) ; <nl> mmm a / modules / viz / src / vtk / vtkCloudMatSource . cpp <nl> ppp b / modules / viz / src / vtk / vtkCloudMatSource . cpp <nl> int cv : : viz : : vtkCloudMatSource : : SetColorCloudNormals ( InputArray _cloud , InputArr <nl> CV_Assert ( _normals . channels ( ) = = 3 | | _normals . channels ( ) = = 4 ) ; <nl> CV_Assert ( _normals . size ( ) = = _cloud . size ( ) ) ; <nl> <nl> - Mat cloud = _cloud . getMat ( ) ; <nl> - Mat normals = _normals . getMat ( ) ; <nl> - <nl> - if ( normals . depth ( ) = = CV_32F & & cloud . depth ( ) = = CV_32F ) <nl> - filterNanNormalsCopy < float , float > ( normals , cloud , total ) ; <nl> - else if ( normals . depth ( ) = = CV_32F & & cloud . depth ( ) = = CV_64F ) <nl> - filterNanNormalsCopy < float , double > ( normals , cloud , total ) ; <nl> - else if ( normals . depth ( ) = = CV_64F & & cloud . depth ( ) = = CV_32F ) <nl> - filterNanNormalsCopy < double , float > ( normals , cloud , total ) ; <nl> - else if ( normals . depth ( ) = = CV_64F & & cloud . depth ( ) = = CV_64F ) <nl> - filterNanNormalsCopy < double , double > ( normals , cloud , total ) ; <nl> + Mat c = _cloud . getMat ( ) ; <nl> + Mat n = _normals . getMat ( ) ; <nl> + <nl> + if ( n . depth ( ) = = CV_32F & & c . depth ( ) = = CV_32F ) <nl> + filterNanNormalsCopy < float , float > ( n , c , total ) ; <nl> + else if ( n . depth ( ) = = CV_32F & & c . depth ( ) = = CV_64F ) <nl> + filterNanNormalsCopy < float , double > ( n , c , total ) ; <nl> + else if ( n . depth ( ) = = CV_64F & & c . depth ( ) = = CV_32F ) <nl> + filterNanNormalsCopy < double , float > ( n , c , total ) ; <nl> + else if ( n . depth ( ) = = CV_64F & & c . depth ( ) = = CV_64F ) <nl> + filterNanNormalsCopy < double , double > ( n , c , total ) ; <nl> else <nl> CV_Assert ( ! " Unsupported normals / cloud type " ) ; <nl> <nl> int cv : : viz : : vtkCloudMatSource : : SetColorCloudNormalsTCoords ( InputArray _cloud , I <nl> CV_Assert ( _tcoords . depth ( ) = = CV_32F | | _tcoords . depth ( ) = = CV_64F ) ; <nl> CV_Assert ( _tcoords . channels ( ) = = 2 & & _tcoords . size ( ) = = _cloud . size ( ) ) ; <nl> <nl> - Mat cloud = _cloud . getMat ( ) ; <nl> - Mat tcoords = _tcoords . getMat ( ) ; <nl> - <nl> - if ( tcoords . depth ( ) = = CV_32F & & cloud . depth ( ) = = CV_32F ) <nl> - filterNanTCoordsCopy < float , float > ( tcoords , cloud , total ) ; <nl> - else if ( tcoords . depth ( ) = = CV_32F & & cloud . depth ( ) = = CV_64F ) <nl> - filterNanTCoordsCopy < float , double > ( tcoords , cloud , total ) ; <nl> - else if ( tcoords . depth ( ) = = CV_64F & & cloud . depth ( ) = = CV_32F ) <nl> - filterNanTCoordsCopy < double , float > ( tcoords , cloud , total ) ; <nl> - else if ( tcoords . depth ( ) = = CV_64F & & cloud . depth ( ) = = CV_64F ) <nl> - filterNanTCoordsCopy < double , double > ( tcoords , cloud , total ) ; <nl> + Mat cl = _cloud . getMat ( ) ; <nl> + Mat tc = _tcoords . getMat ( ) ; <nl> + <nl> + if ( tc . depth ( ) = = CV_32F & & cl . depth ( ) = = CV_32F ) <nl> + filterNanTCoordsCopy < float , float > ( tc , cl , total ) ; <nl> + else if ( tc . depth ( ) = = CV_32F & & cl . depth ( ) = = CV_64F ) <nl> + filterNanTCoordsCopy < float , double > ( tc , cl , total ) ; <nl> + else if ( tc . depth ( ) = = CV_64F & & cl . depth ( ) = = CV_32F ) <nl> + filterNanTCoordsCopy < double , float > ( tc , cl , total ) ; <nl> + else if ( tc . depth ( ) = = CV_64F & & cl . depth ( ) = = CV_64F ) <nl> + filterNanTCoordsCopy < double , double > ( tc , cl , total ) ; <nl> else <nl> CV_Assert ( ! " Unsupported tcoords / cloud type " ) ; <nl> <nl> void cv : : viz : : vtkCloudMatSource : : filterNanColorsCopy ( const Mat & cloud_colors , co <nl> template < typename _Tn , typename _Msk > <nl> void cv : : viz : : vtkCloudMatSource : : filterNanNormalsCopy ( const Mat & cloud_normals , const Mat & mask , int total ) <nl> { <nl> - normals = vtkSmartPointer < VtkDepthTraits < _Tn > : : array_type > : : New ( ) ; <nl> + normals = vtkSmartPointer < typename VtkDepthTraits < _Tn > : : array_type > : : New ( ) ; <nl> normals - > SetName ( " Normals " ) ; <nl> normals - > SetNumberOfComponents ( 3 ) ; <nl> normals - > SetNumberOfTuples ( total ) ; <nl> template < typename _Tn , typename _Msk > <nl> void cv : : viz : : vtkCloudMatSource : : filterNanTCoordsCopy ( const Mat & _tcoords , const Mat & mask , int total ) <nl> { <nl> typedef Vec < _Tn , 2 > Vec2 ; <nl> - tcoords = vtkSmartPointer < VtkDepthTraits < _Tn > : : array_type > : : New ( ) ; <nl> + tcoords = vtkSmartPointer < typename VtkDepthTraits < _Tn > : : array_type > : : New ( ) ; <nl> tcoords - > SetName ( " TextureCoordinates " ) ; <nl> tcoords - > SetNumberOfComponents ( 2 ) ; <nl> tcoords - > SetNumberOfTuples ( total ) ; <nl> mmm a / modules / viz / src / vtk / vtkImageMatSource . cpp <nl> ppp b / modules / viz / src / vtk / vtkImageMatSource . cpp <nl> int cv : : viz : : vtkImageMatSource : : RequestData ( vtkInformation * , vtkInformationVecto <nl> <nl> void cv : : viz : : vtkImageMatSource : : SetImage ( InputArray _image ) <nl> { <nl> - CV_Assert ( _image . depth ( ) = = CV_8U & & _image . channels ( ) = = 1 | | _image . channels ( ) = = 3 | | _image . channels ( ) = = 4 ) ; <nl> + CV_Assert ( _image . depth ( ) = = CV_8U & & ( _image . channels ( ) = = 1 | | _image . channels ( ) = = 3 | | _image . channels ( ) = = 4 ) ) ; <nl> <nl> Mat image = _image . getMat ( ) ; <nl> <nl>
|
fixed warnigns and compiler errors for Ubuntu
|
opencv/opencv
|
7410593d55d09524cff5e9cd6584fa68a95a2996
|
2014-01-19T14:39:00Z
|
mmm a / lib / Sema / ConstraintSystem . cpp <nl> ppp b / lib / Sema / ConstraintSystem . cpp <nl> Type ConstraintSystem : : openFunctionType ( <nl> auto resultTy = openType ( genericFn - > getResult ( ) , replacements ) ; <nl> <nl> / / Build the resulting ( non - generic ) function type . <nl> - type = FunctionType : : get ( inputTy , resultTy , <nl> - FunctionType : : ExtInfo ( ) . <nl> - withThrows ( genericFn - > throws ( ) ) ) ; <nl> - } else { <nl> - type = openType ( funcType , replacements ) ; <nl> + funcType = FunctionType : : get ( inputTy , resultTy , <nl> + FunctionType : : ExtInfo ( ) . <nl> + withThrows ( genericFn - > throws ( ) ) ) ; <nl> } <nl> <nl> - return removeArgumentLabels ( type , numArgumentLabelsToRemove ) ; <nl> + return removeArgumentLabels ( funcType , numArgumentLabelsToRemove ) ; <nl> } <nl> <nl> Optional < Type > ConstraintSystem : : isArrayType ( Type type ) { <nl> ConstraintSystem : : getTypeOfReference ( ValueDecl * value , <nl> return { openedType , openedFnType - > getResult ( ) } ; <nl> } <nl> <nl> - / / If we have a type declaration , resolve it within the current context . <nl> + / / Unqualified reference to a local or global function . <nl> + if ( auto funcDecl = dyn_cast < AbstractFunctionDecl > ( value ) ) { <nl> + OpenedTypeMap replacements ; <nl> + <nl> + auto funcType = funcDecl - > getInterfaceType ( ) - > castTo < AnyFunctionType > ( ) ; <nl> + auto openedType = <nl> + openFunctionType ( <nl> + funcType , <nl> + getNumRemovedArgumentLabels ( TC . Context , funcDecl , <nl> + / * isCurriedInstanceReference = * / false , <nl> + functionRefKind ) , <nl> + locator , replacements , <nl> + funcDecl - > getInnermostDeclContext ( ) , <nl> + funcDecl - > getDeclContext ( ) , <nl> + / * skipProtocolSelfConstraint = * / false ) ; <nl> + <nl> + / / If we opened up any type variables , record the replacements . <nl> + recordOpenedTypes ( locator , replacements ) ; <nl> + <nl> + return { openedType , openedType } ; <nl> + } <nl> + <nl> + / / Unqualified reference to a type . <nl> if ( auto typeDecl = dyn_cast < TypeDecl > ( value ) ) { <nl> / / Resolve the reference to this type declaration in our current context . <nl> - auto type = getTypeChecker ( ) . resolveTypeInContext ( typeDecl , DC , <nl> - TR_InExpression , <nl> - isSpecialized ) ; <nl> + auto type = TC . resolveTypeInContext ( typeDecl , DC , <nl> + TR_InExpression , <nl> + isSpecialized ) ; <nl> <nl> / / Open the type . <nl> type = openUnboundGenericType ( type , locator ) ; <nl> ConstraintSystem : : getTypeOfReference ( ValueDecl * value , <nl> return { type , type } ; <nl> } <nl> <nl> + / / Only remaining case : unqualified reference to a property . <nl> + auto * varDecl = cast < VarDecl > ( value ) ; <nl> + <nl> / / Determine the type of the value , opening up that type if necessary . <nl> - bool wantInterfaceType = true ; <nl> - if ( isa < VarDecl > ( value ) ) <nl> - wantInterfaceType = ! value - > getDeclContext ( ) - > isLocalContext ( ) ; <nl> - Type valueType = TC . getUnopenedTypeOfReference ( value , Type ( ) , DC , base , <nl> + bool wantInterfaceType = ! varDecl - > getDeclContext ( ) - > isLocalContext ( ) ; <nl> + Type valueType = TC . getUnopenedTypeOfReference ( varDecl , Type ( ) , DC , base , <nl> wantInterfaceType ) ; <nl> <nl> + assert ( ! valueType - > hasUnboundGenericType ( ) & & <nl> + ! valueType - > hasTypeParameter ( ) ) ; <nl> + <nl> / / If this is a let - param whose type is a type variable , this is an untyped <nl> / / closure param that may be bound to an inout type later . References to the <nl> / / param should have lvalue type instead . Express the relationship with a new <nl> / / constraint . <nl> - if ( auto * param = dyn_cast < ParamDecl > ( value ) ) { <nl> + if ( auto * param = dyn_cast < ParamDecl > ( varDecl ) ) { <nl> if ( param - > isLet ( ) & & valueType - > is < TypeVariableType > ( ) ) { <nl> Type paramType = valueType ; <nl> valueType = createTypeVariable ( getConstraintLocator ( locator ) , <nl> ConstraintSystem : : getTypeOfReference ( ValueDecl * value , <nl> } <nl> } <nl> <nl> - / / Adjust the type of the reference . <nl> - if ( auto funcType = valueType - > getAs < AnyFunctionType > ( ) ) { <nl> - OpenedTypeMap replacements ; <nl> - <nl> - valueType = <nl> - openFunctionType ( <nl> - funcType , <nl> - getNumRemovedArgumentLabels ( TC . Context , value , <nl> - / * isCurriedInstanceReference = * / false , <nl> - functionRefKind ) , <nl> - locator , replacements , <nl> - value - > getInnermostDeclContext ( ) , <nl> - value - > getDeclContext ( ) , <nl> - / * skipProtocolSelfConstraint = * / false ) ; <nl> - <nl> - / / If we opened up any type variables , record the replacements . <nl> - recordOpenedTypes ( locator , replacements ) ; <nl> - } else { <nl> - assert ( ! valueType - > hasUnboundGenericType ( ) & & <nl> - ! valueType - > hasTypeParameter ( ) ) ; <nl> - } <nl> - <nl> return { valueType , valueType } ; <nl> } <nl> <nl> ConstraintSystem : : getTypeOfMemberReference ( <nl> getNumRemovedArgumentLabels ( TC . Context , value , isCurriedInstanceReference , <nl> functionRefKind ) ; <nl> <nl> + AnyFunctionType * funcType ; <nl> + <nl> if ( isa < AbstractFunctionDecl > ( value ) | | <nl> isa < EnumElementDecl > ( value ) ) { <nl> / / This is the easy case . <nl> - auto funcType = value - > getInterfaceType ( ) - > getAs < AnyFunctionType > ( ) ; <nl> - <nl> - openedType = openFunctionType ( funcType , numRemovedArgumentLabels , <nl> - locator , replacements , innerDC , outerDC , <nl> - / * skipProtocolSelfConstraint = * / true ) ; <nl> + funcType = value - > getInterfaceType ( ) - > castTo < AnyFunctionType > ( ) ; <nl> } else { <nl> / / If we ' re not coming from something function - like , prepend the type <nl> / / for ' self ' to the type . <nl> assert ( isa < AbstractStorageDecl > ( value ) ) ; <nl> <nl> - openedType = TC . getUnopenedTypeOfReference ( value , baseTy , useDC , base , <nl> - / * wantInterfaceType = * / true ) ; <nl> - <nl> - / / Remove argument labels , if needed . <nl> - openedType = removeArgumentLabels ( openedType , numRemovedArgumentLabels ) ; <nl> - <nl> - / / Open up the generic parameter list for the container . <nl> - openGeneric ( innerDC , outerDC , innerDC - > getGenericSignatureOfContext ( ) , <nl> - / * skipProtocolSelfConstraint = * / true , <nl> - locator , replacements ) ; <nl> - <nl> - / / Open up the type of the member . <nl> - openedType = openType ( openedType , replacements ) ; <nl> + auto refType = TC . getUnopenedTypeOfReference ( value , baseTy , useDC , base , <nl> + / * wantInterfaceType = * / true ) ; <nl> <nl> - / / Determine the object type of ' self ' . <nl> - auto selfTy = openType ( outerDC - > getSelfInterfaceType ( ) , <nl> - replacements ) ; <nl> + auto selfTy = outerDC - > getSelfInterfaceType ( ) ; <nl> <nl> / / If self is a struct , properly qualify it based on our base <nl> / / qualification . If we have an lvalue coming in , we expect an inout . <nl> ConstraintSystem : : getTypeOfMemberReference ( <nl> ! selfTy - > hasError ( ) ) <nl> selfTy = InOutType : : get ( selfTy ) ; <nl> <nl> - openedType = FunctionType : : get ( selfTy , openedType ) ; <nl> + if ( auto * sig = innerDC - > getGenericSignatureOfContext ( ) ) { <nl> + funcType = GenericFunctionType : : get ( sig , selfTy , refType , <nl> + AnyFunctionType : : ExtInfo ( ) ) ; <nl> + } else { <nl> + funcType = FunctionType : : get ( selfTy , refType , <nl> + AnyFunctionType : : ExtInfo ( ) ) ; <nl> + } <nl> } <nl> <nl> + openedType = openFunctionType ( funcType , numRemovedArgumentLabels , <nl> + locator , replacements , innerDC , outerDC , <nl> + / * skipProtocolSelfConstraint = * / true ) ; <nl> + <nl> if ( ! outerDC - > getAsProtocolOrProtocolExtensionContext ( ) ) { <nl> / / Class methods returning Self as well as constructors get the <nl> / / result replaced with the base object type . <nl> mmm a / lib / Sema / TypeCheckProtocol . cpp <nl> ppp b / lib / Sema / TypeCheckProtocol . cpp <nl> matchWitness ( TypeChecker & tc , <nl> witnessLocator = cs - > getConstraintLocator ( <nl> static_cast < Expr * > ( nullptr ) , <nl> LocatorPathElt ( ConstraintLocator : : Witness , witness ) ) ; <nl> - OpenedTypeMap witnessReplacements ; <nl> if ( witness - > getDeclContext ( ) - > isTypeContext ( ) ) { <nl> std : : tie ( openedFullWitnessType , openWitnessType ) <nl> = cs - > getTypeOfMemberReference ( selfTy , witness , dc , <nl> / * isDynamicResult = * / false , <nl> FunctionRefKind : : DoubleApply , <nl> witnessLocator , <nl> - / * base = * / nullptr , <nl> - & witnessReplacements ) ; <nl> + / * base = * / nullptr ) ; <nl> } else { <nl> std : : tie ( openedFullWitnessType , openWitnessType ) <nl> = cs - > getTypeOfReference ( witness , <nl>
|
Sema : Clean up ConstraintSystem : : getTypeOfReference ( )
|
apple/swift
|
b112e95a7c2574277b1ef1d8a38cf5aa39595d22
|
2017-05-24T07:20:55Z
|
mmm a / cocos / renderer / backend / metal / Utils . mm <nl> ppp b / cocos / renderer / backend / metal / Utils . mm <nl> <nl> # include " Utils . h " <nl> # include " DeviceMTL . h " <nl> + # include " base / CCConfiguration . h " <nl> <nl> # define COLOR_ATTAHCMENT_PIXEL_FORMAT MTLPixelFormatBGRA8Unorm <nl> <nl> - # if ( CC_TARGET_PLATFORM = = CC_PLATFORM_IOS ) <nl> - # define DEPTH_STENCIL_ATTACHMENT_PIXEL_FORMAT MTLPixelFormatDepth32Float_Stencil8 <nl> - # else <nl> - # define DEPTH_STENCIL_ATTACHMENT_PIXEL_FORMAT MTLPixelFormatDepth24Unorm_Stencil8 <nl> - # endif <nl> - <nl> CC_BACKEND_BEGIN <nl> <nl> id < MTLTexture > Utils : : _defaultColorAttachmentTexture = nil ; <nl> uint8_t getBitsPerElement ( MTLPixelFormat pixleFormat ) <nl> } <nl> return 0 ; <nl> } <nl> + <nl> + MTLPixelFormat getSupportedDepthStencilFormat ( ) <nl> + { <nl> + MTLPixelFormat pixelFormat = MTLPixelFormatDepth32Float_Stencil8 ; <nl> + # if ( CC_TARGET_PLATFORM = = CC_PLATFORM_MAC ) <nl> + bool isDepth24Stencil8PixelFormatSupported = Configuration : : getInstance ( ) - > supportsOESPackedDepthStencil ( ) ; <nl> + if ( isDepth24Stencil8PixelFormatSupported ) <nl> + pixelFormat = MTLPixelFormatDepth24Unorm_Stencil8 ; <nl> + # endif <nl> + return pixelFormat ; <nl> + } <nl> } <nl> <nl> MTLPixelFormat Utils : : getDefaultDepthStencilAttachmentPixelFormat ( ) <nl> { <nl> - return DEPTH_STENCIL_ATTACHMENT_PIXEL_FORMAT ; <nl> + return getSupportedDepthStencilFormat ( ) ; <nl> } <nl> <nl> MTLPixelFormat Utils : : getDefaultColorAttachmentPixelFormat ( ) <nl> uint8_t getBitsPerElement ( MTLPixelFormat pixleFormat ) <nl> <nl> / / on mac , D24S8 means MTLPixelFormatDepth24Unorm_Stencil8 , while on ios it means MTLPixelFormatDepth32Float_Stencil8 <nl> case TextureFormat : : D24S8 : <nl> - return DEPTH_STENCIL_ATTACHMENT_PIXEL_FORMAT ; <nl> + return getSupportedDepthStencilFormat ( ) ; <nl> case TextureFormat : : SYSTEM_DEFAULT : <nl> return COLOR_ATTAHCMENT_PIXEL_FORMAT ; <nl> case TextureFormat : : NONE : <nl> uint8_t getBitsPerElement ( MTLPixelFormat pixleFormat ) <nl> MTLTextureDescriptor * textureDescriptor = [ [ MTLTextureDescriptor alloc ] init ] ; <nl> textureDescriptor . width = CAMetalLayer . drawableSize . width ; <nl> textureDescriptor . height = CAMetalLayer . drawableSize . height ; <nl> - textureDescriptor . pixelFormat = DEPTH_STENCIL_ATTACHMENT_PIXEL_FORMAT ; <nl> + textureDescriptor . pixelFormat = getSupportedDepthStencilFormat ( ) ; <nl> textureDescriptor . resourceOptions = MTLResourceStorageModePrivate ; <nl> textureDescriptor . usage = MTLTextureUsageRenderTarget ; <nl> auto ret = [ CAMetalLayer . device newTextureWithDescriptor : textureDescriptor ] ; <nl>
|
get supported depthStencil pixel format ( )
|
cocos2d/cocos2d-x
|
8faf4a758f499bd1b55decab6f1661e425cb970f
|
2019-05-29T02:46:55Z
|
mmm a / aten / src / ATen / native / cuda / UnarySignKernels . cu <nl> ppp b / aten / src / ATen / native / cuda / UnarySignKernels . cu <nl> void logical_not_kernel_cuda ( TensorIterator & iter ) { <nl> <nl> void neg_kernel_cuda ( TensorIterator & iter ) { <nl> AT_DISPATCH_ALL_TYPES_AND_COMPLEX_AND2 ( ScalarType : : Half , at : : ScalarType : : BFloat16 , iter . dtype ( ) , " neg_cuda " , [ & ] ( ) { <nl> - AT_SKIP_BFLOAT16_IF_NOT_ROCM ( scalar_t , " neg_cuda " , [ & ] { <nl> - gpu_kernel ( iter , [ ] GPU_LAMBDA ( scalar_t a ) - > scalar_t { <nl> - return - a ; <nl> - } ) ; <nl> + gpu_kernel ( iter , [ ] GPU_LAMBDA ( scalar_t a ) - > scalar_t { <nl> + return - a ; <nl> } ) ; <nl> } ) ; <nl> } <nl> mmm a / torch / testing / _internal / common_methods_invocations . py <nl> ppp b / torch / testing / _internal / common_methods_invocations . py <nl> def sample_inputs ( self , device , dtype , requires_grad = False ) : <nl> ref = np . negative , <nl> dtypes = all_types_and_complex_and ( torch . half , torch . bfloat16 ) , <nl> dtypesIfCPU = all_types_and_complex_and ( torch . half , torch . bfloat16 ) , <nl> - dtypesIfCUDA = all_types_and_complex_and ( torch . half ) ) , <nl> + dtypesIfCUDA = all_types_and_complex_and ( torch . half , torch . bfloat16 ) ) , <nl> UnaryUfuncInfo ( ' sin ' , <nl> ref = np . sin , <nl> handles_large_floats = False , <nl>
|
CUDA BFloat16 neg ( )
|
pytorch/pytorch
|
dc9e9c118e97b81466f2cd94df406ae8ed5a8189
|
2020-09-25T18:25:49Z
|
mmm a / tensorflow / go / op / wrappers . go <nl> ppp b / tensorflow / go / op / wrappers . go <nl> func SampleDistortedBoundingBoxMinObjectCovered ( value float32 ) SampleDistortedBo <nl> / / <nl> / / value : The cropped area of the image must have an aspect ratio = <nl> / / width / height within this range . <nl> - / / If not specified , defaults to { f : 0 . 75 f : 1 . 33 } <nl> + / / If not specified , defaults to { f : 0 . 75 f : 1 . 33 } <nl> func SampleDistortedBoundingBoxAspectRatioRange ( value [ ] float32 ) SampleDistortedBoundingBoxAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " aspect_ratio_range " ] = value <nl> func SampleDistortedBoundingBoxAspectRatioRange ( value [ ] float32 ) SampleDistorted <nl> / / <nl> / / value : The cropped area of the image must contain a fraction of the <nl> / / supplied image within this range . <nl> - / / If not specified , defaults to { f : 0 . 05 f : 1 } <nl> + / / If not specified , defaults to { f : 0 . 05 f : 1 } <nl> func SampleDistortedBoundingBoxAreaRange ( value [ ] float32 ) SampleDistortedBoundingBoxAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " area_range " ] = value <nl> func SampleDistortedBoundingBoxV2Seed2 ( value int64 ) SampleDistortedBoundingBoxV2 <nl> / / <nl> / / value : The cropped area of the image must have an aspect ratio = <nl> / / width / height within this range . <nl> - / / If not specified , defaults to { f : 0 . 75 f : 1 . 33 } <nl> + / / If not specified , defaults to { f : 0 . 75 f : 1 . 33 } <nl> func SampleDistortedBoundingBoxV2AspectRatioRange ( value [ ] float32 ) SampleDistortedBoundingBoxV2Attr { <nl> return func ( m optionalAttr ) { <nl> m [ " aspect_ratio_range " ] = value <nl> func SampleDistortedBoundingBoxV2AspectRatioRange ( value [ ] float32 ) SampleDistort <nl> / / <nl> / / value : The cropped area of the image must contain a fraction of the <nl> / / supplied image within this range . <nl> - / / If not specified , defaults to { f : 0 . 05 f : 1 } <nl> + / / If not specified , defaults to { f : 0 . 05 f : 1 } <nl> func SampleDistortedBoundingBoxV2AreaRange ( value [ ] float32 ) SampleDistortedBoundingBoxV2Attr { <nl> return func ( m optionalAttr ) { <nl> m [ " area_range " ] = value <nl> func ImageSummaryMaxImages ( value int64 ) ImageSummaryAttr { <nl> / / ImageSummaryBadColor sets the optional bad_color attribute to value . <nl> / / <nl> / / value : Color to use for pixels with non - finite values . <nl> - / / If not specified , defaults to { dtype : DT_UINT8 tensor_shape : { dim : { size : 4 } } int_val : 255 int_val : 0 int_val : 0 int_val : 255 } <nl> + / / If not specified , defaults to { dtype : DT_UINT8 tensor_shape : { dim : { size : 4 } } int_val : 255 int_val : 0 int_val : 0 int_val : 255 } <nl> func ImageSummaryBadColor ( value tf . Tensor ) ImageSummaryAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " bad_color " ] = value <nl> func Conv3DBackpropFilterV2DataFormat ( value string ) Conv3DBackpropFilterV2Attr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DBackpropFilterV2Dilations ( value [ ] int64 ) Conv3DBackpropFilterV2Attr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv2DBackpropInputDataFormat ( value string ) Conv2DBackpropInputAttr { <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func Conv2DBackpropInputDilations ( value [ ] int64 ) Conv2DBackpropInputAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv2DDataFormat ( value string ) Conv2DAttr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func Conv2DDilations ( value [ ] int64 ) Conv2DAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeOutType ( value tf . DataTy <nl> / / QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : List of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeDilations ( value [ ] int64 ) QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedDepthwiseConv2DWithBiasAndReluOutType ( value tf . DataType ) Quantized <nl> / / QuantizedDepthwiseConv2DWithBiasAndReluDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : List of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedDepthwiseConv2DWithBiasAndReluDilations ( value [ ] int64 ) QuantizedDepthwiseConv2DWithBiasAndReluAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedDepthwiseConv2DWithBiasOutType ( value tf . DataType ) QuantizedDepthwi <nl> / / QuantizedDepthwiseConv2DWithBiasDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : List of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedDepthwiseConv2DWithBiasDilations ( value [ ] int64 ) QuantizedDepthwiseConv2DWithBiasAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedDepthwiseConv2DOutType ( value tf . DataType ) QuantizedDepthwiseConv2D <nl> / / QuantizedDepthwiseConv2DDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : List of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedDepthwiseConv2DDilations ( value [ ] int64 ) QuantizedDepthwiseConv2DAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedConv2DPerChannelOutType ( value tf . DataType ) QuantizedConv2DPerChann <nl> / / QuantizedConv2DPerChannelDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : list of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedConv2DPerChannelDilations ( value [ ] int64 ) QuantizedConv2DPerChannelAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv3DBackpropInputV2DataFormat ( value string ) Conv3DBackpropInputV2Attr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DBackpropInputV2Dilations ( value [ ] int64 ) Conv3DBackpropInputV2Attr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func AvgPool3DGrad ( scope * Scope , orig_input_shape tf . Output , grad tf . Output , ksi <nl> type Conv3DBackpropFilterAttr func ( optionalAttr ) <nl> <nl> / / Conv3DBackpropFilterDilations sets the optional dilations attribute to value . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DBackpropFilterDilations ( value [ ] int64 ) Conv3DBackpropFilterAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv3DDataFormat ( value string ) Conv3DAttr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DDilations ( value [ ] int64 ) Conv3DAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func DepthwiseConv2dNativeBackpropInputDataFormat ( value string ) DepthwiseConv2dN <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func DepthwiseConv2dNativeBackpropInputDilations ( value [ ] int64 ) DepthwiseConv2dNativeBackpropInputAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedConv2DOutType ( value tf . DataType ) QuantizedConv2DAttr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedConv2DDilations ( value [ ] int64 ) QuantizedConv2DAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func DepthwiseConv2dNativeBackpropFilterDataFormat ( value string ) DepthwiseConv2d <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func DepthwiseConv2dNativeBackpropFilterDilations ( value [ ] int64 ) DepthwiseConv2dNativeBackpropFilterAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv2DBackpropFilterDataFormat ( value string ) Conv2DBackpropFilterAttr { <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func Conv2DBackpropFilterDilations ( value [ ] int64 ) Conv2DBackpropFilterAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func CreateJob ( scope * Scope , dataset_id tf . Output , address tf . Output , protocol t <nl> type Conv3DBackpropInputAttr func ( optionalAttr ) <nl> <nl> / / Conv3DBackpropInputDilations sets the optional dilations attribute to value . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DBackpropInputDilations ( value [ ] int64 ) Conv3DBackpropInputAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func DepthwiseConv2dNativeDataFormat ( value string ) DepthwiseConv2dNativeAttr { <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func DepthwiseConv2dNativeDilations ( value [ ] int64 ) DepthwiseConv2dNativeAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl>
|
Go : Update generated wrapper functions for TensorFlow ops .
|
tensorflow/tensorflow
|
df6853ac5b6dbeefa814e67041fc4744c1528629
|
2020-04-21T06:49:12Z
|
mmm a / template / multi - platform - lua / Classes / AppDelegate . cpp <nl> ppp b / template / multi - platform - lua / Classes / AppDelegate . cpp <nl> AppDelegate : : ~ AppDelegate ( ) <nl> bool AppDelegate : : applicationDidFinishLaunching ( ) <nl> { <nl> / / initialize director <nl> - Director * director = Director : : getInstance ( ) ; <nl> + auto director = Director : : getInstance ( ) ; <nl> director - > setOpenGLView ( EGLView : : getInstance ( ) ) ; <nl> <nl> + EGLView : : getInstance ( ) - > setDesignResolutionSize ( 480 , 320 , ResolutionPolicy : : NO_BORDER ) ; <nl> + <nl> / / turn on display FPS <nl> director - > setDisplayStats ( true ) ; <nl> <nl> bool AppDelegate : : applicationDidFinishLaunching ( ) <nl> director - > setAnimationInterval ( 1 . 0 / 60 ) ; <nl> <nl> / / register lua engine <nl> - LuaEngine * engine = LuaEngine : : getInstance ( ) ; <nl> + auto engine = LuaEngine : : getInstance ( ) ; <nl> ScriptEngineManager : : getInstance ( ) - > setScriptEngine ( engine ) ; <nl> <nl> std : : string path = FileUtils : : getInstance ( ) - > fullPathForFilename ( " hello . lua " ) ; <nl>
|
Merge pull request from samuele3hu / developTest
|
cocos2d/cocos2d-x
|
38b618bc4f8e8231bd9b543e16de3684d84055b4
|
2013-09-18T01:36:21Z
|
mmm a / tests / pthread / test_pthread_mandelbrot . cpp <nl> ppp b / tests / pthread / test_pthread_mandelbrot . cpp <nl> pthread_t thread [ MAX_NUM_THREADS ] ; <nl> double timeSpentInMandelbrot [ MAX_NUM_THREADS ] = { } ; <nl> unsigned long long numIters [ MAX_NUM_THREADS ] = { } ; <nl> <nl> + uint32_t numThreadsRunning = 0 ; <nl> + uint32_t maxThreadsRunning = 1 ; <nl> + <nl> bool use_sse = true ; <nl> <nl> int tasksDone = 0 ; <nl> int tasksPending [ MAX_NUM_THREADS ] = { } ; <nl> void * mandelbrot_thread ( void * arg ) <nl> { <nl> int idx = ( int ) arg ; <nl> + emscripten_atomic_add_u32 ( & numThreadsRunning , 1 ) ; <nl> <nl> char threadName [ 32 ] ; <nl> sprintf ( threadName , " Worker % d " , idx ) ; <nl> void register_tasks ( ) <nl> <nl> numTasks = EM_ASM_INT_V ( return parseInt ( document . getElementById ( ' num_threads ' ) . value ) ) ; <nl> if ( numTasks < 1 ) numTasks = 1 ; <nl> - if ( numTasks > MAX_NUM_THREADS ) numTasks = MAX_NUM_THREADS ; <nl> + if ( numTasks > emscripten_num_logical_cores ( ) ) numTasks = emscripten_num_logical_cores ( ) ; <nl> <nl> / / Register tasks . <nl> emscripten_atomic_store_u32 ( & tasksDone , 0 ) ; <nl> void wait_tasks ( ) <nl> / / Wait for each task to finish . <nl> for ( ; ; ) <nl> { <nl> - int td = tasksDone ; <nl> + int td = emscripten_atomic_load_u32 ( & tasksDone ) ; <nl> if ( td > = numTasks ) <nl> break ; <nl> emscripten_futex_wait ( & tasksDone , td , 1 ) ; <nl> void wait_tasks ( ) <nl> <nl> void main_tick ( ) <nl> { <nl> + const int threadsRunning = emscripten_atomic_load_u32 ( & numThreadsRunning ) ; <nl> + if ( threadsRunning < maxThreadsRunning ) return ; <nl> + <nl> wait_tasks ( ) ; <nl> numItersDoneOnCanvas + = numItersPerFrame ; <nl> <nl> int main ( int argc , char * * argv ) <nl> outputImage [ i ] = 0x00000000 ; <nl> <nl> # ifndef SINGLETHREADED <nl> - for ( int i = 0 ; i < MAX_NUM_THREADS ; + + i ) <nl> + maxThreadsRunning = emscripten_num_logical_cores ( ) < MAX_NUM_THREADS ? emscripten_num_logical_cores ( ) : MAX_NUM_THREADS ; <nl> + for ( int i = 0 ; i < maxThreadsRunning ; + + i ) <nl> { <nl> pthread_attr_t attr ; <nl> pthread_attr_init ( & attr ) ; <nl>
|
Improve multithreaded Mandelbrot test to launch correctly even if pthread pool is not used .
|
emscripten-core/emscripten
|
d6f4a9a7e20287d80828233ad26aefc4244222a2
|
2016-06-20T15:10:47Z
|
mmm a / docs / en / operations / tips . md <nl> ppp b / docs / en / operations / tips . md <nl> Most other file systems should also work fine . File systems with delayed allocat <nl> <nl> # # Linux Kernel <nl> <nl> - Don ' t use an outdated Linux kernel . In 2015 , 3 . 18 . 19 was new enough . <nl> - Consider using the kernel build from Yandex : < https : / / github . com / yandex / smart > – it provides at least a 5 % performance increase . <nl> + Don ' t use an outdated Linux kernel . <nl> <nl> # # Network <nl> <nl> mmm a / docs / ru / operations / tips . md <nl> ppp b / docs / ru / operations / tips . md <nl> XFS также подходит , но не так тщательно проте <nl> <nl> # # Ядро Linux <nl> <nl> - Не используйте слишком старое ядро Linux . В 2015 году 3 . 18 . 19 — достаточно свежее . <nl> - Рассмотрите возможность использования сборки ядра от Яндекса : < https : / / github . com / yandex / smart > — это дает прирост в производительности не менее 5 % . <nl> + Не используйте слишком старое ядро Linux . <nl> <nl> # # Сеть <nl> <nl>
|
Updated tips ( tnx . Vladislav U . from the Telegram chat ) [ # CLICKHOUSE - 2 ]
|
ClickHouse/ClickHouse
|
574c4da4199c295af7137e8322211789b3480479
|
2018-10-09T14:38:59Z
|
mmm a / tools / run_tests / run_tests . py <nl> ppp b / tools / run_tests / run_tests . py <nl> def runs_per_test_type ( arg_str ) : <nl> ' clang3 . 4 ' , ' clang3 . 5 ' , ' clang3 . 6 ' , ' clang3 . 7 ' , <nl> ' vs2010 ' , ' vs2013 ' , ' vs2015 ' , <nl> ' python2 . 7 ' , ' python3 . 4 ' , <nl> - ' node0 . 12 ' , ' node4 ' , ' node5 ' , ' node6 ' , ' node7 ' <nl> + ' node0 . 12 ' , ' node4 ' , ' node5 ' , ' node6 ' , ' node7 ' , <nl> ' coreclr ' ] , <nl> default = ' default ' , <nl> help = ' Selects compiler to use . Allowed values depend on the platform and language . ' ) <nl>
|
Add missing comma in run_tests . py
|
grpc/grpc
|
5a3f862153cfbf0e0f49f17e598d8e70522bbe66
|
2016-10-26T20:45:04Z
|
mmm a / third_party / mlir / test / lib / TestDialect / TestOps . td <nl> ppp b / third_party / mlir / test / lib / TestDialect / TestOps . td <nl> def FunctionalRegionOp : TEST_Op < " functional_region_op " , <nl> / / Test Traits <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> - def SameOperandElementTypeOp : TEST_Op < " same_operand_type " , <nl> + def SameOperandElementTypeOp : TEST_Op < " same_operand_element_type " , <nl> [ SameOperandsElementType ] > { <nl> - let arguments = ( ins AnyVectorOrTensor : $ x , AnyVectorOrTensor : $ y ) ; <nl> - let results = ( outs AnyVectorOrTensor : $ res ) ; <nl> + let arguments = ( ins AnyVectorOrTensor , AnyVectorOrTensor ) ; <nl> + let results = ( outs AnyVectorOrTensor ) ; <nl> } <nl> <nl> - def SameOperandAndResultElementTypeOp : TEST_Op < " same_operand_and_result_type " , <nl> + def SameOperandAndResultElementTypeOp : TEST_Op < " same_operand_and_result_element_type " , <nl> [ SameOperandsAndResultElementType ] > { <nl> - let arguments = ( ins Variadic < AnyVectorOrTensor > : $ args ) ; <nl> - let results = ( outs Variadic < AnyVectorOrTensor > : $ res ) ; <nl> + let arguments = ( ins Variadic < AnyVectorOrTensor > ) ; <nl> + let results = ( outs Variadic < AnyVectorOrTensor > ) ; <nl> } <nl> <nl> def SameOperandShapeOp : TEST_Op < " same_operand_shape " , [ SameOperandsShape ] > { <nl> - let arguments = ( ins Variadic < AnyVectorOrTensor > : $ args ) ; <nl> - let results = ( outs AnyVectorOrTensor : $ res ) ; <nl> + let arguments = ( ins Variadic < AnyVectorOrTensor > ) ; <nl> + let results = ( outs AnyVectorOrTensor ) ; <nl> } <nl> <nl> def SameOperandAndResultShapeOp : TEST_Op < " same_operand_and_result_shape " , <nl> [ SameOperandsAndResultShape ] > { <nl> - let arguments = ( ins Variadic < AnyVectorOrTensor > : $ args ) ; <nl> - let results = ( outs Variadic < AnyVectorOrTensor > : $ res ) ; <nl> + let arguments = ( ins Variadic < AnyVectorOrTensor > ) ; <nl> + let results = ( outs Variadic < AnyVectorOrTensor > ) ; <nl> } <nl> <nl> def ArgAndResHaveFixedElementTypesOp : <nl> def IfFirstOperandIsNoneThenSoIsSecond : <nl> } <nl> <nl> def BroadcastableOp : TEST_Op < " broadcastable " , [ Broadcastable ] > { <nl> - let arguments = ( ins AnyTensor : $ x , AnyTensor : $ y ) ; <nl> - let results = ( outs AnyTensor : $ res ) ; <nl> + let arguments = ( ins AnyTensor , AnyTensor ) ; <nl> + let results = ( outs AnyTensor ) ; <nl> } <nl> <nl> / / There the " HasParent " trait . <nl> def I32ElementsAttrOp : TEST_Op < " i32ElementsAttr " > { <nl> <nl> def OpWithInferTypeInterfaceOp : TEST_Op < " op_with_infer_type_if " , <nl> [ DeclareOpInterfaceMethods < InferTypeOpInterface > ] > { <nl> - let arguments = ( ins AnyTensor : $ x , AnyTensor : $ y ) ; <nl> - let results = ( outs AnyTensor : $ res ) ; <nl> + let arguments = ( ins AnyTensor , AnyTensor ) ; <nl> + let results = ( outs AnyTensor ) ; <nl> } <nl> <nl> def IsNotScalar : Constraint < CPred < " $ 0 . getType ( ) . getRank ( ) ! = 0 " > > ; <nl> def UpdateAttr : Pat < ( I32ElementsAttrOp $ attr ) , <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> def OpA : TEST_Op < " op_a " > { <nl> - let arguments = ( ins I32 : $ operand , I32Attr : $ attr ) ; <nl> - let results = ( outs I32 : $ result ) ; <nl> + let arguments = ( ins I32 , I32Attr : $ attr ) ; <nl> + let results = ( outs I32 ) ; <nl> } <nl> <nl> def OpB : TEST_Op < " op_b " > { <nl> - let arguments = ( ins I32 : $ operand , I32Attr : $ attr ) ; <nl> - let results = ( outs I32 : $ result ) ; <nl> + let arguments = ( ins I32 , I32Attr : $ attr ) ; <nl> + let results = ( outs I32 ) ; <nl> } <nl> <nl> / / Test named pattern . <nl> def TestNamedPatternRule : Pat < ( OpA $ input , $ attr ) , ( OpB $ input , $ attr ) > ; <nl> def : Pat < ( OpA ( OpA $ input , $ attr ) , $ bttr ) , ( OpB $ input , $ bttr ) > ; <nl> <nl> / / Test added benefit . <nl> - def OpD : TEST_Op < " op_d " > , Arguments < ( ins I32 : $ arg ) > , Results < ( outs I32 : $ res ) > ; <nl> - def OpE : TEST_Op < " op_e " > , Arguments < ( ins I32 : $ arg ) > , Results < ( outs I32 : $ res ) > ; <nl> - def OpF : TEST_Op < " op_f " > , Arguments < ( ins I32 : $ arg ) > , Results < ( outs I32 : $ res ) > ; <nl> - def OpG : TEST_Op < " op_g " > , Arguments < ( ins I32 : $ arg ) > , Results < ( outs I32 : $ res ) > ; <nl> + def OpD : TEST_Op < " op_d " > , Arguments < ( ins I32 ) > , Results < ( outs I32 ) > ; <nl> + def OpE : TEST_Op < " op_e " > , Arguments < ( ins I32 ) > , Results < ( outs I32 ) > ; <nl> + def OpF : TEST_Op < " op_f " > , Arguments < ( ins I32 ) > , Results < ( outs I32 ) > ; <nl> + def OpG : TEST_Op < " op_g " > , Arguments < ( ins I32 ) > , Results < ( outs I32 ) > ; <nl> / / Verify that bumping benefit results in selecting different op . <nl> def : Pat < ( OpD $ input ) , ( OpE $ input ) > ; <nl> def : Pat < ( OpD $ input ) , ( OpF $ input ) , [ ] , ( addBenefit 10 ) > ; <nl> def : Pat < ( OpG $ input ) , ( OpB $ input , ConstantAttr < I32Attr , " 20 " > : $ attr ) > ; <nl> def : Pat < ( OpG ( OpG $ input ) ) , ( OpB $ input , ConstantAttr < I32Attr , " 34 " > : $ attr ) > ; <nl> <nl> / / Test patterns for zero - result op . <nl> - def OpH : TEST_Op < " op_h " > , Arguments < ( ins I32 : $ arg ) > , Results < ( outs ) > ; <nl> - def OpI : TEST_Op < " op_i " > , Arguments < ( ins I32 : $ arg ) > , Results < ( outs ) > ; <nl> + def OpH : TEST_Op < " op_h " > , Arguments < ( ins I32 ) > , Results < ( outs ) > ; <nl> + def OpI : TEST_Op < " op_i " > , Arguments < ( ins I32 ) > , Results < ( outs ) > ; <nl> def : Pat < ( OpH $ input ) , ( OpI $ input ) > ; <nl> <nl> / / Test patterns for zero - input op . <nl> - def OpJ : TEST_Op < " op_j " > , Arguments < ( ins ) > , Results < ( outs I32 : $ res ) > ; <nl> - def OpK : TEST_Op < " op_k " > , Arguments < ( ins ) > , Results < ( outs I32 : $ res ) > ; <nl> + def OpJ : TEST_Op < " op_j " > , Arguments < ( ins ) > , Results < ( outs I32 ) > ; <nl> + def OpK : TEST_Op < " op_k " > , Arguments < ( ins ) > , Results < ( outs I32 ) > ; <nl> def : Pat < ( OpJ ) , ( OpK ) > ; <nl> <nl> / / Test NativeCodeCall . <nl> def OpNativeCodeCall1 : TEST_Op < " native_code_call1 " > { <nl> BoolAttr : $ choice , <nl> I64Attr : $ attr1 , I64Attr : $ attr2 <nl> ) ; <nl> - let results = ( outs I32 : $ output ) ; <nl> + let results = ( outs I32 ) ; <nl> } <nl> def OpNativeCodeCall2 : TEST_Op < " native_code_call2 " > { <nl> let arguments = ( ins I32 : $ input , I64ArrayAttr : $ attr ) ; <nl> - let results = ( outs I32 : $ output ) ; <nl> + let results = ( outs I32 ) ; <nl> } <nl> / / Native code call to invoke a C + + function <nl> def CreateOperand : NativeCodeCall < " chooseOperand ( $ 0 , $ 1 , $ 2 ) " > ; <nl> def : Pat < ( OpNativeCodeCall1 $ input1 , $ input2 , <nl> / / Test AllAttrConstraintsOf . <nl> def OpAllAttrConstraint1 : TEST_Op < " all_attr_constraint_of1 " > { <nl> let arguments = ( ins I64ArrayAttr : $ attr ) ; <nl> - let results = ( outs I32 : $ output ) ; <nl> + let results = ( outs I32 ) ; <nl> } <nl> def OpAllAttrConstraint2 : TEST_Op < " all_attr_constraint_of2 " > { <nl> let arguments = ( ins I64ArrayAttr : $ attr ) ; <nl> - let results = ( outs I32 : $ output ) ; <nl> + let results = ( outs I32 ) ; <nl> } <nl> def Constraint0 : AttrConstraint < <nl> CPred < " $ _self . cast < ArrayAttr > ( ) . getValue ( ) [ 0 ] . " <nl> def TestOpWithRegionFoldNoSideEffect : TEST_Op < <nl> / / Op for testing folding of outer op with inner ops . <nl> def TestOpWithRegionFold : TEST_Op < " op_with_region_fold " > { <nl> let arguments = ( ins I32 : $ operand ) ; <nl> - let results = ( outs I32 : $ result ) ; <nl> + let results = ( outs I32 ) ; <nl> let regions = ( region SizedRegion < 1 > : $ region ) ; <nl> let hasFolder = 1 ; <nl> } <nl> def TestOpWithRegionFold : TEST_Op < " op_with_region_fold " > { <nl> / / Test symbol binding . <nl> def OpSymbolBindingA : TEST_Op < " symbol_binding_a " , [ ] > { <nl> let arguments = ( ins I32 : $ operand , I64Attr : $ attr ) ; <nl> - let results = ( outs I32 : $ result ) ; <nl> + let results = ( outs I32 ) ; <nl> } <nl> def OpSymbolBindingB : TEST_Op < " symbol_binding_b " , [ ] > { <nl> let arguments = ( ins I32 : $ operand ) ; <nl> - let results = ( outs I32 : $ result ) ; <nl> + let results = ( outs I32 ) ; <nl> <nl> let builders = [ <nl> OpBuilder < <nl> def OpSymbolBindingB : TEST_Op < " symbol_binding_b " , [ ] > { <nl> } <nl> def OpSymbolBindingC : TEST_Op < " symbol_binding_c " , [ ] > { <nl> let arguments = ( ins I32 : $ operand ) ; <nl> - let results = ( outs I32 : $ result ) ; <nl> + let results = ( outs I32 ) ; <nl> let builders = OpSymbolBindingB . builders ; <nl> } <nl> def OpSymbolBindingD : TEST_Op < " symbol_binding_d " , [ ] > { <nl> let arguments = ( ins I32 : $ input1 , I32 : $ input2 , I64Attr : $ attr ) ; <nl> - let results = ( outs I32 : $ result ) ; <nl> + let results = ( outs I32 ) ; <nl> } <nl> def HasOneUse : Constraint < CPred < " $ 0 - > hasOneUse ( ) " > , " has one use " > ; <nl> def : Pattern < <nl> def OpAttrMatch1 : TEST_Op < " match_op_attribute1 " > { <nl> DefaultValuedAttr < I32Attr , " 42 " > : $ default_valued_attr , <nl> I32Attr : $ more_attr <nl> ) ; <nl> - let results = ( outs I32 : $ output ) ; <nl> + let results = ( outs I32 ) ; <nl> } <nl> def OpAttrMatch2 : TEST_Op < " match_op_attribute2 " > { <nl> let arguments = OpAttrMatch1 . arguments ; <nl> - let results = ( outs I32 : $ output ) ; <nl> + let results = ( outs I32 ) ; <nl> } <nl> def MoreConstraint : AttrConstraint < <nl> CPred < " $ _self . cast < IntegerAttr > ( ) . getInt ( ) = = 4 " > , " more constraint " > ; <nl> def OpAttrMatch4 : TEST_Op < " match_op_attribute4 " > { <nl> def : Pat < ( OpAttrMatch3 $ attr ) , ( OpAttrMatch4 ConstUnitAttr , $ attr ) > ; <nl> <nl> / / Test with constant attr . <nl> - def OpC : TEST_Op < " op_c " > , Arguments < ( ins I32 : $ arg ) > , Results < ( outs I32 : $ res ) > ; <nl> + def OpC : TEST_Op < " op_c " > , Arguments < ( ins I32 ) > , Results < ( outs I32 ) > ; <nl> def : Pat < ( OpC $ input ) , ( OpB $ input , ConstantAttr < I32Attr , " 17 " > : $ attr ) > ; <nl> <nl> / / Test string enum attribute in rewrites . <nl> def OneResultOp2 : TEST_Op < " one_result2 " > { <nl> } <nl> <nl> def OneResultOp3 : TEST_Op < " one_result3 " > { <nl> - let arguments = ( ins F32 : $ input ) ; <nl> + let arguments = ( ins F32 ) ; <nl> let results = ( outs I32 : $ result1 ) ; <nl> } <nl> <nl> def : Pattern < <nl> / / Test Patterns ( Variadic Ops ) <nl> <nl> def OneVResOneVOperandOp1 : TEST_Op < " one_variadic_out_one_variadic_in1 " > { <nl> - let arguments = ( ins Variadic < I32 > : $ inputs ) ; <nl> - let results = ( outs Variadic < I32 > : $ outputs ) ; <nl> + let arguments = ( ins Variadic < I32 > ) ; <nl> + let results = ( outs Variadic < I32 > ) ; <nl> } <nl> def OneVResOneVOperandOp2 : TEST_Op < " one_variadic_out_one_variadic_in2 " > { <nl> - let arguments = ( ins Variadic < I32 > : $ inputs ) ; <nl> - let results = ( outs Variadic < I32 > : $ outputs ) ; <nl> + let arguments = ( ins Variadic < I32 > ) ; <nl> + let results = ( outs Variadic < I32 > ) ; <nl> } <nl> <nl> / / Rewrite an op with one variadic operand and one variadic result to <nl> def MixedVResultOp2 : TEST_Op < " mixed_variadic_out2 " , [ SameVariadicResultSize ] > { <nl> def : Pat < ( MixedVResultOp1 ) , ( MixedVResultOp2 ) > ; <nl> <nl> def OneI32ResultOp : TEST_Op < " one_i32_out " > { <nl> - let results = ( outs I32 : $ output ) ; <nl> + let results = ( outs I32 ) ; <nl> } <nl> <nl> def MixedVOperandOp3 : TEST_Op < " mixed_variadic_in3 " , <nl> def MixedVOperandOp3 : TEST_Op < " mixed_variadic_in3 " , <nl> I32Attr : $ count <nl> ) ; <nl> <nl> - let results = ( outs I32 : $ output ) ; <nl> + let results = ( outs I32 ) ; <nl> } <nl> <nl> def MixedVResultOp3 : TEST_Op < " mixed_variadic_out3 " , <nl> def Test_LegalizerEnum_Failure : StrEnumAttrCase < " Failure " > ; <nl> def Test_LegalizerEnum : StrEnumAttr < " Success " , " Failure " , <nl> [ Test_LegalizerEnum_Success , Test_LegalizerEnum_Failure ] > ; <nl> <nl> - def ILLegalOpA : TEST_Op < " illegal_op_a " > , Results < ( outs I32 : $ res ) > ; <nl> - def ILLegalOpB : TEST_Op < " illegal_op_b " > , Results < ( outs I32 : $ res ) > ; <nl> - def ILLegalOpC : TEST_Op < " illegal_op_c " > , Results < ( outs I32 : $ res ) > ; <nl> - def ILLegalOpD : TEST_Op < " illegal_op_d " > , Results < ( outs I32 : $ res ) > ; <nl> - def ILLegalOpE : TEST_Op < " illegal_op_e " > , Results < ( outs I32 : $ res ) > ; <nl> - def ILLegalOpF : TEST_Op < " illegal_op_f " > , Results < ( outs I32 : $ res ) > ; <nl> + def ILLegalOpA : TEST_Op < " illegal_op_a " > , Results < ( outs I32 ) > ; <nl> + def ILLegalOpB : TEST_Op < " illegal_op_b " > , Results < ( outs I32 ) > ; <nl> + def ILLegalOpC : TEST_Op < " illegal_op_c " > , Results < ( outs I32 ) > ; <nl> + def ILLegalOpD : TEST_Op < " illegal_op_d " > , Results < ( outs I32 ) > ; <nl> + def ILLegalOpE : TEST_Op < " illegal_op_e " > , Results < ( outs I32 ) > ; <nl> + def ILLegalOpF : TEST_Op < " illegal_op_f " > , Results < ( outs I32 ) > ; <nl> def LegalOpA : TEST_Op < " legal_op_a " > , <nl> - Arguments < ( ins Test_LegalizerEnum : $ status ) > , Results < ( outs I32 : $ res ) > ; <nl> + Arguments < ( ins Test_LegalizerEnum : $ status ) > , Results < ( outs I32 ) > ; <nl> <nl> / / Check that smaller pattern depths are chosen , i . e . prioritize more direct <nl> / / mappings . <nl> def : Pat < ( ILLegalOpE ) , ( LegalOpA Test_LegalizerEnum_Success ) > ; <nl> <nl> / / Check that patterns use the most up - to - date value when being replaced . <nl> def TestRewriteOp : TEST_Op < " rewrite " > , <nl> - Arguments < ( ins AnyType : $ input ) > , Results < ( outs AnyType : $ res ) > ; <nl> + Arguments < ( ins AnyType ) > , Results < ( outs AnyType ) > ; <nl> def : Pat < ( TestRewriteOp $ input ) , ( replaceWithValue $ input ) > ; <nl> <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> def : Pat < ( TestRewriteOp $ input ) , ( replaceWithValue $ input ) > ; <nl> <nl> def TestRegionBuilderOp : TEST_Op < " region_builder " > ; <nl> def TestReturnOp : TEST_Op < " return " , [ Terminator ] > , <nl> - Arguments < ( ins Variadic < AnyType > : $ inputs ) > ; <nl> + Arguments < ( ins Variadic < AnyType > ) > ; <nl> def TestCastOp : TEST_Op < " cast " > , <nl> - Arguments < ( ins Variadic < AnyType > : $ inputs ) > , Results < ( outs AnyType : $ res ) > ; <nl> + Arguments < ( ins Variadic < AnyType > ) > , Results < ( outs AnyType ) > ; <nl> def TestInvalidOp : TEST_Op < " invalid " , [ Terminator ] > , <nl> - Arguments < ( ins Variadic < AnyType > : $ inputs ) > ; <nl> + Arguments < ( ins Variadic < AnyType > ) > ; <nl> def TestTypeProducerOp : TEST_Op < " type_producer " > , <nl> - Results < ( outs AnyType : $ output ) > ; <nl> + Results < ( outs AnyType ) > ; <nl> def TestTypeConsumerOp : TEST_Op < " type_consumer " > , <nl> - Arguments < ( ins AnyType : $ input ) > ; <nl> + Arguments < ( ins AnyType ) > ; <nl> def TestValidOp : TEST_Op < " valid " , [ Terminator ] > , <nl> - Arguments < ( ins Variadic < AnyType > : $ inputs ) > ; <nl> + Arguments < ( ins Variadic < AnyType > ) > ; <nl> <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> / / Test parser . <nl> def IsolatedRegionOp : TEST_Op < " isolated_region " , [ IsolatedFromAbove ] > { <nl> argument is of index type . <nl> } ] ; <nl> <nl> - let arguments = ( ins Index : $ input ) ; <nl> + let arguments = ( ins Index ) ; <nl> let regions = ( region SizedRegion < 1 > : $ region ) ; <nl> let parser = [ { return : : parse $ cppClass ( parser , result ) ; } ] ; <nl> let printer = [ { return : : print ( p , * this ) ; } ] ; <nl> def WrappingRegionOp : TEST_Op < " wrapping_region " , <nl> parseGenericOperation from the custom parser . <nl> } ] ; <nl> <nl> - let results = ( outs Variadic < AnyType > : $ outputs ) ; <nl> + let results = ( outs Variadic < AnyType > ) ; <nl> let regions = ( region SizedRegion < 1 > : $ region ) ; <nl> let parser = [ { return : : parse $ cppClass ( parser , result ) ; } ] ; <nl> let printer = [ { return : : print ( p , * this ) ; } ] ; <nl>
|
NFC : Cleanup test ops and traits tests
|
tensorflow/tensorflow
|
467e3594ddbe64c356d4d0b71512d17f5e7e1712
|
2019-10-05T17:04:18Z
|
mmm a / test / Interop / Cxx / class / constructors - irgen . swift <nl> ppp b / test / Interop / Cxx / class / constructors - irgen . swift <nl> <nl> / / Target - specific tests for C + + constructor call code generation . <nl> <nl> + / / REQUIRES : rdar70772958 <nl> + <nl> / / RUN : % swift - module - name Swift - target x86_64 - apple - macosx10 . 9 - dump - clang - diagnostics - I % S / Inputs - enable - cxx - interop - emit - ir % s - parse - stdlib - parse - as - library - disable - legacy - type - info | % FileCheck % s - check - prefix = ITANIUM_X64 <nl> / / RUN : % swift - module - name Swift - target armv7 - none - linux - androideabi - dump - clang - diagnostics - I % S / Inputs - enable - cxx - interop - emit - ir % s - parse - stdlib - parse - as - library - disable - legacy - type - info | % FileCheck % s - check - prefix = ITANIUM_ARM <nl> / / RUN : % swift - module - name Swift - target x86_64 - unknown - windows - msvc - dump - clang - diagnostics - I % S / Inputs - enable - cxx - interop - emit - ir % s - parse - stdlib - parse - as - library - disable - legacy - type - info | % FileCheck % s - check - prefix = MICROSOFT_X64 <nl> mmm a / test / Interop / Cxx / class / type - classification - non - trivial - irgen . swift <nl> ppp b / test / Interop / Cxx / class / type - classification - non - trivial - irgen . swift <nl> <nl> / / RUN : % target - swift - frontend - enable - cxx - interop - I % S / Inputs % s - emit - ir | % FileCheck % s <nl> + / / REQUIRES : rdar70772958 <nl> <nl> / / Verify that non - trival / address - only C + + classes are constructed and accessed <nl> / / correctly . Make sure that we correctly IRGen functions that construct <nl>
|
Disable two tests
|
apple/swift
|
6afe07d5f80ac85a4319e726838da9cd8c95ab48
|
2020-10-28T19:22:13Z
|
mmm a / buildscripts / setup_multiversion_mongodb . py <nl> ppp b / buildscripts / setup_multiversion_mongodb . py <nl> <nl> import os <nl> import tempfile <nl> import urllib2 <nl> + import urlparse <nl> import subprocess <nl> import tarfile <nl> import signal <nl> <nl> import traceback <nl> import shutil <nl> import errno <nl> + from contextlib import closing <nl> # To ensure it exists on the system <nl> import gzip <nl> + import zipfile <nl> <nl> # <nl> # Useful script for installing multiple versions of MongoDB on a machine <nl> def links ( self ) : <nl> return self . _links <nl> <nl> def download_links ( self ) : <nl> + # This href is for community builds ; enterprise builds are not browseable . <nl> href = " http : / / dl . mongodb . org / dl / % s / % s " \ <nl> % ( self . platform . lower ( ) , self . arch ) <nl> <nl> def download_links ( self ) : <nl> <nl> links = { } <nl> for line in html . split ( ) : <nl> - match = re . compile ( " http : \ / \ / downloads \ . mongodb \ . org \ / % s / mongodb - % s - % s - ( [ ^ \ " ] * ) \ . tgz " \ <nl> + match = re . compile ( " http : . * / % s / mongodb - % s - % s - ( [ ^ \ " ] * ) \ . ( tgz | zip ) " \ <nl> % ( self . platform . lower ( ) , self . platform . lower ( ) , self . arch ) ) . search ( line ) <nl> <nl> if match = = None : continue <nl> def download_version ( self , version ) : <nl> full_version = urls [ - 1 ] [ 0 ] <nl> url = urls [ - 1 ] [ 1 ] <nl> extract_dir = url . split ( " / " ) [ - 1 ] [ : - 4 ] <nl> + file_suffix = os . path . splitext ( urlparse . urlparse ( url ) . path ) [ 1 ] <nl> <nl> # only download if we don ' t already have the directory <nl> already_downloaded = os . path . isdir ( os . path . join ( self . install_dir , extract_dir ) ) <nl> def download_version ( self , version ) : <nl> % ( version , full_version , extract_dir ) <nl> else : <nl> temp_dir = tempfile . mkdtemp ( ) <nl> - temp_file = tempfile . mktemp ( suffix = " . tgz " ) <nl> + temp_file = tempfile . mktemp ( suffix = file_suffix ) <nl> <nl> data = urllib2 . urlopen ( url ) <nl> <nl> print " Downloading data for version % s ( % s ) . . . " % ( version , full_version ) <nl> + print " Download url is % s " % url <nl> <nl> with open ( temp_file , ' wb ' ) as f : <nl> f . write ( data . read ( ) ) <nl> print " Uncompressing data for version % s ( % s ) . . . " % ( version , full_version ) <nl> <nl> - # Can ' t use cool with syntax b / c of python 2 . 6 <nl> - tf = tarfile . open ( temp_file , ' r : gz ' ) <nl> - <nl> - try : <nl> - tf . extractall ( path = temp_dir ) <nl> - except : <nl> - tf . close ( ) <nl> - raise <nl> - <nl> - tf . close ( ) <nl> + if file_suffix = = " . zip " : <nl> + # Support . zip downloads , used for Windows binaries . <nl> + with zipfile . ZipFile ( temp_file ) as zf : <nl> + zf . extractall ( temp_dir ) <nl> + elif file_suffix = = " . tgz " : <nl> + # Support . tgz downloads , used for Linux binaries . <nl> + with closing ( tarfile . open ( temp_file , ' r : gz ' ) ) as tf : <nl> + tf . extractall ( path = temp_dir ) <nl> + else : <nl> + raise Exception ( " Unsupported file extension % s " % file_suffix ) <nl> <nl> temp_install_dir = os . path . join ( temp_dir , extract_dir ) <nl> <nl> def symlink_version ( self , version , installed_dir ) : <nl> <nl> for executable in os . listdir ( os . path . join ( installed_dir , " bin " ) ) : <nl> <nl> - link_name = " % s - % s " % ( executable , version ) <nl> + executable_name , executable_extension = os . path . splitext ( executable ) <nl> + link_name = " % s - % s % s " % ( executable_name , version , executable_extension ) <nl> <nl> try : <nl> - os . symlink ( os . path . join ( installed_dir , " bin " , executable ) , \ <nl> - os . path . join ( self . link_dir , link_name ) ) <nl> + executable = os . path . join ( installed_dir , " bin " , executable ) <nl> + executable_link = os . path . join ( self . link_dir , link_name ) <nl> + if os . name = = " nt " : <nl> + # os . symlink is not supported on Windows , use a direct method instead . <nl> + def symlink_ms ( source , link_name ) : <nl> + import ctypes <nl> + csl = ctypes . windll . kernel32 . CreateSymbolicLinkW <nl> + csl . argtypes = ( ctypes . c_wchar_p , ctypes . c_wchar_p , ctypes . c_uint32 ) <nl> + csl . restype = ctypes . c_ubyte <nl> + flags = 1 if os . path . isdir ( source ) else 0 <nl> + if csl ( link_name , source . replace ( ' / ' , ' \ \ ' ) , flags ) = = 0 : <nl> + raise ctypes . WinError ( ) <nl> + os . symlink = symlink_ms <nl> + os . symlink ( executable , executable_link ) <nl> except OSError as exc : <nl> if exc . errno = = errno . EEXIST : <nl> pass <nl> def symlink_version ( self , version , installed_dir ) : <nl> <nl> CL_HELP_MESSAGE = \ <nl> " " " <nl> - Downloads and installs particular mongodb versions ( each binary is renamed to include its version ) <nl> - into an install directory and symlinks the binaries with versions to another directory . <nl> + Downloads and installs particular mongodb versions ( each binary is renamed to include its version ) <nl> + into an install directory and symlinks the binaries with versions to another directory . This script <nl> + only supports community builds , not enterprise builds . <nl> <nl> Usage : setup_multiversion_mongodb . py INSTALL_DIR LINK_DIR PLATFORM_AND_ARCH VERSION1 [ VERSION2 VERSION3 . . . ] <nl> <nl> mmm a / etc / evergreen . yml <nl> ppp b / etc / evergreen . yml <nl> functions : <nl> set - o verbose <nl> <nl> rm - rf / data / install / data / multiversion <nl> - $ { python | python } buildscripts / setup_multiversion_mongodb . py / data / install / data / multiversion " Linux / x86_64 " " 2 . 4 " " 2 . 6 " " 3 . 0 " <nl> + $ { python | python } buildscripts / setup_multiversion_mongodb . py / data / install / data / multiversion $ { multiversion_platform_arch | " Linux / x86_64 " } " 2 . 4 " " 2 . 6 " " 3 . 0 " <nl> <nl> pre : <nl> - command : shell . track <nl> buildvariants : <nl> push_bucket : downloads . mongodb . org <nl> push_name : win32 <nl> push_arch : x86_64 - 2008plus <nl> + multiversion_platform_arch : " win32 / x86_64 - 2008plus " <nl> msi_target : msi <nl> content_type : application / zip <nl> compile_flags : - - release - - win - version - min = ws08r2 - j $ ( grep - c ^ processor / proc / cpuinfo ) MONGO_DISTMOD = 2008plus VARIANT_DIR = win32 <nl> buildvariants : <nl> - name : jstestfuzz_sharded_WT <nl> - name : mmap <nl> - name : mongosTest <nl> + - name : multiversion <nl> - name : noPassthrough <nl> - name : noPassthrough_WT <nl> - name : noPassthroughWithMongod <nl>
|
SERVER - 12108 Support Windows binaries for multiversion tests
|
mongodb/mongo
|
44b96032027ad17cdd4ee1b6aaf5a2cf012fcfc8
|
2015-12-21T17:06:09Z
|
mmm a / doc / CMakeLists . txt <nl> ppp b / doc / CMakeLists . txt <nl> if ( DOXYGEN_FOUND ) <nl> <nl> set ( OPENCV_MATHJAX_RELPATH " https : / / cdnjs . cloudflare . com / ajax / libs / mathjax / 2 . 7 . 0 " CACHE STRING " URI to a MathJax installation " ) <nl> <nl> + set ( OPENCV_DOCS_EXCLUDE_CUDA ON ) <nl> + if ( " ; $ { OPENCV_MODULES_EXTRA } ; " MATCHES " ; cudev ; " ) <nl> + set ( OPENCV_DOCS_EXCLUDE_CUDA OFF ) <nl> + list ( APPEND CMAKE_DOXYGEN_ENABLED_SECTIONS " CUDA_MODULES " ) <nl> + endif ( ) <nl> + <nl> # gathering headers <nl> set ( paths_include ) <nl> set ( paths_doc ) <nl> if ( DOXYGEN_FOUND ) <nl> if ( EXISTS " $ { header_dir } " ) <nl> list ( APPEND paths_include " $ { header_dir } " ) <nl> list ( APPEND deps $ { header_dir } ) <nl> + if ( OPENCV_DOCS_EXCLUDE_CUDA ) <nl> + if ( EXISTS " $ { OPENCV_MODULE_opencv_ $ { m } _LOCATION } / include / opencv2 / $ { m } / cuda " ) <nl> + list ( APPEND CMAKE_DOXYGEN_EXCLUDE_LIST " $ { OPENCV_MODULE_opencv_ $ { m } _LOCATION } / include / opencv2 / $ { m } / cuda " ) <nl> + endif ( ) <nl> + file ( GLOB list_cuda_files " $ { OPENCV_MODULE_opencv_ $ { m } _LOCATION } / include / opencv2 / $ { m } / * cuda * . hpp " ) <nl> + if ( list_cuda_files ) <nl> + list ( APPEND CMAKE_DOXYGEN_EXCLUDE_LIST $ { list_cuda_files } ) <nl> + endif ( ) <nl> + endif ( ) <nl> endif ( ) <nl> # doc folder <nl> set ( docs_dir " $ { OPENCV_MODULE_opencv_ $ { m } _LOCATION } / doc " ) <nl> if ( DOXYGEN_FOUND ) <nl> # set export variables <nl> string ( REPLACE " ; " " \ \ \ n " CMAKE_DOXYGEN_INPUT_LIST " $ { rootfile } ; $ { faqfile } ; $ { paths_include } ; $ { paths_hal_interface } ; $ { paths_doc } ; $ { tutorial_path } ; $ { tutorial_py_path } ; $ { tutorial_js_path } ; $ { paths_tutorial } ; $ { tutorial_contrib_root } " ) <nl> string ( REPLACE " ; " " \ \ \ n " CMAKE_DOXYGEN_IMAGE_PATH " $ { paths_doc } ; $ { tutorial_path } ; $ { tutorial_py_path } ; $ { tutorial_js_path } ; $ { paths_tutorial } " ) <nl> + string ( REPLACE " ; " " \ \ \ n " CMAKE_DOXYGEN_EXCLUDE_LIST " $ { CMAKE_DOXYGEN_EXCLUDE_LIST } " ) <nl> + string ( REPLACE " ; " " " CMAKE_DOXYGEN_ENABLED_SECTIONS " $ { CMAKE_DOXYGEN_ENABLED_SECTIONS } " ) <nl> # TODO : remove paths_doc from EXAMPLE_PATH after face module tutorials / samples moved to separate folders <nl> string ( REPLACE " ; " " \ \ \ n " CMAKE_DOXYGEN_EXAMPLE_PATH " $ { example_path } ; $ { paths_doc } ; $ { paths_sample } " ) <nl> set ( CMAKE_DOXYGEN_LAYOUT " $ { CMAKE_CURRENT_BINARY_DIR } / DoxygenLayout . xml " ) <nl> mmm a / doc / Doxyfile . in <nl> ppp b / doc / Doxyfile . in <nl> GENERATE_TODOLIST = YES <nl> GENERATE_TESTLIST = YES <nl> GENERATE_BUGLIST = YES <nl> GENERATE_DEPRECATEDLIST = YES <nl> - ENABLED_SECTIONS = <nl> + ENABLED_SECTIONS = @ CMAKE_DOXYGEN_ENABLED_SECTIONS @ <nl> MAX_INITIALIZER_LINES = 30 <nl> SHOW_USED_FILES = YES <nl> SHOW_FILES = YES <nl> INPUT = @ CMAKE_DOXYGEN_INPUT_LIST @ <nl> INPUT_ENCODING = UTF - 8 <nl> FILE_PATTERNS = <nl> RECURSIVE = YES <nl> - EXCLUDE = <nl> + EXCLUDE = @ CMAKE_DOXYGEN_EXCLUDE_LIST @ <nl> EXCLUDE_SYMLINKS = NO <nl> EXCLUDE_PATTERNS = * . inl . hpp * . impl . hpp * _detail . hpp * / cudev / * * / detail / * . hpp * . m * / opencl / runtime / * <nl> EXCLUDE_SYMBOLS = cv : : DataType < * > cv : : traits : : * int void CV__ * <nl> mmm a / doc / tutorials / gpu / gpu - basics - similarity / gpu_basics_similarity . markdown <nl> ppp b / doc / tutorials / gpu / gpu - basics - similarity / gpu_basics_similarity . markdown <nl> <nl> + @ cond CUDA_MODULES <nl> Similarity check ( PNSR and SSIM ) on the GPU { # tutorial_gpu_basics_similarity } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> @ todo update this tutorial <nl> It may be just the improvement needed for your application to work . You may obse <nl> instance of this on the [ YouTube here ] ( https : / / www . youtube . com / watch ? v = 3_ESXmFlnvY ) . <nl> <nl> @ youtube { 3_ESXmFlnvY } <nl> + @ endcond <nl> mmm a / doc / tutorials / gpu / gpu - thrust - interop / gpu_thrust_interop . markdown <nl> ppp b / doc / tutorials / gpu / gpu - thrust - interop / gpu_thrust_interop . markdown <nl> <nl> + @ cond CUDA_MODULES <nl> Using a cv : : cuda : : GpuMat with thrust { # tutorial_gpu_thrust_interop } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> Next we will determine how many values are greater than 0 by using thrust : : count <nl> <nl> We will use those results to create an output buffer for storing the copied values , we will then use copy_if with the same predicate to populate the output buffer . <nl> Lastly we will download the values into a CPU mat for viewing . <nl> + @ endcond <nl> mmm a / doc / tutorials / gpu / table_of_content_gpu . markdown <nl> ppp b / doc / tutorials / gpu / table_of_content_gpu . markdown <nl> <nl> + @ cond CUDA_MODULES <nl> GPU - Accelerated Computer Vision ( cuda module ) { # tutorial_table_of_content_gpu } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> run the OpenCV algorithms . <nl> <nl> This tutorial will show you how to wrap a GpuMat into a thrust iterator in order to be able to <nl> use the functions in the thrust library . <nl> + @ endcond <nl> mmm a / doc / tutorials / introduction / transition_guide / transition_guide . markdown <nl> ppp b / doc / tutorials / introduction / transition_guide / transition_guide . markdown <nl> for ( ; ; ) { <nl> <nl> CUDA { # tutorial_transition_hints_cuda } <nl> mmm - <nl> - _cuda_ module has been split into several smaller pieces : <nl> + <nl> + CUDA modules has been moved into opencv_contrib repository . <nl> + <nl> + @ cond CUDA_MODULES <nl> - _cuda_ - @ ref cuda <nl> - _cudaarithm_ - @ ref cudaarithm <nl> - _cudabgsegm_ - @ ref cudabgsegm <nl> _cuda_ module has been split into several smaller pieces : <nl> - _cudastereo_ - @ ref cudastereo <nl> - _cudawarping_ - @ ref cudawarping <nl> - _cudev_ - @ ref cudev <nl> - <nl> - ` gpu ` namespace has been removed , use cv : : cuda namespace instead . Many classes has also been renamed , for example : <nl> - - ` gpu : : FAST_GPU ` - > cv : : cuda : : FastFeatureDetector <nl> - - ` gpu : : createBoxFilter_GPU ` - > cv : : cuda : : createBoxFilter <nl> + @ endcond <nl> <nl> Documentation format { # tutorial_transition_docs } <nl> mmmmmmmmmmmmmmmmmm - - <nl> mmm a / doc / tutorials / tutorials . markdown <nl> ppp b / doc / tutorials / tutorials . markdown <nl> As always , we would be happy to hear your comments and receive your contribution <nl> <nl> Learn how to create beautiful photo panoramas and more with OpenCV stitching pipeline . <nl> <nl> + @ cond CUDA_MODULES <nl> - @ subpage tutorial_table_of_content_gpu <nl> <nl> Squeeze out every <nl> little computational power from your system by utilizing the power of your video card to run the <nl> OpenCV algorithms . <nl> + @ endcond <nl> <nl> - @ subpage tutorial_table_of_content_ios <nl> <nl>
|
Merge pull request from alalek : fix_documentation_build
|
opencv/opencv
|
66fdddc3390578f116642bbbbb317cdde0d28725
|
2018-09-28T14:16:25Z
|
mmm a / src / video_core / renderer_vulkan / vk_scheduler . cpp <nl> ppp b / src / video_core / renderer_vulkan / vk_scheduler . cpp <nl> <nl> / / Refer to the license . txt file included . <nl> <nl> # include " common / assert . h " <nl> - # include " common / logging / log . h " <nl> + # include " common / microprofile . h " <nl> # include " video_core / renderer_vulkan / declarations . h " <nl> # include " video_core / renderer_vulkan / vk_device . h " <nl> # include " video_core / renderer_vulkan / vk_resource_manager . h " <nl> <nl> <nl> namespace Vulkan { <nl> <nl> + MICROPROFILE_DECLARE ( Vulkan_WaitForWorker ) ; <nl> + <nl> + void VKScheduler : : CommandChunk : : ExecuteAll ( vk : : CommandBuffer cmdbuf , <nl> + const vk : : DispatchLoaderDynamic & dld ) { <nl> + auto command = first ; <nl> + while ( command ! = nullptr ) { <nl> + auto next = command - > GetNext ( ) ; <nl> + command - > Execute ( cmdbuf , dld ) ; <nl> + command - > ~ Command ( ) ; <nl> + command = next ; <nl> + } <nl> + <nl> + command_offset = 0 ; <nl> + first = nullptr ; <nl> + last = nullptr ; <nl> + } <nl> + <nl> VKScheduler : : VKScheduler ( const VKDevice & device , VKResourceManager & resource_manager ) <nl> - : device { device } , resource_manager { resource_manager } { <nl> - next_fence = & resource_manager . CommitFence ( ) ; <nl> + : device { device } , resource_manager { resource_manager } , next_fence { <nl> + & resource_manager . CommitFence ( ) } { <nl> + AcquireNewChunk ( ) ; <nl> AllocateNewContext ( ) ; <nl> + worker_thread = std : : thread ( & VKScheduler : : WorkerThread , this ) ; <nl> } <nl> <nl> - VKScheduler : : ~ VKScheduler ( ) = default ; <nl> + VKScheduler : : ~ VKScheduler ( ) { <nl> + quit = true ; <nl> + cv . notify_all ( ) ; <nl> + worker_thread . join ( ) ; <nl> + } <nl> <nl> void VKScheduler : : Flush ( bool release_fence , vk : : Semaphore semaphore ) { <nl> SubmitExecution ( semaphore ) ; <nl> - if ( release_fence ) <nl> + if ( release_fence ) { <nl> current_fence - > Release ( ) ; <nl> + } <nl> AllocateNewContext ( ) ; <nl> } <nl> <nl> void VKScheduler : : Finish ( bool release_fence , vk : : Semaphore semaphore ) { <nl> SubmitExecution ( semaphore ) ; <nl> current_fence - > Wait ( ) ; <nl> - if ( release_fence ) <nl> + if ( release_fence ) { <nl> current_fence - > Release ( ) ; <nl> + } <nl> AllocateNewContext ( ) ; <nl> } <nl> <nl> + void VKScheduler : : WaitWorker ( ) { <nl> + MICROPROFILE_SCOPE ( Vulkan_WaitForWorker ) ; <nl> + DispatchWork ( ) ; <nl> + <nl> + bool finished = false ; <nl> + do { <nl> + cv . notify_all ( ) ; <nl> + std : : unique_lock lock { mutex } ; <nl> + finished = chunk_queue . Empty ( ) ; <nl> + } while ( ! finished ) ; <nl> + } <nl> + <nl> + void VKScheduler : : DispatchWork ( ) { <nl> + if ( chunk - > Empty ( ) ) { <nl> + return ; <nl> + } <nl> + chunk_queue . Push ( std : : move ( chunk ) ) ; <nl> + cv . notify_all ( ) ; <nl> + AcquireNewChunk ( ) ; <nl> + } <nl> + <nl> + void VKScheduler : : RequestRenderpass ( const vk : : RenderPassBeginInfo & renderpass_bi ) { <nl> + if ( state . renderpass & & renderpass_bi = = * state . renderpass ) { <nl> + return ; <nl> + } <nl> + const bool end_renderpass = state . renderpass . has_value ( ) ; <nl> + state . renderpass = renderpass_bi ; <nl> + Record ( [ renderpass_bi , end_renderpass ] ( auto cmdbuf , auto & dld ) { <nl> + if ( end_renderpass ) { <nl> + cmdbuf . endRenderPass ( dld ) ; <nl> + } <nl> + cmdbuf . beginRenderPass ( renderpass_bi , vk : : SubpassContents : : eInline , dld ) ; <nl> + } ) ; <nl> + } <nl> + <nl> + void VKScheduler : : RequestOutsideRenderPassOperationContext ( ) { <nl> + EndRenderPass ( ) ; <nl> + } <nl> + <nl> + void VKScheduler : : BindGraphicsPipeline ( vk : : Pipeline pipeline ) { <nl> + if ( state . graphics_pipeline = = pipeline ) { <nl> + return ; <nl> + } <nl> + state . graphics_pipeline = pipeline ; <nl> + Record ( [ pipeline ] ( auto cmdbuf , auto & dld ) { <nl> + cmdbuf . bindPipeline ( vk : : PipelineBindPoint : : eGraphics , pipeline , dld ) ; <nl> + } ) ; <nl> + } <nl> + <nl> + void VKScheduler : : WorkerThread ( ) { <nl> + std : : unique_lock lock { mutex } ; <nl> + do { <nl> + cv . wait ( lock , [ this ] { return ! chunk_queue . Empty ( ) | | quit ; } ) ; <nl> + if ( quit ) { <nl> + continue ; <nl> + } <nl> + auto extracted_chunk = std : : move ( chunk_queue . Front ( ) ) ; <nl> + chunk_queue . Pop ( ) ; <nl> + extracted_chunk - > ExecuteAll ( current_cmdbuf , device . GetDispatchLoader ( ) ) ; <nl> + chunk_reserve . Push ( std : : move ( extracted_chunk ) ) ; <nl> + } while ( ! quit ) ; <nl> + } <nl> + <nl> void VKScheduler : : SubmitExecution ( vk : : Semaphore semaphore ) { <nl> + EndPendingOperations ( ) ; <nl> + InvalidateState ( ) ; <nl> + WaitWorker ( ) ; <nl> + <nl> + std : : unique_lock lock { mutex } ; <nl> + <nl> + const auto queue = device . GetGraphicsQueue ( ) ; <nl> const auto & dld = device . GetDispatchLoader ( ) ; <nl> current_cmdbuf . end ( dld ) ; <nl> <nl> - const auto queue = device . GetGraphicsQueue ( ) ; <nl> - const vk : : SubmitInfo submit_info ( 0 , nullptr , nullptr , 1 , & current_cmdbuf , semaphore ? 1u : 0u , <nl> + const vk : : SubmitInfo submit_info ( 0 , nullptr , nullptr , 1 , & current_cmdbuf , semaphore ? 1U : 0U , <nl> & semaphore ) ; <nl> - queue . submit ( { submit_info } , * current_fence , dld ) ; <nl> + queue . submit ( { submit_info } , static_cast < vk : : Fence > ( * current_fence ) , dld ) ; <nl> } <nl> <nl> void VKScheduler : : AllocateNewContext ( ) { <nl> + std : : unique_lock lock { mutex } ; <nl> current_fence = next_fence ; <nl> - current_cmdbuf = resource_manager . CommitCommandBuffer ( * current_fence ) ; <nl> next_fence = & resource_manager . CommitFence ( ) ; <nl> <nl> - const auto & dld = device . GetDispatchLoader ( ) ; <nl> - current_cmdbuf . begin ( { vk : : CommandBufferUsageFlagBits : : eOneTimeSubmit } , dld ) ; <nl> + current_cmdbuf = resource_manager . CommitCommandBuffer ( * current_fence ) ; <nl> + current_cmdbuf . begin ( { vk : : CommandBufferUsageFlagBits : : eOneTimeSubmit } , <nl> + device . GetDispatchLoader ( ) ) ; <nl> + } <nl> + <nl> + void VKScheduler : : InvalidateState ( ) { <nl> + state . graphics_pipeline = nullptr ; <nl> + state . viewports = false ; <nl> + state . scissors = false ; <nl> + state . depth_bias = false ; <nl> + state . blend_constants = false ; <nl> + state . depth_bounds = false ; <nl> + state . stencil_values = false ; <nl> + } <nl> + <nl> + void VKScheduler : : EndPendingOperations ( ) { <nl> + EndRenderPass ( ) ; <nl> + } <nl> + <nl> + void VKScheduler : : EndRenderPass ( ) { <nl> + if ( ! state . renderpass ) { <nl> + return ; <nl> + } <nl> + state . renderpass = std : : nullopt ; <nl> + Record ( [ ] ( auto cmdbuf , auto & dld ) { cmdbuf . endRenderPass ( dld ) ; } ) ; <nl> + } <nl> + <nl> + void VKScheduler : : AcquireNewChunk ( ) { <nl> + if ( chunk_reserve . Empty ( ) ) { <nl> + chunk = std : : make_unique < CommandChunk > ( ) ; <nl> + return ; <nl> + } <nl> + chunk = std : : move ( chunk_reserve . Front ( ) ) ; <nl> + chunk_reserve . Pop ( ) ; <nl> } <nl> <nl> } / / namespace Vulkan <nl> mmm a / src / video_core / renderer_vulkan / vk_scheduler . h <nl> ppp b / src / video_core / renderer_vulkan / vk_scheduler . h <nl> <nl> <nl> # pragma once <nl> <nl> + # include < condition_variable > <nl> + # include < memory > <nl> + # include < optional > <nl> + # include < stack > <nl> + # include < thread > <nl> + # include < utility > <nl> # include " common / common_types . h " <nl> + # include " common / threadsafe_queue . h " <nl> # include " video_core / renderer_vulkan / declarations . h " <nl> <nl> namespace Vulkan { <nl> class VKFenceView { <nl> VKFence * const & fence ; <nl> } ; <nl> <nl> - class VKCommandBufferView { <nl> + / / / The scheduler abstracts command buffer and fence management with an interface that ' s able to do <nl> + / / / OpenGL - like operations on Vulkan command buffers . <nl> + class VKScheduler { <nl> public : <nl> - VKCommandBufferView ( ) = default ; <nl> - VKCommandBufferView ( const vk : : CommandBuffer & cmdbuf ) : cmdbuf { cmdbuf } { } <nl> + explicit VKScheduler ( const VKDevice & device , VKResourceManager & resource_manager ) ; <nl> + ~ VKScheduler ( ) ; <nl> + <nl> + / / / Sends the current execution context to the GPU . <nl> + void Flush ( bool release_fence = true , vk : : Semaphore semaphore = nullptr ) ; <nl> + <nl> + / / / Sends the current execution context to the GPU and waits for it to complete . <nl> + void Finish ( bool release_fence = true , vk : : Semaphore semaphore = nullptr ) ; <nl> + <nl> + / / / Waits for the worker thread to finish executing everything . After this function returns it ' s <nl> + / / / safe to touch worker resources . <nl> + void WaitWorker ( ) ; <nl> + <nl> + / / / Sends currently recorded work to the worker thread . <nl> + void DispatchWork ( ) ; <nl> + <nl> + / / / Requests to begin a renderpass . <nl> + void RequestRenderpass ( const vk : : RenderPassBeginInfo & renderpass_bi ) ; <nl> + <nl> + / / / Requests the current executino context to be able to execute operations only allowed outside <nl> + / / / of a renderpass . <nl> + void RequestOutsideRenderPassOperationContext ( ) ; <nl> + <nl> + / / / Binds a pipeline to the current execution context . <nl> + void BindGraphicsPipeline ( vk : : Pipeline pipeline ) ; <nl> <nl> - const vk : : CommandBuffer * operator - > ( ) const noexcept { <nl> - return & cmdbuf ; <nl> + / / / Returns true when viewports have been set in the current command buffer . <nl> + bool TouchViewports ( ) { <nl> + return std : : exchange ( state . viewports , true ) ; <nl> } <nl> <nl> - operator vk : : CommandBuffer ( ) const noexcept { <nl> - return cmdbuf ; <nl> + / / / Returns true when scissors have been set in the current command buffer . <nl> + bool TouchScissors ( ) { <nl> + return std : : exchange ( state . scissors , true ) ; <nl> } <nl> <nl> - private : <nl> - const vk : : CommandBuffer & cmdbuf ; <nl> - } ; <nl> + / / / Returns true when depth bias have been set in the current command buffer . <nl> + bool TouchDepthBias ( ) { <nl> + return std : : exchange ( state . depth_bias , true ) ; <nl> + } <nl> <nl> - / / / The scheduler abstracts command buffer and fence management with an interface that ' s able to do <nl> - / / / OpenGL - like operations on Vulkan command buffers . <nl> - class VKScheduler { <nl> - public : <nl> - explicit VKScheduler ( const VKDevice & device , VKResourceManager & resource_manager ) ; <nl> - ~ VKScheduler ( ) ; <nl> + / / / Returns true when blend constants have been set in the current command buffer . <nl> + bool TouchBlendConstants ( ) { <nl> + return std : : exchange ( state . blend_constants , true ) ; <nl> + } <nl> + <nl> + / / / Returns true when depth bounds have been set in the current command buffer . <nl> + bool TouchDepthBounds ( ) { <nl> + return std : : exchange ( state . depth_bounds , true ) ; <nl> + } <nl> + <nl> + / / / Returns true when stencil values have been set in the current command buffer . <nl> + bool TouchStencilValues ( ) { <nl> + return std : : exchange ( state . stencil_values , true ) ; <nl> + } <nl> + <nl> + / / / Send work to a separate thread . <nl> + template < typename T > <nl> + void Record ( T & & command ) { <nl> + if ( chunk - > Record ( command ) ) { <nl> + return ; <nl> + } <nl> + DispatchWork ( ) ; <nl> + ( void ) chunk - > Record ( command ) ; <nl> + } <nl> <nl> / / / Gets a reference to the current fence . <nl> VKFenceView GetFence ( ) const { <nl> return current_fence ; <nl> } <nl> <nl> - / / / Gets a reference to the current command buffer . <nl> - VKCommandBufferView GetCommandBuffer ( ) const { <nl> - return current_cmdbuf ; <nl> - } <nl> + private : <nl> + class Command { <nl> + public : <nl> + virtual ~ Command ( ) = default ; <nl> <nl> - / / / Sends the current execution context to the GPU . <nl> - void Flush ( bool release_fence = true , vk : : Semaphore semaphore = nullptr ) ; <nl> + virtual void Execute ( vk : : CommandBuffer cmdbuf , <nl> + const vk : : DispatchLoaderDynamic & dld ) const = 0 ; <nl> <nl> - / / / Sends the current execution context to the GPU and waits for it to complete . <nl> - void Finish ( bool release_fence = true , vk : : Semaphore semaphore = nullptr ) ; <nl> + Command * GetNext ( ) const { <nl> + return next ; <nl> + } <nl> + <nl> + void SetNext ( Command * next_ ) { <nl> + next = next_ ; <nl> + } <nl> + <nl> + private : <nl> + Command * next = nullptr ; <nl> + } ; <nl> + <nl> + template < typename T > <nl> + class TypedCommand final : public Command { <nl> + public : <nl> + explicit TypedCommand ( T & & command ) : command { std : : move ( command ) } { } <nl> + ~ TypedCommand ( ) override = default ; <nl> + <nl> + TypedCommand ( TypedCommand & & ) = delete ; <nl> + TypedCommand & operator = ( TypedCommand & & ) = delete ; <nl> + <nl> + void Execute ( vk : : CommandBuffer cmdbuf , <nl> + const vk : : DispatchLoaderDynamic & dld ) const override { <nl> + command ( cmdbuf , dld ) ; <nl> + } <nl> + <nl> + private : <nl> + T command ; <nl> + } ; <nl> + <nl> + class CommandChunk final { <nl> + public : <nl> + void ExecuteAll ( vk : : CommandBuffer cmdbuf , const vk : : DispatchLoaderDynamic & dld ) ; <nl> + <nl> + template < typename T > <nl> + bool Record ( T & command ) { <nl> + using FuncType = TypedCommand < T > ; <nl> + static_assert ( sizeof ( FuncType ) < sizeof ( data ) , " Lambda is too large " ) ; <nl> + <nl> + if ( command_offset > sizeof ( data ) - sizeof ( FuncType ) ) { <nl> + return false ; <nl> + } <nl> + <nl> + Command * current_last = last ; <nl> + <nl> + last = new ( data . data ( ) + command_offset ) FuncType ( std : : move ( command ) ) ; <nl> + <nl> + if ( current_last ) { <nl> + current_last - > SetNext ( last ) ; <nl> + } else { <nl> + first = last ; <nl> + } <nl> + <nl> + command_offset + = sizeof ( FuncType ) ; <nl> + return true ; <nl> + } <nl> + <nl> + bool Empty ( ) const { <nl> + return command_offset = = 0 ; <nl> + } <nl> + <nl> + private : <nl> + Command * first = nullptr ; <nl> + Command * last = nullptr ; <nl> + <nl> + std : : size_t command_offset = 0 ; <nl> + std : : array < u8 , 0x8000 > data { } ; <nl> + } ; <nl> + <nl> + void WorkerThread ( ) ; <nl> <nl> - private : <nl> void SubmitExecution ( vk : : Semaphore semaphore ) ; <nl> <nl> void AllocateNewContext ( ) ; <nl> <nl> + void InvalidateState ( ) ; <nl> + <nl> + void EndPendingOperations ( ) ; <nl> + <nl> + void EndRenderPass ( ) ; <nl> + <nl> + void AcquireNewChunk ( ) ; <nl> + <nl> const VKDevice & device ; <nl> VKResourceManager & resource_manager ; <nl> vk : : CommandBuffer current_cmdbuf ; <nl> VKFence * current_fence = nullptr ; <nl> VKFence * next_fence = nullptr ; <nl> + <nl> + struct State { <nl> + std : : optional < vk : : RenderPassBeginInfo > renderpass ; <nl> + vk : : Pipeline graphics_pipeline ; <nl> + bool viewports = false ; <nl> + bool scissors = false ; <nl> + bool depth_bias = false ; <nl> + bool blend_constants = false ; <nl> + bool depth_bounds = false ; <nl> + bool stencil_values = false ; <nl> + } state ; <nl> + <nl> + std : : unique_ptr < CommandChunk > chunk ; <nl> + std : : thread worker_thread ; <nl> + <nl> + Common : : SPSCQueue < std : : unique_ptr < CommandChunk > > chunk_queue ; <nl> + Common : : SPSCQueue < std : : unique_ptr < CommandChunk > > chunk_reserve ; <nl> + std : : mutex mutex ; <nl> + std : : condition_variable cv ; <nl> + bool quit = false ; <nl> } ; <nl> <nl> } / / namespace Vulkan <nl>
|
Merge pull request from ReinUsesLisp / vk - scheduler
|
yuzu-emu/yuzu
|
d53cf05513947d29c48c3b6ade4f92326b4f0a02
|
2019-12-19T03:04:08Z
|
mmm a / tensorflow / workspace . bzl <nl> ppp b / tensorflow / workspace . bzl <nl> def tf_repositories ( path_prefix = " " , tf_repo_name = " " ) : <nl> ) <nl> <nl> # Check out LLVM and MLIR from llvm - project . <nl> - LLVM_COMMIT = " 2e1a737f46460ddc15733f78acb42e27bc18a5ee " <nl> - LLVM_SHA256 = " 577112564ad1c44b6acde837740231235d0fc0ec5593a51fdae1d8696364e110 " <nl> + LLVM_COMMIT = " c56bbb3961e460cdff96c200068c073dd5d9f5cc " <nl> + LLVM_SHA256 = " a0bb508e62e7bfc4dfa252594f8dafebd17518b1486305b8de79b2dfd626705a " <nl> LLVM_URLS = [ <nl> " https : / / storage . googleapis . com / mirror . tensorflow . org / github . com / llvm / llvm - project / archive / { commit } . tar . gz " . format ( commit = LLVM_COMMIT ) , <nl> " https : / / github . com / llvm / llvm - project / archive / { commit } . tar . gz " . format ( commit = LLVM_COMMIT ) , <nl>
|
Integrate LLVM at llvm / llvm - project @ c56bbb3961e4
|
tensorflow/tensorflow
|
ed302386d0242f4b961fc34368cdd2549517f746
|
2020-10-28T12:55:43Z
|
mmm a / lib / Sema / CSApply . cpp <nl> ppp b / lib / Sema / CSApply . cpp <nl> namespace { <nl> <nl> / / Get the _MaxBuiltinFloatType decl , or look for it if it ' s not cached . <nl> auto maxFloatTypeDecl = ctx . get_MaxBuiltinFloatTypeDecl ( ) ; <nl> - <nl> - if ( ! maxFloatTypeDecl | | <nl> - ! maxFloatTypeDecl - > getDeclaredInterfaceType ( ) - > is < BuiltinFloatType > ( ) ) { <nl> - ctx . Diags . diagnose ( expr - > getLoc ( ) , diag : : no_MaxBuiltinFloatType_found ) ; <nl> - return nullptr ; <nl> - } <nl> + / / Presence of this declaration has been validated in CSGen . <nl> + assert ( maxFloatTypeDecl ) ; <nl> <nl> auto maxType = maxFloatTypeDecl - > getUnderlyingType ( ) ; <nl> <nl> mmm a / lib / Sema / CSGen . cpp <nl> ppp b / lib / Sema / CSGen . cpp <nl> namespace { <nl> return visitLiteralExpr ( expr ) ; <nl> } <nl> <nl> + Type visitFloatLiteralExpr ( FloatLiteralExpr * expr ) { <nl> + auto & ctx = CS . getASTContext ( ) ; <nl> + / / Get the _MaxBuiltinFloatType decl , or look for it if it ' s not cached . <nl> + auto maxFloatTypeDecl = ctx . get_MaxBuiltinFloatTypeDecl ( ) ; <nl> + <nl> + if ( ! maxFloatTypeDecl | | <nl> + ! maxFloatTypeDecl - > getDeclaredInterfaceType ( ) - > is < BuiltinFloatType > ( ) ) { <nl> + ctx . Diags . diagnose ( expr - > getLoc ( ) , diag : : no_MaxBuiltinFloatType_found ) ; <nl> + return nullptr ; <nl> + } <nl> + <nl> + return visitLiteralExpr ( expr ) ; <nl> + } <nl> + <nl> Type visitLiteralExpr ( LiteralExpr * expr ) { <nl> / / If the expression has already been assigned a type ; just use that type . <nl> if ( expr - > getType ( ) ) <nl>
|
[ CSGen ] Validate presence of ` _MaxBuiltinFloatType ` before generating constraints for float literals
|
apple/swift
|
81c3f626389dfa328f764fe7f5ae31dd4c04df7d
|
2020-02-18T00:09:11Z
|
mmm a / src / yuzu / main . cpp <nl> ppp b / src / yuzu / main . cpp <nl> void GMainWindow : : OnGameListOpenFolder ( GameListOpenTarget target , const std : : str <nl> case GameListOpenTarget : : SaveData : { <nl> open_target = tr ( " Save Data " ) ; <nl> const std : : string nand_dir = FileUtil : : GetUserPath ( FileUtil : : UserPath : : NANDDir ) ; <nl> - ASSERT ( program_id ! = 0 ) ; <nl> <nl> if ( has_user_save ) { <nl> / / User save data <nl>
|
main : Remove assert for opening savedata when program_id = 0
|
yuzu-emu/yuzu
|
cd814bfdfee631bca465db1810df648267f439b8
|
2020-07-29T10:50:30Z
|
mmm a / tools / depends / target / openssl / Makefile <nl> ppp b / tools / depends / target / openssl / Makefile <nl> endif <nl> ifeq ( $ ( OS ) , darwin_embedded ) <nl> ifeq ( $ ( TARGET_PLATFORM ) , appletvos ) <nl> # Need to add " no - async " to avoid " ' setcontext ' is unavailable : not available on tvOS " error <nl> - CONFIGURE = . / Configure iphoneos - cross no - shared zlib no - asm no - async - - prefix = $ ( PREFIX ) <nl> + CONFIGURE = . / Configure iphoneos - cross no - shared zlib no - async - - prefix = $ ( PREFIX ) <nl> else <nl> - CONFIGURE = . / Configure iphoneos - cross no - shared zlib no - asm - - prefix = $ ( PREFIX ) <nl> + CONFIGURE = . / Configure iphoneos - cross no - shared zlib - - prefix = $ ( PREFIX ) <nl> endif <nl> endif <nl> ifeq ( $ ( OS ) , osx ) <nl>
|
[ depends / target ] darwinembedded openssl enable asm
|
xbmc/xbmc
|
49ef30a227d057b565c9f0ca3b8f2f29172a26f1
|
2020-08-01T20:31:48Z
|
mmm a / lib / Sema / CSApply . cpp <nl> ppp b / lib / Sema / CSApply . cpp <nl> bool ConstraintSystem : : applySolutionFix ( Expr * expr , <nl> DC ) ; <nl> if ( ! useAs & & ! useAsBang ) <nl> return false ; <nl> + <nl> + / / If we ' re performing pattern matching , " as " means something completely different . . . <nl> + if ( auto binOpExpr = dyn_cast < BinaryExpr > ( expr ) ) { <nl> + auto overloadedFn = dyn_cast < OverloadedDeclRefExpr > ( binOpExpr - > getFn ( ) ) ; <nl> + if ( overloadedFn & & overloadedFn - > getDecls ( ) . size ( ) > 0 ) { <nl> + ValueDecl * decl0 = overloadedFn - > getDecls ( ) [ 0 ] ; <nl> + if ( decl0 - > getBaseName ( ) = = decl0 - > getASTContext ( ) . Id_MatchOperator ) <nl> + return false ; <nl> + } <nl> + } <nl> <nl> bool needsParensInside = exprNeedsParensBeforeAddingAs ( TC , DC , affected ) ; <nl> bool needsParensOutside = exprNeedsParensAfterAddingAs ( TC , DC , affected , <nl> mmm a / test / stdlib / StringDiagnostics . swift <nl> ppp b / test / stdlib / StringDiagnostics . swift <nl> func testAmbiguousStringComparisons ( s : String ) { <nl> let a10 = nsString < = s / / expected - error { { ' NSString ' is not implicitly convertible to ' String ' ; did you mean to use ' as ' to explicitly convert ? } } { { 21 - 21 = as String } } <nl> let a11 = nsString > = s / / expected - error { { ' NSString ' is not implicitly convertible to ' String ' ; did you mean to use ' as ' to explicitly convert ? } } { { 21 - 21 = as String } } <nl> let a12 = nsString > s / / expected - error { { ' NSString ' is not implicitly convertible to ' String ' ; did you mean to use ' as ' to explicitly convert ? } } { { 21 - 21 = as String } } <nl> + <nl> + / / Shouldn ' t suggest ' as ' in a pattern - matching context , as opposed to all these other situations <nl> + if case nsString = " " { } / / expected - error { { expression pattern of type ' NSString ' cannot match values of type ' String ' } } <nl> } <nl> <nl> func testStringDeprecation ( hello : String ) { <nl>
|
Merge pull request from gregomni / 6204
|
apple/swift
|
20a488225ad3703c11b1b0b6dff835ec7f16382e
|
2017-11-07T18:02:58Z
|
mmm a / CMake / HPHPFindLibs . cmake <nl> ppp b / CMake / HPHPFindLibs . cmake <nl> macro ( hphp_link target ) <nl> target_link_libraries ( $ { target } $ { RT_LIB } ) <nl> endif ( ) <nl> <nl> + target_link_libraries ( $ { target } fastlz ) <nl> target_link_libraries ( $ { target } timelib ) <nl> target_link_libraries ( $ { target } sqlite3 ) <nl> target_link_libraries ( $ { target } lz4 ) <nl> mmm a / CMake / HPHPSetup . cmake <nl> ppp b / CMake / HPHPSetup . cmake <nl> add_definitions ( - DHPHP_OSS = 1 ) <nl> # later versions of binutils don ' t play well without automake <nl> add_definitions ( - DPACKAGE = hhvm - DPACKAGE_VERSION = Release ) <nl> <nl> + include_directories ( " $ { TP_DIR } / fastlz " ) <nl> include_directories ( " $ { TP_DIR } / libsqlite3 " ) <nl> include_directories ( " $ { TP_DIR } / timelib " ) <nl> include_directories ( " $ { TP_DIR } / libafdt / src " ) <nl> mmm a / hphp / runtime / ext / memcached / ext_memcached . cpp <nl> ppp b / hphp / runtime / ext / memcached / ext_memcached . cpp <nl> <nl> # include < map > <nl> # include < memory > <nl> # include < vector > <nl> + # include < fastlz . h > <nl> # include < zlib . h > <nl> <nl> # include " hphp / system / systemlib . h " <nl> namespace HPHP { <nl> # define MEMC_VAL_IS_IGBINARY 5 <nl> # define MEMC_VAL_IS_JSON 6 <nl> <nl> - # define MEMC_VAL_COMPRESSED ( 1 < < 4 ) <nl> + # define MEMC_VAL_COMPRESSED ( 1 < < 4 ) <nl> + # define MEMC_VAL_COMPRESSION_ZLIB ( 1 < < 5 ) <nl> + # define MEMC_VAL_COMPRESSION_FASTLZ ( 1 < < 6 ) <nl> <nl> # define MEMC_COMPRESS_THRESHOLD 100 <nl> <nl> class MemcachedData { <nl> bool toObject ( Variant & value , const memcached_result_st & result ) { <nl> const char * payload = memcached_result_value ( & result ) ; <nl> size_t payloadLength = memcached_result_length ( & result ) ; <nl> - uint32_t flags = memcached_result_flags ( & result ) ; <nl> + uint32_t flags = memcached_result_flags ( & result ) ; <nl> <nl> String decompPayload ; <nl> if ( flags & MEMC_VAL_COMPRESSED ) { <nl> bool done = false ; <nl> std : : vector < char > buffer ; <nl> unsigned long bufferSize ; <nl> - for ( int factor = 1 ; ! done & & factor < = 16 ; + + factor ) { <nl> - bufferSize = payloadLength * ( 1 < < factor ) + 1 ; <nl> - buffer . resize ( bufferSize ) ; <nl> - if ( uncompress ( ( Bytef * ) buffer . data ( ) , & bufferSize , <nl> - ( const Bytef * ) payload , ( uLong ) payloadLength ) = = Z_OK ) { <nl> - done = true ; <nl> + uint32_t maxLength ; <nl> + int status ; <nl> + <nl> + / * new - style * / <nl> + if ( ( flags & MEMC_VAL_COMPRESSION_FASTLZ | | <nl> + flags & MEMC_VAL_COMPRESSION_ZLIB ) <nl> + & & payloadLength > sizeof ( uint32_t ) ) { <nl> + memcpy ( & maxLength , payload , sizeof ( uint32_t ) ) ; <nl> + if ( maxLength < std : : numeric_limits < uint32_t > : : max ( ) ) { <nl> + buffer . resize ( maxLength + 1 ) ; <nl> + payloadLength - = sizeof ( uint32_t ) ; <nl> + payload + = sizeof ( uint32_t ) ; <nl> + bufferSize = maxLength ; <nl> + <nl> + if ( flags & MEMC_VAL_COMPRESSION_FASTLZ ) { <nl> + bufferSize = fastlz_decompress ( payload , payloadLength , <nl> + buffer . data ( ) , maxLength ) ; <nl> + done = ( bufferSize > 0 ) ; <nl> + } else if ( flags & MEMC_VAL_COMPRESSION_ZLIB ) { <nl> + status = uncompress ( ( Bytef * ) buffer . data ( ) , & bufferSize , <nl> + ( const Bytef * ) payload , ( uLong ) payloadLength ) ; <nl> + done = ( status = = Z_OK ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + / * old - style * / <nl> + if ( ! done ) { <nl> + for ( int factor = 1 ; factor < = 16 ; + + factor ) { <nl> + if ( payloadLength > = <nl> + std : : numeric_limits < unsigned long > : : max ( ) / ( 1 < < factor ) ) { <nl> + break ; <nl> + } <nl> + bufferSize = payloadLength * ( 1 < < factor ) + 1 ; <nl> + buffer . resize ( bufferSize ) ; <nl> + status = uncompress ( ( Bytef * ) buffer . data ( ) , & bufferSize , <nl> + ( const Bytef * ) payload , ( uLong ) payloadLength ) ; <nl> + if ( status = = Z_OK ) { <nl> + done = true ; <nl> + break ; <nl> + } else if ( status ! = Z_BUF_ERROR ) { <nl> + break ; <nl> + } <nl> } <nl> } <nl> if ( ! done ) { <nl> new file mode 100644 <nl> index 00000000000 . . d71ff01a9fc <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / ext_memcached / decompression . php <nl> <nl> + < ? php <nl> + define ( ' MEMC_SERIALIZED ' , 4 ) ; <nl> + define ( ' MEMC_COMPRESSED ' , 16 ) ; <nl> + define ( ' MEMC_COMPRESSION_ZLIB ' , 32 ) ; <nl> + define ( ' MEMC_COMPRESSION_FASTLZ ' , 64 ) ; <nl> + <nl> + $ keys = array ( <nl> + ' no_compression ' = > array ( <nl> + ' flag ' = > MEMC_SERIALIZED , <nl> + ' data ' = > ' a : 2 : { s : 16 : " compression_type " ; N ; s : 5 : " valid " ; b : 1 ; } ' , <nl> + ) , <nl> + ' old_style_zlib ' = > array ( <nl> + ' flag ' = > MEMC_SERIALIZED | MEMC_COMPRESSED , <nl> + ' data ' = > <nl> + base64_decode ( ' eJxLtDKyqi62MjSzUkrOzy0oSi0uzszPiy + pLEhVsgaKm1gp5eekxBeXVOa ' <nl> + . ' kxlflZCaBRE2tlMoSczJTlKyTrAytawEh2Bb9 ' ) , <nl> + ) , <nl> + ' new_style_zlib ' = > array ( <nl> + ' flag ' = > MEMC_SERIALIZED | MEMC_COMPRESSED | MEMC_COMPRESSION_ZLIB , <nl> + ' data ' = > <nl> + base64_decode ( ' RAAAAHicS7QysqoutjI0s1JKzs8tKEotLs7Mz4svqSxIVbIGiptYKeWllsc ' <nl> + . ' Xl1TmpMZX5WQmgURNrZTKEnMyU5Ssk6wMrWsBIyQXCA = = ' ) , <nl> + ) , <nl> + ' new_style_fastlz ' = > array ( <nl> + ' flag ' = > MEMC_SERIALIZED | MEMC_COMPRESSED | MEMC_COMPRESSION_FASTLZ , <nl> + ' data ' = > <nl> + base64_decode ( ' RgAAABxhOjI6e3M6MTY6ImNvbXByZXNzaW9uX3R5cGUiO4AXD25ld19zdHl ' <nl> + . ' sZV9mYXN0bHpAFw41OiJ2YWxpZCI7YjoxO30 = ' ) , <nl> + ) , <nl> + ) ; <nl> + <nl> + / / Write the values to memcache using a raw socket connection <nl> + / / to make sure that they are not transformed in any way . <nl> + $ socket = fsockopen ( ' localhost ' , 11211 ) ; <nl> + $ socket | | die ( " Couldn ' t connect to memcache . \ n " ) ; <nl> + foreach ( $ keys as $ key = > $ value ) { <nl> + extract ( $ value , EXTR_OVERWRITE ) ; <nl> + $ size = strlen ( $ data ) ; <nl> + fwrite ( $ socket , " set $ key $ flag 0 $ size \ r \ n $ data \ r \ n " ) ; <nl> + fread ( $ socket , 8 ) = = = " STORED \ r \ n " | | die ( " Couldn ' t store value . \ n " ) ; <nl> + } <nl> + socket_close ( $ socket ) ; <nl> + <nl> + / / Read the values from memcached and decompress / unserialize . <nl> + $ mc = new Memcached ; <nl> + $ mc - > addServer ( ' localhost ' , 11211 ) ; <nl> + foreach ( $ keys as $ key = > $ value ) { <nl> + var_dump ( $ mc - > get ( $ key ) ) ; <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . c1d3f77124c <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / ext_memcached / decompression . php . expect <nl> <nl> + array ( 2 ) { <nl> + [ " compression_type " ] = > <nl> + NULL <nl> + [ " valid " ] = > <nl> + bool ( true ) <nl> + } <nl> + array ( 2 ) { <nl> + [ " compression_type " ] = > <nl> + string ( 14 ) " old_style_zlib " <nl> + [ " valid " ] = > <nl> + bool ( true ) <nl> + } <nl> + array ( 2 ) { <nl> + [ " compression_type " ] = > <nl> + string ( 14 ) " new_style_zlib " <nl> + [ " valid " ] = > <nl> + bool ( true ) <nl> + } <nl> + array ( 2 ) { <nl> + [ " compression_type " ] = > <nl> + string ( 16 ) " new_style_fastlz " <nl> + [ " valid " ] = > <nl> + bool ( true ) <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . bae83c4c1fc <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / ext_memcached / decompression . php . skipif <nl> <nl> + < ? php <nl> + <nl> + $ memc = new Memcached ( ) ; <nl> + $ memc - > addServer ( ' localhost ' , ' 11211 ' ) ; <nl> + $ version = $ memc - > getVersion ( ) ; <nl> + if ( ! $ version ) { <nl> + echo " SKIP No Memcached running " ; <nl> + } <nl> \ No newline at end of file <nl>
|
Add fastlz decompression support to memcached extension
|
facebook/hhvm
|
32deb47357f0f33e27a715e8dfbf9f1ba29214d3
|
2014-06-17T14:44:59Z
|
mmm a / modules / imgproc / src / templmatch . cpp <nl> ppp b / modules / imgproc / src / templmatch . cpp <nl> void cv : : matchTemplate ( InputArray _img , InputArray _templ , OutputArray _result , <nl> <nl> bool swapNotNeed = ( _img . size ( ) . height > = _templ . size ( ) . height & & _img . size ( ) . width > = _templ . size ( ) . width ) ; <nl> if ( ! swapNotNeed ) <nl> + { <nl> CV_Assert ( _img . size ( ) . height < = _templ . size ( ) . height & & _img . size ( ) . width < = _templ . size ( ) . width ) ; <nl> + } <nl> <nl> bool use_opencl = ocl : : useOpenCL ( ) & & _result . isUMat ( ) ; <nl> if ( use_opencl & & ( swapNotNeed ? ocl_matchTemplate ( _img , _templ , _result , method ) : ocl_matchTemplate ( _templ , _img , _result , method ) ) ) <nl>
|
fixed
|
opencv/opencv
|
7e2bdb590f781de8c2fb6c2109641e81fae4146b
|
2014-01-23T10:50:29Z
|
mmm a / src / interfaces / chain . cpp <nl> ppp b / src / interfaces / chain . cpp <nl> bool FillBlock ( const CBlockIndex * index , const FoundBlock & block , UniqueLock < Rec <nl> <nl> class LockImpl : public Chain : : Lock , public UniqueLock < RecursiveMutex > <nl> { <nl> - uint256 getBlockHash ( int height ) override <nl> - { <nl> - LockAssertion lock ( : : cs_main ) ; <nl> - CBlockIndex * block = : : ChainActive ( ) [ height ] ; <nl> - assert ( block ! = nullptr ) ; <nl> - return block - > GetBlockHash ( ) ; <nl> - } <nl> bool haveBlockOnDisk ( int height ) override <nl> { <nl> LockAssertion lock ( : : cs_main ) ; <nl> class ChainImpl : public Chain <nl> } <nl> return nullopt ; <nl> } <nl> + uint256 getBlockHash ( int height ) override <nl> + { <nl> + LOCK ( : : cs_main ) ; <nl> + CBlockIndex * block = : : ChainActive ( ) [ height ] ; <nl> + assert ( block ) ; <nl> + return block - > GetBlockHash ( ) ; <nl> + } <nl> bool findBlock ( const uint256 & hash , const FoundBlock & block ) override <nl> { <nl> WAIT_LOCK ( cs_main , lock ) ; <nl> mmm a / src / interfaces / chain . h <nl> ppp b / src / interfaces / chain . h <nl> class Chain <nl> public : <nl> virtual ~ Lock ( ) { } <nl> <nl> - / / ! Get block hash . Height must be valid or this function will abort . <nl> - virtual uint256 getBlockHash ( int height ) = 0 ; <nl> - <nl> / / ! Check that the block is available on disk ( i . e . has not been <nl> / / ! pruned ) , and contains transactions . <nl> virtual bool haveBlockOnDisk ( int height ) = 0 ; <nl> class Chain <nl> / / ! included in the current chain . <nl> virtual Optional < int > getBlockHeight ( const uint256 & hash ) = 0 ; <nl> <nl> + / / ! Get block hash . Height must be valid or this function will abort . <nl> + virtual uint256 getBlockHash ( int height ) = 0 ; <nl> + <nl> / / ! Return whether node has the block and optionally return block metadata <nl> / / ! or contents . <nl> virtual bool findBlock ( const uint256 & hash , const FoundBlock & block = { } ) = 0 ; <nl> mmm a / src / wallet / wallet . cpp <nl> ppp b / src / wallet / wallet . cpp <nl> std : : shared_ptr < CWallet > CWallet : : CreateWalletFromFile ( interfaces : : Chain & chain , <nl> <nl> const Optional < int > tip_height = chain . getHeight ( ) ; <nl> if ( tip_height ) { <nl> - walletInstance - > m_last_block_processed = locked_chain - > getBlockHash ( * tip_height ) ; <nl> + walletInstance - > m_last_block_processed = chain . getBlockHash ( * tip_height ) ; <nl> walletInstance - > m_last_block_processed_height = * tip_height ; <nl> } else { <nl> walletInstance - > m_last_block_processed . SetNull ( ) ; <nl> std : : shared_ptr < CWallet > CWallet : : CreateWalletFromFile ( interfaces : : Chain & chain , <nl> <nl> { <nl> WalletRescanReserver reserver ( * walletInstance ) ; <nl> - if ( ! reserver . reserve ( ) | | ( ScanResult : : SUCCESS ! = walletInstance - > ScanForWalletTransactions ( locked_chain - > getBlockHash ( rescan_height ) , rescan_height , { } / * max height * / , reserver , true / * update * / ) . status ) ) { <nl> + if ( ! reserver . reserve ( ) | | ( ScanResult : : SUCCESS ! = walletInstance - > ScanForWalletTransactions ( chain . getBlockHash ( rescan_height ) , rescan_height , { } / * max height * / , reserver , true / * update * / ) . status ) ) { <nl> error = _ ( " Failed to rescan the wallet during initialization " ) . translated ; <nl> return nullptr ; <nl> } <nl>
|
[ wallet ] Move getBlockHash from Chain : : Lock interface to simple Chain
|
bitcoin/bitcoin
|
0a76287387950bc9c5b634e95c5cd5fb1029f42d
|
2020-04-30T18:37:21Z
|
mmm a / libraries / chain / controller . cpp <nl> ppp b / libraries / chain / controller . cpp <nl> struct controller_impl { <nl> <nl> if ( add_to_fork_db ) { <nl> pending - > _pending_block_state - > validated = true ; <nl> - head = fork_db . add ( pending - > _pending_block_state ) ; <nl> + auto new_bsp = fork_db . add ( pending - > _pending_block_state ) ; <nl> + head = fork_db . head ( ) ; <nl> + FC_ASSERT ( new_bsp = = head , " committed block did not become the new head in fork database " ) ; <nl> } <nl> <nl> pending - > push ( ) ; <nl> struct controller_impl { <nl> <nl> pending = db . start_undo_session ( true ) ; <nl> pending - > _pending_block_state = std : : make_shared < block_state > ( * head , when ) ; <nl> + pending - > _pending_block_state - > in_current_chain = true ; <nl> <nl> try { <nl> auto onbtrx = std : : make_shared < transaction_metadata > ( get_on_block_transaction ( ) ) ; <nl> struct controller_impl { <nl> try { <nl> abort_block ( ) ; <nl> apply_block ( b ) ; <nl> + fork_db . mark_in_current_chain ( new_head , true ) ; <nl> fork_db . set_validity ( new_head , true ) ; <nl> head = new_head ; <nl> } catch ( const fc : : exception & e ) { <nl> - fork_db . set_validity ( new_head , false ) ; <nl> + fork_db . set_validity ( new_head , false ) ; / / Removes new_head from fork_db index , so no need to mark it as not in the current chain . <nl> throw ; <nl> } <nl> - } else { <nl> + } else if ( new_head - > id ! = head - > id ) { <nl> auto branches = fork_db . fetch_branch_from ( new_head - > id , head - > id ) ; <nl> <nl> - while ( head_block_id ( ) ! = branches . second . back ( ) - > header . previous ) <nl> + for ( auto itr = branches . second . begin ( ) ; itr ! = branches . second . end ( ) ; + + itr ) { <nl> + fork_db . mark_in_current_chain ( * itr , false ) ; <nl> pop_block ( ) ; <nl> + } <nl> + FC_ASSERT ( head_block_id ( ) = = branches . second . back ( ) - > header . previous , <nl> + " loss of sync between fork_db and chainbase during fork switch " ) ; / / _should_ never fail <nl> <nl> for ( auto ritr = branches . first . rbegin ( ) ; ritr ! = branches . first . rend ( ) ; + + ritr ) { <nl> optional < fc : : exception > except ; <nl> try { <nl> apply_block ( ( * ritr ) - > block ) ; <nl> + fork_db . mark_in_current_chain ( * ritr , true ) ; <nl> } <nl> catch ( const fc : : exception & e ) { except = e ; } <nl> if ( except ) { <nl> struct controller_impl { <nl> } <nl> <nl> / / pop all blocks from the bad fork <nl> - while ( head_block_id ( ) ! = branches . second . back ( ) - > header . previous ) <nl> + for ( auto itr = ( ritr + 1 ) . base ( ) ; itr ! = branches . second . end ( ) ; + + itr ) { <nl> + fork_db . mark_in_current_chain ( * itr , false ) ; <nl> pop_block ( ) ; <nl> + } <nl> + FC_ASSERT ( head_block_id ( ) = = branches . second . back ( ) - > header . previous , <nl> + " loss of sync between fork_db and chainbase during fork switch reversal " ) ; / / _should_ never fail <nl> <nl> / / re - apply good blocks <nl> for ( auto ritr = branches . second . rbegin ( ) ; ritr ! = branches . second . rend ( ) ; + + ritr ) { <nl> apply_block ( ( * ritr ) - > block ) ; <nl> + fork_db . mark_in_current_chain ( * ritr , true ) ; <nl> } <nl> throw * except ; <nl> } / / end if exception <nl> struct controller_impl { <nl> } ) ; <nl> } <nl> <nl> - / * * <nl> - * This method only works for blocks within the TAPOS range , ( last 65K blocks ) . It <nl> - * will return block_id_type ( ) for older blocks . <nl> - * / <nl> - block_id_type get_block_id_for_num ( uint32_t block_num ) { <nl> - auto sid = block_num & 0xffff ; <nl> - auto id = db . get < block_summary_object , by_id > ( sid ) . block_id ; <nl> - auto num = block_header : : num_from_id ( id ) ; <nl> - if ( num = = block_num ) return id ; <nl> - return block_id_type ( ) ; <nl> - } <nl> - <nl> void clear_expired_transactions ( ) { <nl> / / Look for expired transactions in the deduplication list , and remove them . <nl> auto & transaction_idx = db . get_mutable_index < transaction_multi_index > ( ) ; <nl> void controller : : log_irreversible_blocks ( ) { <nl> if ( lib > 1 ) { <nl> while ( log_head & & log_head - > block_num ( ) < lib ) { <nl> auto lhead = log_head - > block_num ( ) ; <nl> - auto blk_id = my - > get_block_id_for_num ( lhead + 1 ) ; <nl> - auto blk = my - > fork_db . get_block ( blk_id ) ; <nl> - FC_ASSERT ( blk , " unable to find block state " , ( " id " , blk_id ) ) ; <nl> + auto blk = my - > fork_db . get_block_in_current_chain_by_num ( lhead + 1 ) ; <nl> + FC_ASSERT ( blk , " unable to find block state " , ( " block_num " , lhead + 1 ) ) ; <nl> irreversible_block ( blk ) ; <nl> my - > blog . append ( * blk - > block ) ; <nl> my - > fork_db . prune ( blk ) ; <nl> signed_block_ptr controller : : fetch_block_by_number ( uint32_t block_num ) const { <nl> optional < signed_block > b = my - > blog . read_block_by_num ( block_num ) ; <nl> if ( b ) return std : : make_shared < signed_block > ( move ( * b ) ) ; <nl> <nl> - auto blk_id = my - > get_block_id_for_num ( block_num ) ; <nl> - auto blk_state = my - > fork_db . get_block ( blk_id ) ; <nl> + auto blk_state = my - > fork_db . get_block_in_current_chain_by_num ( block_num ) ; <nl> if ( blk_state ) return blk_state - > block ; <nl> return signed_block_ptr ( ) ; <nl> } <nl> mmm a / libraries / chain / fork_database . cpp <nl> ppp b / libraries / chain / fork_database . cpp <nl> namespace eosio { namespace chain { <nl> block_state_ptr , <nl> indexed_by < <nl> hashed_unique < tag < by_block_id > , member < block_header_state , block_id_type , & block_header_state : : id > , std : : hash < block_id_type > > , <nl> - hashed_non_unique < tag < by_prev > , const_mem_fun < block_header_state , <nl> - const block_id_type & , & block_header_state : : prev > , <nl> + hashed_non_unique < tag < by_prev > , const_mem_fun < block_header_state , <nl> + const block_id_type & , & block_header_state : : prev > , <nl> std : : hash < block_id_type > > , <nl> - ordered_non_unique < tag < by_block_num > , member < block_header_state , uint32_t , & block_header_state : : block_num > > , <nl> - ordered_non_unique < tag < by_lib_block_num > , <nl> + ordered_non_unique < tag < by_block_num > , <nl> + composite_key < block_state , <nl> + member < block_header_state , uint32_t , & block_header_state : : block_num > , <nl> + member < block_state , bool , & block_state : : in_current_chain > <nl> + > , <nl> + composite_key_compare < std : : less < uint32_t > , std : : greater < bool > > <nl> + > , <nl> + ordered_non_unique < tag < by_lib_block_num > , <nl> composite_key < block_header_state , <nl> member < block_header_state , uint32_t , & block_header_state : : dpos_last_irreversible_blocknum > , <nl> member < block_header_state , uint32_t , & block_header_state : : block_num > <nl> namespace eosio { namespace chain { <nl> auto first_branch = get_block ( first ) ; <nl> auto second_branch = get_block ( second ) ; <nl> <nl> - while ( first_branch - > block_num > second_branch - > block_num ) <nl> + while ( first_branch - > block_num > second_branch - > block_num ) <nl> { <nl> result . first . push_back ( first_branch ) ; <nl> first_branch = get_block ( first_branch - > header . previous ) ; <nl> namespace eosio { namespace chain { <nl> <nl> void fork_database : : set_validity ( const block_state_ptr & h , bool valid ) { <nl> if ( ! valid ) { <nl> - remove ( h - > id ) ; <nl> + remove ( h - > id ) ; <nl> } else { <nl> / / / remove older than irreversible and mark block as valid <nl> h - > validated = true ; <nl> } <nl> } <nl> + <nl> + void fork_database : : mark_in_current_chain ( const block_state_ptr & h , bool in_current_chain ) { <nl> + if ( h - > in_current_chain = = in_current_chain ) <nl> + return ; <nl> + <nl> + auto & by_id_idx = my - > index . get < by_block_id > ( ) ; <nl> + auto itr = by_id_idx . find ( h - > id ) ; <nl> + FC_ASSERT ( itr ! = by_id_idx . end ( ) , " could not find block in fork database " ) ; <nl> + <nl> + by_id_idx . modify ( itr , [ & ] ( auto & bsp ) { / / Need to modify this way rather than directly so that Boost MultiIndex can re - sort <nl> + bsp - > in_current_chain = in_current_chain ; <nl> + } ) ; <nl> + } <nl> + <nl> void fork_database : : prune ( const block_state_ptr & h ) { <nl> auto num = h - > block_num ; <nl> - <nl> + <nl> auto itr = my - > index . find ( h - > id ) ; <nl> if ( itr ! = my - > index . end ( ) ) <nl> my - > index . erase ( itr ) ; <nl> <nl> auto & numidx = my - > index . get < by_block_num > ( ) ; <nl> - auto nitr = numidx . find ( num ) ; <nl> - if ( nitr ! = numidx . end ( ) ) { <nl> + for ( auto nitr = numidx . lower_bound ( num ) ; nitr ! = numidx . end ( ) & & ( * nitr ) - > block_num = = num ; + + nitr ) { <nl> remove ( ( * nitr ) - > id ) ; <nl> } <nl> } <nl> <nl> - <nl> block_state_ptr fork_database : : get_block ( const block_id_type & id ) const { <nl> auto itr = my - > index . find ( id ) ; <nl> - if ( itr ! = my - > index . end ( ) ) <nl> + if ( itr ! = my - > index . end ( ) ) <nl> return * itr ; <nl> return block_state_ptr ( ) ; <nl> } <nl> <nl> - <nl> + block_state_ptr fork_database : : get_block_in_current_chain_by_num ( uint32_t n ) const { <nl> + const auto & numidx = my - > index . get < by_block_num > ( ) ; <nl> + auto nitr = numidx . lower_bound ( n ) ; <nl> + FC_ASSERT ( nitr ! = numidx . end ( ) & & ( * nitr ) - > block_num = = n , <nl> + " could not find block in fork database with block number $ { block_num } " , ( " block_num " , n ) ) ; <nl> + FC_ASSERT ( ( * nitr ) - > in_current_chain = = true , <nl> + " block ( with block number $ { block_num } ) found in fork database is not in the current chain " , ( " block_num " , n ) ) ; <nl> + return * nitr ; <nl> + } <nl> <nl> } } / / / eosio : : chain <nl> mmm a / libraries / chain / include / eosio / chain / block_state . hpp <nl> ppp b / libraries / chain / include / eosio / chain / block_state . hpp <nl> namespace eosio { namespace chain { <nl> / / / weak_ptr prev_block_state . . . . <nl> signed_block_ptr block ; <nl> bool validated = false ; <nl> + bool in_current_chain = false ; <nl> <nl> / / / this data is redundant with the data stored in block , but facilitates <nl> / / / recapturing transactions when we pop a block <nl> mmm a / libraries / chain / include / eosio / chain / fork_database . hpp <nl> ppp b / libraries / chain / include / eosio / chain / fork_database . hpp <nl> <nl> - # pragma once <nl> + # pragma once <nl> # include < eosio / chain / block_state . hpp > <nl> # include < boost / signals2 / signal . hpp > <nl> <nl> namespace eosio { namespace chain { <nl> * As new blocks are received , they are pushed into the fork database . The fork <nl> * database tracks the longest chain and the last irreversible block number . All <nl> * blocks older than the last irreversible block are freed after emitting the <nl> - * irreversible signal . <nl> + * irreversible signal . <nl> * / <nl> class fork_database { <nl> public : <nl> namespace eosio { namespace chain { <nl> ~ fork_database ( ) ; <nl> <nl> block_state_ptr get_block ( const block_id_type & id ) const ; <nl> + block_state_ptr get_block_in_current_chain_by_num ( uint32_t n ) const ; <nl> / / vector < block_state_ptr > get_blocks_by_number ( uint32_t n ) const ; <nl> <nl> / * * <nl> namespace eosio { namespace chain { <nl> void set ( block_state_ptr s ) ; <nl> <nl> / * * this method will attempt to append the block to an exsting <nl> - * block_state and will return a pointer to the head block or <nl> + * block_state and will return a pointer to the new block state or <nl> * throw on error . <nl> * / <nl> - block_state_ptr add ( signed_block_ptr b ) ; <nl> - block_state_ptr add ( block_state_ptr next_block ) ; <nl> + block_state_ptr add ( signed_block_ptr b ) ; <nl> + block_state_ptr add ( block_state_ptr next_block ) ; <nl> void remove ( const block_id_type & id ) ; <nl> <nl> const block_state_ptr & head ( ) const ; <nl> namespace eosio { namespace chain { <nl> * than the LIB are pruned after emitting irreversible signal . <nl> * / <nl> void set_validity ( const block_state_ptr & h , bool valid ) ; <nl> + void mark_in_current_chain ( const block_state_ptr & h , bool in_current_chain ) ; <nl> void prune ( const block_state_ptr & h ) ; <nl> <nl> / * * <nl>
|
async push transaction api
|
EOSIO/eos
|
c0d4755cda458a15c6d4f3ab278da86c3dc3f697
|
2018-04-23T19:07:48Z
|
mmm a / lib / SILOptimizer / Transforms / RedundantOverflowCheckRemoval . cpp <nl> ppp b / lib / SILOptimizer / Transforms / RedundantOverflowCheckRemoval . cpp <nl> class RedundantOverflowCheckRemovalPass : public SILFunctionTransform { <nl> if ( auto * CBI = dyn_cast < CondBranchInst > ( Inst ) ) <nl> registerBranchFormula ( CBI ) ; <nl> <nl> - / / Handle cond_fail instructions . <nl> + / / Handle cond_fail instructions . <nl> if ( auto * CFI = dyn_cast < CondFailInst > ( Inst ) ) { <nl> if ( tryToRemoveCondFail ( CFI ) ) { <nl> ToRemove . push_back ( CFI ) ; <nl>
|
[ gardening ] De - indent comment in ` RedundantOverflowCheckRemovalPass ` .
|
apple/swift
|
c809ca1469c7293ad299b6ac1ec33d007934e880
|
2016-04-10T21:47:08Z
|
mmm a / Marlin / planner . cpp <nl> ppp b / Marlin / planner . cpp <nl> float junction_deviation = 0 . 1 ; <nl> <nl> / / Max segement time in us . <nl> # ifdef XY_FREQUENCY_LIMIT <nl> - # define MAX_FREQ_TIME ( 1000000 . 0 / XY_FREQUENCY_LIMIT ) <nl> <nl> / / Check and limit the xy direction change frequency <nl> unsigned char direction_change = block - > direction_bits ^ old_direction_bits ; <nl>
|
Remove extra MAX_FREQ_TIME define ( PR )
|
MarlinFirmware/Marlin
|
f690b82343e87146d959be260fb1f023733aecd9
|
2015-09-08T18:11:12Z
|
mmm a / tensorflow / workspace . bzl <nl> ppp b / tensorflow / workspace . bzl <nl> def tf_workspace ( path_prefix = " " , tf_repo_name = " " ) : <nl> tf_http_archive ( <nl> name = " com_google_absl " , <nl> build_file = clean_dep ( " / / third_party : com_google_absl . BUILD " ) , <nl> - sha256 = " ba53057aaae399cdc5d9b76cc39ca53bcae130f4317395f353689bac5c2444b4 " , <nl> - strip_prefix = " abseil - cpp - 6cc6ac44e065b9e8975fadfd6ccb99cbcf89aac4 " , <nl> + sha256 = " 9171f04d7deefcc88f3a80482f9e56b6c3c77ed568aca7a15dee1da90272093a " , <nl> + strip_prefix = " abseil - cpp - 044da8a29c923506af0f0b46bc46f43c1e1300b5 " , <nl> urls = [ <nl> - " http : / / mirror . tensorflow . org / github . com / abseil / abseil - cpp / archive / 6cc6ac44e065b9e8975fadfd6ccb99cbcf89aac4 . tar . gz " , <nl> - " https : / / github . com / abseil / abseil - cpp / archive / 6cc6ac44e065b9e8975fadfd6ccb99cbcf89aac4 . tar . gz " , <nl> + " http : / / mirror . tensorflow . org / github . com / abseil / abseil - cpp / archive / 044da8a29c923506af0f0b46bc46f43c1e1300b5 . tar . gz " , <nl> + " https : / / github . com / abseil / abseil - cpp / archive / 044da8a29c923506af0f0b46bc46f43c1e1300b5 . tar . gz " , <nl> ] , <nl> ) <nl> <nl>
|
[ TF : XLA ] Bump open source abseil revision to 044da8a29c923506af0f0b46bc46f43c1e1300b5
|
tensorflow/tensorflow
|
91cbed99b672d7eaa23d5a76739f3bd4826b6402
|
2019-04-08T22:54:29Z
|
mmm a / Marlin / Marlin_main . cpp <nl> ppp b / Marlin / Marlin_main . cpp <nl> inline void gcode_M303 ( ) { <nl> int c = code_seen ( ' C ' ) ? code_value_short ( ) : 5 ; <nl> float temp = code_seen ( ' S ' ) ? code_value ( ) : ( e < 0 ? 70 . 0 : 150 . 0 ) ; <nl> PID_autotune ( temp , e , c ) ; <nl> - / / Suppress a line mismatch error <nl> - gcode_LastN + = 1 ; <nl> - FlushSerialRequestResend ( ) ; <nl> } <nl> <nl> # ifdef SCARA <nl> mmm a / Marlin / language . h <nl> ppp b / Marlin / language . h <nl> <nl> # define MSG_KP " Kp : " <nl> # define MSG_KI " Ki : " <nl> # define MSG_KD " Kd : " <nl> - # define MSG_OK_B " ok B : " <nl> - # define MSG_OK_T " ok T : " <nl> + # define MSG_B " B : " <nl> + # define MSG_T " T : " <nl> # define MSG_AT " @ : " <nl> # define MSG_PID_AUTOTUNE_FINISHED MSG_PID_AUTOTUNE " finished ! Put the last Kp , Ki and Kd constants from below into Configuration . h " <nl> # define MSG_PID_DEBUG " PID_DEBUG " <nl> mmm a / Marlin / temperature . cpp <nl> ppp b / Marlin / temperature . cpp <nl> static void updateTemperaturesFromRawValues ( ) ; <nl> / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = Functions = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> - void PID_autotune ( float temp , int extruder , int ncycles ) <nl> - { <nl> + void PID_autotune ( float temp , int extruder , int ncycles ) { <nl> float input = 0 . 0 ; <nl> int cycles = 0 ; <nl> bool heating = true ; <nl> void PID_autotune ( float temp , int extruder , int ncycles ) <nl> int p ; <nl> if ( extruder < 0 ) { <nl> p = soft_pwm_bed ; <nl> - SERIAL_PROTOCOLPGM ( MSG_OK_B ) ; <nl> + SERIAL_PROTOCOLPGM ( MSG_B ) ; <nl> } <nl> else { <nl> p = soft_pwm [ extruder ] ; <nl> - SERIAL_PROTOCOLPGM ( MSG_OK_T ) ; <nl> + SERIAL_PROTOCOLPGM ( MSG_T ) ; <nl> } <nl> <nl> SERIAL_PROTOCOL ( input ) ; <nl>
|
Fix error next command in autotune ( PR )
|
MarlinFirmware/Marlin
|
eb81982fcd0af671f30e2b6ec45c25566b621b08
|
2015-06-12T12:10:38Z
|
mmm a / build_msvc / bench_bitcoin / bench_bitcoin . vcxproj . in <nl> ppp b / build_msvc / bench_bitcoin / bench_bitcoin . vcxproj . in <nl> <nl> < ProjectReference Include = " . . \ libleveldb \ libleveldb . vcxproj " > <nl> < Project > { 18430fef - 6b61 - 4c53 - b396 - 718e02850f1b } < / Project > <nl> < / ProjectReference > <nl> + < ProjectReference Include = " . . \ libtest_util \ libtest_util . vcxproj " > <nl> + < Project > { 1e065f03 - 3566 - 47d0 - 8fa9 - daa72b084e7d } < / Project > <nl> + < / ProjectReference > <nl> < / ItemGroup > <nl> < Target Name = " RawBenchHeaderGen " BeforeTargets = " PrepareForBuild " > <nl> < PropertyGroup > <nl> mmm a / build_msvc / bitcoin . sln <nl> ppp b / build_msvc / bitcoin . sln <nl> Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " libbitcoin_qt " , " libbitcoin <nl> EndProject <nl> Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " bitcoin - qt " , " bitcoin - qt \ bitcoin - qt . vcxproj " , " { 7E99172D - 7FF2 - 4CB6 - B736 - AC9B76ED412A } " <nl> EndProject <nl> + Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " libtest_util " , " libtest_util \ libtest_util . vcxproj " , " { 868474FD - 35F6 - 4400 - 8EED - 30A33E7521D4 } " <nl> + EndProject <nl> Global <nl> GlobalSection ( SolutionConfigurationPlatforms ) = preSolution <nl> Debug | x64 = Debug | x64 <nl> Global <nl> { 7E99172D - 7FF2 - 4CB6 - B736 - AC9B76ED412A } . Release | x64 . Build . 0 = Release | x64 <nl> { 7E99172D - 7FF2 - 4CB6 - B736 - AC9B76ED412A } . Release | x86 . ActiveCfg = Release | Win32 <nl> { 7E99172D - 7FF2 - 4CB6 - B736 - AC9B76ED412A } . Release | x86 . Build . 0 = Release | Win32 <nl> + { 868474FD - 35F6 - 4400 - 8EED - 30A33E7521D4 } . Debug | x64 . ActiveCfg = Debug | x64 <nl> + { 868474FD - 35F6 - 4400 - 8EED - 30A33E7521D4 } . Debug | x64 . Build . 0 = Debug | x64 <nl> + { 868474FD - 35F6 - 4400 - 8EED - 30A33E7521D4 } . Debug | x86 . ActiveCfg = Debug | Win32 <nl> + { 868474FD - 35F6 - 4400 - 8EED - 30A33E7521D4 } . Debug | x86 . Build . 0 = Debug | Win32 <nl> + { 868474FD - 35F6 - 4400 - 8EED - 30A33E7521D4 } . Release | x64 . ActiveCfg = Release | x64 <nl> + { 868474FD - 35F6 - 4400 - 8EED - 30A33E7521D4 } . Release | x64 . Build . 0 = Release | x64 <nl> + { 868474FD - 35F6 - 4400 - 8EED - 30A33E7521D4 } . Release | x86 . ActiveCfg = Release | Win32 <nl> + { 868474FD - 35F6 - 4400 - 8EED - 30A33E7521D4 } . Release | x86 . Build . 0 = Release | Win32 <nl> EndGlobalSection <nl> GlobalSection ( SolutionProperties ) = preSolution <nl> HideSolutionNode = FALSE <nl> EndGlobalSection <nl> GlobalSection ( ExtensibilityGlobals ) = postSolution <nl> - SolutionGuid = { 8AA72EDA - 2CD4 - 4564 - B1E4 - 688B760EEEE9 } <nl> + SolutionGuid = { 8AA72EDA - 2CD4 - 4564 - B1E4 - 688B760EEEE9 } <nl> + SolutionGuid = { 8607C0F4 - F33D - 41B8 - 8D51 - 18E366A0F8DF } <nl> + SolutionGuid = { 58AAB032 - 7274 - 49BD - 845E - 5EF4DBB69B70 } <nl> EndGlobalSection <nl> EndGlobal <nl> new file mode 100644 <nl> index 000000000000 . . b5e844010e91 <nl> mmm / dev / null <nl> ppp b / build_msvc / libtest_util / libtest_util . vcxproj . in <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> + < Project DefaultTargets = " Build " xmlns = " http : / / schemas . microsoft . com / developer / msbuild / 2003 " > <nl> + < Import Project = " . . \ common . init . vcxproj " / > <nl> + < PropertyGroup Label = " Globals " > <nl> + < ProjectGuid > { 868474FD - 35F6 - 4400 - 8EED - 30A33E7521D4 } < / ProjectGuid > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Label = " Configuration " > <nl> + < ConfigurationType > StaticLibrary < / ConfigurationType > <nl> + < / PropertyGroup > <nl> + < ItemGroup > <nl> + @ SOURCE_FILES @ <nl> + < / ItemGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . props " / > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . targets " / > <nl> + < Import Project = " . . \ common . vcxproj " / > <nl> + < / Project > <nl> mmm a / build_msvc / msvc - autogen . py <nl> ppp b / build_msvc / msvc - autogen . py <nl> <nl> ' libbitcoin_wallet ' , <nl> ' libbitcoin_zmq ' , <nl> ' bench_bitcoin ' , <nl> + ' libtest_util ' , <nl> ] <nl> <nl> ignore_list = [ <nl> mmm a / build_msvc / test_bitcoin / test_bitcoin . vcxproj <nl> ppp b / build_msvc / test_bitcoin / test_bitcoin . vcxproj <nl> <nl> < ProjectReference Include = " . . \ libbitcoin_zmq \ libbitcoin_zmq . vcxproj " > <nl> < Project > { 792d487f - f14c - 49fc - a9de - 3fc150f31c3f } < / Project > <nl> < / ProjectReference > <nl> + < ProjectReference Include = " . . \ libtest_util \ libtest_util . vcxproj " > <nl> + < Project > { 1e065f03 - 3566 - 47d0 - 8fa9 - daa72b084e7d } < / Project > <nl> + < / ProjectReference > <nl> < ProjectReference Include = " . . \ libunivalue \ libunivalue . vcxproj " > <nl> < Project > { 5724ba7d - a09a - 4ba8 - 800b - c4c1561b3d69 } < / Project > <nl> < / ProjectReference > <nl>
|
Added libtest_util library to msvc build configuration .
|
bitcoin/bitcoin
|
b509554433cb4bd32852239d0dd195ec059657f6
|
2019-11-23T15:49:16Z
|
mmm a / tensorflow / contrib / lite / tools / benchmark_model . cc <nl> ppp b / tensorflow / contrib / lite / tools / benchmark_model . cc <nl> int Main ( int argc , char * * argv ) { <nl> string output_layer_string ; / / e . g . : output <nl> int num_runs = 50 ; <nl> string run_delay = " - 1 . 0 " ; <nl> - int num_threads = - 1 ; <nl> + int num_threads = 1 ; <nl> string benchmark_name = " " ; <nl> string output_prefix = " " ; <nl> int warmup_runs = 1 ; <nl>
|
Change default number of threads to 1 .
|
tensorflow/tensorflow
|
3ac41829fbfe4c1c75967df3d1b39115ca420359
|
2018-05-11T19:39:36Z
|
mmm a / tensorflow / contrib / cmake / README . md <nl> ppp b / tensorflow / contrib / cmake / README . md <nl> Note : Windows support is in an * * alpha * * state , and we welcome your feedback . <nl> <nl> # # # Pre - requisites <nl> <nl> - * CMake version 3 . 1 or later <nl> + * CMake version 3 . 1 up to 3 . 6 <nl> <nl> * [ Git ] ( http : / / git - scm . com ) <nl> <nl>
|
Updating Cmake version due problems with v3 . 7
|
tensorflow/tensorflow
|
4de2ac0b289a6e837983ebd57d6b3caa67ce5b4d
|
2016-10-22T02:47:00Z
|
mmm a / docs / api / python / ndarray / sparse . md <nl> ppp b / docs / api / python / ndarray / sparse . md <nl> This document lists the routines of the * n * - dimensional sparse array package : <nl> ` ` ` <nl> <nl> The ` CSRNDArray ` and ` RowSparseNDArray ` API , defined in the ` ndarray . sparse ` package , provides <nl> - imperative sparse tensor operations on * * CPU * * . <nl> + imperative sparse tensor operations . <nl> <nl> An ` CSRNDArray ` inherits from ` NDArray ` , and represents a two - dimensional , fixed - size array in compressed sparse row format . <nl> <nl> A detailed tutorial is available at <nl> <nl> ` ` ` eval_rst <nl> <nl> - . . note : : ` ` mxnet . ndarray . sparse . RowSparseNDArray ` ` and ` ` mxnet . ndarray . sparse . CSRNDArray ` ` DO NOT support the ` ` mxnet . gluon ` ` high - level interface yet . <nl> - <nl> . . note : : ` ` mxnet . ndarray . sparse ` ` is similar to ` ` mxnet . ndarray ` ` in some aspects . But the differences are not negligible . For instance : <nl> <nl> - - Only a subset of operators in ` ` mxnet . ndarray ` ` have specialized implementations in ` ` mxnet . ndarray . sparse ` ` . <nl> - Operators such as Convolution and broadcasting do not have sparse implementations yet . <nl> + - Only a subset of operators in ` ` mxnet . ndarray ` ` have efficient sparse implementations in ` ` mxnet . ndarray . sparse ` ` . <nl> + - If an operator do not occur in the ` ` mxnet . ndarray . sparse ` ` namespace , that means the operator does not have an efficient sparse implementation yet . If sparse inputs are passed to such an operator , it will convert inputs to the dense format and fallback to the already available dense implementation . <nl> - The storage types ( ` ` stype ` ` ) of sparse operators ' outputs depend on the storage types of inputs . <nl> By default the operators not available in ` ` mxnet . ndarray . sparse ` ` infer " default " ( dense ) storage type for outputs . <nl> Please refer to the [ API Reference ] ( # api - reference ) section for further details on specific operators . <nl> - - GPU support for ` ` mxnet . ndarray . sparse ` ` is experimental . Only a few sparse operators are supported on GPU such as ` ` sparse . dot ` ` . <nl> <nl> . . note : : ` ` mxnet . ndarray . sparse . CSRNDArray ` ` is similar to ` ` scipy . sparse . csr_matrix ` ` in some aspects . But they differ in a few aspects : <nl> <nl> We summarize the interface for each class in the following sections . <nl> sgd_update <nl> sgd_mom_update <nl> adam_update <nl> - ftrl_update <nl> adagrad_update <nl> ` ` ` <nl> <nl> mmm a / docs / api / python / symbol / sparse . md <nl> ppp b / docs / api / python / symbol / sparse . md <nl> This document lists the routines of the sparse symbolic expression package : <nl> ` ` ` <nl> <nl> The ` Sparse Symbol ` API , defined in the ` symbol . sparse ` package , provides <nl> - sparse neural network graphs and auto - differentiation on CPU . <nl> + sparse neural network graphs and auto - differentiation . <nl> <nl> The storage type of a variable is speficied by the ` stype ` attribute of the variable . <nl> The storage type of a symbolic expression is inferred based on the storage types of the variables and the operators . <nl> array ( [ 1 . , 1 . ] , <nl> . . note : : most operators provided in ` ` mxnet . symbol . sparse ` ` are similar to those in <nl> ` ` mxnet . symbol ` ` although there are few differences : <nl> <nl> - - Only a subset of operators in ` ` mxnet . symbol ` ` have specialized implementations in ` ` mxnet . symbol . sparse ` ` . <nl> - Operators such as reduction and broadcasting do not have sparse implementations yet . <nl> + - Only a subset of operators in ` ` mxnet . symbol ` ` have efficient sparse implementations in ` ` mxnet . symbol . sparse ` ` . <nl> + - If an operator do not occur in the ` ` mxnet . symbol . sparse ` ` namespace , that means the operator does not have an efficient sparse implementation yet . If sparse inputs are passed to such an operator , it will convert inputs to the dense format and fallback to the already available dense implementation . <nl> - The storage types ( ` ` stype ` ` ) of sparse operators ' outputs depend on the storage types of inputs . <nl> By default the operators not available in ` ` mxnet . symbol . sparse ` ` infer " default " ( dense ) storage type for outputs . <nl> Please refer to the API reference section for further details on specific operators . <nl> - - GPU support for ` ` mxnet . symbol . sparse ` ` is experimental . <nl> <nl> ` ` ` <nl> <nl> mmm a / docs / tutorials / sparse / csr . md <nl> ppp b / docs / tutorials / sparse / csr . md <nl> Note that in the file the column indices are expected to be sorted in ascending <nl> <nl> # # # GPU Support <nl> <nl> - By default , ` CSRNDArray ` operators are executed on CPU . In MXNet , GPU support for ` CSRNDArray ` is experimental with only a few sparse operators such as [ dot ] ( https : / / mxnet . incubator . apache . org / api / python / ndarray / sparse . html # mxnet . ndarray . sparse . dot ) . <nl> - <nl> - To create a ` CSRNDArray ` on a GPU , we need to explicitly specify the context : <nl> + By default , ` CSRNDArray ` operators are executed on CPU . To create a ` CSRNDArray ` on a GPU , we need to explicitly specify the context : <nl> <nl> * * Note * * If a GPU is not available , an error will be reported in the following section . In order to execute it a cpu , set ` gpu_device ` to ` mx . cpu ( ) ` . <nl> <nl> mmm a / docs / tutorials / sparse / row_sparse . md <nl> ppp b / docs / tutorials / sparse / row_sparse . md <nl> Note that only [ mxnet . optimizer . SGD ] ( https : / / mxnet . incubator . apache . org / api / pyth <nl> <nl> # # # GPU Support <nl> <nl> - By default , RowSparseNDArray operators are executed on CPU . In MXNet , GPU support for RowSparseNDArray is limited <nl> - to a few sparse operators such as [ sgd_update ] ( https : / / mxnet . incubator . apache . org / api / python / ndarray / sparse . html # mxnet . ndarray . sparse . sgd_update ) , <nl> - [ dot ] ( https : / / mxnet . incubator . apache . org / api / python / ndarray / sparse . html # mxnet . ndarray . sparse . dot ) and <nl> - [ Embedding ] ( https : / / mxnet . incubator . apache . org / api / python / ndarray / ndarray . html # mxnet . ndarray . Embedding ) . <nl> - <nl> - To create a RowSparseNDArray on gpu , we need to explicitly specify the context : <nl> + By default , RowSparseNDArray operators are executed on CPU . To create a RowSparseNDArray on gpu , we need to explicitly specify the context : <nl> <nl> * * Note * * If a GPU is not available , an error will be reported in the following section . In order to execute it on a cpu , set gpu_device to mx . cpu ( ) . <nl> <nl> mmm a / docs / tutorials / sparse / train . md <nl> ppp b / docs / tutorials / sparse / train . md <nl> assert metric . get ( ) [ 1 ] < 1 , " Achieved MSE ( % f ) is larger than expected ( 1 . 0 ) " % <nl> <nl> # # # Training the model with multiple machines or multiple devices <nl> <nl> - To train a sparse model with multiple machines , you need to call ` prepare ` before ` forward ` , or ` save_checkpoint ` . <nl> + Distributed training with ` row_sparse ` weights and gradients are supported in MXNet , which significantly reduces communication cost for large models . To train a sparse model with multiple machines , you need to call ` prepare ` before ` forward ` , or ` save_checkpoint ` . <nl> Please refer to the example in [ mxnet / example / sparse / linear_classification ] ( https : / / github . com / apache / incubator - mxnet / tree / master / example / sparse / linear_classification ) <nl> for more details . <nl> <nl>
|
Documentation update related to sparse support ( )
|
apache/incubator-mxnet
|
d9ea96ad3c367a2b93d68d3e0edb63ea63c6841c
|
2018-08-27T20:25:57Z
|
mmm a / xbmc / GUIInfoManager . cpp <nl> ppp b / xbmc / GUIInfoManager . cpp <nl> <nl> # include " utils / Weather . h " <nl> # include " PartyModeManager . h " <nl> # include " guilib / GUIVisualisationControl . h " <nl> - # include " input / ButtonTranslator . h " <nl> + # include " input / WindowTranslator . h " <nl> # include " utils / AlarmClock . h " <nl> # include " LangInfo . h " <nl> # include " utils / SystemInfo . h " <nl> int CGUIInfoManager : : TranslateSingleString ( const std : : string & strCondition , bool <nl> { <nl> if ( prop . name = = " property " & & prop . num_params ( ) = = 1 ) <nl> { / / ! @ todo this doesn ' t support foo . xml <nl> - int winID = cat . param ( ) . empty ( ) ? 0 : CButtonTranslator : : TranslateWindow ( cat . param ( ) ) ; <nl> + int winID = cat . param ( ) . empty ( ) ? 0 : CWindowTranslator : : TranslateWindow ( cat . param ( ) ) ; <nl> if ( winID ! = WINDOW_INVALID ) <nl> return AddMultiInfo ( GUIInfo ( WINDOW_PROPERTY , winID , ConditionalStringParameter ( prop . param ( ) ) ) ) ; <nl> } <nl> int CGUIInfoManager : : TranslateSingleString ( const std : : string & strCondition , bool <nl> { / / ! @ todo The parameter for these should really be on the first not the second property <nl> if ( prop . param ( ) . find ( " xml " ) ! = std : : string : : npos ) <nl> return AddMultiInfo ( GUIInfo ( window_bools [ i ] . val , 0 , ConditionalStringParameter ( prop . param ( ) ) ) ) ; <nl> - int winID = prop . param ( ) . empty ( ) ? WINDOW_INVALID : CButtonTranslator : : TranslateWindow ( prop . param ( ) ) ; <nl> + int winID = prop . param ( ) . empty ( ) ? WINDOW_INVALID : CWindowTranslator : : TranslateWindow ( prop . param ( ) ) ; <nl> return winID ! = WINDOW_INVALID ? AddMultiInfo ( GUIInfo ( window_bools [ i ] . val , winID , 0 ) ) : window_bools [ i ] . val ; <nl> } <nl> } <nl> mmm a / xbmc / guilib / GUIAudioManager . cpp <nl> ppp b / xbmc / guilib / GUIAudioManager . cpp <nl> <nl> # include " ServiceBroker . h " <nl> # include " input / ActionIDs . h " <nl> # include " input / ActionTranslator . h " <nl> - # include " input / ButtonTranslator . h " <nl> # include " input / Key . h " <nl> + # include " input / WindowTranslator . h " <nl> # include " settings / lib / Setting . h " <nl> + # include " settings / Settings . h " <nl> # include " threads / SingleLock . h " <nl> # include " utils / URIUtils . h " <nl> # include " utils / XBMCTinyXML . h " <nl> bool CGUIAudioManager : : Load ( ) <nl> if ( pIdNode ) <nl> { <nl> if ( pIdNode - > FirstChild ( ) ) <nl> - id = CButtonTranslator : : TranslateWindow ( pIdNode - > FirstChild ( ) - > Value ( ) ) ; <nl> + id = CWindowTranslator : : TranslateWindow ( pIdNode - > FirstChild ( ) - > Value ( ) ) ; <nl> } <nl> <nl> CWindowSounds sounds ; <nl> mmm a / xbmc / guilib / GUIWindow . cpp <nl> ppp b / xbmc / guilib / GUIWindow . cpp <nl> <nl> # include " utils / log . h " <nl> # include " threads / SingleLock . h " <nl> # include " utils / TimeUtils . h " <nl> - # include " input / ButtonTranslator . h " <nl> + # include " input / WindowTranslator . h " <nl> # include " utils / XMLUtils . h " <nl> # include " GUIAudioManager . h " <nl> # include " Application . h " <nl> bool CGUIWindow : : Load ( TiXmlElement * pRootElement ) <nl> std : : string strValue = pChild - > Value ( ) ; <nl> if ( strValue = = " previouswindow " & & pChild - > FirstChild ( ) ) <nl> { <nl> - m_previousWindow = CButtonTranslator : : TranslateWindow ( pChild - > FirstChild ( ) - > Value ( ) ) ; <nl> + m_previousWindow = CWindowTranslator : : TranslateWindow ( pChild - > FirstChild ( ) - > Value ( ) ) ; <nl> } <nl> else if ( strValue = = " defaultcontrol " & & pChild - > FirstChild ( ) ) <nl> { <nl> mmm a / xbmc / input / ButtonTranslator . cpp <nl> ppp b / xbmc / input / ButtonTranslator . cpp <nl> <nl> # include " CustomControllerTranslator . h " <nl> # include " IRTranslator . h " <nl> # include " TouchTranslator . h " <nl> + # include " WindowTranslator . h " <nl> # include " FileItem . h " <nl> # include " filesystem / Directory . h " <nl> # include " guilib / WindowIDs . h " <nl> typedef struct <nl> int action ; <nl> } ActionMapping ; <nl> <nl> - typedef struct <nl> - { <nl> - int origin ; <nl> - int target ; <nl> - } WindowMapping ; <nl> - <nl> - static const ActionMapping windows [ ] = <nl> - { <nl> - { " home " , WINDOW_HOME } , <nl> - { " programs " , WINDOW_PROGRAMS } , <nl> - { " pictures " , WINDOW_PICTURES } , <nl> - { " filemanager " , WINDOW_FILES } , <nl> - { " settings " , WINDOW_SETTINGS_MENU } , <nl> - { " music " , WINDOW_MUSIC_NAV } , <nl> - { " videos " , WINDOW_VIDEO_NAV } , <nl> - { " tvchannels " , WINDOW_TV_CHANNELS } , <nl> - { " tvrecordings " , WINDOW_TV_RECORDINGS } , <nl> - { " tvguide " , WINDOW_TV_GUIDE } , <nl> - { " tvtimers " , WINDOW_TV_TIMERS } , <nl> - { " tvsearch " , WINDOW_TV_SEARCH } , <nl> - { " radiochannels " , WINDOW_RADIO_CHANNELS } , <nl> - { " radiorecordings " , WINDOW_RADIO_RECORDINGS } , <nl> - { " radioguide " , WINDOW_RADIO_GUIDE } , <nl> - { " radiotimers " , WINDOW_RADIO_TIMERS } , <nl> - { " radiosearch " , WINDOW_RADIO_SEARCH } , <nl> - { " gamecontrollers " , WINDOW_DIALOG_GAME_CONTROLLERS } , <nl> - { " games " , WINDOW_GAMES } , <nl> - { " pvrguideinfo " , WINDOW_DIALOG_PVR_GUIDE_INFO } , <nl> - { " pvrrecordinginfo " , WINDOW_DIALOG_PVR_RECORDING_INFO } , <nl> - { " pvrradiordsinfo " , WINDOW_DIALOG_PVR_RADIO_RDS_INFO } , <nl> - { " pvrtimersetting " , WINDOW_DIALOG_PVR_TIMER_SETTING } , <nl> - { " pvrgroupmanager " , WINDOW_DIALOG_PVR_GROUP_MANAGER } , <nl> - { " pvrchannelmanager " , WINDOW_DIALOG_PVR_CHANNEL_MANAGER } , <nl> - { " pvrguidesearch " , WINDOW_DIALOG_PVR_GUIDE_SEARCH } , <nl> - { " pvrchannelscan " , WINDOW_DIALOG_PVR_CHANNEL_SCAN } , <nl> - { " pvrupdateprogress " , WINDOW_DIALOG_PVR_UPDATE_PROGRESS } , <nl> - { " pvrosdchannels " , WINDOW_DIALOG_PVR_OSD_CHANNELS } , <nl> - { " pvrchannelguide " , WINDOW_DIALOG_PVR_CHANNEL_GUIDE } , <nl> - { " pvrosdguide " , WINDOW_DIALOG_PVR_CHANNEL_GUIDE } , / / backward compatibility to v17 <nl> - { " pvrosdteletext " , WINDOW_DIALOG_OSD_TELETEXT } , <nl> - { " systeminfo " , WINDOW_SYSTEM_INFORMATION } , <nl> - { " testpattern " , WINDOW_TEST_PATTERN } , <nl> - { " screencalibration " , WINDOW_SCREEN_CALIBRATION } , <nl> - { " systemsettings " , WINDOW_SETTINGS_SYSTEM } , <nl> - { " servicesettings " , WINDOW_SETTINGS_SERVICE } , <nl> - { " pvrsettings " , WINDOW_SETTINGS_MYPVR } , <nl> - { " playersettings " , WINDOW_SETTINGS_PLAYER } , <nl> - { " mediasettings " , WINDOW_SETTINGS_MEDIA } , <nl> - { " interfacesettings " , WINDOW_SETTINGS_INTERFACE } , <nl> - { " appearancesettings " , WINDOW_SETTINGS_INTERFACE } , / / backward compatibility to v16 <nl> - { " gamesettings " , WINDOW_SETTINGS_MYGAMES } , <nl> - { " videoplaylist " , WINDOW_VIDEO_PLAYLIST } , <nl> - { " loginscreen " , WINDOW_LOGIN_SCREEN } , <nl> - { " profiles " , WINDOW_SETTINGS_PROFILES } , <nl> - { " skinsettings " , WINDOW_SKIN_SETTINGS } , <nl> - { " addonbrowser " , WINDOW_ADDON_BROWSER } , <nl> - { " yesnodialog " , WINDOW_DIALOG_YES_NO } , <nl> - { " progressdialog " , WINDOW_DIALOG_PROGRESS } , <nl> - { " virtualkeyboard " , WINDOW_DIALOG_KEYBOARD } , <nl> - { " volumebar " , WINDOW_DIALOG_VOLUME_BAR } , <nl> - { " submenu " , WINDOW_DIALOG_SUB_MENU } , <nl> - { " favourites " , WINDOW_DIALOG_FAVOURITES } , <nl> - { " contextmenu " , WINDOW_DIALOG_CONTEXT_MENU } , <nl> - { " notification " , WINDOW_DIALOG_KAI_TOAST } , <nl> - { " numericinput " , WINDOW_DIALOG_NUMERIC } , <nl> - { " gamepadinput " , WINDOW_DIALOG_GAMEPAD } , <nl> - { " shutdownmenu " , WINDOW_DIALOG_BUTTON_MENU } , <nl> - { " playercontrols " , WINDOW_DIALOG_PLAYER_CONTROLS } , <nl> - { " playerprocessinfo " , WINDOW_DIALOG_PLAYER_PROCESS_INFO } , <nl> - { " seekbar " , WINDOW_DIALOG_SEEK_BAR } , <nl> - { " musicosd " , WINDOW_DIALOG_MUSIC_OSD } , <nl> - { " addonsettings " , WINDOW_DIALOG_ADDON_SETTINGS } , <nl> - { " visualisationpresetlist " , WINDOW_DIALOG_VIS_PRESET_LIST } , <nl> - { " osdcmssettings " , WINDOW_DIALOG_CMS_OSD_SETTINGS } , <nl> - { " osdvideosettings " , WINDOW_DIALOG_VIDEO_OSD_SETTINGS } , <nl> - { " osdaudiosettings " , WINDOW_DIALOG_AUDIO_OSD_SETTINGS } , <nl> - { " audiodspmanager " , WINDOW_DIALOG_AUDIO_DSP_MANAGER } , <nl> - { " osdaudiodspsettings " , WINDOW_DIALOG_AUDIO_DSP_OSD_SETTINGS } , <nl> - { " videobookmarks " , WINDOW_DIALOG_VIDEO_BOOKMARKS } , <nl> - { " filebrowser " , WINDOW_DIALOG_FILE_BROWSER } , <nl> - { " networksetup " , WINDOW_DIALOG_NETWORK_SETUP } , <nl> - { " mediasource " , WINDOW_DIALOG_MEDIA_SOURCE } , <nl> - { " profilesettings " , WINDOW_DIALOG_PROFILE_SETTINGS } , <nl> - { " locksettings " , WINDOW_DIALOG_LOCK_SETTINGS } , <nl> - { " contentsettings " , WINDOW_DIALOG_CONTENT_SETTINGS } , <nl> - { " songinformation " , WINDOW_DIALOG_SONG_INFO } , <nl> - { " smartplaylisteditor " , WINDOW_DIALOG_SMART_PLAYLIST_EDITOR } , <nl> - { " smartplaylistrule " , WINDOW_DIALOG_SMART_PLAYLIST_RULE } , <nl> - { " busydialog " , WINDOW_DIALOG_BUSY } , <nl> - { " pictureinfo " , WINDOW_DIALOG_PICTURE_INFO } , <nl> - { " accesspoints " , WINDOW_DIALOG_ACCESS_POINTS } , <nl> - { " fullscreeninfo " , WINDOW_DIALOG_FULLSCREEN_INFO } , <nl> - { " sliderdialog " , WINDOW_DIALOG_SLIDER } , <nl> - { " addoninformation " , WINDOW_DIALOG_ADDON_INFO } , <nl> - { " subtitlesearch " , WINDOW_DIALOG_SUBTITLES } , <nl> - { " musicplaylist " , WINDOW_MUSIC_PLAYLIST } , <nl> - { " musicplaylisteditor " , WINDOW_MUSIC_PLAYLIST_EDITOR } , <nl> - { " teletext " , WINDOW_DIALOG_OSD_TELETEXT } , <nl> - { " selectdialog " , WINDOW_DIALOG_SELECT } , <nl> - { " musicinformation " , WINDOW_DIALOG_MUSIC_INFO } , <nl> - { " okdialog " , WINDOW_DIALOG_OK } , <nl> - { " movieinformation " , WINDOW_DIALOG_VIDEO_INFO } , <nl> - { " textviewer " , WINDOW_DIALOG_TEXT_VIEWER } , <nl> - { " fullscreenvideo " , WINDOW_FULLSCREEN_VIDEO } , <nl> - { " fullscreenlivetv " , WINDOW_FULLSCREEN_LIVETV } , / / virtual window / keymap section for PVR specific bindings in fullscreen playback ( which internally uses WINDOW_FULLSCREEN_VIDEO ) <nl> - { " fullscreenradio " , WINDOW_FULLSCREEN_RADIO } , / / virtual window for fullscreen radio , uses WINDOW_VISUALISATION as fallback <nl> - { " fullscreengame " , WINDOW_FULLSCREEN_GAME } , / / virtual window for fullscreen games , uses WINDOW_FULLSCREEN_VIDEO as fallback <nl> - { " visualisation " , WINDOW_VISUALISATION } , <nl> - { " slideshow " , WINDOW_SLIDESHOW } , <nl> - { " weather " , WINDOW_WEATHER } , <nl> - { " screensaver " , WINDOW_SCREENSAVER } , <nl> - { " videoosd " , WINDOW_DIALOG_VIDEO_OSD } , <nl> - { " videomenu " , WINDOW_VIDEO_MENU } , <nl> - { " videotimeseek " , WINDOW_VIDEO_TIME_SEEK } , <nl> - { " startwindow " , WINDOW_START } , <nl> - { " startup " , WINDOW_STARTUP_ANIM } , <nl> - { " peripheralsettings " , WINDOW_DIALOG_PERIPHERAL_SETTINGS } , <nl> - { " extendedprogressdialog " , WINDOW_DIALOG_EXT_PROGRESS } , <nl> - { " mediafilter " , WINDOW_DIALOG_MEDIA_FILTER } , <nl> - { " addon " , WINDOW_ADDON_START } , <nl> - { " eventlog " , WINDOW_EVENT_LOG } , <nl> - { " tvtimerrules " , WINDOW_TV_TIMER_RULES } , <nl> - { " radiotimerrules " , WINDOW_RADIO_TIMER_RULES } <nl> - } ; <nl> - <nl> static const ActionMapping mousekeys [ ] = <nl> { <nl> { " click " , KEY_MOUSE_CLICK } , <nl> static const ActionMapping mousekeys [ ] = <nl> { " mouserdragend " , KEY_MOUSE_RDRAG_END } <nl> } ; <nl> <nl> - static const WindowMapping fallbackWindows [ ] = <nl> - { <nl> - { WINDOW_FULLSCREEN_LIVETV , WINDOW_FULLSCREEN_VIDEO } , <nl> - { WINDOW_FULLSCREEN_RADIO , WINDOW_VISUALISATION } , <nl> - { WINDOW_FULLSCREEN_GAME , WINDOW_FULLSCREEN_VIDEO } <nl> - } ; <nl> - <nl> # ifdef TARGET_WINDOWS <nl> static const ActionMapping appcommands [ ] = <nl> { <nl> bool CButtonTranslator : : LoadKeymap ( const std : : string & keymapPath ) <nl> if ( strcmpi ( szWindow , " global " ) = = 0 ) <nl> windowID = - 1 ; <nl> else <nl> - windowID = TranslateWindow ( szWindow ) ; <nl> + windowID = CWindowTranslator : : TranslateWindow ( szWindow ) ; <nl> } <nl> MapWindowActions ( pWindow , windowID ) ; <nl> } <nl> bool CButtonTranslator : : TranslateCustomControllerString ( int windowId , const std : <nl> if ( ! m_customControllerTranslator - > TranslateCustomControllerString ( windowId , controllerName , buttonId , actionId , strAction ) ) <nl> { <nl> / / If it ' s invalid , try to get it from a fallback window or the global map <nl> - int fallbackWindow = GetFallbackWindow ( windowId ) ; <nl> + int fallbackWindow = CWindowTranslator : : GetFallbackWindow ( windowId ) ; <nl> if ( fallbackWindow > - 1 ) <nl> m_customControllerTranslator - > TranslateCustomControllerString ( fallbackWindow , controllerName , buttonId , actionId , strAction ) ; <nl> <nl> bool CButtonTranslator : : TranslateTouchAction ( int window , int touchAction , int to <nl> <nl> if ( ! m_touchTranslator - > TranslateTouchAction ( window , touchAction , touchPointers , actionId , actionString ) ) <nl> { <nl> - int fallbackWindow = GetFallbackWindow ( window ) ; <nl> + int fallbackWindow = CWindowTranslator : : GetFallbackWindow ( window ) ; <nl> if ( fallbackWindow > - 1 ) <nl> m_touchTranslator - > TranslateTouchAction ( fallbackWindow , touchAction , touchPointers , actionId , actionString ) ; <nl> <nl> int CButtonTranslator : : GetActionCode ( int window , int action ) <nl> return it2 - > second . id ; <nl> } <nl> <nl> - void CButtonTranslator : : GetWindows ( std : : vector < std : : string > & windowList ) <nl> - { <nl> - unsigned int size = sizeof ( windows ) / sizeof ( ActionMapping ) ; <nl> - windowList . clear ( ) ; <nl> - windowList . reserve ( size ) ; <nl> - for ( unsigned int index = 0 ; index < size ; index + + ) <nl> - windowList . push_back ( windows [ index ] . name ) ; <nl> - } <nl> - <nl> - int CButtonTranslator : : GetFallbackWindow ( int windowID ) <nl> - { <nl> - for ( unsigned int index = 0 ; index < ARRAY_SIZE ( fallbackWindows ) ; + + index ) <nl> - { <nl> - if ( fallbackWindows [ index ] . origin = = windowID ) <nl> - return fallbackWindows [ index ] . target ; <nl> - } <nl> - / / for addon windows use WINDOW_ADDON_START because id is dynamic <nl> - if ( windowID > WINDOW_ADDON_START & & windowID < = WINDOW_ADDON_END ) <nl> - return WINDOW_ADDON_START ; <nl> - <nl> - return - 1 ; <nl> - } <nl> - <nl> CAction CButtonTranslator : : GetAction ( int window , const CKey & key , bool fallback ) <nl> { <nl> std : : string strAction ; <nl> CAction CButtonTranslator : : GetAction ( int window , const CKey & key , bool fallback ) <nl> if ( actionID = = 0 & & fallback ) <nl> { <nl> / / ! @ todo Refactor fallback logic <nl> - int fallbackWindow = GetFallbackWindow ( window ) ; <nl> + int fallbackWindow = CWindowTranslator : : GetFallbackWindow ( window ) ; <nl> if ( fallbackWindow > - 1 ) <nl> actionID = GetActionCode ( fallbackWindow , key , strAction ) ; <nl> / / still no valid action ? use global map <nl> bool CButtonTranslator : : HasLongpressMapping ( int window , const CKey & key ) <nl> if ( window > - 1 ) <nl> { <nl> / / first check if we have a fallback for the window <nl> - int fallbackWindow = GetFallbackWindow ( window ) ; <nl> + int fallbackWindow = CWindowTranslator : : GetFallbackWindow ( window ) ; <nl> if ( fallbackWindow > - 1 & & HasLongpressMapping ( fallbackWindow , key ) ) <nl> return true ; <nl> <nl> unsigned int CButtonTranslator : : GetHoldTimeMs ( int window , const CKey & key , bool <nl> else if ( fallback ) <nl> { <nl> / / ! @ todo Refactor fallback logic <nl> - int fallbackWindow = GetFallbackWindow ( window ) ; <nl> + int fallbackWindow = CWindowTranslator : : GetFallbackWindow ( window ) ; <nl> if ( fallbackWindow > - 1 ) <nl> holdtimeMs = GetHoldTimeMs ( fallbackWindow , key , false ) ; <nl> else <nl> unsigned int CButtonTranslator : : GetHoldTimeMs ( int window , const CKey & key , bool <nl> else if ( fallback ) <nl> { <nl> / / ! @ todo Refactor fallback logic <nl> - int fallbackWindow = GetFallbackWindow ( window ) ; <nl> + int fallbackWindow = CWindowTranslator : : GetFallbackWindow ( window ) ; <nl> if ( fallbackWindow > - 1 ) <nl> holdtimeMs = GetHoldTimeMs ( fallbackWindow , key , false ) ; <nl> else <nl> void CButtonTranslator : : MapWindowActions ( TiXmlNode * pWindow , int windowID ) <nl> <nl> } <nl> <nl> - std : : string CButtonTranslator : : TranslateWindow ( int windowID ) <nl> - { <nl> - for ( unsigned int index = 0 ; index < ARRAY_SIZE ( windows ) ; + + index ) <nl> - { <nl> - if ( windows [ index ] . action = = windowID ) <nl> - return windows [ index ] . name ; <nl> - } <nl> - return " " ; <nl> - } <nl> - <nl> - int CButtonTranslator : : TranslateWindow ( const std : : string & window ) <nl> - { <nl> - std : : string strWindow ( window ) ; <nl> - if ( strWindow . empty ( ) ) <nl> - return WINDOW_INVALID ; <nl> - StringUtils : : ToLower ( strWindow ) ; <nl> - / / eliminate . xml <nl> - if ( StringUtils : : EndsWith ( strWindow , " . xml " ) ) <nl> - strWindow = strWindow . substr ( 0 , strWindow . size ( ) - 4 ) ; <nl> - <nl> - / / window12345 , for custom window to be keymapped <nl> - if ( strWindow . length ( ) > 6 & & StringUtils : : StartsWithNoCase ( strWindow , " window " ) ) <nl> - strWindow = strWindow . substr ( 6 ) ; <nl> - if ( StringUtils : : StartsWithNoCase ( strWindow , " my " ) ) / / drop " my " prefix <nl> - strWindow = strWindow . substr ( 2 ) ; <nl> - if ( StringUtils : : IsNaturalNumber ( strWindow ) ) <nl> - { <nl> - / / allow a full window id or a delta id <nl> - int iWindow = atoi ( strWindow . c_str ( ) ) ; <nl> - if ( iWindow > WINDOW_INVALID ) <nl> - return iWindow ; <nl> - return WINDOW_HOME + iWindow ; <nl> - } <nl> - <nl> - / / run through the window structure <nl> - for ( unsigned int index = 0 ; index < ARRAY_SIZE ( windows ) ; + + index ) <nl> - { <nl> - if ( strWindow = = windows [ index ] . name ) <nl> - return windows [ index ] . action ; <nl> - } <nl> - <nl> - CLog : : Log ( LOGERROR , " Window Translator : Can ' t find window % s " , strWindow . c_str ( ) ) ; <nl> - return WINDOW_INVALID ; <nl> - } <nl> - <nl> uint32_t CButtonTranslator : : TranslateGamepadString ( const char * szButton ) <nl> { <nl> if ( ! szButton ) <nl> mmm a / xbmc / input / ButtonTranslator . h <nl> ppp b / xbmc / input / ButtonTranslator . h <nl> <nl> <nl> # include < map > <nl> # include < string > <nl> - # include < vector > <nl> # include " system . h " / / for HAS_EVENT_SERVER <nl> <nl> # ifdef HAS_EVENT_SERVER <nl> class CButtonTranslator <nl> / / / clears the maps <nl> void Clear ( ) ; <nl> <nl> - static void GetWindows ( std : : vector < std : : string > & windowList ) ; <nl> - <nl> / * ! \ brief Finds out if a longpress mapping exists for this key <nl> \ param window id of the current window <nl> \ param key to search a mapping for <nl> class CButtonTranslator <nl> * / <nl> CAction GetGlobalAction ( const CKey & key ) ; <nl> <nl> - / * ! \ brief Translate between a window name and it ' s id <nl> - \ param window name of the window <nl> - \ return id of the window , or WINDOW_INVALID if not found <nl> - * / <nl> - static int TranslateWindow ( const std : : string & window ) ; <nl> - <nl> - / * ! \ brief Translate between a window id and it ' s name <nl> - \ param window id of the window <nl> - \ return name of the window , or an empty string if not found <nl> - * / <nl> - static std : : string TranslateWindow ( int window ) ; <nl> - <nl> int TranslateLircRemoteString ( const char * szDevice , const char * szButton ) ; <nl> <nl> bool TranslateCustomControllerString ( int windowId , const std : : string & controllerName , int buttonId , int & action , std : : string & strAction ) ; <nl> class CButtonTranslator <nl> <nl> int GetActionCode ( int window , int action ) ; <nl> int GetActionCode ( int window , const CKey & key , std : : string & strAction ) const ; <nl> - int GetFallbackWindow ( int windowID ) ; <nl> <nl> static uint32_t TranslateGamepadString ( const char * szButton ) ; <nl> static uint32_t TranslateJoystickCommand ( const TiXmlElement * pButton , const std : : string & controllerId , unsigned int & holdtimeMs ) ; <nl> mmm a / xbmc / input / CMakeLists . txt <nl> ppp b / xbmc / input / CMakeLists . txt <nl> set ( SOURCES Action . cpp <nl> KeyboardStat . cpp <nl> MouseStat . cpp <nl> TouchTranslator . cpp <nl> + WindowTranslator . cpp <nl> XBMC_keytable . cpp ) <nl> <nl> set ( HEADERS Action . h <nl> set ( HEADERS Action . h <nl> KeyboardStat . h <nl> MouseStat . h <nl> TouchTranslator . h <nl> + WindowTranslator . h <nl> XBIRRemote . h <nl> XBMC_keyboard . h <nl> XBMC_keysym . h <nl> new file mode 100644 <nl> index 000000000000 . . 98e57e795645 <nl> mmm / dev / null <nl> ppp b / xbmc / input / WindowTranslator . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2017 Team Kodi <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with this Program ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " WindowTranslator . h " <nl> + # include " guilib / WindowIDs . h " <nl> + # include " utils / log . h " <nl> + # include " utils / StringUtils . h " <nl> + <nl> + # include < algorithm > <nl> + # include < map > <nl> + # include < stdlib . h > <nl> + <nl> + namespace <nl> + { <nl> + using WindowName = std : : string ; <nl> + using WindowID = int ; <nl> + <nl> + static const std : : map < WindowName , WindowID > WindowMapping = <nl> + { <nl> + { " home " , WINDOW_HOME } , <nl> + { " programs " , WINDOW_PROGRAMS } , <nl> + { " pictures " , WINDOW_PICTURES } , <nl> + { " filemanager " , WINDOW_FILES } , <nl> + { " settings " , WINDOW_SETTINGS_MENU } , <nl> + { " music " , WINDOW_MUSIC_NAV } , <nl> + { " videos " , WINDOW_VIDEO_NAV } , <nl> + { " tvchannels " , WINDOW_TV_CHANNELS } , <nl> + { " tvrecordings " , WINDOW_TV_RECORDINGS } , <nl> + { " tvguide " , WINDOW_TV_GUIDE } , <nl> + { " tvtimers " , WINDOW_TV_TIMERS } , <nl> + { " tvsearch " , WINDOW_TV_SEARCH } , <nl> + { " radiochannels " , WINDOW_RADIO_CHANNELS } , <nl> + { " radiorecordings " , WINDOW_RADIO_RECORDINGS } , <nl> + { " radioguide " , WINDOW_RADIO_GUIDE } , <nl> + { " radiotimers " , WINDOW_RADIO_TIMERS } , <nl> + { " radiosearch " , WINDOW_RADIO_SEARCH } , <nl> + { " gamecontrollers " , WINDOW_DIALOG_GAME_CONTROLLERS } , <nl> + { " games " , WINDOW_GAMES } , <nl> + { " pvrguideinfo " , WINDOW_DIALOG_PVR_GUIDE_INFO } , <nl> + { " pvrrecordinginfo " , WINDOW_DIALOG_PVR_RECORDING_INFO } , <nl> + { " pvrradiordsinfo " , WINDOW_DIALOG_PVR_RADIO_RDS_INFO } , <nl> + { " pvrtimersetting " , WINDOW_DIALOG_PVR_TIMER_SETTING } , <nl> + { " pvrgroupmanager " , WINDOW_DIALOG_PVR_GROUP_MANAGER } , <nl> + { " pvrchannelmanager " , WINDOW_DIALOG_PVR_CHANNEL_MANAGER } , <nl> + { " pvrguidesearch " , WINDOW_DIALOG_PVR_GUIDE_SEARCH } , <nl> + { " pvrchannelscan " , WINDOW_DIALOG_PVR_CHANNEL_SCAN } , <nl> + { " pvrupdateprogress " , WINDOW_DIALOG_PVR_UPDATE_PROGRESS } , <nl> + { " pvrosdchannels " , WINDOW_DIALOG_PVR_OSD_CHANNELS } , <nl> + { " pvrchannelguide " , WINDOW_DIALOG_PVR_CHANNEL_GUIDE } , <nl> + { " pvrosdguide " , WINDOW_DIALOG_PVR_CHANNEL_GUIDE } , / / backward compatibility to v17 <nl> + { " pvrosdteletext " , WINDOW_DIALOG_OSD_TELETEXT } , <nl> + { " systeminfo " , WINDOW_SYSTEM_INFORMATION } , <nl> + { " testpattern " , WINDOW_TEST_PATTERN } , <nl> + { " screencalibration " , WINDOW_SCREEN_CALIBRATION } , <nl> + { " systemsettings " , WINDOW_SETTINGS_SYSTEM } , <nl> + { " servicesettings " , WINDOW_SETTINGS_SERVICE } , <nl> + { " pvrsettings " , WINDOW_SETTINGS_MYPVR } , <nl> + { " playersettings " , WINDOW_SETTINGS_PLAYER } , <nl> + { " mediasettings " , WINDOW_SETTINGS_MEDIA } , <nl> + { " interfacesettings " , WINDOW_SETTINGS_INTERFACE } , <nl> + { " appearancesettings " , WINDOW_SETTINGS_INTERFACE } , / / backward compatibility to v16 <nl> + { " gamesettings " , WINDOW_SETTINGS_MYGAMES } , <nl> + { " videoplaylist " , WINDOW_VIDEO_PLAYLIST } , <nl> + { " loginscreen " , WINDOW_LOGIN_SCREEN } , <nl> + { " profiles " , WINDOW_SETTINGS_PROFILES } , <nl> + { " skinsettings " , WINDOW_SKIN_SETTINGS } , <nl> + { " addonbrowser " , WINDOW_ADDON_BROWSER } , <nl> + { " yesnodialog " , WINDOW_DIALOG_YES_NO } , <nl> + { " progressdialog " , WINDOW_DIALOG_PROGRESS } , <nl> + { " virtualkeyboard " , WINDOW_DIALOG_KEYBOARD } , <nl> + { " volumebar " , WINDOW_DIALOG_VOLUME_BAR } , <nl> + { " submenu " , WINDOW_DIALOG_SUB_MENU } , <nl> + { " favourites " , WINDOW_DIALOG_FAVOURITES } , <nl> + { " contextmenu " , WINDOW_DIALOG_CONTEXT_MENU } , <nl> + { " notification " , WINDOW_DIALOG_KAI_TOAST } , <nl> + { " numericinput " , WINDOW_DIALOG_NUMERIC } , <nl> + { " gamepadinput " , WINDOW_DIALOG_GAMEPAD } , <nl> + { " shutdownmenu " , WINDOW_DIALOG_BUTTON_MENU } , <nl> + { " playercontrols " , WINDOW_DIALOG_PLAYER_CONTROLS } , <nl> + { " playerprocessinfo " , WINDOW_DIALOG_PLAYER_PROCESS_INFO } , <nl> + { " seekbar " , WINDOW_DIALOG_SEEK_BAR } , <nl> + { " musicosd " , WINDOW_DIALOG_MUSIC_OSD } , <nl> + { " addonsettings " , WINDOW_DIALOG_ADDON_SETTINGS } , <nl> + { " visualisationpresetlist " , WINDOW_DIALOG_VIS_PRESET_LIST } , <nl> + { " osdcmssettings " , WINDOW_DIALOG_CMS_OSD_SETTINGS } , <nl> + { " osdvideosettings " , WINDOW_DIALOG_VIDEO_OSD_SETTINGS } , <nl> + { " osdaudiosettings " , WINDOW_DIALOG_AUDIO_OSD_SETTINGS } , <nl> + { " audiodspmanager " , WINDOW_DIALOG_AUDIO_DSP_MANAGER } , <nl> + { " osdaudiodspsettings " , WINDOW_DIALOG_AUDIO_DSP_OSD_SETTINGS } , <nl> + { " videobookmarks " , WINDOW_DIALOG_VIDEO_BOOKMARKS } , <nl> + { " filebrowser " , WINDOW_DIALOG_FILE_BROWSER } , <nl> + { " networksetup " , WINDOW_DIALOG_NETWORK_SETUP } , <nl> + { " mediasource " , WINDOW_DIALOG_MEDIA_SOURCE } , <nl> + { " profilesettings " , WINDOW_DIALOG_PROFILE_SETTINGS } , <nl> + { " locksettings " , WINDOW_DIALOG_LOCK_SETTINGS } , <nl> + { " contentsettings " , WINDOW_DIALOG_CONTENT_SETTINGS } , <nl> + { " songinformation " , WINDOW_DIALOG_SONG_INFO } , <nl> + { " smartplaylisteditor " , WINDOW_DIALOG_SMART_PLAYLIST_EDITOR } , <nl> + { " smartplaylistrule " , WINDOW_DIALOG_SMART_PLAYLIST_RULE } , <nl> + { " busydialog " , WINDOW_DIALOG_BUSY } , <nl> + { " pictureinfo " , WINDOW_DIALOG_PICTURE_INFO } , <nl> + { " accesspoints " , WINDOW_DIALOG_ACCESS_POINTS } , <nl> + { " fullscreeninfo " , WINDOW_DIALOG_FULLSCREEN_INFO } , <nl> + { " sliderdialog " , WINDOW_DIALOG_SLIDER } , <nl> + { " addoninformation " , WINDOW_DIALOG_ADDON_INFO } , <nl> + { " subtitlesearch " , WINDOW_DIALOG_SUBTITLES } , <nl> + { " musicplaylist " , WINDOW_MUSIC_PLAYLIST } , <nl> + { " musicplaylisteditor " , WINDOW_MUSIC_PLAYLIST_EDITOR } , <nl> + { " teletext " , WINDOW_DIALOG_OSD_TELETEXT } , <nl> + { " selectdialog " , WINDOW_DIALOG_SELECT } , <nl> + { " musicinformation " , WINDOW_DIALOG_MUSIC_INFO } , <nl> + { " okdialog " , WINDOW_DIALOG_OK } , <nl> + { " movieinformation " , WINDOW_DIALOG_VIDEO_INFO } , <nl> + { " textviewer " , WINDOW_DIALOG_TEXT_VIEWER } , <nl> + { " fullscreenvideo " , WINDOW_FULLSCREEN_VIDEO } , <nl> + { " fullscreenlivetv " , WINDOW_FULLSCREEN_LIVETV } , / / virtual window / keymap section for PVR specific bindings in fullscreen playback ( which internally uses WINDOW_FULLSCREEN_VIDEO ) <nl> + { " fullscreenradio " , WINDOW_FULLSCREEN_RADIO } , / / virtual window for fullscreen radio , uses WINDOW_VISUALISATION as fallback <nl> + { " fullscreengame " , WINDOW_FULLSCREEN_GAME } , / / virtual window for fullscreen games , uses WINDOW_FULLSCREEN_VIDEO as fallback <nl> + { " visualisation " , WINDOW_VISUALISATION } , <nl> + { " slideshow " , WINDOW_SLIDESHOW } , <nl> + { " weather " , WINDOW_WEATHER } , <nl> + { " screensaver " , WINDOW_SCREENSAVER } , <nl> + { " videoosd " , WINDOW_DIALOG_VIDEO_OSD } , <nl> + { " videomenu " , WINDOW_VIDEO_MENU } , <nl> + { " videotimeseek " , WINDOW_VIDEO_TIME_SEEK } , <nl> + { " startwindow " , WINDOW_START } , <nl> + { " startup " , WINDOW_STARTUP_ANIM } , <nl> + { " peripheralsettings " , WINDOW_DIALOG_PERIPHERAL_SETTINGS } , <nl> + { " extendedprogressdialog " , WINDOW_DIALOG_EXT_PROGRESS } , <nl> + { " mediafilter " , WINDOW_DIALOG_MEDIA_FILTER } , <nl> + { " addon " , WINDOW_ADDON_START } , <nl> + { " eventlog " , WINDOW_EVENT_LOG } , <nl> + { " tvtimerrules " , WINDOW_TV_TIMER_RULES } , <nl> + { " radiotimerrules " , WINDOW_RADIO_TIMER_RULES } <nl> + } ; <nl> + <nl> + struct FallbackWindowMapping <nl> + { <nl> + int origin ; <nl> + int target ; <nl> + } ; <nl> + <nl> + static const std : : vector < FallbackWindowMapping > FallbackWindows = <nl> + { <nl> + { WINDOW_FULLSCREEN_LIVETV , WINDOW_FULLSCREEN_VIDEO } , <nl> + { WINDOW_FULLSCREEN_RADIO , WINDOW_VISUALISATION } , <nl> + { WINDOW_FULLSCREEN_GAME , WINDOW_FULLSCREEN_VIDEO } <nl> + } ; <nl> + } / / anonymous namespace <nl> + <nl> + void CWindowTranslator : : GetWindows ( std : : vector < std : : string > & windowList ) <nl> + { <nl> + windowList . clear ( ) ; <nl> + windowList . reserve ( WindowMapping . size ( ) ) ; <nl> + for ( auto itMapping : WindowMapping ) <nl> + windowList . push_back ( itMapping . first ) ; <nl> + } <nl> + <nl> + int CWindowTranslator : : TranslateWindow ( const std : : string & window ) <nl> + { <nl> + std : : string strWindow ( window ) ; <nl> + if ( strWindow . empty ( ) ) <nl> + return WINDOW_INVALID ; <nl> + <nl> + StringUtils : : ToLower ( strWindow ) ; <nl> + <nl> + / / Eliminate . xml <nl> + if ( StringUtils : : EndsWith ( strWindow , " . xml " ) ) <nl> + strWindow = strWindow . substr ( 0 , strWindow . size ( ) - 4 ) ; <nl> + <nl> + / / window12345 , for custom window to be keymapped <nl> + if ( strWindow . length ( ) > 6 & & StringUtils : : StartsWith ( strWindow , " window " ) ) <nl> + strWindow = strWindow . substr ( 6 ) ; <nl> + <nl> + / / Drop " my " prefix <nl> + if ( StringUtils : : StartsWith ( strWindow , " my " ) ) <nl> + strWindow = strWindow . substr ( 2 ) ; <nl> + <nl> + if ( StringUtils : : IsNaturalNumber ( strWindow ) ) <nl> + { <nl> + / / Allow a full window ID or a delta ID <nl> + int iWindow = atoi ( strWindow . c_str ( ) ) ; <nl> + if ( iWindow > WINDOW_INVALID ) <nl> + return iWindow ; <nl> + <nl> + return WINDOW_HOME + iWindow ; <nl> + } <nl> + <nl> + / / Run through the window structure <nl> + auto it = WindowMapping . find ( strWindow ) ; <nl> + if ( it ! = WindowMapping . end ( ) ) <nl> + return it - > second ; <nl> + <nl> + CLog : : Log ( LOGERROR , " Window Translator : Can ' t find window % s " , window . c_str ( ) ) ; <nl> + <nl> + return WINDOW_INVALID ; <nl> + } <nl> + <nl> + std : : string CWindowTranslator : : TranslateWindow ( int windowId ) <nl> + { <nl> + static auto reverseWindowMapping = CreateReverseWindowMapping ( ) ; <nl> + <nl> + auto it = reverseWindowMapping . find ( windowId ) ; <nl> + if ( it ! = reverseWindowMapping . end ( ) ) <nl> + return it - > second ; <nl> + <nl> + return " " ; <nl> + } <nl> + <nl> + int CWindowTranslator : : GetFallbackWindow ( int windowId ) <nl> + { <nl> + auto it = std : : find_if ( FallbackWindows . begin ( ) , FallbackWindows . end ( ) , <nl> + [ windowId ] ( const FallbackWindowMapping & mapping ) <nl> + { <nl> + return mapping . origin = = windowId ; <nl> + } ) ; <nl> + <nl> + if ( it ! = FallbackWindows . end ( ) ) <nl> + return it - > target ; <nl> + <nl> + / / For add - on windows use WINDOW_ADDON_START because ID is dynamic <nl> + if ( WINDOW_ADDON_START < windowId & & windowId < = WINDOW_ADDON_END ) <nl> + return WINDOW_ADDON_START ; <nl> + <nl> + return - 1 ; <nl> + } <nl> + <nl> + std : : map < int , const char * > CWindowTranslator : : CreateReverseWindowMapping ( ) <nl> + { <nl> + std : : map < WindowID , const char * > reverseWindowMapping ; <nl> + <nl> + for ( auto itMapping : WindowMapping ) <nl> + reverseWindowMapping . insert ( std : : make_pair ( itMapping . second , itMapping . first . c_str ( ) ) ) ; <nl> + <nl> + return reverseWindowMapping ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . bf0ae6381691 <nl> mmm / dev / null <nl> ppp b / xbmc / input / WindowTranslator . h <nl> <nl> + / * <nl> + * Copyright ( C ) 2017 Team Kodi <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with this Program ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + # pragma once <nl> + <nl> + # include < map > <nl> + # include < string > <nl> + # include < vector > <nl> + <nl> + class CWindowTranslator <nl> + { <nl> + public : <nl> + / * ! <nl> + * \ brief Get a list of all known window names <nl> + * / <nl> + static void GetWindows ( std : : vector < std : : string > & windowList ) ; <nl> + <nl> + / * ! <nl> + * \ brief Translate between a window name and its ID <nl> + * \ param window The name of the window <nl> + * \ return ID of the window , or WINDOW_INVALID if not found <nl> + * / <nl> + static int TranslateWindow ( const std : : string & window ) ; <nl> + <nl> + / * ! <nl> + * \ brief Translate between a window id and it ' s name <nl> + * \ param window id of the window <nl> + * \ return name of the window , or an empty string if not found <nl> + * / <nl> + static std : : string TranslateWindow ( int windowId ) ; <nl> + <nl> + / * ! <nl> + * \ brief Get the window ID that should be used as fallback for keymap input <nl> + * \ return The fallback window , or - 1 for no fallback window <nl> + * / <nl> + static int GetFallbackWindow ( int windowId ) ; <nl> + <nl> + private : <nl> + static std : : map < int , const char * > CreateReverseWindowMapping ( ) ; <nl> + } ; <nl> mmm a / xbmc / interfaces / builtins / GUIBuiltins . cpp <nl> ppp b / xbmc / interfaces / builtins / GUIBuiltins . cpp <nl> <nl> # include " dialogs / GUIDialogNumeric . h " <nl> # include " filesystem / Directory . h " <nl> # include " input / ActionTranslator . h " <nl> - # include " input / ButtonTranslator . h " <nl> # include " input / Key . h " <nl> + # include " input / WindowTranslator . h " <nl> # include " guilib / GUIWindowManager . h " <nl> # include " guilib / LocalizeStrings . h " <nl> # include " guilib / StereoscopicsManager . h " <nl> static int Action ( const std : : vector < std : : string > & params ) <nl> unsigned int actionID ; <nl> if ( CActionTranslator : : TranslateActionString ( params [ 0 ] . c_str ( ) , actionID ) ) <nl> { <nl> - int windowID = params . size ( ) = = 2 ? CButtonTranslator : : TranslateWindow ( params [ 1 ] ) : WINDOW_INVALID ; <nl> + int windowID = params . size ( ) = = 2 ? CWindowTranslator : : TranslateWindow ( params [ 1 ] ) : WINDOW_INVALID ; <nl> CApplicationMessenger : : GetInstance ( ) . SendMsg ( TMSG_GUI_ACTION , windowID , - 1 , static_cast < void * > ( new CAction ( actionID ) ) ) ; <nl> } <nl> <nl> static int ActivateWindow ( const std : : vector < std : : string > & params2 ) <nl> } <nl> <nl> / / confirm the window destination is valid prior to switching <nl> - int iWindow = CButtonTranslator : : TranslateWindow ( strWindow ) ; <nl> + int iWindow = CWindowTranslator : : TranslateWindow ( strWindow ) ; <nl> if ( iWindow ! = WINDOW_INVALID ) <nl> { <nl> / / compare the given directory param with the current active directory <nl> static int ActivateAndFocus ( const std : : vector < std : : string > & params ) <nl> std : : string strWindow = params [ 0 ] ; <nl> <nl> / / confirm the window destination is valid prior to switching <nl> - int iWindow = CButtonTranslator : : TranslateWindow ( strWindow ) ; <nl> + int iWindow = CWindowTranslator : : TranslateWindow ( strWindow ) ; <nl> if ( iWindow ! = WINDOW_INVALID ) <nl> { <nl> if ( iWindow ! = g_windowManager . GetActiveWindow ( ) ) <nl> static int CancelAlarm ( const std : : vector < std : : string > & params ) <nl> * / <nl> static int ClearProperty ( const std : : vector < std : : string > & params ) <nl> { <nl> - CGUIWindow * window = g_windowManager . GetWindow ( params . size ( ) > 1 ? CButtonTranslator : : TranslateWindow ( params [ 1 ] ) : g_windowManager . GetFocusedWindow ( ) ) ; <nl> + CGUIWindow * window = g_windowManager . GetWindow ( params . size ( ) > 1 ? CWindowTranslator : : TranslateWindow ( params [ 1 ] ) : g_windowManager . GetFocusedWindow ( ) ) ; <nl> if ( window ) <nl> window - > SetProperty ( params [ 0 ] , " " ) ; <nl> <nl> static int CloseDialog ( const std : : vector < std : : string > & params ) <nl> } <nl> else <nl> { <nl> - int id = CButtonTranslator : : TranslateWindow ( params [ 0 ] ) ; <nl> + int id = CWindowTranslator : : TranslateWindow ( params [ 0 ] ) ; <nl> CGUIWindow * window = g_windowManager . GetWindow ( id ) ; <nl> if ( window & & window - > IsDialog ( ) ) <nl> ( ( CGUIDialog * ) window ) - > Close ( bForce ) ; <nl> static int SetResolution ( const std : : vector < std : : string > & params ) <nl> * / <nl> static int SetProperty ( const std : : vector < std : : string > & params ) <nl> { <nl> - CGUIWindow * window = g_windowManager . GetWindow ( params . size ( ) > 2 ? CButtonTranslator : : TranslateWindow ( params [ 2 ] ) : g_windowManager . GetFocusedWindow ( ) ) ; <nl> + CGUIWindow * window = g_windowManager . GetWindow ( params . size ( ) > 2 ? CWindowTranslator : : TranslateWindow ( params [ 2 ] ) : g_windowManager . GetFocusedWindow ( ) ) ; <nl> if ( window ) <nl> window - > SetProperty ( params [ 0 ] , params [ 1 ] ) ; <nl> <nl> mmm a / xbmc / interfaces / builtins / GUIControlBuiltins . cpp <nl> ppp b / xbmc / interfaces / builtins / GUIControlBuiltins . cpp <nl> <nl> # include " GUIControlBuiltins . h " <nl> <nl> # include " guilib / GUIWindowManager . h " <nl> - # include " input / ButtonTranslator . h " <nl> + # include " input / WindowTranslator . h " <nl> # include " utils / StringUtils . h " <nl> <nl> / * ! \ brief Send a move event to a GUI control . <nl> static int SendClick ( const std : : vector < std : : string > & params ) <nl> if ( params . size ( ) = = 2 ) <nl> { <nl> / / have a window - convert it <nl> - int windowID = CButtonTranslator : : TranslateWindow ( params [ 0 ] ) ; <nl> + int windowID = CWindowTranslator : : TranslateWindow ( params [ 0 ] ) ; <nl> CGUIMessage message ( GUI_MSG_CLICKED , atoi ( params [ 1 ] . c_str ( ) ) , windowID ) ; <nl> g_windowManager . SendMessage ( message ) ; <nl> } <nl> static int SendClick ( const std : : vector < std : : string > & params ) <nl> static int SendMessage ( const std : : vector < std : : string > & params ) <nl> { <nl> int controlID = atoi ( params [ 0 ] . c_str ( ) ) ; <nl> - int windowID = ( params . size ( ) = = 3 ) ? CButtonTranslator : : TranslateWindow ( params [ 2 ] ) : g_windowManager . GetActiveWindow ( ) ; <nl> + int windowID = ( params . size ( ) = = 3 ) ? CWindowTranslator : : TranslateWindow ( params [ 2 ] ) : g_windowManager . GetActiveWindow ( ) ; <nl> if ( params [ 1 ] = = " moveup " ) <nl> g_windowManager . SendMessage ( GUI_MSG_MOVE_OFFSET , windowID , controlID , 1 ) ; <nl> else if ( params [ 1 ] = = " movedown " ) <nl> mmm a / xbmc / interfaces / json - rpc / FavouritesOperations . cpp <nl> ppp b / xbmc / interfaces / json - rpc / FavouritesOperations . cpp <nl> <nl> <nl> # include " FavouritesOperations . h " <nl> # include " favourites / FavouritesService . h " <nl> - # include " input / ButtonTranslator . h " <nl> + # include " input / WindowTranslator . h " <nl> # include " utils / StringUtils . h " <nl> # include " Util . h " <nl> # include " utils / URIUtils . h " <nl> # include " utils / Variant . h " <nl> # include " guilib / WindowIDs . h " <nl> + # include " ServiceBroker . h " <nl> + <nl> # include < vector > <nl> <nl> using namespace JSONRPC ; <nl> JSONRPC_STATUS CFavouritesOperations : : GetFavourites ( const std : : string & method , I <nl> if ( fields . find ( " window " ) ! = fields . end ( ) ) <nl> { <nl> if ( StringUtils : : IsNaturalNumber ( parameters [ 0 ] ) ) <nl> - object [ " window " ] = CButtonTranslator : : TranslateWindow ( strtol ( parameters [ 0 ] . c_str ( ) , NULL , 10 ) ) ; <nl> + object [ " window " ] = CWindowTranslator : : TranslateWindow ( strtol ( parameters [ 0 ] . c_str ( ) , NULL , 10 ) ) ; <nl> else <nl> object [ " window " ] = parameters [ 0 ] ; <nl> } <nl> JSONRPC_STATUS CFavouritesOperations : : AddFavourite ( const std : : string & method , IT <nl> if ( type . compare ( " window " ) = = 0 ) <nl> { <nl> item = CFileItem ( parameterObject [ " windowparameter " ] . asString ( ) , true ) ; <nl> - contextWindow = CButtonTranslator : : TranslateWindow ( parameterObject [ " window " ] . asString ( ) ) ; <nl> + contextWindow = CWindowTranslator : : TranslateWindow ( parameterObject [ " window " ] . asString ( ) ) ; <nl> if ( contextWindow = = WINDOW_INVALID ) <nl> return InvalidParams ; <nl> } <nl> mmm a / xbmc / interfaces / json - rpc / JSONRPC . cpp <nl> ppp b / xbmc / interfaces / json - rpc / JSONRPC . cpp <nl> <nl> # include " addons / IAddon . h " <nl> # include " dbwrappers / DatabaseQuery . h " <nl> # include " input / ActionTranslator . h " <nl> - # include " input / ButtonTranslator . h " <nl> + # include " input / WindowTranslator . h " <nl> # include " interfaces / AnnouncementManager . h " <nl> # include " playlists / SmartPlayList . h " <nl> # include " settings / AdvancedSettings . h " <nl> void CJSONRPC : : Initialize ( ) <nl> CJSONServiceDescription : : AddEnum ( " Input . Action " , enumList ) ; <nl> <nl> enumList . clear ( ) ; <nl> - CButtonTranslator : : GetWindows ( enumList ) ; <nl> + CWindowTranslator : : GetWindows ( enumList ) ; <nl> CJSONServiceDescription : : AddEnum ( " GUI . Window " , enumList ) ; <nl> <nl> / / filter - related enums <nl> mmm a / xbmc / windows / GUIWindowDebugInfo . cpp <nl> ppp b / xbmc / windows / GUIWindowDebugInfo . cpp <nl> <nl> # include " utils / log . h " <nl> # include " CompileInfo . h " <nl> # include " filesystem / SpecialProtocol . h " <nl> - # include " input / ButtonTranslator . h " <nl> + # include " input / WindowTranslator . h " <nl> # include " guilib / GUIControlFactory . h " <nl> # include " guilib / GUIFontManager . h " <nl> # include " guilib / GUITextLayout . h " <nl> void CGUIWindowDebugInfo : : Process ( unsigned int currentTime , CDirtyRegionList & di <nl> point = CPoint ( pointer - > GetXPosition ( ) , pointer - > GetYPosition ( ) ) ; <nl> if ( window ) <nl> { <nl> - std : : string windowName = CButtonTranslator : : TranslateWindow ( window - > GetID ( ) ) ; <nl> + std : : string windowName = CWindowTranslator : : TranslateWindow ( window - > GetID ( ) ) ; <nl> if ( ! windowName . empty ( ) ) <nl> windowName + = " ( " + std : : string ( window - > GetProperty ( " xmlfile " ) . asString ( ) ) + " ) " ; <nl> else <nl>
|
ButtonTranslator : Move window translation to new class CWindowTranslator
|
xbmc/xbmc
|
52e71f11af858bd4f132264a5c4e8858cacf0efb
|
2017-06-15T07:01:22Z
|
mmm a / tensorflow / lite / tools / benchmark / benchmark_params . h <nl> ppp b / tensorflow / lite / tools / benchmark / benchmark_params . h <nl> class BenchmarkParams { <nl> return params_ . find ( name ) ! = params_ . end ( ) ; <nl> } <nl> <nl> + bool Empty ( ) const { return params_ . empty ( ) ; } <nl> + <nl> const BenchmarkParam * GetParam ( const std : : string & name ) const { <nl> const auto & entry = params_ . find ( name ) ; <nl> if ( entry = = params_ . end ( ) ) return nullptr ; <nl> mmm a / tensorflow / lite / tools / benchmark / benchmark_performance_options . cc <nl> ppp b / tensorflow / lite / tools / benchmark / benchmark_performance_options . cc <nl> std : : vector < Flag > BenchmarkPerformanceOptions : : GetFlags ( ) { <nl> CreateFlag < std : : string > ( <nl> " perf_options_list " , & params_ , <nl> " A comma - separated list of TFLite performance options to benchmark . " <nl> - " By default , all performance options are benchmarked . " ) , <nl> + " By default , all performance options are benchmarked . Note if it ' s " <nl> + " set to ' none ' , then the tool simply benchmark the model against the " <nl> + " specified benchmark parameters . " ) , <nl> CreateFlag < float > ( " option_benchmark_run_delay " , & params_ , <nl> " The delay between two consecutive runs of " <nl> " benchmarking performance options in seconds . " ) , <nl> bool BenchmarkPerformanceOptions : : ParsePerfOptions ( ) { <nl> perf_options_ . clear ( ) ; <nl> return false ; <nl> } <nl> + <nl> + if ( HasOption ( " none " ) & & perf_options_ . size ( ) > 1 ) { <nl> + TFLITE_LOG ( ERROR ) < < " The ' none ' option can not be used together with " <nl> + " other perf options in - - perf_options_list ! " ; <nl> + perf_options_ . clear ( ) ; <nl> + return false ; <nl> + } <nl> return true ; <nl> } <nl> <nl> std : : vector < std : : string > BenchmarkPerformanceOptions : : GetValidPerfOptions ( ) <nl> const { <nl> - return { " all " , " cpu " , " gpu " , " nnapi " } ; <nl> + return { " all " , " cpu " , " gpu " , " nnapi " , " none " } ; <nl> } <nl> <nl> bool BenchmarkPerformanceOptions : : HasOption ( const std : : string & option ) const { <nl> void BenchmarkPerformanceOptions : : CreatePerformanceOptions ( ) { <nl> <nl> const bool benchmark_all = HasOption ( " all " ) ; <nl> <nl> + if ( HasOption ( " none " ) ) { <nl> + / / Just add an empty BenchmarkParams instance . <nl> + BenchmarkParams params ; <nl> + all_run_params_ . emplace_back ( std : : move ( params ) ) ; <nl> + } <nl> + <nl> if ( benchmark_all | | HasOption ( " cpu " ) ) { <nl> const std : : vector < int > num_threads = { 1 , 2 , 4 } ; <nl> for ( const int count : num_threads ) { <nl> void BenchmarkPerformanceOptions : : Run ( ) { <nl> <nl> / / Now perform all runs , each with different performance - affecting parameters . <nl> for ( const auto & run_params : all_run_params_ ) { <nl> - / / Reset all performance - related options before any runs . <nl> - ResetPerformanceOptions ( ) ; <nl> - single_option_run_params_ - > Set ( run_params ) ; <nl> + / / If the run_params is empty , then it means " none " is set for <nl> + / / - - perf_options_list . <nl> + if ( ! run_params . Empty ( ) ) { <nl> + / / Reset all performance - related options before any runs . <nl> + ResetPerformanceOptions ( ) ; <nl> + single_option_run_params_ - > Set ( run_params ) ; <nl> + } <nl> util : : SleepForSeconds ( params_ . Get < float > ( " option_benchmark_run_delay " ) ) ; <nl> <nl> / / Clear internally created listeners before each run but keep externally <nl>
|
Add a ' none ' option to let the multi - perf - option run tool fallback to the single - perf - option run behavior .
|
tensorflow/tensorflow
|
7972e763651d7449ef70e6c6776e1d4294bc4aea
|
2020-01-13T14:15:36Z
|
mmm a / include / swift / SILOptimizer / Analysis / ARCAnalysis . h <nl> ppp b / include / swift / SILOptimizer / Analysis / ARCAnalysis . h <nl> class ConsumedArgToEpilogueReleaseMatcher { <nl> Optional < ArrayRef < SILInstruction * > > getFullyPostDomReleases ( ) const { <nl> if ( releases . empty ( ) | | foundSomeButNotAllReleases ( ) ) <nl> return None ; <nl> - return ArrayRef < SILInstruction * > { releases } ; <nl> + return { releases } ; <nl> } <nl> <nl> / / / If we were able to find a set of releases for this argument , but those <nl>
|
Revert " SILOptimizer : make a conversion operation explicit "
|
apple/swift
|
ec11c213cabacf3ef0b0274202eb1ad4fb902851
|
2018-09-17T16:07:38Z
|
mmm a / imgui . cpp <nl> ppp b / imgui . cpp <nl> void ImGui : : NewFrame ( ) <nl> / / No window should be open at the beginning of the frame . <nl> / / But in order to allow the user to call NewFrame ( ) multiple times without calling Render ( ) , we are doing an explicit clear . <nl> g . CurrentWindowStack . resize ( 0 ) ; <nl> - g . CurrentPopupStack . resize ( 0 ) ; <nl> + g . BeginPopupStack . resize ( 0 ) ; <nl> ClosePopupsOverWindow ( g . NavWindow ) ; <nl> <nl> / / Create implicit / fallback window - which we will only render it if the user has added something to it . <nl> void ImGui : : Shutdown ( ImGuiContext * context ) <nl> g . StyleModifiers . clear ( ) ; <nl> g . FontStack . clear ( ) ; <nl> g . OpenPopupStack . clear ( ) ; <nl> - g . CurrentPopupStack . clear ( ) ; <nl> + g . BeginPopupStack . clear ( ) ; <nl> g . DrawDataBuilder . ClearFreeMemory ( ) ; <nl> g . OverlayDrawList . ClearFreeMemory ( ) ; <nl> g . PrivateClipboard . clear ( ) ; <nl> ImVec2 ImGui : : GetMousePos ( ) <nl> ImVec2 ImGui : : GetMousePosOnOpeningCurrentPopup ( ) <nl> { <nl> ImGuiContext & g = * GImGui ; <nl> - if ( g . CurrentPopupStack . Size > 0 ) <nl> - return g . OpenPopupStack [ g . CurrentPopupStack . Size - 1 ] . OpenMousePos ; <nl> + if ( g . BeginPopupStack . Size > 0 ) <nl> + return g . OpenPopupStack [ g . BeginPopupStack . Size - 1 ] . OpenMousePos ; <nl> return g . IO . MousePos ; <nl> } <nl> <nl> static void CheckStacksSize ( ImGuiWindow * window , bool write ) <nl> short * p_backup = & window - > DC . StackSizesBackup [ 0 ] ; <nl> { int current = window - > IDStack . Size ; if ( write ) * p_backup = ( short ) current ; else IM_ASSERT ( * p_backup = = current & & " PushID / PopID or TreeNode / TreePop Mismatch ! " ) ; p_backup + + ; } / / Too few or too many PopID ( ) / TreePop ( ) <nl> { int current = window - > DC . GroupStack . Size ; if ( write ) * p_backup = ( short ) current ; else IM_ASSERT ( * p_backup = = current & & " BeginGroup / EndGroup Mismatch ! " ) ; p_backup + + ; } / / Too few or too many EndGroup ( ) <nl> - { int current = g . CurrentPopupStack . Size ; if ( write ) * p_backup = ( short ) current ; else IM_ASSERT ( * p_backup = = current & & " BeginMenu / EndMenu or BeginPopup / EndPopup Mismatch " ) ; p_backup + + ; } / / Too few or too many EndMenu ( ) / EndPopup ( ) <nl> + { int current = g . BeginPopupStack . Size ; if ( write ) * p_backup = ( short ) current ; else IM_ASSERT ( * p_backup = = current & & " BeginMenu / EndMenu or BeginPopup / EndPopup Mismatch " ) ; p_backup + + ; } / / Too few or too many EndMenu ( ) / EndPopup ( ) <nl> / / For color , style and font stacks there is an incentive to use Push / Begin / Pop / . . . / End patterns , so we relax our checks a little to allow them . <nl> { int current = g . ColorModifiers . Size ; if ( write ) * p_backup = ( short ) current ; else IM_ASSERT ( * p_backup > = current & & " PushStyleColor / PopStyleColor Mismatch ! " ) ; p_backup + + ; } / / Too few or too many PopStyleColor ( ) <nl> { int current = g . StyleModifiers . Size ; if ( write ) * p_backup = ( short ) current ; else IM_ASSERT ( * p_backup > = current & & " PushStyleVar / PopStyleVar Mismatch ! " ) ; p_backup + + ; } / / Too few or too many PopStyleVar ( ) <nl> bool ImGui : : Begin ( const char * name , bool * p_open , ImGuiWindowFlags flags ) <nl> const bool window_just_appearing_after_hidden_for_resize = ( window - > HiddenFramesForResize > 0 ) ; <nl> if ( flags & ImGuiWindowFlags_Popup ) <nl> { <nl> - ImGuiPopupRef & popup_ref = g . OpenPopupStack [ g . CurrentPopupStack . Size ] ; <nl> + ImGuiPopupRef & popup_ref = g . OpenPopupStack [ g . BeginPopupStack . Size ] ; <nl> window_just_activated_by_user | = ( window - > PopupId ! = popup_ref . PopupId ) ; / / We recycle popups so treat window as activated if popup id changed <nl> window_just_activated_by_user | = ( window ! = popup_ref . Window ) ; <nl> } <nl> bool ImGui : : Begin ( const char * name , bool * p_open , ImGuiWindowFlags flags ) <nl> CheckStacksSize ( window , true ) ; <nl> if ( flags & ImGuiWindowFlags_Popup ) <nl> { <nl> - ImGuiPopupRef & popup_ref = g . OpenPopupStack [ g . CurrentPopupStack . Size ] ; <nl> + ImGuiPopupRef & popup_ref = g . OpenPopupStack [ g . BeginPopupStack . Size ] ; <nl> popup_ref . Window = window ; <nl> - g . CurrentPopupStack . push_back ( popup_ref ) ; <nl> + g . BeginPopupStack . push_back ( popup_ref ) ; <nl> window - > PopupId = popup_ref . PopupId ; <nl> } <nl> <nl> bool ImGui : : Begin ( const char * name , bool * p_open , ImGuiWindowFlags flags ) <nl> { <nl> window - > AutoPosLastDirection = ImGuiDir_None ; <nl> if ( ( flags & ImGuiWindowFlags_Popup ) ! = 0 & & ! window_pos_set_by_api ) <nl> - window - > Pos = g . CurrentPopupStack . back ( ) . OpenPopupPos ; <nl> + window - > Pos = g . BeginPopupStack . back ( ) . OpenPopupPos ; <nl> } <nl> <nl> / / Position child window <nl> void ImGui : : End ( ) <nl> / / Pop from window stack <nl> g . CurrentWindowStack . pop_back ( ) ; <nl> if ( window - > Flags & ImGuiWindowFlags_Popup ) <nl> - g . CurrentPopupStack . pop_back ( ) ; <nl> + g . BeginPopupStack . pop_back ( ) ; <nl> CheckStacksSize ( window , false ) ; <nl> SetCurrentWindow ( g . CurrentWindowStack . empty ( ) ? NULL : g . CurrentWindowStack . back ( ) ) ; <nl> } <nl> void ImGui : : SetTooltip ( const char * fmt , . . . ) <nl> bool ImGui : : IsPopupOpen ( ImGuiID id ) <nl> { <nl> ImGuiContext & g = * GImGui ; <nl> - return g . OpenPopupStack . Size > g . CurrentPopupStack . Size & & g . OpenPopupStack [ g . CurrentPopupStack . Size ] . PopupId = = id ; <nl> + return g . OpenPopupStack . Size > g . BeginPopupStack . Size & & g . OpenPopupStack [ g . BeginPopupStack . Size ] . PopupId = = id ; <nl> } <nl> <nl> bool ImGui : : IsPopupOpen ( const char * str_id ) <nl> { <nl> ImGuiContext & g = * GImGui ; <nl> - return g . OpenPopupStack . Size > g . CurrentPopupStack . Size & & g . OpenPopupStack [ g . CurrentPopupStack . Size ] . PopupId = = g . CurrentWindow - > GetID ( str_id ) ; <nl> + return g . OpenPopupStack . Size > g . BeginPopupStack . Size & & g . OpenPopupStack [ g . BeginPopupStack . Size ] . PopupId = = g . CurrentWindow - > GetID ( str_id ) ; <nl> } <nl> <nl> ImGuiWindow * ImGui : : GetFrontMostPopupModal ( ) <nl> void ImGui : : OpenPopupEx ( ImGuiID id ) <nl> { <nl> ImGuiContext & g = * GImGui ; <nl> ImGuiWindow * parent_window = g . CurrentWindow ; <nl> - int current_stack_size = g . CurrentPopupStack . Size ; <nl> + int current_stack_size = g . BeginPopupStack . Size ; <nl> ImGuiPopupRef popup_ref ; / / Tagged as new ref as Window will be set back to NULL if we write this into OpenPopupStack . <nl> popup_ref . PopupId = id ; <nl> popup_ref . Window = NULL ; <nl> void ImGui : : ClosePopupToLevel ( int remaining ) <nl> void ImGui : : CloseCurrentPopup ( ) <nl> { <nl> ImGuiContext & g = * GImGui ; <nl> - int popup_idx = g . CurrentPopupStack . Size - 1 ; <nl> - if ( popup_idx < 0 | | popup_idx > = g . OpenPopupStack . Size | | g . CurrentPopupStack [ popup_idx ] . PopupId ! = g . OpenPopupStack [ popup_idx ] . PopupId ) <nl> + int popup_idx = g . BeginPopupStack . Size - 1 ; <nl> + if ( popup_idx < 0 | | popup_idx > = g . OpenPopupStack . Size | | g . BeginPopupStack [ popup_idx ] . PopupId ! = g . OpenPopupStack [ popup_idx ] . PopupId ) <nl> return ; <nl> while ( popup_idx > 0 & & g . OpenPopupStack [ popup_idx ] . Window & & ( g . OpenPopupStack [ popup_idx ] . Window - > Flags & ImGuiWindowFlags_ChildMenu ) ) <nl> popup_idx - - ; <nl> bool ImGui : : BeginPopupEx ( ImGuiID id , ImGuiWindowFlags extra_flags ) <nl> <nl> char name [ 20 ] ; <nl> if ( extra_flags & ImGuiWindowFlags_ChildMenu ) <nl> - ImFormatString ( name , IM_ARRAYSIZE ( name ) , " # # Menu_ % 02d " , g . CurrentPopupStack . Size ) ; / / Recycle windows based on depth <nl> + ImFormatString ( name , IM_ARRAYSIZE ( name ) , " # # Menu_ % 02d " , g . BeginPopupStack . Size ) ; / / Recycle windows based on depth <nl> else <nl> ImFormatString ( name , IM_ARRAYSIZE ( name ) , " # # Popup_ % 08x " , id ) ; / / Not recycling , so we can close / open during the same frame <nl> <nl> bool ImGui : : BeginPopupEx ( ImGuiID id , ImGuiWindowFlags extra_flags ) <nl> bool ImGui : : BeginPopup ( const char * str_id , ImGuiWindowFlags flags ) <nl> { <nl> ImGuiContext & g = * GImGui ; <nl> - if ( g . OpenPopupStack . Size < = g . CurrentPopupStack . Size ) / / Early out for performance <nl> + if ( g . OpenPopupStack . Size < = g . BeginPopupStack . Size ) / / Early out for performance <nl> { <nl> g . NextWindowData . Clear ( ) ; / / We behave like Begin ( ) and need to consume those values <nl> return false ; <nl> bool ImGui : : BeginPopupModal ( const char * name , bool * p_open , ImGuiWindowFlags fla <nl> { <nl> EndPopup ( ) ; <nl> if ( is_open ) <nl> - ClosePopupToLevel ( g . CurrentPopupStack . Size ) ; <nl> + ClosePopupToLevel ( g . BeginPopupStack . Size ) ; <nl> return false ; <nl> } <nl> return is_open ; <nl> void ImGui : : EndPopup ( ) <nl> { <nl> ImGuiContext & g = * GImGui ; ( void ) g ; <nl> IM_ASSERT ( g . CurrentWindow - > Flags & ImGuiWindowFlags_Popup ) ; / / Mismatched BeginPopup ( ) / EndPopup ( ) calls <nl> - IM_ASSERT ( g . CurrentPopupStack . Size > 0 ) ; <nl> + IM_ASSERT ( g . BeginPopupStack . Size > 0 ) ; <nl> <nl> / / Make all menus and popups wrap around for now , may need to expose that policy . <nl> NavMoveRequestTryWrapping ( g . CurrentWindow , ImGuiNavMoveFlags_LoopY ) ; <nl> mmm a / imgui_internal . h <nl> ppp b / imgui_internal . h <nl> struct ImGuiContext <nl> ImVector < ImGuiStyleMod > StyleModifiers ; / / Stack for PushStyleVar ( ) / PopStyleVar ( ) <nl> ImVector < ImFont * > FontStack ; / / Stack for PushFont ( ) / PopFont ( ) <nl> ImVector < ImGuiPopupRef > OpenPopupStack ; / / Which popups are open ( persistent ) <nl> - ImVector < ImGuiPopupRef > CurrentPopupStack ; / / Which level of BeginPopup ( ) we are in ( reset every frame ) <nl> + ImVector < ImGuiPopupRef > BeginPopupStack ; / / Which level of BeginPopup ( ) we are in ( reset every frame ) <nl> ImGuiNextWindowData NextWindowData ; / / Storage for SetNextWindow * * functions <nl> bool NextTreeNodeOpenVal ; / / Storage for SetNextTreeNode * * functions <nl> ImGuiCond NextTreeNodeOpenCond ; <nl> mmm a / imgui_widgets . cpp <nl> ppp b / imgui_widgets . cpp <nl> bool ImGui : : BeginCombo ( const char * label , const char * preview_value , ImGuiComboF <nl> } <nl> <nl> char name [ 16 ] ; <nl> - ImFormatString ( name , IM_ARRAYSIZE ( name ) , " # # Combo_ % 02d " , g . CurrentPopupStack . Size ) ; / / Recycle windows based on depth <nl> + ImFormatString ( name , IM_ARRAYSIZE ( name ) , " # # Combo_ % 02d " , g . BeginPopupStack . Size ) ; / / Recycle windows based on depth <nl> <nl> / / Peak into expected window size so we can position it <nl> if ( ImGuiWindow * popup_window = FindWindowByName ( name ) ) <nl> bool ImGui : : BeginMenu ( const char * label , bool enabled ) <nl> <nl> bool pressed ; <nl> bool menu_is_open = IsPopupOpen ( id ) ; <nl> - bool menuset_is_open = ! ( window - > Flags & ImGuiWindowFlags_Popup ) & & ( g . OpenPopupStack . Size > g . CurrentPopupStack . Size & & g . OpenPopupStack [ g . CurrentPopupStack . Size ] . OpenParentId = = window - > IDStack . back ( ) ) ; <nl> + bool menuset_is_open = ! ( window - > Flags & ImGuiWindowFlags_Popup ) & & ( g . OpenPopupStack . Size > g . BeginPopupStack . Size & & g . OpenPopupStack [ g . BeginPopupStack . Size ] . OpenParentId = = window - > IDStack . back ( ) ) ; <nl> ImGuiWindow * backed_nav_window = g . NavWindow ; <nl> if ( menuset_is_open ) <nl> g . NavWindow = window ; / / Odd hack to allow hovering across menus of a same menu - set ( otherwise we wouldn ' t be able to hover parent ) <nl> bool ImGui : : BeginMenu ( const char * label , bool enabled ) <nl> { <nl> / / Implement http : / / bjk5 . com / post / 44698559168 / breaking - down - amazons - mega - dropdown to avoid using timers , so menus feels more reactive . <nl> bool moving_within_opened_triangle = false ; <nl> - if ( g . HoveredWindow = = window & & g . OpenPopupStack . Size > g . CurrentPopupStack . Size & & g . OpenPopupStack [ g . CurrentPopupStack . Size ] . ParentWindow = = window & & ! ( window - > Flags & ImGuiWindowFlags_MenuBar ) ) <nl> + if ( g . HoveredWindow = = window & & g . OpenPopupStack . Size > g . BeginPopupStack . Size & & g . OpenPopupStack [ g . BeginPopupStack . Size ] . ParentWindow = = window & & ! ( window - > Flags & ImGuiWindowFlags_MenuBar ) ) <nl> { <nl> - if ( ImGuiWindow * next_window = g . OpenPopupStack [ g . CurrentPopupStack . Size ] . Window ) <nl> + if ( ImGuiWindow * next_window = g . OpenPopupStack [ g . BeginPopupStack . Size ] . Window ) <nl> { <nl> ImRect next_window_rect = next_window - > Rect ( ) ; <nl> ImVec2 ta = g . IO . MousePos - g . IO . MouseDelta ; <nl> bool ImGui : : BeginMenu ( const char * label , bool enabled ) <nl> if ( ! enabled ) / / explicitly close if an open menu becomes disabled , facilitate users code a lot in pattern such as ' if ( BeginMenu ( " options " , has_object ) ) { . . use object . . } ' <nl> want_close = true ; <nl> if ( want_close & & IsPopupOpen ( id ) ) <nl> - ClosePopupToLevel ( g . CurrentPopupStack . Size ) ; <nl> + ClosePopupToLevel ( g . BeginPopupStack . Size ) ; <nl> <nl> IMGUI_TEST_ENGINE_ITEM_INFO ( id , label , window - > DC . ItemFlags | ImGuiItemStatusFlags_Openable | ( menu_is_open ? ImGuiItemStatusFlags_Opened : 0 ) ) ; <nl> <nl> - if ( ! menu_is_open & & want_open & & g . OpenPopupStack . Size > g . CurrentPopupStack . Size ) <nl> + if ( ! menu_is_open & & want_open & & g . OpenPopupStack . Size > g . BeginPopupStack . Size ) <nl> { <nl> / / Don ' t recycle same menu level in the same frame , first close the other menu and yield for a frame . <nl> OpenPopup ( label ) ; <nl> void ImGui : : EndMenu ( ) <nl> ImGuiWindow * window = g . CurrentWindow ; <nl> if ( g . NavWindow & & g . NavWindow - > ParentWindow = = window & & g . NavMoveDir = = ImGuiDir_Left & & NavMoveRequestButNoResultYet ( ) & & window - > DC . LayoutType = = ImGuiLayoutType_Vertical ) <nl> { <nl> - ClosePopupToLevel ( g . CurrentPopupStack . Size ) ; <nl> + ClosePopupToLevel ( g . BeginPopupStack . Size ) ; <nl> NavMoveRequestCancel ( ) ; <nl> } <nl> <nl>
|
Internals : Popups : Renamed CurrentPopupStack to BeginPopupStack which is much less ambiguous .
|
ocornut/imgui
|
65dac021712f99ba954392734ceafe43392efe59
|
2018-12-14T17:44:17Z
|
mmm a / tensorflow / go / op / wrappers . go <nl> ppp b / tensorflow / go / op / wrappers . go <nl> func DepthwiseConv2dNativeBackpropFilterDataFormat ( value string ) DepthwiseConv2d <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func DepthwiseConv2dNativeBackpropFilterDilations ( value [ ] int64 ) DepthwiseConv2dNativeBackpropFilterAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func SampleDistortedBoundingBoxV2Seed2 ( value int64 ) SampleDistortedBoundingBoxV2 <nl> / / <nl> / / value : The cropped area of the image must have an aspect ratio = <nl> / / width / height within this range . <nl> - / / If not specified , defaults to { f : 0 . 75 f : 1 . 33 } <nl> + / / If not specified , defaults to { f : 0 . 75 f : 1 . 33 } <nl> func SampleDistortedBoundingBoxV2AspectRatioRange ( value [ ] float32 ) SampleDistortedBoundingBoxV2Attr { <nl> return func ( m optionalAttr ) { <nl> m [ " aspect_ratio_range " ] = value <nl> func SampleDistortedBoundingBoxV2AspectRatioRange ( value [ ] float32 ) SampleDistort <nl> / / <nl> / / value : The cropped area of the image must contain a fraction of the <nl> / / supplied image within this range . <nl> - / / If not specified , defaults to { f : 0 . 05 f : 1 } <nl> + / / If not specified , defaults to { f : 0 . 05 f : 1 } <nl> func SampleDistortedBoundingBoxV2AreaRange ( value [ ] float32 ) SampleDistortedBoundingBoxV2Attr { <nl> return func ( m optionalAttr ) { <nl> m [ " area_range " ] = value <nl> func SampleDistortedBoundingBoxMinObjectCovered ( value float32 ) SampleDistortedBo <nl> / / <nl> / / value : The cropped area of the image must have an aspect ratio = <nl> / / width / height within this range . <nl> - / / If not specified , defaults to { f : 0 . 75 f : 1 . 33 } <nl> + / / If not specified , defaults to { f : 0 . 75 f : 1 . 33 } <nl> func SampleDistortedBoundingBoxAspectRatioRange ( value [ ] float32 ) SampleDistortedBoundingBoxAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " aspect_ratio_range " ] = value <nl> func SampleDistortedBoundingBoxAspectRatioRange ( value [ ] float32 ) SampleDistorted <nl> / / <nl> / / value : The cropped area of the image must contain a fraction of the <nl> / / supplied image within this range . <nl> - / / If not specified , defaults to { f : 0 . 05 f : 1 } <nl> + / / If not specified , defaults to { f : 0 . 05 f : 1 } <nl> func SampleDistortedBoundingBoxAreaRange ( value [ ] float32 ) SampleDistortedBoundingBoxAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " area_range " ] = value <nl> func ImageSummaryMaxImages ( value int64 ) ImageSummaryAttr { <nl> / / ImageSummaryBadColor sets the optional bad_color attribute to value . <nl> / / <nl> / / value : Color to use for pixels with non - finite values . <nl> - / / If not specified , defaults to { dtype : DT_UINT8 tensor_shape : { dim : { size : 4 } } int_val : 255 int_val : 0 int_val : 0 int_val : 255 } <nl> + / / If not specified , defaults to { dtype : DT_UINT8 tensor_shape : { dim : { size : 4 } } int_val : 255 int_val : 0 int_val : 0 int_val : 255 } <nl> func ImageSummaryBadColor ( value tf . Tensor ) ImageSummaryAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " bad_color " ] = value <nl> func Conv3DBackpropFilterV2DataFormat ( value string ) Conv3DBackpropFilterV2Attr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DBackpropFilterV2Dilations ( value [ ] int64 ) Conv3DBackpropFilterV2Attr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv2DBackpropInputDataFormat ( value string ) Conv2DBackpropInputAttr { <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func Conv2DBackpropInputDilations ( value [ ] int64 ) Conv2DBackpropInputAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv2DDataFormat ( value string ) Conv2DAttr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func Conv2DDilations ( value [ ] int64 ) Conv2DAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeOutType ( value tf . DataTy <nl> / / QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : List of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeDilations ( value [ ] int64 ) QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedDepthwiseConv2DWithBiasAndReluOutType ( value tf . DataType ) Quantized <nl> / / QuantizedDepthwiseConv2DWithBiasAndReluDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : List of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedDepthwiseConv2DWithBiasAndReluDilations ( value [ ] int64 ) QuantizedDepthwiseConv2DWithBiasAndReluAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedDepthwiseConv2DWithBiasOutType ( value tf . DataType ) QuantizedDepthwi <nl> / / QuantizedDepthwiseConv2DWithBiasDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : List of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedDepthwiseConv2DWithBiasDilations ( value [ ] int64 ) QuantizedDepthwiseConv2DWithBiasAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedDepthwiseConv2DOutType ( value tf . DataType ) QuantizedDepthwiseConv2D <nl> / / QuantizedDepthwiseConv2DDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : List of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedDepthwiseConv2DDilations ( value [ ] int64 ) QuantizedDepthwiseConv2DAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedConv2DPerChannelOutType ( value tf . DataType ) QuantizedConv2DPerChann <nl> / / QuantizedConv2DPerChannelDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : list of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedConv2DPerChannelDilations ( value [ ] int64 ) QuantizedConv2DPerChannelAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv3DBackpropInputV2DataFormat ( value string ) Conv3DBackpropInputV2Attr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DBackpropInputV2Dilations ( value [ ] int64 ) Conv3DBackpropInputV2Attr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func DepthwiseConv2dNativeDataFormat ( value string ) DepthwiseConv2dNativeAttr { <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func DepthwiseConv2dNativeDilations ( value [ ] int64 ) DepthwiseConv2dNativeAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func DepthwiseConv2dNative ( scope * Scope , input tf . Output , filter tf . Output , stri <nl> type Conv3DBackpropInputAttr func ( optionalAttr ) <nl> <nl> / / Conv3DBackpropInputDilations sets the optional dilations attribute to value . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DBackpropInputDilations ( value [ ] int64 ) Conv3DBackpropInputAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func DepthwiseConv2dNativeBackpropInputDataFormat ( value string ) DepthwiseConv2dN <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func DepthwiseConv2dNativeBackpropInputDilations ( value [ ] int64 ) DepthwiseConv2dNativeBackpropInputAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedConv2DOutType ( value tf . DataType ) QuantizedConv2DAttr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedConv2DDilations ( value [ ] int64 ) QuantizedConv2DAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv3DDataFormat ( value string ) Conv3DAttr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DDilations ( value [ ] int64 ) Conv3DAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func SparseReduceMax ( scope * Scope , input_indices tf . Output , input_values tf . Outp <nl> type Conv3DBackpropFilterAttr func ( optionalAttr ) <nl> <nl> / / Conv3DBackpropFilterDilations sets the optional dilations attribute to value . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DBackpropFilterDilations ( value [ ] int64 ) Conv3DBackpropFilterAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv2DBackpropFilterDataFormat ( value string ) Conv2DBackpropFilterAttr { <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func Conv2DBackpropFilterDilations ( value [ ] int64 ) Conv2DBackpropFilterAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl>
|
Go : Update generated wrapper functions for TensorFlow ops .
|
tensorflow/tensorflow
|
3ec7d0638f45820c34a44f0e0b6a6abd89ab26aa
|
2019-12-25T08:54:24Z
|
mmm a / xbmc / peripherals / devices / PeripheralCecAdapter . cpp <nl> ppp b / xbmc / peripherals / devices / PeripheralCecAdapter . cpp <nl> void CPeripheralCecAdapter : : Process ( void ) <nl> return ; <nl> } <nl> <nl> + CAnnouncementManager : : AddAnnouncer ( m_cecAdapter ) ; <nl> CLog : : Log ( LOGDEBUG , " % s - connection to the CEC adapter opened " , __FUNCTION__ ) ; <nl> - m_bIsReady = true ; <nl> - CAnnouncementManager : : AddAnnouncer ( this ) ; <nl> <nl> if ( GetSettingBool ( " cec_power_on_startup " ) ) <nl> { <nl> void CPeripheralCecAdapter : : Process ( void ) <nl> FlushLog ( ) ; <nl> } <nl> <nl> - if ( GetSettingBool ( " use_tv_menu_language " ) ) <nl> - { <nl> - cec_menu_language language ; <nl> - if ( m_cecAdapter - > GetDeviceMenuLanguage ( CECDEVICE_TV , & language ) ) <nl> - SetMenuLanguage ( language . language ) ; <nl> - } <nl> - <nl> - CStdString strNotification ; <nl> - cec_osd_name tvName = m_cecAdapter - > GetDeviceOSDName ( CECDEVICE_TV ) ; <nl> - strNotification . Format ( " % s : % s " , g_localizeStrings . Get ( 36016 ) , tvName . name ) ; <nl> - <nl> - / * disable the mute setting when an amp is found , because the amp handles the mute setting and <nl> - set PCM output to 100 % * / <nl> - if ( HasConnectedAudioSystem ( ) ) <nl> - { <nl> - cec_osd_name ampName = m_cecAdapter - > GetDeviceOSDName ( CECDEVICE_AUDIOSYSTEM ) ; <nl> - CLog : : Log ( LOGDEBUG , " % s - CEC capable amplifier found ( % s ) . volume will be controlled on the amp " , __FUNCTION__ , ampName . name ) ; <nl> - strNotification . AppendFormat ( " - % s " , ampName . name ) ; <nl> - <nl> - g_settings . m_bMute = false ; <nl> - g_settings . m_nVolumeLevel = VOLUME_MAXIMUM ; <nl> - } <nl> - <nl> - m_cecAdapter - > SetOSDString ( CECDEVICE_TV , CEC_DISPLAY_CONTROL_DISPLAY_FOR_DEFAULT_TIME , g_localizeStrings . Get ( 36016 ) . c_str ( ) ) ; <nl> - CGUIDialogKaiToast : : QueueNotification ( CGUIDialogKaiToast : : Info , g_localizeStrings . Get ( 36000 ) , strNotification ) ; <nl> + m_queryThread = new CPeripheralCecAdapterQueryThread ( this ) ; <nl> + m_queryThread - > Create ( false ) ; <nl> <nl> while ( ! m_bStop ) <nl> { <nl> void CPeripheralCecAdapter : : Process ( void ) <nl> ProcessNextCommand ( ) ; <nl> if ( ! m_bStop ) <nl> ProcessVolumeChange ( ) ; <nl> + <nl> if ( ! m_bStop ) <nl> Sleep ( 5 ) ; <nl> } <nl> <nl> + delete m_queryThread ; <nl> m_cecAdapter - > Close ( ) ; <nl> <nl> CLog : : Log ( LOGDEBUG , " % s - CEC adapter processor thread ended " , __FUNCTION__ ) ; <nl> void CPeripheralCecAdapter : : ProcessNextCommand ( void ) <nl> } <nl> } <nl> break ; <nl> + case CEC_OPCODE_REPORT_POWER_STATUS : <nl> + if ( command . initiator = = CECDEVICE_TV & & <nl> + command . parameters . size = = 1 & & <nl> + command . parameters [ 0 ] = = CEC_POWER_STATUS_ON & & <nl> + m_queryThread ) <nl> + { <nl> + m_queryThread - > Signal ( ) ; <nl> + } <nl> + break ; <nl> default : <nl> break ; <nl> } <nl> bool CPeripheralCecAdapter : : TranslateComPort ( CStdString & strLocation ) <nl> <nl> return false ; <nl> } <nl> + <nl> + CPeripheralCecAdapterQueryThread : : CPeripheralCecAdapterQueryThread ( CPeripheralCecAdapter * adapter ) : <nl> + CThread ( " CEC Adapter Query Thread " ) , <nl> + m_adapter ( adapter ) <nl> + { <nl> + m_event . Reset ( ) ; <nl> + } <nl> + <nl> + CPeripheralCecAdapterQueryThread : : ~ CPeripheralCecAdapterQueryThread ( void ) <nl> + { <nl> + m_event . Set ( ) ; <nl> + StopThread ( true ) ; <nl> + } <nl> + <nl> + void CPeripheralCecAdapterQueryThread : : Signal ( void ) <nl> + { <nl> + m_event . Set ( ) ; <nl> + } <nl> + <nl> + void CPeripheralCecAdapterQueryThread : : Process ( void ) <nl> + { <nl> + / * wait until the TV reports to be powered on * / <nl> + do <nl> + { <nl> + m_event . WaitMSec ( 2000 ) ; <nl> + if ( m_adapter - > m_bStop ) <nl> + return ; <nl> + } while ( m_adapter - > m_cecAdapter - > GetDevicePowerStatus ( CECDEVICE_TV ) ! = CEC_POWER_STATUS_ON ) ; <nl> + <nl> + if ( m_adapter - > GetSettingBool ( " use_tv_menu_language " ) ) <nl> + { <nl> + cec_menu_language language ; <nl> + if ( m_adapter - > m_cecAdapter - > GetDeviceMenuLanguage ( CECDEVICE_TV , & language ) ) <nl> + m_adapter - > SetMenuLanguage ( language . language ) ; <nl> + } <nl> + <nl> + CStdString strNotification ; <nl> + cec_osd_name tvName = m_adapter - > m_cecAdapter - > GetDeviceOSDName ( CECDEVICE_TV ) ; <nl> + strNotification . Format ( " % s : % s " , g_localizeStrings . Get ( 36016 ) , tvName . name ) ; <nl> + <nl> + / * disable the mute setting when an amp is found , because the amp handles the mute setting and <nl> + set PCM output to 100 % * / <nl> + if ( m_adapter - > HasConnectedAudioSystem ( ) ) <nl> + { <nl> + cec_osd_name ampName = m_adapter - > m_cecAdapter - > GetDeviceOSDName ( CECDEVICE_AUDIOSYSTEM ) ; <nl> + CLog : : Log ( LOGDEBUG , " % s - CEC capable amplifier found ( % s ) . volume will be controlled on the amp " , __FUNCTION__ , ampName . name ) ; <nl> + strNotification . AppendFormat ( " - % s " , ampName . name ) ; <nl> + <nl> + g_settings . m_bMute = false ; <nl> + g_settings . m_nVolumeLevel = VOLUME_MAXIMUM ; <nl> + } <nl> + <nl> + m_adapter - > m_bIsReady = true ; <nl> + <nl> + m_adapter - > m_cecAdapter - > SetOSDString ( CECDEVICE_TV , CEC_DISPLAY_CONTROL_DISPLAY_FOR_DEFAULT_TIME , g_localizeStrings . Get ( 36016 ) . c_str ( ) ) ; <nl> + CGUIDialogKaiToast : : QueueNotification ( CGUIDialogKaiToast : : Info , g_localizeStrings . Get ( 36000 ) , strNotification ) ; <nl> + } <nl> + <nl> # endif <nl> mmm a / xbmc / peripherals / devices / PeripheralCecAdapter . h <nl> ppp b / xbmc / peripherals / devices / PeripheralCecAdapter . h <nl> namespace CEC <nl> <nl> namespace PERIPHERALS <nl> { <nl> + class CPeripheralCecAdapterQueryThread ; <nl> + <nl> typedef struct <nl> { <nl> WORD iButton ; <nl> namespace PERIPHERALS <nl> <nl> class CPeripheralCecAdapter : public CPeripheralHID , public ANNOUNCEMENT : : IAnnouncer , private CThread <nl> { <nl> + friend class CPeripheralCecAdapterQueryThread ; <nl> + <nl> public : <nl> CPeripheralCecAdapter ( const PeripheralType type , const PeripheralBusType busType , const CStdString & strLocation , const CStdString & strDeviceName , int iVendorId , int iProductId ) ; <nl> virtual ~ CPeripheralCecAdapter ( void ) ; <nl> namespace PERIPHERALS <nl> static bool FindConfigLocation ( CStdString & strString ) ; <nl> static bool TranslateComPort ( CStdString & strPort ) ; <nl> <nl> - DllLibCEC * m_dll ; <nl> - CEC : : ICECAdapter * m_cecAdapter ; <nl> - bool m_bStarted ; <nl> - bool m_bHasButton ; <nl> - bool m_bIsReady ; <nl> - CStdString m_strMenuLanguage ; <nl> - CDateTime m_screensaverLastActivated ; <nl> - CecButtonPress m_button ; <nl> - std : : queue < CEC : : cec_keypress > m_buttonQueue ; <nl> - std : : queue < CecVolumeChange > m_volumeChangeQueue ; <nl> - unsigned int m_lastKeypress ; <nl> - CecVolumeChange m_lastChange ; <nl> - CCriticalSection m_critSection ; <nl> + DllLibCEC * m_dll ; <nl> + CEC : : ICECAdapter * m_cecAdapter ; <nl> + bool m_bStarted ; <nl> + bool m_bHasButton ; <nl> + bool m_bIsReady ; <nl> + CStdString m_strMenuLanguage ; <nl> + CDateTime m_screensaverLastActivated ; <nl> + CecButtonPress m_button ; <nl> + std : : queue < CEC : : cec_keypress > m_buttonQueue ; <nl> + std : : queue < CecVolumeChange > m_volumeChangeQueue ; <nl> + unsigned int m_lastKeypress ; <nl> + CecVolumeChange m_lastChange ; <nl> + CPeripheralCecAdapterQueryThread * m_queryThread ; <nl> + CCriticalSection m_critSection ; <nl> + } ; <nl> + <nl> + class CPeripheralCecAdapterQueryThread : public CThread <nl> + { <nl> + public : <nl> + CPeripheralCecAdapterQueryThread ( CPeripheralCecAdapter * adapter ) ; <nl> + virtual ~ CPeripheralCecAdapterQueryThread ( void ) ; <nl> + <nl> + virtual void Signal ( void ) ; <nl> + <nl> + protected : <nl> + virtual void Process ( void ) ; <nl> + <nl> + CPeripheralCecAdapter * m_adapter ; <nl> + CEvent m_event ; <nl> } ; <nl> } <nl> <nl>
|
cec : some TVs don ' t like us querying it while activating sources . moved the queries to a background thread , and only query after the TV reports power state active .
|
xbmc/xbmc
|
56ce04d94b02a3350430387e8414ff3f6e36f9ab
|
2012-03-27T14:05:09Z
|
mmm a / xbmc / addons / AddonDatabase . h <nl> ppp b / xbmc / addons / AddonDatabase . h <nl> class CAddonDatabase : public CDatabase <nl> int AddAddon ( const ADDON : : AddonPtr & item , int idRepo ) ; <nl> bool GetAddon ( const CStdString & addonID , ADDON : : AddonPtr & addon ) ; <nl> bool GetAddons ( ADDON : : VECADDONS & addons ) ; <nl> - bool GetAddon ( int id , ADDON : : AddonPtr & addon ) ; <nl> <nl> / * ! \ brief Grab the repository from which a given addon came <nl> \ param addonID - the id of the addon in question <nl> class CAddonDatabase : public CDatabase <nl> virtual bool UpdateOldVersion ( int version ) ; <nl> virtual int GetMinVersion ( ) const { return 16 ; } <nl> const char * GetBaseDBName ( ) const { return " Addons " ; } <nl> + <nl> + bool GetAddon ( int id , ADDON : : AddonPtr & addon ) ; <nl> } ; <nl> <nl>
|
[ addondb ] move GetAddon ( int ) version to protected as it ' s not part of the external API
|
xbmc/xbmc
|
e352ebb4ee9ff5b62f552164121491d741bf57ea
|
2014-01-28T07:31:57Z
|
mmm a / utils / sil - mode . el <nl> ppp b / utils / sil - mode . el <nl> <nl> - ; = = = mmm sil - mode . el mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - = = = ; <nl> - ; <nl> - ; This source file is part of the Swift . org open source project <nl> - ; <nl> - ; Copyright ( c ) 2014 - 2016 Apple Inc . and the Swift project authors <nl> - ; Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> - ; <nl> - ; See http : / / swift . org / LICENSE . txt for license information <nl> - ; See http : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> - ; <nl> - ; = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = = = ; <nl> + ; ; = = = mmm sil - mode . el mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = = = ; ; <nl> + ; ; <nl> + ; ; This source file is part of the Swift . org open source project <nl> + ; ; <nl> + ; ; Copyright ( c ) 2014 - 2016 Apple Inc . and the Swift project authors <nl> + ; ; Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + ; ; <nl> + ; ; See http : / / swift . org / LICENSE . txt for license information <nl> + ; ; See http : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + ; ; <nl> + ; ; = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = ; ; <nl> <nl> ; ; Create mode - specific tables . <nl> ( defvar sil - mode - syntax - table nil <nl> <nl> ' words ) . font - lock - keyword - face ) <nl> ; ; SIL Stage <nl> ' ( " sil_stage " . font - lock - keyword - face ) <nl> + <nl> ; ; SIL Function <nl> ` ( , ( regexp - opt ' ( " sil " " internal " " thunk " ) <nl> ' words ) . font - lock - keyword - face ) <nl> <nl> ` ( , ( regexp - opt ' ( " public " " hidden " " private " " shared " " public_external " <nl> " hidden_external " " shared_external " " private_external " ) <nl> ' words ) . font - lock - keyword - face ) <nl> + <nl> ; ; SIL Declaration <nl> ` ( , ( regexp - opt ' ( " getter " " setter " " allocator " " initializer " " enumelt " <nl> " destroyer " " globalaccessor " " objc " ) ' words ) . <nl> font - lock - keyword - face ) <nl> + <nl> ; ; SIL Instructions - Allocation / Deallocation . <nl> ` ( , ( regexp - opt ' ( " alloc_stack " " alloc_ref " " alloc_ref_dynamic " " alloc_box " <nl> - " dealloc_stack " " dealloc_box " " dealloc_ref " ) <nl> + " alloc_value_buffer " " alloc_global " <nl> + " dealloc_stack " " dealloc_box " " project_box " " dealloc_ref " <nl> + " dealloc_partial_ref " " dealloc_value_buffer " <nl> + " project_value_buffer " ) <nl> ' words ) . font - lock - keyword - face ) <nl> + <nl> ; ; SIL Instructions - Debug Information . <nl> ` ( , ( regexp - opt ' ( " debug_value " " debug_value_addr " ) <nl> ' words ) . font - lock - keyword - face ) <nl> + <nl> ; ; SIL Instructions - Accessing Memory . <nl> ` ( , ( regexp - opt ' ( " load " " store " " assign " " mark_uninitialized " <nl> " mark_function_escape " " copy_addr " " destroy_addr " <nl> " index_addr " " index_raw_pointer " " to " ) <nl> ' words ) . font - lock - keyword - face ) <nl> + <nl> ; ; SIL Instructions - Reference Counting . <nl> ` ( , ( regexp - opt ' ( " strong_retain " <nl> " strong_release " " strong_retain_unowned " <nl> " unowned_retain " " unowned_release " <nl> - " ref_to_unmanaged " " unmanaged_to_ref " <nl> - " load_weak " " store_weak " " fix_lifetime " " mark_dependence " <nl> + " load_weak " " store_weak " <nl> + " fix_lifetime " " mark_dependence " <nl> + " is_unique " " is_unique_or_pinned " <nl> + " copy_block " <nl> " strong_unpin " " strong_pin " " is_unique " " is_unique_or_pinned " ) <nl> ' words ) . font - lock - keyword - face ) <nl> ; ; Literals <nl> <nl> " objc_existential_metatype_to_object " <nl> " word_to_bridge_object " <nl> " is_nonnull " <nl> + <nl> ) <nl> ' words ) . font - lock - keyword - face ) <nl> - ; ; Value Buffer <nl> - ` ( , ( regexp - opt ' ( " alloc_value_buffer " " dealloc_value_buffer " <nl> - " project_value_buffer " ) ' words ) . font - lock - keyword - face ) <nl> + <nl> ; ; Checked Conversions <nl> ` ( , ( regexp - opt ' ( " unconditional_checked_cast " " unconditional_checked_cast_addr " ) <nl> ' words ) . font - lock - keyword - face ) <nl>
|
[ sil - mode . el ] Add syntax highlighting for some more instructions .
|
apple/swift
|
4fcdc025be466b6c600b4a1d5b1f4cab2e4f4215
|
2016-02-20T04:54:27Z
|
mmm a / src / mongo / db / mongod_options . cpp <nl> ppp b / src / mongo / db / mongod_options . cpp <nl> namespace mongo { <nl> <nl> rs_options . addOptionChaining ( " replication . replSetName " , " " , moe : : String , " arg is < setname > " ) <nl> . setSources ( moe : : SourceYAMLConfig ) <nl> - . format ( " [ ^ / ] " , " [ replica set name with no \ " / \ " ] " ) <nl> + . format ( " [ ^ / ] + " , " [ replica set name with no \ " / \ " ] " ) <nl> . incompatibleWith ( " replication . replSet " ) ; <nl> <nl> rs_options . addOptionChaining ( " replication . secondaryIndexPrefetch " , " replIndexPrefetch " , moe : : String , <nl>
|
SERVER - 13178 Fix replica set name regular expression
|
mongodb/mongo
|
93f3f1b5028c52cdaff5974bf39858ae5e066d5e
|
2014-03-13T14:23:14Z
|
mmm a / lib / Parse / ParseExpr . cpp <nl> ppp b / lib / Parse / ParseExpr . cpp <nl> <nl> # include " llvm / ADT / SmallString . h " <nl> # include " llvm / ADT / StringSwitch . h " <nl> # include " llvm / ADT / Twine . h " <nl> + # include " swift / Basic / Defer . h " <nl> # include " swift / Basic / StringExtras . h " <nl> # include " llvm / Support / Compiler . h " <nl> # include " llvm / Support / SaveAndRestore . h " <nl> parseClosureSignatureIfPresent ( SmallVectorImpl < CaptureListEntry > & captureList , <nl> return false ; <nl> } <nl> <nl> - / / At this point , we know we have a closure signature . Parse the capture list <nl> - / / and parameters . <nl> - if ( consumeIf ( tok : : l_square ) & & <nl> - ! consumeIf ( tok : : r_square ) ) { <nl> + if ( Tok . is ( tok : : l_square ) & & peekToken ( ) . is ( tok : : r_square ) ) { <nl> + SyntaxParsingContext CaptureCtx ( SyntaxContext , <nl> + SyntaxKind : : ClosureCaptureSignature ) ; <nl> + consumeToken ( tok : : l_square ) ; <nl> + consumeToken ( tok : : r_square ) ; <nl> + } else if ( Tok . is ( tok : : l_square ) & & ! peekToken ( ) . is ( tok : : r_square ) ) { <nl> + SyntaxParsingContext CaptureCtx ( SyntaxContext , <nl> + SyntaxKind : : ClosureCaptureSignature ) ; <nl> + consumeToken ( tok : : l_square ) ; <nl> + / / At this point , we know we have a closure signature . Parse the capture list <nl> + / / and parameters . <nl> + bool HasNext ; <nl> do { <nl> + SyntaxParsingContext CapturedItemCtx ( SyntaxContext , <nl> + SyntaxKind : : ClosureCaptureItem ) ; <nl> + SWIFT_DEFER { HasNext = consumeIf ( tok : : comma ) ; } ; <nl> / / Check for the strength specifier : " weak " , " unowned " , or <nl> / / " unowned ( safe / unsafe ) " . <nl> SourceLoc loc ; <nl> parseClosureSignatureIfPresent ( SmallVectorImpl < CaptureListEntry > & captureList , <nl> continue ; <nl> } <nl> <nl> + / / Squash all tokens , if any , as the specifier of the captured item . <nl> + CapturedItemCtx . collectNodesInPlace ( SyntaxKind : : TokenList ) ; <nl> + <nl> / / The thing being capture specified is an identifier , or as an identifier <nl> / / followed by an expression . <nl> Expr * initializer ; <nl> parseClosureSignatureIfPresent ( SmallVectorImpl < CaptureListEntry > & captureList , <nl> CurDeclContext ) ; <nl> <nl> captureList . push_back ( CaptureListEntry ( VD , PBD ) ) ; <nl> - } while ( consumeIf ( tok : : comma ) ) ; <nl> + } while ( HasNext ) ; <nl> <nl> + SyntaxContext - > collectNodesInPlace ( SyntaxKind : : ClosureCaptureItemList ) ; <nl> / / The capture list needs to be closed off with a ' ] ' . <nl> if ( ! consumeIf ( tok : : r_square ) ) { <nl> diagnose ( Tok , diag : : expected_capture_list_end_rsquare ) ; <nl> mmm a / test / Syntax / Outputs / round_trip_parse_gen . swift . withkinds <nl> ppp b / test / Syntax / Outputs / round_trip_parse_gen . swift . withkinds <nl> func tryfoo < FunctionSignature > ( ) < / FunctionSignature > < CodeBlock > { < TryExpr > <nl> try ! < IdentifierExpr > foo < / IdentifierExpr > ( ) < / TryExpr > < TryExpr > <nl> try ? < IdentifierExpr > foo < / IdentifierExpr > ( ) < / TryExpr > < TryExpr > <nl> try ! < MemberAccessExpr > < IdentifierExpr > foo < / IdentifierExpr > ( ) . bar < / MemberAccessExpr > ( ) . foo ( ) . bar ( ) < / TryExpr > <nl> + } < / CodeBlock > < / FunctionDecl > < FunctionDecl > <nl> + <nl> + func closure < FunctionSignature > ( ) < / FunctionSignature > < CodeBlock > { <nl> + { < ClosureCaptureSignature > [ < ClosureCaptureItem > weak < IdentifierExpr > a < / IdentifierExpr > , < / ClosureCaptureItem > < ClosureCaptureItem > <nl> + unowned ( safe ) self , < / ClosureCaptureItem > < ClosureCaptureItem > <nl> + b = < IntegerLiteralExpr > 3 < / IntegerLiteralExpr > , < / ClosureCaptureItem > < ClosureCaptureItem > <nl> + unowned ( unsafe ) c = < MemberAccessExpr > < IdentifierExpr > foo < / IdentifierExpr > ( ) . bar < / MemberAccessExpr > < / ClosureCaptureItem > ] < / ClosureCaptureSignature > in <nl> + } <nl> + { < ClosureCaptureSignature > [ ] < / ClosureCaptureSignature > in } <nl> } < / CodeBlock > < / FunctionDecl > <nl> mmm a / test / Syntax / round_trip_parse_gen . swift <nl> ppp b / test / Syntax / round_trip_parse_gen . swift <nl> func tryfoo ( ) { <nl> try ? foo ( ) <nl> try ! foo ( ) . bar ( ) . foo ( ) . bar ( ) <nl> } <nl> + <nl> + func closure ( ) { <nl> + { [ weak a , <nl> + unowned ( safe ) self , <nl> + b = 3 , <nl> + unowned ( unsafe ) c = foo ( ) . bar ] in <nl> + } <nl> + { [ ] in } <nl> + } <nl> mmm a / utils / gyb_syntax_support / ExprNodes . py <nl> ppp b / utils / gyb_syntax_support / ExprNodes . py <nl> <nl> children = [ <nl> Child ( ' Type ' , kind = ' Type ' ) , <nl> ] ) , <nl> + <nl> + Node ( ' ClosureCaptureItem ' , kind = ' Syntax ' , <nl> + children = [ <nl> + Child ( " Specifier " , kind = ' TokenList ' , is_optional = True ) , <nl> + Child ( " Name " , kind = ' IdentifierToken ' , is_optional = True ) , <nl> + Child ( ' AssignToken ' , kind = ' EqualToken ' , is_optional = True ) , <nl> + Child ( " Expression " , kind = ' Expr ' ) , <nl> + Child ( ' TrailingComma ' , kind = ' CommaToken ' , is_optional = True ) , <nl> + ] ) , <nl> + <nl> + Node ( ' ClosureCaptureItemList ' , kind = ' SyntaxCollection ' , <nl> + element = ' ClosureCaptureItem ' ) , <nl> + <nl> + Node ( ' ClosureCaptureSignature ' , kind = ' Syntax ' , <nl> + children = [ <nl> + Child ( ' LeftSquare ' , kind = ' LeftSquareToken ' ) , <nl> + Child ( ' Items ' , kind = ' ClosureCaptureItemList ' , is_optional = True ) , <nl> + Child ( ' RightSquare ' , kind = ' RightSquareToken ' ) , <nl> + ] ) , <nl> ] <nl>
|
Merge remote - tracking branch ' origin / master ' into master - next
|
apple/swift
|
7b0ec9d1dd8f9bbfbb1dbc99593830dd772cb75a
|
2017-12-13T04:29:40Z
|
mmm a / xbmc / pvr / PVRManager . cpp <nl> ppp b / xbmc / pvr / PVRManager . cpp <nl> void CPVRManager : : ResetPlayingTag ( void ) <nl> <nl> bool CPVRManager : : ToggleRecordingOnChannel ( unsigned int iChannelId ) <nl> { <nl> - bool bReturn = false ; <nl> - <nl> - CPVRChannelPtr channel ( m_channelGroups - > GetChannelById ( iChannelId ) ) ; <nl> + const CPVRChannelPtr channel ( m_channelGroups - > GetChannelById ( iChannelId ) ) ; <nl> if ( ! channel ) <nl> - return bReturn ; <nl> - <nl> - if ( m_addons - > HasTimerSupport ( channel - > ClientID ( ) ) ) <nl> - { <nl> - / * timers are supported on this channel * / <nl> - if ( ! channel - > IsRecording ( ) ) <nl> - { <nl> - bReturn = m_timers - > InstantTimer ( channel ) ; <nl> - if ( ! bReturn ) <nl> - CGUIDialogOK : : ShowAndGetInput ( CVariant { 19033 } , CVariant { 19164 } ) ; <nl> - } <nl> - else <nl> - { <nl> - / * delete active timers * / <nl> - bReturn = m_timers - > DeleteTimersOnChannel ( channel , true , true ) ; <nl> - } <nl> - } <nl> + return false ; <nl> <nl> - return bReturn ; <nl> + return SetRecordingOnChannel ( channel , ! channel - > IsRecording ( ) ) ; <nl> } <nl> <nl> bool CPVRManager : : StartRecordingOnPlayingChannel ( bool bOnOff ) <nl> + { <nl> + return SetRecordingOnChannel ( m_addons - > GetPlayingChannel ( ) , bOnOff ) ; <nl> + } <nl> + <nl> + bool CPVRManager : : SetRecordingOnChannel ( const CPVRChannelPtr & channel , bool bOnOff ) <nl> { <nl> bool bReturn = false ; <nl> <nl> - CPVRChannelPtr channel ( m_addons - > GetPlayingChannel ( ) ) ; <nl> if ( ! channel ) <nl> return bReturn ; <nl> <nl> + if ( ! g_PVRManager . CheckParentalLock ( channel ) ) <nl> + return bReturn ; <nl> + <nl> if ( m_addons - > HasTimerSupport ( channel - > ClientID ( ) ) ) <nl> { <nl> / * timers are supported on this channel * / <nl> if ( bOnOff & & ! channel - > IsRecording ( ) ) <nl> { <nl> - bReturn = m_timers - > InstantTimer ( channel ) ; <nl> + const CPVRTimerInfoTagPtr newTimer ( CPVRTimerInfoTag : : CreateInstantTimerTag ( channel ) ) ; <nl> + <nl> + if ( newTimer ) <nl> + bReturn = newTimer - > AddToClient ( ) ; <nl> + <nl> if ( ! bReturn ) <nl> CGUIDialogOK : : ShowAndGetInput ( CVariant { 19033 } , CVariant { 19164 } ) ; <nl> } <nl> mmm a / xbmc / pvr / PVRManager . h <nl> ppp b / xbmc / pvr / PVRManager . h <nl> namespace PVR <nl> * / <nl> void QueueJob ( CJob * job ) ; <nl> <nl> + / * ! <nl> + * @ brief Start or stop recording on a given channel . <nl> + * @ param channel the channel to start / stop recording . <nl> + * @ param bOnOff True to start recording , false to stop . <nl> + * @ return True if the recording was started or stopped successfully , false otherwise . <nl> + * / <nl> + bool SetRecordingOnChannel ( const CPVRChannelPtr & channel , bool bOnOff ) ; <nl> + <nl> ManagerState GetState ( void ) const ; <nl> <nl> void SetState ( ManagerState state ) ; <nl> mmm a / xbmc / pvr / timers / PVRTimers . cpp <nl> ppp b / xbmc / pvr / timers / PVRTimers . cpp <nl> bool CPVRTimers : : DeleteTimersOnChannel ( const CPVRChannelPtr & channel , bool bDele <nl> return bReturn ; <nl> } <nl> <nl> - bool CPVRTimers : : InstantTimer ( const CPVRChannelPtr & channel ) <nl> - { <nl> - assert ( channel . get ( ) ) ; <nl> - <nl> - if ( ! g_PVRManager . CheckParentalLock ( channel ) ) <nl> - return false ; <nl> - <nl> - CPVRTimerInfoTagPtr newTimer ( CPVRTimerInfoTag : : CreateInstantTimerTag ( channel ) ) ; <nl> - <nl> - bool bReturn ( false ) ; <nl> - if ( newTimer ) <nl> - bReturn = newTimer - > AddToClient ( ) ; <nl> - <nl> - if ( ! bReturn ) <nl> - CLog : : Log ( LOGERROR , " PVRTimers - % s - unable to add an instant timer on the client " , __FUNCTION__ ) ; <nl> - <nl> - return bReturn ; <nl> - } <nl> - <nl> / * * * * * * * * * * static methods * * * * * * * * * * / <nl> <nl> bool CPVRTimers : : AddTimer ( const CPVRTimerInfoTagPtr & item ) <nl> mmm a / xbmc / pvr / timers / PVRTimers . h <nl> ppp b / xbmc / pvr / timers / PVRTimers . h <nl> namespace PVR <nl> * / <nl> bool DeleteTimersOnChannel ( const CPVRChannelPtr & channel , bool bDeleteRepeating = true , bool bCurrentlyActiveOnly = false ) ; <nl> <nl> - / * ! <nl> - * @ brief Create a new instant timer on a channel . <nl> - * @ param channel The channel to create the timer on . <nl> - * @ return True if the timer was created , false otherwise . <nl> - * / <nl> - bool InstantTimer ( const CPVRChannelPtr & channel ) ; <nl> - <nl> / * ! <nl> * @ return Next event time ( timer or daily wake up ) <nl> * / <nl>
|
[ PVR ] Refactor instant timer creation ( no functional changes )
|
xbmc/xbmc
|
8c8ddaec99041f0c38bf0af0c2d21c3aa5807b32
|
2016-05-30T09:59:17Z
|
similarity index 100 % <nl> rename from hphp / test / quick / debugger / break2 . php <nl> rename to hphp / test / quick / debugger / break2 . php . disabled <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - spl / SplFileObject_fgetcsv_basic . php <nl> rename to hphp / test / zend / bad / ext - spl / SplFileObject_fgetcsv_basic . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - spl / SplFileObject_fgetcsv_delimiter_basic . php <nl> rename to hphp / test / zend / bad / ext - spl / SplFileObject_fgetcsv_delimiter_basic . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - spl / SplFileObject_fgetcsv_delimiter_error . php <nl> rename to hphp / test / zend / bad / ext - spl / SplFileObject_fgetcsv_delimiter_error . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - array / array_next_error2 . php <nl> rename to hphp / test / zend / bad / ext - standard - array / array_next_error2 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - array / prev_error3 . php <nl> rename to hphp / test / zend / bad / ext - standard - array / prev_error3 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - class_object / get_object_vars_variation_003 . php <nl> rename to hphp / test / zend / bad / ext - standard - class_object / get_object_vars_variation_003 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / bug12556 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / bug12556 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / bug22382 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / bug22382 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / bug26003 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / bug26003 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fgetcsv_variation10 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fgetcsv_variation10 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fgetcsv_variation13 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fgetcsv_variation13 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fgetcsv_variation14 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fgetcsv_variation14 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fgetcsv_variation15 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fgetcsv_variation15 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fgetcsv_variation16 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fgetcsv_variation16 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fgetcsv_variation18 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fgetcsv_variation18 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fgetcsv_variation20 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fgetcsv_variation20 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fgetcsv_variation21 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fgetcsv_variation21 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fgetcsv_variation22 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fgetcsv_variation22 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fgetcsv_variation23 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fgetcsv_variation23 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fgetcsv_variation26 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fgetcsv_variation26 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fgetcsv_variation29 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fgetcsv_variation29 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fgetcsv_variation30 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fgetcsv_variation30 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fgetcsv_variation31 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fgetcsv_variation31 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fgetcsv_variation8 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fgetcsv_variation8 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fgetcsv_variation9 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fgetcsv_variation9 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fputcsv_variation10 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fputcsv_variation10 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fputcsv_variation11 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fputcsv_variation11 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fputcsv_variation12 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fputcsv_variation12 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - file / fputcsv_variation5 . php <nl> rename to hphp / test / zend / bad / ext - standard - file / fputcsv_variation5 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - general_functions / 004 . php <nl> rename to hphp / test / zend / bad / ext - standard - general_functions / 004 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - strings / bug28386 . php <nl> rename to hphp / test / zend / bad / ext - standard - strings / bug28386 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - strings / wordwrap_basic . php <nl> rename to hphp / test / zend / bad / ext - standard - strings / wordwrap_basic . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / ext - standard - strings / wordwrap_variation5 . php <nl> rename to hphp / test / zend / bad / ext - standard - strings / wordwrap_variation5 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / tests - lang / 038 . php <nl> rename to hphp / test / zend / bad / tests - lang / 038 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / zend / bug48912 . php <nl> rename to hphp / test / zend / bad / zend / bug48912 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / zend / bug64239_3 . php <nl> rename to hphp / test / zend / bad / zend / bug64239_3 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / zend / class_alias_015 . php <nl> rename to hphp / test / zend / bad / zend / class_alias_015 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / zend / lsb_021 . php <nl> rename to hphp / test / zend / bad / zend / lsb_021 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / good / zend / lsb_022 . php <nl> rename to hphp / test / zend / bad / zend / lsb_022 . php <nl>
|
Disable tests which are giving us grief with control chars in their output .
|
facebook/hhvm
|
44ae3c3dace0974ff469b78e4c5254ce82df3776
|
2013-06-28T00:36:45Z
|
mmm a / include / swoole . h <nl> ppp b / include / swoole . h <nl> static sw_inline char * swoole_strdup ( const char * s ) <nl> { <nl> size_t l = strlen ( s ) + 1 ; <nl> char * p = ( char * ) sw_malloc ( l ) ; <nl> - if ( ! p ) <nl> + if ( likely ( p ) ) <nl> { <nl> - return NULL ; <nl> + memcpy ( p , s , l ) ; <nl> } <nl> - memcpy ( p , s , l ) ; <nl> return p ; <nl> } <nl> <nl> static sw_inline char * swoole_strndup ( const char * s , size_t n ) <nl> { <nl> char * p = ( char * ) sw_malloc ( n + 1 ) ; <nl> - if ( ! p ) <nl> + if ( likely ( p ) ) <nl> { <nl> - return NULL ; <nl> + strncpy ( p , s , n ) [ n ] = ' \ 0 ' ; <nl> } <nl> - strncpy ( p , s , n ) ; <nl> - p [ n ] = ' \ 0 ' ; <nl> return p ; <nl> } <nl> <nl> mmm a / swoole_http_server . cc <nl> ppp b / swoole_http_server . cc <nl> static PHP_METHOD ( swoole_http_response , end ) <nl> # ifdef SW_USE_HTTP2 <nl> if ( ctx - > stream ) <nl> { <nl> - swoole_http2_server_do_response ( ctx , & http_body ) ; <nl> - RETURN_TRUE ; <nl> + RETURN_BOOL ( swoole_http2_server_do_response ( ctx , & http_body ) = = SW_OK ) ; <nl> } <nl> # endif <nl> <nl>
|
Code optimization .
|
swoole/swoole-src
|
5492aa196425e3b4a031fe579edc1a2dbf6b6ea3
|
2019-05-14T02:46:27Z
|
mmm a / CONTRIBUTING . md <nl> ppp b / CONTRIBUTING . md <nl> Copy the error message from the console instead of sending a screenshot of it . <nl> <nl> Use the toolbar above the comment edit area to format your comment . <nl> <nl> - Add three backticks before and after a code sample or output of a command to format it ( The ' Insert code ' button can help you doing it ) . <nl> + Add three backticks before and after a code sample or output of a command to format it ( The ` Insert code ` button can help you doing it ) . <nl> <nl> - If your comment includes a code sample or output of a command that exceeds ~ 25 lines , post it as attached text file ( filename . txt ) . <nl> + If your comment includes a code sample or output of a command that exceeds ~ 25 lines , post it as attached text file ( ` filename . txt ` ) . <nl> <nl> - Use ' Preview ' before you send your issue . Read it again before sending . <nl> + Use ` Preview ` before you send your issue . Read it again before sending . <nl> <nl> Note that most of the people that respond to issues and answer questions are either other ' regular ' users or * * volunteers * * developers . Please be nice to them : - ) <nl> <nl>
|
Merge pull request from kant / patch - 3
|
tesseract-ocr/tesseract
|
57224bc9b5bb71627b6e3a07469dfdae15a6f64d
|
2018-07-26T17:06:02Z
|
mmm a / scala - package / examples / src / main / scala / ml / dmlc / mxnet / examples / neuralstyle / ModelVgg19 . scala <nl> ppp b / scala - package / examples / src / main / scala / ml / dmlc / mxnet / examples / neuralstyle / ModelVgg19 . scala <nl> import ml . dmlc . mxnet . NDArray <nl> import ml . dmlc . mxnet . Symbol <nl> import ml . dmlc . mxnet . Shape <nl> <nl> + / * * <nl> + * Definition for the neuralstyle network and initialize it with pretrained weight <nl> + * @ author Depeng Liang <nl> + * / <nl> object ModelVgg19 { <nl> case class ConvExecutor ( executor : Executor , data : NDArray , dataGrad : NDArray , <nl> style : Array [ NDArray ] , content : NDArray ) <nl> mmm a / scala - package / examples / src / main / scala / ml / dmlc / mxnet / examples / neuralstyle / NeuralStyle . scala <nl> ppp b / scala - package / examples / src / main / scala / ml / dmlc / mxnet / examples / neuralstyle / NeuralStyle . scala <nl> import com . sksamuel . scrimage . nio . JpegWriter <nl> import ml . dmlc . mxnet . optimizer . SGD <nl> import ml . dmlc . mxnet . optimizer . Adam <nl> <nl> + / * * <nl> + * An Implementation of the paper A Neural Algorithm of Artistic Style <nl> + * by Leon A . Gatys , Alexander S . Ecker , and Matthias Bethge <nl> + * @ author Depeng Liang <nl> + * / <nl> object NeuralStyle { <nl> - case class Executor ( executor : ml . dmlc . mxnet . Executor , data : NDArray , dataGrad : NDArray ) <nl> + case class NSExecutor ( executor : Executor , data : NDArray , dataGrad : NDArray ) <nl> <nl> private val logger = LoggerFactory . getLogger ( classOf [ NeuralStyle ] ) <nl> <nl> object NeuralStyle { <nl> result . output ( filename ) ( JpegWriter ( ) ) <nl> } <nl> <nl> - def styleGramExecutor ( inputShape : Shape , ctx : Context ) : Executor = { <nl> + def styleGramExecutor ( inputShape : Shape , ctx : Context ) : NSExecutor = { <nl> / / symbol <nl> val data = Symbol . Variable ( " conv " ) <nl> val rsData = Symbol . Reshape ( ) ( Map ( " data " - > data , <nl> object NeuralStyle { <nl> val gradMap = Map ( " conv " - > grad ) <nl> val reqs = Map ( " conv " - > " write " , " weight " - > " null " ) <nl> val executor = fc . bind ( ctx , args , gradMap , reqs , Nil , null ) <nl> - Executor ( executor , conv , grad ) <nl> + NSExecutor ( executor , conv , grad ) <nl> } <nl> <nl> def twoNorm ( array : Array [ Float ] ) : Float = { <nl> object NeuralStyle { <nl> val parser : CmdLineParser = new CmdLineParser ( alle ) <nl> try { <nl> parser . parseArgument ( args . toList . asJava ) <nl> + assert ( alle . contentImage ! = null & & alle . styleImage ! = null <nl> + & & alle . modelPath ! = null & & alle . outputDir ! = null ) <nl> <nl> val dev = if ( alle . gpu > = 0 ) Context . gpu ( alle . gpu ) else Context . cpu ( 0 ) <nl> val contentNp = preprocessContentImage ( alle . contentImage , alle . maxLongEdge , dev ) <nl> object NeuralStyle { <nl> <nl> saveImage ( contentNp , s " $ { alle . outputDir } / input . jpg " , alle . guassianRadius ) <nl> saveImage ( styleNp , s " $ { alle . outputDir } / style . jpg " , alle . guassianRadius ) <nl> - / / val optimizer = new SGD ( <nl> - / / learningRate = alle . lr , <nl> - / / momentum = 0 . 9f , <nl> - / / wd = 0 . 005f , <nl> - / / clipGradient = 10 , <nl> - / / lrScheduler = lr ) <nl> + <nl> val optimizer = new Adam ( <nl> learningRate = alle . lr , <nl> wd = 0 . 005f , <nl> object NeuralStyle { <nl> var eps = 0f <nl> var trainingDone = false <nl> var e = 0 <nl> - while ( e < alle . maxNumEpochs & & ! trainingDone ) { <nl> + while ( e < alle . maxNumEpochs & & ! trainingDone ) { <nl> modelExecutor . data . set ( img ) <nl> modelExecutor . executor . forward ( ) <nl> <nl> / / style gradient <nl> - for ( i < - 0 until modelExecutor . style . length ) { <nl> + for ( i < - 0 until modelExecutor . style . length ) { <nl> val gram = gramExecutor ( i ) <nl> gram . data . set ( modelExecutor . style ( i ) ) <nl> gram . executor . forward ( ) <nl> object NeuralStyle { <nl> oldImg . set ( img ) <nl> logger . info ( s " epoch $ e , relative change $ eps " ) <nl> <nl> - if ( eps < alle . stopEps ) { <nl> + if ( eps < alle . stopEps ) { <nl> logger . info ( " eps < args . stop_eps , training finished " ) <nl> trainingDone = true <nl> } <nl> - if ( ( e + 1 ) % alle . saveEpochs = = 0 ) { <nl> + if ( ( e + 1 ) % alle . saveEpochs = = 0 ) { <nl> saveImage ( img , s " $ { alle . outputDir } / tmp_ $ { e + 1 } . jpg " , alle . guassianRadius ) <nl> } <nl> e = e + 1 <nl> class NeuralStyle { <nl> @ Option ( name = " - - model " , usage = " the pretrained model to use : [ ' vgg ' ] " ) <nl> private val model : String = " vgg19 " <nl> @ Option ( name = " - - content - image " , usage = " the content image " ) <nl> - private val contentImage : String = " input / IMG_4343 . jpg " <nl> + private val contentImage : String = null <nl> @ Option ( name = " - - style - image " , usage = " the style image " ) <nl> - private val styleImage : String = " input / starry_night . jpg " <nl> + private val styleImage : String = null <nl> @ Option ( name = " - - model - path " , usage = " the model file path " ) <nl> - private val modelPath : String = " model / vgg19 . params " <nl> + private val modelPath : String = null <nl> @ Option ( name = " - - stop - eps " , usage = " stop if the relative chanage is less than eps " ) <nl> private val stopEps : Float = 0 . 0005f <nl> @ Option ( name = " - - content - weight " , usage = " the weight for the content image " ) <nl> class NeuralStyle { <nl> @ Option ( name = " - - gpu " , usage = " which gpu card to use , - 1 means using cpu " ) <nl> private val gpu : Int = 0 <nl> @ Option ( name = " - - output - dir " , usage = " the output directory " ) <nl> - private val outputDir : String = " output " <nl> + private val outputDir : String = null <nl> @ Option ( name = " - - save - epochs " , usage = " save the output every n epochs " ) <nl> private val saveEpochs : Int = 50 <nl> @ Option ( name = " - - guassian - radius " , usage = " the gaussian blur filter radius " ) <nl>
|
add run script to scalapkg examples / bin and fix some coding style
|
apache/incubator-mxnet
|
258049c4933446e2a13068e0d95853f1c3f5d102
|
2016-04-13T00:57:54Z
|
mmm a / include / LightGBM / utils / json11 . h <nl> ppp b / include / LightGBM / utils / json11 . h <nl> <nl> <nl> / * json11 <nl> * <nl> - * json11 is a tiny JSON library for C + + 11 , providing JSON parsing and serialization . <nl> + * json11 is a tiny JSON library for C + + 11 , providing JSON parsing and <nl> + * serialization . <nl> * <nl> - * The core object provided by the library is json11 : : Json . A Json object represents any JSON <nl> - * value : null , bool , number ( int or double ) , string ( std : : string ) , array ( std : : vector ) , or <nl> - * object ( std : : map ) . <nl> + * The core object provided by the library is json11 : : Json . A Json object <nl> + * represents any JSON value : null , bool , number ( int or double ) , string <nl> + * ( std : : string ) , array ( std : : vector ) , or object ( std : : map ) . <nl> * <nl> - * Json objects act like values : they can be assigned , copied , moved , compared for equality or <nl> - * order , etc . There are also helper methods Json : : dump , to serialize a Json to a string , and <nl> - * Json : : parse ( static ) to parse a std : : string as a Json object . <nl> + * Json objects act like values : they can be assigned , copied , moved , compared <nl> + * for equality or order , etc . There are also helper methods Json : : dump , to <nl> + * serialize a Json to a string , and Json : : parse ( static ) to parse a std : : string <nl> + * as a Json object . <nl> * <nl> - * Internally , the various types of Json object are represented by the JsonValue class <nl> - * hierarchy . <nl> + * Internally , the various types of Json object are represented by the JsonValue <nl> + * class hierarchy . <nl> * <nl> - * A note on numbers - JSON specifies the syntax of number formatting but not its semantics , <nl> - * so some JSON implementations distinguish between integers and floating - point numbers , while <nl> - * some don ' t . In json11 , we choose the latter . Because some JSON implementations ( namely <nl> - * Javascript itself ) treat all numbers as the same type , distinguishing the two leads <nl> - * to JSON that will be * silently * changed by a round - trip through those implementations . <nl> - * Dangerous ! To avoid that risk , json11 stores all numbers as double internally , but also <nl> + * A note on numbers - JSON specifies the syntax of number formatting but not <nl> + * its semantics , so some JSON implementations distinguish between integers and <nl> + * floating - point numbers , while some don ' t . In json11 , we choose the latter . <nl> + * Because some JSON implementations ( namely Javascript itself ) treat all <nl> + * numbers as the same type , distinguishing the two leads to JSON that will be <nl> + * * silently * changed by a round - trip through those implementations . Dangerous ! <nl> + * To avoid that risk , json11 stores all numbers as double internally , but also <nl> * provides integer helpers . <nl> * <nl> - * Fortunately , double - precision IEEE754 ( ' double ' ) can precisely store any integer in the <nl> - * range + / - 2 ^ 53 , which includes every ' int ' on most systems . ( Timestamps often use int64 <nl> - * or long long to avoid the Y2038K problem ; a double storing microseconds since some epoch <nl> - * will be exact for + / - 275 years . ) <nl> + * Fortunately , double - precision IEEE754 ( ' double ' ) can precisely store any <nl> + * integer in the range + / - 2 ^ 53 , which includes every ' int ' on most systems . <nl> + * ( Timestamps often use int64 or long long to avoid the Y2038K problem ; a <nl> + * double storing microseconds since some epoch will be exact for + / - 275 <nl> + * years . ) <nl> * / <nl> # pragma once <nl> <nl> - # include < string > <nl> # include < initializer_list > <nl> # include < map > <nl> # include < memory > <nl> + # include < string > <nl> # include < utility > <nl> # include < vector > <nl> <nl> namespace json11 { <nl> <nl> - enum JsonParse { <nl> - STANDARD , COMMENTS <nl> - } ; <nl> + enum JsonParse { STANDARD , COMMENTS } ; <nl> <nl> class JsonValue ; <nl> <nl> class Json final { <nl> public : <nl> - / / Types <nl> - enum Type { <nl> - NUL , NUMBER , BOOL , STRING , ARRAY , OBJECT <nl> - } ; <nl> - <nl> - / / Array and object typedefs <nl> - typedef std : : vector < Json > array ; <nl> - typedef std : : map < std : : string , Json > object ; <nl> - <nl> - / / Constructors for the various types of JSON value . <nl> - Json ( ) noexcept ; / / NUL <nl> - Json ( std : : nullptr_t ) noexcept ; / / NUL <nl> - Json ( double value ) ; / / NUMBER <nl> - Json ( int value ) ; / / NUMBER <nl> - Json ( bool value ) ; / / BOOL <nl> - Json ( const std : : string & value ) ; / / STRING <nl> - Json ( std : : string & & value ) ; / / STRING <nl> - Json ( const char * value ) ; / / STRING <nl> - Json ( const array & values ) ; / / ARRAY <nl> - Json ( array & & values ) ; / / ARRAY <nl> - Json ( const object & values ) ; / / OBJECT <nl> - Json ( object & & values ) ; / / OBJECT <nl> - <nl> - / / Implicit constructor : anything with a to_json ( ) function . <nl> - template < class T , class = decltype ( & T : : to_json ) > <nl> - Json ( const T & t ) : Json ( t . to_json ( ) ) { } <nl> - <nl> - / / Implicit constructor : map - like objects ( std : : map , std : : unordered_map , etc ) <nl> - template < class M , typename std : : enable_if < <nl> - std : : is_constructible < std : : string , decltype ( std : : declval < M > ( ) . begin ( ) - > first ) > : : value <nl> - & & std : : is_constructible < Json , decltype ( std : : declval < M > ( ) . begin ( ) - > second ) > : : value , <nl> - int > : : type = 0 > <nl> - Json ( const M & m ) : Json ( object ( m . begin ( ) , m . end ( ) ) ) { } <nl> - <nl> - / / Implicit constructor : vector - like objects ( std : : list , std : : vector , std : : set , etc ) <nl> - template < class V , typename std : : enable_if < <nl> - std : : is_constructible < Json , decltype ( * std : : declval < V > ( ) . begin ( ) ) > : : value , <nl> - int > : : type = 0 > <nl> - Json ( const V & v ) : Json ( array ( v . begin ( ) , v . end ( ) ) ) { } <nl> - <nl> - / / This prevents Json ( some_pointer ) from accidentally producing a bool . Use <nl> - / / Json ( bool ( some_pointer ) ) if that behavior is desired . <nl> - Json ( void * ) = delete ; <nl> - <nl> - / / Accessors <nl> - Type type ( ) const ; <nl> - <nl> - bool is_null ( ) const { return type ( ) = = NUL ; } <nl> - bool is_number ( ) const { return type ( ) = = NUMBER ; } <nl> - bool is_bool ( ) const { return type ( ) = = BOOL ; } <nl> - bool is_string ( ) const { return type ( ) = = STRING ; } <nl> - bool is_array ( ) const { return type ( ) = = ARRAY ; } <nl> - bool is_object ( ) const { return type ( ) = = OBJECT ; } <nl> - <nl> - / / Return the enclosed value if this is a number , 0 otherwise . Note that json11 does not <nl> - / / distinguish between integer and non - integer numbers - number_value ( ) and int_value ( ) <nl> - / / can both be applied to a NUMBER - typed object . <nl> - double number_value ( ) const ; <nl> - int int_value ( ) const ; <nl> - <nl> - / / Return the enclosed value if this is a boolean , false otherwise . <nl> - bool bool_value ( ) const ; <nl> - / / Return the enclosed string if this is a string , " " otherwise . <nl> - const std : : string & string_value ( ) const ; <nl> - / / Return the enclosed std : : vector if this is an array , or an empty vector otherwise . <nl> - const array & array_items ( ) const ; <nl> - / / Return the enclosed std : : map if this is an object , or an empty map otherwise . <nl> - const object & object_items ( ) const ; <nl> - <nl> - / / Return a reference to arr [ i ] if this is an array , Json ( ) otherwise . <nl> - const Json & operator [ ] ( size_t i ) const ; <nl> - / / Return a reference to obj [ key ] if this is an object , Json ( ) otherwise . <nl> - const Json & operator [ ] ( const std : : string & key ) const ; <nl> - <nl> - / / Serialize . <nl> - void dump ( std : : string & out ) const ; <nl> - std : : string dump ( ) const { <nl> - std : : string out ; <nl> - dump ( out ) ; <nl> - return out ; <nl> + / / Types <nl> + enum Type { NUL , NUMBER , BOOL , STRING , ARRAY , OBJECT } ; <nl> + <nl> + / / Array and object typedefs <nl> + typedef std : : vector < Json > array ; <nl> + typedef std : : map < std : : string , Json > object ; <nl> + <nl> + / / Constructors for the various types of JSON value . <nl> + Json ( ) noexcept ; / / NUL <nl> + explicit Json ( std : : nullptr_t ) noexcept ; / / NUL <nl> + explicit Json ( double value ) ; / / NUMBER <nl> + explicit Json ( int value ) ; / / NUMBER <nl> + explicit Json ( bool value ) ; / / BOOL <nl> + explicit Json ( const std : : string & value ) ; / / STRING <nl> + explicit Json ( std : : string & & value ) ; / / STRING <nl> + explicit Json ( const char * value ) ; / / STRING <nl> + explicit Json ( const array & values ) ; / / ARRAY <nl> + explicit Json ( array & & values ) ; / / ARRAY <nl> + explicit Json ( const object & values ) ; / / OBJECT <nl> + explicit Json ( object & & values ) ; / / OBJECT <nl> + <nl> + / / Implicit constructor : anything with a to_json ( ) function . <nl> + template < class T , class = decltype ( & T : : to_json ) > <nl> + explicit Json ( const T & t ) : Json ( t . to_json ( ) ) { } <nl> + <nl> + / / Implicit constructor : map - like objects ( std : : map , std : : unordered_map , etc ) <nl> + template < <nl> + class M , <nl> + typename std : : enable_if < <nl> + std : : is_constructible < <nl> + std : : string , decltype ( std : : declval < M > ( ) . begin ( ) - > first ) > : : value & & <nl> + std : : is_constructible < <nl> + Json , decltype ( std : : declval < M > ( ) . begin ( ) - > second ) > : : value , <nl> + int > : : type = 0 > <nl> + explicit Json ( const M & m ) : Json ( object ( m . begin ( ) , m . end ( ) ) ) { } <nl> + <nl> + / / Implicit constructor : vector - like objects ( std : : list , std : : vector , <nl> + / / std : : set , etc ) <nl> + template < class V , typename std : : enable_if < <nl> + std : : is_constructible < <nl> + Json , decltype ( * std : : declval < V > ( ) . begin ( ) ) > : : value , <nl> + int > : : type = 0 > <nl> + explicit Json ( const V & v ) : Json ( array ( v . begin ( ) , v . end ( ) ) ) { } <nl> + <nl> + / / This prevents Json ( some_pointer ) from accidentally producing a bool . Use <nl> + / / Json ( bool ( some_pointer ) ) if that behavior is desired . <nl> + explicit Json ( void * ) = delete ; <nl> + <nl> + / / Accessors <nl> + Type type ( ) const ; <nl> + <nl> + bool is_null ( ) const { return type ( ) = = NUL ; } <nl> + bool is_number ( ) const { return type ( ) = = NUMBER ; } <nl> + bool is_bool ( ) const { return type ( ) = = BOOL ; } <nl> + bool is_string ( ) const { return type ( ) = = STRING ; } <nl> + bool is_array ( ) const { return type ( ) = = ARRAY ; } <nl> + bool is_object ( ) const { return type ( ) = = OBJECT ; } <nl> + <nl> + / / Return the enclosed value if this is a number , 0 otherwise . Note that <nl> + / / json11 does not distinguish between integer and non - integer numbers - <nl> + / / number_value ( ) and int_value ( ) can both be applied to a NUMBER - typed <nl> + / / object . <nl> + double number_value ( ) const ; <nl> + int int_value ( ) const ; <nl> + <nl> + / / Return the enclosed value if this is a boolean , false otherwise . <nl> + bool bool_value ( ) const ; <nl> + / / Return the enclosed string if this is a string , " " otherwise . <nl> + const std : : string & string_value ( ) const ; <nl> + / / Return the enclosed std : : vector if this is an array , or an empty vector <nl> + / / otherwise . <nl> + const array & array_items ( ) const ; <nl> + / / Return the enclosed std : : map if this is an object , or an empty map <nl> + / / otherwise . <nl> + const object & object_items ( ) const ; <nl> + <nl> + / / Return a reference to arr [ i ] if this is an array , Json ( ) otherwise . <nl> + const Json & operator [ ] ( size_t i ) const ; <nl> + / / Return a reference to obj [ key ] if this is an object , Json ( ) otherwise . <nl> + const Json & operator [ ] ( const std : : string & key ) const ; <nl> + <nl> + / / Serialize . <nl> + void dump ( std : : string * out ) const ; <nl> + std : : string dump ( ) const { <nl> + std : : string out ; <nl> + dump ( & out ) ; <nl> + return out ; <nl> + } <nl> + <nl> + / / Parse . If parse fails , return Json ( ) and assign an error message to err . <nl> + static Json parse ( const std : : string & in , std : : string * err , <nl> + JsonParse strategy = JsonParse : : STANDARD ) ; <nl> + static Json parse ( const char * in , std : : string * err , <nl> + JsonParse strategy = JsonParse : : STANDARD ) { <nl> + if ( in ) { <nl> + return parse ( std : : string ( in ) , err , strategy ) ; <nl> + } else { <nl> + * err = " null input " ; <nl> + return Json ( nullptr ) ; <nl> } <nl> - <nl> - / / Parse . If parse fails , return Json ( ) and assign an error message to err . <nl> - static Json parse ( const std : : string & in , <nl> - std : : string & err , <nl> - JsonParse strategy = JsonParse : : STANDARD ) ; <nl> - static Json parse ( const char * in , <nl> - std : : string & err , <nl> - JsonParse strategy = JsonParse : : STANDARD ) { <nl> - if ( in ) { <nl> - return parse ( std : : string ( in ) , err , strategy ) ; <nl> - } else { <nl> - err = " null input " ; <nl> - return nullptr ; <nl> - } <nl> - } <nl> - / / Parse multiple objects , concatenated or separated by whitespace <nl> - static std : : vector < Json > parse_multi ( <nl> - const std : : string & in , <nl> - std : : string : : size_type & parser_stop_pos , <nl> - std : : string & err , <nl> - JsonParse strategy = JsonParse : : STANDARD ) ; <nl> - <nl> - static inline std : : vector < Json > parse_multi ( <nl> - const std : : string & in , <nl> - std : : string & err , <nl> - JsonParse strategy = JsonParse : : STANDARD ) { <nl> - std : : string : : size_type parser_stop_pos ; <nl> - return parse_multi ( in , parser_stop_pos , err , strategy ) ; <nl> - } <nl> - <nl> - bool operator = = ( const Json & rhs ) const ; <nl> - bool operator < ( const Json & rhs ) const ; <nl> - bool operator ! = ( const Json & rhs ) const { return ! ( * this = = rhs ) ; } <nl> - bool operator < = ( const Json & rhs ) const { return ! ( rhs < * this ) ; } <nl> - bool operator > ( const Json & rhs ) const { return ( rhs < * this ) ; } <nl> - bool operator > = ( const Json & rhs ) const { return ! ( * this < rhs ) ; } <nl> - <nl> - / * has_shape ( types , err ) <nl> - * <nl> - * Return true if this is a JSON object and , for each item in types , has a field of <nl> - * the given type . If not , return false and set err to a descriptive message . <nl> - * / <nl> - typedef std : : initializer_list < std : : pair < std : : string , Type > > shape ; <nl> - bool has_shape ( const shape & types , std : : string & err ) const ; <nl> + } <nl> + / / Parse multiple objects , concatenated or separated by whitespace <nl> + static std : : vector < Json > parse_multi ( <nl> + const std : : string & in , std : : string : : size_type * parser_stop_pos , <nl> + std : : string * err , JsonParse strategy = JsonParse : : STANDARD ) ; <nl> + <nl> + static inline std : : vector < Json > parse_multi ( <nl> + const std : : string & in , std : : string * err , <nl> + JsonParse strategy = JsonParse : : STANDARD ) { <nl> + std : : string : : size_type parser_stop_pos ; <nl> + return parse_multi ( in , & parser_stop_pos , err , strategy ) ; <nl> + } <nl> + <nl> + bool operator = = ( const Json & rhs ) const ; <nl> + bool operator < ( const Json & rhs ) const ; <nl> + bool operator ! = ( const Json & rhs ) const { return ! ( * this = = rhs ) ; } <nl> + bool operator < = ( const Json & rhs ) const { return ! ( rhs < * this ) ; } <nl> + bool operator > ( const Json & rhs ) const { return ( rhs < * this ) ; } <nl> + bool operator > = ( const Json & rhs ) const { return ! ( * this < rhs ) ; } <nl> + <nl> + / * has_shape ( types , err ) <nl> + * <nl> + * Return true if this is a JSON object and , for each item in types , has a <nl> + * field of the given type . If not , return false and set err to a descriptive <nl> + * message . <nl> + * / <nl> + typedef std : : initializer_list < std : : pair < std : : string , Type > > shape ; <nl> + bool has_shape ( const shape & types , std : : string * err ) const ; <nl> <nl> private : <nl> - std : : shared_ptr < JsonValue > m_ptr ; <nl> + std : : shared_ptr < JsonValue > m_ptr ; <nl> } ; <nl> <nl> - / / Internal class hierarchy - JsonValue objects are not exposed to users of this API . <nl> + / / Internal class hierarchy - JsonValue objects are not exposed to users of this <nl> + / / API . <nl> class JsonValue { <nl> protected : <nl> - friend class Json ; <nl> - friend class JsonInt ; <nl> - friend class JsonDouble ; <nl> - virtual Json : : Type type ( ) const = 0 ; <nl> - virtual bool equals ( const JsonValue * other ) const = 0 ; <nl> - virtual bool less ( const JsonValue * other ) const = 0 ; <nl> - virtual void dump ( std : : string & out ) const = 0 ; <nl> - virtual double number_value ( ) const ; <nl> - virtual int int_value ( ) const ; <nl> - virtual bool bool_value ( ) const ; <nl> - virtual const std : : string & string_value ( ) const ; <nl> - virtual const Json : : array & array_items ( ) const ; <nl> - virtual const Json & operator [ ] ( size_t i ) const ; <nl> - virtual const Json : : object & object_items ( ) const ; <nl> - virtual const Json & operator [ ] ( const std : : string & key ) const ; <nl> - virtual ~ JsonValue ( ) { } <nl> + friend class Json ; <nl> + friend class JsonInt ; <nl> + friend class JsonDouble ; <nl> + virtual Json : : Type type ( ) const = 0 ; <nl> + virtual bool equals ( const JsonValue * other ) const = 0 ; <nl> + virtual bool less ( const JsonValue * other ) const = 0 ; <nl> + virtual void dump ( std : : string * out ) const = 0 ; <nl> + virtual double number_value ( ) const ; <nl> + virtual int int_value ( ) const ; <nl> + virtual bool bool_value ( ) const ; <nl> + virtual const std : : string & string_value ( ) const ; <nl> + virtual const Json : : array & array_items ( ) const ; <nl> + virtual const Json & operator [ ] ( size_t i ) const ; <nl> + virtual const Json : : object & object_items ( ) const ; <nl> + virtual const Json & operator [ ] ( const std : : string & key ) const ; <nl> + virtual ~ JsonValue ( ) { } <nl> } ; <nl> <nl> } / / namespace json11 <nl> mmm a / src / boosting / gbdt . cpp <nl> ppp b / src / boosting / gbdt . cpp <nl> void GBDT : : Init ( const Config * config , const Dataset * train_data , const Objective <nl> std : : stringstream buffer ; <nl> buffer < < forced_splits_file . rdbuf ( ) ; <nl> std : : string err ; <nl> - forced_splits_json_ = Json : : parse ( buffer . str ( ) , err ) ; <nl> + forced_splits_json_ = Json : : parse ( buffer . str ( ) , & err ) ; <nl> } <nl> <nl> objective_function_ = objective_function ; <nl> void GBDT : : ResetConfig ( const Config * config ) { <nl> std : : stringstream buffer ; <nl> buffer < < forced_splits_file . rdbuf ( ) ; <nl> std : : string err ; <nl> - forced_splits_json_ = Json : : parse ( buffer . str ( ) , err ) ; <nl> + forced_splits_json_ = Json : : parse ( buffer . str ( ) , & err ) ; <nl> tree_learner_ - > SetForcedSplit ( & forced_splits_json_ ) ; <nl> } else { <nl> forced_splits_json_ = Json ( ) ; <nl> mmm a / src / io / dataset_loader . cpp <nl> ppp b / src / io / dataset_loader . cpp <nl> std : : vector < std : : vector < double > > DatasetLoader : : GetForcedBins ( std : : string forced <nl> std : : stringstream buffer ; <nl> buffer < < forced_bins_stream . rdbuf ( ) ; <nl> std : : string err ; <nl> - Json forced_bins_json = Json : : parse ( buffer . str ( ) , err ) ; <nl> + Json forced_bins_json = Json : : parse ( buffer . str ( ) , & err ) ; <nl> CHECK ( forced_bins_json . is_array ( ) ) ; <nl> std : : vector < Json > forced_bins_arr = forced_bins_json . array_items ( ) ; <nl> for ( size_t i = 0 ; i < forced_bins_arr . size ( ) ; + + i ) { <nl> mmm a / src / io / json11 . cpp <nl> ppp b / src / io / json11 . cpp <nl> namespace json11 { <nl> <nl> static const int max_depth = 200 ; <nl> <nl> - using std : : string ; <nl> - using std : : vector ; <nl> - using std : : map ; <nl> - using std : : make_shared ; <nl> using std : : initializer_list ; <nl> + using std : : make_shared ; <nl> + using std : : map ; <nl> using std : : move ; <nl> + using std : : string ; <nl> + using std : : vector ; <nl> <nl> using LightGBM : : Log ; <nl> <nl> using LightGBM : : Log ; <nl> * it may not be orderable . <nl> * / <nl> struct NullStruct { <nl> - bool operator = = ( NullStruct ) const { return true ; } <nl> - bool operator < ( NullStruct ) const { return false ; } <nl> + bool operator = = ( NullStruct ) const { return true ; } <nl> + bool operator < ( NullStruct ) const { return false ; } <nl> } ; <nl> <nl> / * * * * * * * * * * * * * * * * * * * * <nl> * Serialization <nl> * / <nl> <nl> - static void dump ( NullStruct , string & out ) { <nl> - out + = " null " ; <nl> - } <nl> - <nl> - static void dump ( double value , string & out ) { <nl> - if ( std : : isfinite ( value ) ) { <nl> - char buf [ 32 ] ; <nl> - snprintf ( buf , sizeof buf , " % . 17g " , value ) ; <nl> - out + = buf ; <nl> - } else { <nl> - out + = " null " ; <nl> - } <nl> - } <nl> + static void dump ( NullStruct , string * out ) { * out + = " null " ; } <nl> <nl> - static void dump ( int value , string & out ) { <nl> + static void dump ( double value , string * out ) { <nl> + if ( std : : isfinite ( value ) ) { <nl> char buf [ 32 ] ; <nl> - snprintf ( buf , sizeof buf , " % d " , value ) ; <nl> - out + = buf ; <nl> + snprintf ( buf , sizeof buf , " % . 17g " , value ) ; <nl> + * out + = buf ; <nl> + } else { <nl> + * out + = " null " ; <nl> + } <nl> } <nl> <nl> - static void dump ( bool value , string & out ) { <nl> - out + = value ? " true " : " false " ; <nl> + static void dump ( int value , string * out ) { <nl> + char buf [ 32 ] ; <nl> + snprintf ( buf , sizeof buf , " % d " , value ) ; <nl> + * out + = buf ; <nl> } <nl> <nl> - static void dump ( const string & value , string & out ) { <nl> - out + = ' " ' ; <nl> - for ( size_t i = 0 ; i < value . length ( ) ; i + + ) { <nl> - const char ch = value [ i ] ; <nl> - if ( ch = = ' \ \ ' ) { <nl> - out + = " \ \ \ \ " ; <nl> - } else if ( ch = = ' " ' ) { <nl> - out + = " \ \ \ " " ; <nl> - } else if ( ch = = ' \ b ' ) { <nl> - out + = " \ \ b " ; <nl> - } else if ( ch = = ' \ f ' ) { <nl> - out + = " \ \ f " ; <nl> - } else if ( ch = = ' \ n ' ) { <nl> - out + = " \ \ n " ; <nl> - } else if ( ch = = ' \ r ' ) { <nl> - out + = " \ \ r " ; <nl> - } else if ( ch = = ' \ t ' ) { <nl> - out + = " \ \ t " ; <nl> - } else if ( static_cast < uint8_t > ( ch ) < = 0x1f ) { <nl> - char buf [ 8 ] ; <nl> - snprintf ( buf , sizeof buf , " \ \ u % 04x " , ch ) ; <nl> - out + = buf ; <nl> - } else if ( static_cast < uint8_t > ( ch ) = = 0xe2 & & static_cast < uint8_t > ( value [ i + 1 ] ) = = 0x80 <nl> - & & static_cast < uint8_t > ( value [ i + 2 ] ) = = 0xa8 ) { <nl> - out + = " \ \ u2028 " ; <nl> - i + = 2 ; <nl> - } else if ( static_cast < uint8_t > ( ch ) = = 0xe2 & & static_cast < uint8_t > ( value [ i + 1 ] ) = = 0x80 <nl> - & & static_cast < uint8_t > ( value [ i + 2 ] ) = = 0xa9 ) { <nl> - out + = " \ \ u2029 " ; <nl> - i + = 2 ; <nl> - } else { <nl> - out + = ch ; <nl> - } <nl> + static void dump ( bool value , string * out ) { * out + = value ? " true " : " false " ; } <nl> + <nl> + static void dump ( const string & value , string * out ) { <nl> + * out + = ' " ' ; <nl> + for ( size_t i = 0 ; i < value . length ( ) ; i + + ) { <nl> + const char ch = value [ i ] ; <nl> + if ( ch = = ' \ \ ' ) { <nl> + * out + = " \ \ \ \ " ; <nl> + } else if ( ch = = ' " ' ) { <nl> + * out + = " \ \ \ " " ; <nl> + } else if ( ch = = ' \ b ' ) { <nl> + * out + = " \ \ b " ; <nl> + } else if ( ch = = ' \ f ' ) { <nl> + * out + = " \ \ f " ; <nl> + } else if ( ch = = ' \ n ' ) { <nl> + * out + = " \ \ n " ; <nl> + } else if ( ch = = ' \ r ' ) { <nl> + * out + = " \ \ r " ; <nl> + } else if ( ch = = ' \ t ' ) { <nl> + * out + = " \ \ t " ; <nl> + } else if ( static_cast < uint8_t > ( ch ) < = 0x1f ) { <nl> + char buf [ 8 ] ; <nl> + snprintf ( buf , sizeof buf , " \ \ u % 04x " , ch ) ; <nl> + * out + = buf ; <nl> + } else if ( static_cast < uint8_t > ( ch ) = = 0xe2 & & <nl> + static_cast < uint8_t > ( value [ i + 1 ] ) = = 0x80 & & <nl> + static_cast < uint8_t > ( value [ i + 2 ] ) = = 0xa8 ) { <nl> + * out + = " \ \ u2028 " ; <nl> + i + = 2 ; <nl> + } else if ( static_cast < uint8_t > ( ch ) = = 0xe2 & & <nl> + static_cast < uint8_t > ( value [ i + 1 ] ) = = 0x80 & & <nl> + static_cast < uint8_t > ( value [ i + 2 ] ) = = 0xa9 ) { <nl> + * out + = " \ \ u2029 " ; <nl> + i + = 2 ; <nl> + } else { <nl> + * out + = ch ; <nl> } <nl> - out + = ' " ' ; <nl> + } <nl> + * out + = ' " ' ; <nl> } <nl> <nl> - static void dump ( const Json : : array & values , string & out ) { <nl> - bool first = true ; <nl> - out + = " [ " ; <nl> - for ( const auto & value : values ) { <nl> - if ( ! first ) <nl> - out + = " , " ; <nl> - value . dump ( out ) ; <nl> - first = false ; <nl> - } <nl> - out + = " ] " ; <nl> + static void dump ( const Json : : array & values , string * out ) { <nl> + bool first = true ; <nl> + * out + = " [ " ; <nl> + for ( const auto & value : values ) { <nl> + if ( ! first ) * out + = " , " ; <nl> + value . dump ( out ) ; <nl> + first = false ; <nl> + } <nl> + * out + = " ] " ; <nl> } <nl> <nl> - static void dump ( const Json : : object & values , string & out ) { <nl> - bool first = true ; <nl> - out + = " { " ; <nl> - for ( const auto & kv : values ) { <nl> - if ( ! first ) <nl> - out + = " , " ; <nl> - dump ( kv . first , out ) ; <nl> - out + = " : " ; <nl> - kv . second . dump ( out ) ; <nl> - first = false ; <nl> - } <nl> - out + = " } " ; <nl> + static void dump ( const Json : : object & values , string * out ) { <nl> + bool first = true ; <nl> + * out + = " { " ; <nl> + for ( const auto & kv : values ) { <nl> + if ( ! first ) * out + = " , " ; <nl> + dump ( kv . first , out ) ; <nl> + * out + = " : " ; <nl> + kv . second . dump ( out ) ; <nl> + first = false ; <nl> + } <nl> + * out + = " } " ; <nl> } <nl> <nl> - void Json : : dump ( string & out ) const { <nl> - m_ptr - > dump ( out ) ; <nl> - } <nl> + void Json : : dump ( string * out ) const { m_ptr - > dump ( out ) ; } <nl> <nl> / * * * * * * * * * * * * * * * * * * * * <nl> * Value wrappers <nl> void Json : : dump ( string & out ) const { <nl> template < Json : : Type tag , typename T > <nl> class Value : public JsonValue { <nl> protected : <nl> - / / Constructors <nl> - explicit Value ( const T & value ) : m_value ( value ) { } <nl> - explicit Value ( T & & value ) : m_value ( move ( value ) ) { } <nl> - <nl> - / / Get type tag <nl> - Json : : Type type ( ) const override { <nl> - return tag ; <nl> - } <nl> - <nl> - / / Comparisons <nl> - bool equals ( const JsonValue * other ) const override { <nl> - return m_value = = static_cast < const Value < tag , T > * > ( other ) - > m_value ; <nl> - } <nl> - bool less ( const JsonValue * other ) const override { <nl> - return m_value < ( static_cast < const Value < tag , T > * > ( other ) - > m_value ) ; <nl> - } <nl> - <nl> - const T m_value ; <nl> - void dump ( string & out ) const override { json11 : : dump ( m_value , out ) ; } <nl> + / / Constructors <nl> + explicit Value ( const T & value ) : m_value ( value ) { } <nl> + explicit Value ( T & & value ) : m_value ( move ( value ) ) { } <nl> + <nl> + / / Get type tag <nl> + Json : : Type type ( ) const override { return tag ; } <nl> + <nl> + / / Comparisons <nl> + bool equals ( const JsonValue * other ) const override { <nl> + return m_value = = static_cast < const Value < tag , T > * > ( other ) - > m_value ; <nl> + } <nl> + bool less ( const JsonValue * other ) const override { <nl> + return m_value < ( static_cast < const Value < tag , T > * > ( other ) - > m_value ) ; <nl> + } <nl> + <nl> + const T m_value ; <nl> + void dump ( string * out ) const override { json11 : : dump ( m_value , out ) ; } <nl> } ; <nl> <nl> class JsonDouble final : public Value < Json : : NUMBER , double > { <nl> - double number_value ( ) const override { return m_value ; } <nl> - int int_value ( ) const override { return static_cast < int > ( m_value ) ; } <nl> - bool equals ( const JsonValue * other ) const override { return m_value = = other - > number_value ( ) ; } <nl> - bool less ( const JsonValue * other ) const override { return m_value < other - > number_value ( ) ; } <nl> + double number_value ( ) const override { return m_value ; } <nl> + int int_value ( ) const override { return static_cast < int > ( m_value ) ; } <nl> + bool equals ( const JsonValue * other ) const override { <nl> + return m_value = = other - > number_value ( ) ; <nl> + } <nl> + bool less ( const JsonValue * other ) const override { <nl> + return m_value < other - > number_value ( ) ; <nl> + } <nl> + <nl> public : <nl> - explicit JsonDouble ( double value ) : Value ( value ) { } <nl> + explicit JsonDouble ( double value ) : Value ( value ) { } <nl> } ; <nl> <nl> class JsonInt final : public Value < Json : : NUMBER , int > { <nl> - double number_value ( ) const override { return m_value ; } <nl> - int int_value ( ) const override { return m_value ; } <nl> - bool equals ( const JsonValue * other ) const override { return m_value = = other - > number_value ( ) ; } <nl> - bool less ( const JsonValue * other ) const override { return m_value < other - > number_value ( ) ; } <nl> + double number_value ( ) const override { return m_value ; } <nl> + int int_value ( ) const override { return m_value ; } <nl> + bool equals ( const JsonValue * other ) const override { <nl> + return m_value = = other - > number_value ( ) ; <nl> + } <nl> + bool less ( const JsonValue * other ) const override { <nl> + return m_value < other - > number_value ( ) ; <nl> + } <nl> + <nl> public : <nl> - explicit JsonInt ( int value ) : Value ( value ) { } <nl> + explicit JsonInt ( int value ) : Value ( value ) { } <nl> } ; <nl> <nl> class JsonBoolean final : public Value < Json : : BOOL , bool > { <nl> - bool bool_value ( ) const override { return m_value ; } <nl> + bool bool_value ( ) const override { return m_value ; } <nl> + <nl> public : <nl> - explicit JsonBoolean ( bool value ) : Value ( value ) { } <nl> + explicit JsonBoolean ( bool value ) : Value ( value ) { } <nl> } ; <nl> <nl> class JsonString final : public Value < Json : : STRING , string > { <nl> - const string & string_value ( ) const override { return m_value ; } <nl> + const string & string_value ( ) const override { return m_value ; } <nl> + <nl> public : <nl> - explicit JsonString ( const string & value ) : Value ( value ) { } <nl> - explicit JsonString ( string & & value ) : Value ( move ( value ) ) { } <nl> + explicit JsonString ( const string & value ) : Value ( value ) { } <nl> + explicit JsonString ( string & & value ) : Value ( move ( value ) ) { } <nl> } ; <nl> <nl> class JsonArray final : public Value < Json : : ARRAY , Json : : array > { <nl> - const Json : : array & array_items ( ) const override { return m_value ; } <nl> - const Json & operator [ ] ( size_t i ) const override ; <nl> + const Json : : array & array_items ( ) const override { return m_value ; } <nl> + const Json & operator [ ] ( size_t i ) const override ; <nl> + <nl> public : <nl> - explicit JsonArray ( const Json : : array & value ) : Value ( value ) { } <nl> - explicit JsonArray ( Json : : array & & value ) : Value ( move ( value ) ) { } <nl> + explicit JsonArray ( const Json : : array & value ) : Value ( value ) { } <nl> + explicit JsonArray ( Json : : array & & value ) : Value ( move ( value ) ) { } <nl> } ; <nl> <nl> class JsonObject final : public Value < Json : : OBJECT , Json : : object > { <nl> - const Json : : object & object_items ( ) const override { return m_value ; } <nl> - const Json & operator [ ] ( const string & key ) const override ; <nl> + const Json : : object & object_items ( ) const override { return m_value ; } <nl> + const Json & operator [ ] ( const string & key ) const override ; <nl> + <nl> public : <nl> - explicit JsonObject ( const Json : : object & value ) : Value ( value ) { } <nl> - explicit JsonObject ( Json : : object & & value ) : Value ( move ( value ) ) { } <nl> + explicit JsonObject ( const Json : : object & value ) : Value ( value ) { } <nl> + explicit JsonObject ( Json : : object & & value ) : Value ( move ( value ) ) { } <nl> } ; <nl> <nl> class JsonNull final : public Value < Json : : NUL , NullStruct > { <nl> public : <nl> - JsonNull ( ) : Value ( { } ) { } <nl> + JsonNull ( ) : Value ( { } ) { } <nl> } ; <nl> <nl> / * * * * * * * * * * * * * * * * * * * * <nl> * Static globals - static - init - safe <nl> * / <nl> struct Statics { <nl> - const std : : shared_ptr < JsonValue > null = make_shared < JsonNull > ( ) ; <nl> - const std : : shared_ptr < JsonValue > t = make_shared < JsonBoolean > ( true ) ; <nl> - const std : : shared_ptr < JsonValue > f = make_shared < JsonBoolean > ( false ) ; <nl> - const string empty_string ; <nl> - const vector < Json > empty_vector ; <nl> - const map < string , Json > empty_map ; <nl> - Statics ( ) { } <nl> + const std : : shared_ptr < JsonValue > null = make_shared < JsonNull > ( ) ; <nl> + const std : : shared_ptr < JsonValue > t = make_shared < JsonBoolean > ( true ) ; <nl> + const std : : shared_ptr < JsonValue > f = make_shared < JsonBoolean > ( false ) ; <nl> + const string empty_string ; <nl> + const vector < Json > empty_vector ; <nl> + const map < string , Json > empty_map ; <nl> + Statics ( ) { } <nl> } ; <nl> <nl> - static const Statics & statics ( ) { <nl> - static const Statics s { } ; <nl> - return s ; <nl> + static const Statics & statics ( ) { <nl> + static const Statics s { } ; <nl> + return s ; <nl> } <nl> <nl> - static const Json & static_null ( ) { <nl> - / / This has to be separate , not in Statics , because Json ( ) accesses statics ( ) . null . <nl> - static const Json json_null ; <nl> - return json_null ; <nl> + static const Json & static_null ( ) { <nl> + / / This has to be separate , not in Statics , because Json ( ) accesses <nl> + / / statics ( ) . null . <nl> + static const Json json_null ; <nl> + return json_null ; <nl> } <nl> <nl> / * * * * * * * * * * * * * * * * * * * * <nl> * Constructors <nl> * / <nl> <nl> - Json : : Json ( ) noexcept : m_ptr ( statics ( ) . null ) { } <nl> - Json : : Json ( std : : nullptr_t ) noexcept : m_ptr ( statics ( ) . null ) { } <nl> - Json : : Json ( double value ) : m_ptr ( make_shared < JsonDouble > ( value ) ) { } <nl> - Json : : Json ( int value ) : m_ptr ( make_shared < JsonInt > ( value ) ) { } <nl> - Json : : Json ( bool value ) : m_ptr ( value ? statics ( ) . t : statics ( ) . f ) { } <nl> - Json : : Json ( const string & value ) : m_ptr ( make_shared < JsonString > ( value ) ) { } <nl> - Json : : Json ( string & & value ) : m_ptr ( make_shared < JsonString > ( move ( value ) ) ) { } <nl> - Json : : Json ( const char * value ) : m_ptr ( make_shared < JsonString > ( value ) ) { } <nl> - Json : : Json ( const Json : : array & values ) : m_ptr ( make_shared < JsonArray > ( values ) ) { } <nl> - Json : : Json ( Json : : array & & values ) : m_ptr ( make_shared < JsonArray > ( move ( values ) ) ) { } <nl> - Json : : Json ( const Json : : object & values ) : m_ptr ( make_shared < JsonObject > ( values ) ) { } <nl> - Json : : Json ( Json : : object & & values ) : m_ptr ( make_shared < JsonObject > ( move ( values ) ) ) { } <nl> + Json : : Json ( ) noexcept : m_ptr ( statics ( ) . null ) { } <nl> + Json : : Json ( std : : nullptr_t ) noexcept : m_ptr ( statics ( ) . null ) { } <nl> + Json : : Json ( double value ) : m_ptr ( make_shared < JsonDouble > ( value ) ) { } <nl> + Json : : Json ( int value ) : m_ptr ( make_shared < JsonInt > ( value ) ) { } <nl> + Json : : Json ( bool value ) : m_ptr ( value ? statics ( ) . t : statics ( ) . f ) { } <nl> + Json : : Json ( const string & value ) : m_ptr ( make_shared < JsonString > ( value ) ) { } <nl> + Json : : Json ( string & & value ) : m_ptr ( make_shared < JsonString > ( move ( value ) ) ) { } <nl> + Json : : Json ( const char * value ) : m_ptr ( make_shared < JsonString > ( value ) ) { } <nl> + Json : : Json ( const Json : : array & values ) : m_ptr ( make_shared < JsonArray > ( values ) ) { } <nl> + Json : : Json ( Json : : array & & values ) <nl> + : m_ptr ( make_shared < JsonArray > ( move ( values ) ) ) { } <nl> + Json : : Json ( const Json : : object & values ) <nl> + : m_ptr ( make_shared < JsonObject > ( values ) ) { } <nl> + Json : : Json ( Json : : object & & values ) <nl> + : m_ptr ( make_shared < JsonObject > ( move ( values ) ) ) { } <nl> <nl> / * * * * * * * * * * * * * * * * * * * * <nl> * Accessors <nl> * / <nl> <nl> - Json : : Type Json : : type ( ) const { return m_ptr - > type ( ) ; } <nl> - double Json : : number_value ( ) const { return m_ptr - > number_value ( ) ; } <nl> - int Json : : int_value ( ) const { return m_ptr - > int_value ( ) ; } <nl> - bool Json : : bool_value ( ) const { return m_ptr - > bool_value ( ) ; } <nl> - const string & Json : : string_value ( ) const { return m_ptr - > string_value ( ) ; } <nl> - const vector < Json > & Json : : array_items ( ) const { return m_ptr - > array_items ( ) ; } <nl> - const map < string , Json > & Json : : object_items ( ) const { return m_ptr - > object_items ( ) ; } <nl> - const Json & Json : : operator [ ] ( size_t i ) const { return ( * m_ptr ) [ i ] ; } <nl> - const Json & Json : : operator [ ] ( const string & key ) const { return ( * m_ptr ) [ key ] ; } <nl> - <nl> - double JsonValue : : number_value ( ) const { return 0 ; } <nl> - int JsonValue : : int_value ( ) const { return 0 ; } <nl> - bool JsonValue : : bool_value ( ) const { return false ; } <nl> - const string & JsonValue : : string_value ( ) const { return statics ( ) . empty_string ; } <nl> - const vector < Json > & JsonValue : : array_items ( ) const { return statics ( ) . empty_vector ; } <nl> - const map < string , Json > & JsonValue : : object_items ( ) const { return statics ( ) . empty_map ; } <nl> - const Json & JsonValue : : operator [ ] ( size_t ) const { return static_null ( ) ; } <nl> - const Json & JsonValue : : operator [ ] ( const string & ) const { return static_null ( ) ; } <nl> - <nl> - const Json & JsonObject : : operator [ ] ( const string & key ) const { <nl> - auto iter = m_value . find ( key ) ; <nl> - return ( iter = = m_value . end ( ) ) ? static_null ( ) : iter - > second ; <nl> + Json : : Type Json : : type ( ) const { return m_ptr - > type ( ) ; } <nl> + double Json : : number_value ( ) const { return m_ptr - > number_value ( ) ; } <nl> + int Json : : int_value ( ) const { return m_ptr - > int_value ( ) ; } <nl> + bool Json : : bool_value ( ) const { return m_ptr - > bool_value ( ) ; } <nl> + const string & Json : : string_value ( ) const { return m_ptr - > string_value ( ) ; } <nl> + const vector < Json > & Json : : array_items ( ) const { return m_ptr - > array_items ( ) ; } <nl> + const map < string , Json > & Json : : object_items ( ) const { <nl> + return m_ptr - > object_items ( ) ; <nl> + } <nl> + const Json & Json : : operator [ ] ( size_t i ) const { return ( * m_ptr ) [ i ] ; } <nl> + const Json & Json : : operator [ ] ( const string & key ) const { return ( * m_ptr ) [ key ] ; } <nl> + <nl> + double JsonValue : : number_value ( ) const { return 0 ; } <nl> + int JsonValue : : int_value ( ) const { return 0 ; } <nl> + bool JsonValue : : bool_value ( ) const { return false ; } <nl> + const string & JsonValue : : string_value ( ) const { return statics ( ) . empty_string ; } <nl> + const vector < Json > & JsonValue : : array_items ( ) const { <nl> + return statics ( ) . empty_vector ; <nl> + } <nl> + const map < string , Json > & JsonValue : : object_items ( ) const { <nl> + return statics ( ) . empty_map ; <nl> + } <nl> + const Json & JsonValue : : operator [ ] ( size_t ) const { return static_null ( ) ; } <nl> + const Json & JsonValue : : operator [ ] ( const string & ) const { <nl> + return static_null ( ) ; <nl> + } <nl> + <nl> + const Json & JsonObject : : operator [ ] ( const string & key ) const { <nl> + auto iter = m_value . find ( key ) ; <nl> + return ( iter = = m_value . end ( ) ) ? static_null ( ) : iter - > second ; <nl> } <nl> - const Json & JsonArray : : operator [ ] ( size_t i ) const { <nl> - if ( i > = m_value . size ( ) ) <nl> - return static_null ( ) ; <nl> - else <nl> - return m_value [ i ] ; <nl> + const Json & JsonArray : : operator [ ] ( size_t i ) const { <nl> + if ( i > = m_value . size ( ) ) <nl> + return static_null ( ) ; <nl> + else <nl> + return m_value [ i ] ; <nl> } <nl> <nl> / * * * * * * * * * * * * * * * * * * * * <nl> * Comparison <nl> * / <nl> <nl> - bool Json : : operator = = ( const Json & other ) const { <nl> - if ( m_ptr = = other . m_ptr ) <nl> - return true ; <nl> - if ( m_ptr - > type ( ) ! = other . m_ptr - > type ( ) ) <nl> - return false ; <nl> + bool Json : : operator = = ( const Json & other ) const { <nl> + if ( m_ptr = = other . m_ptr ) return true ; <nl> + if ( m_ptr - > type ( ) ! = other . m_ptr - > type ( ) ) return false ; <nl> <nl> - return m_ptr - > equals ( other . m_ptr . get ( ) ) ; <nl> + return m_ptr - > equals ( other . m_ptr . get ( ) ) ; <nl> } <nl> <nl> - bool Json : : operator < ( const Json & other ) const { <nl> - if ( m_ptr = = other . m_ptr ) <nl> - return false ; <nl> - if ( m_ptr - > type ( ) ! = other . m_ptr - > type ( ) ) <nl> - return m_ptr - > type ( ) < other . m_ptr - > type ( ) ; <nl> + bool Json : : operator < ( const Json & other ) const { <nl> + if ( m_ptr = = other . m_ptr ) return false ; <nl> + if ( m_ptr - > type ( ) ! = other . m_ptr - > type ( ) ) <nl> + return m_ptr - > type ( ) < other . m_ptr - > type ( ) ; <nl> <nl> - return m_ptr - > less ( other . m_ptr . get ( ) ) ; <nl> + return m_ptr - > less ( other . m_ptr . get ( ) ) ; <nl> } <nl> <nl> / * * * * * * * * * * * * * * * * * * * * <nl> bool Json : : operator < ( const Json & other ) const { <nl> * Format char c suitable for printing in an error message . <nl> * / <nl> static inline string esc ( char c ) { <nl> - char buf [ 12 ] ; <nl> - if ( static_cast < uint8_t > ( c ) > = 0x20 & & static_cast < uint8_t > ( c ) < = 0x7f ) { <nl> - snprintf ( buf , sizeof buf , " ' % c ' ( % d ) " , c , c ) ; <nl> - } else { <nl> - snprintf ( buf , sizeof buf , " ( % d ) " , c ) ; <nl> - } <nl> - return string ( buf ) ; <nl> + char buf [ 12 ] ; <nl> + if ( static_cast < uint8_t > ( c ) > = 0x20 & & static_cast < uint8_t > ( c ) < = 0x7f ) { <nl> + snprintf ( buf , sizeof buf , " ' % c ' ( % d ) " , c , c ) ; <nl> + } else { <nl> + snprintf ( buf , sizeof buf , " ( % d ) " , c ) ; <nl> + } <nl> + return string ( buf ) ; <nl> } <nl> <nl> - static inline bool in_range ( long x , long lower , long upper ) { <nl> - return ( x > = lower & & x < = upper ) ; <nl> + template < typename T > <nl> + static inline bool in_range ( T x , T lower , T upper ) { <nl> + return ( x > = lower & & x < = upper ) ; <nl> } <nl> <nl> namespace { <nl> namespace { <nl> * Object that tracks all state of an in - progress parse . <nl> * / <nl> struct JsonParser final { <nl> - / * State <nl> - * / <nl> - const char * str ; <nl> - const size_t str_len ; <nl> - size_t i ; <nl> - string & err ; <nl> - bool failed ; <nl> - const JsonParse strategy ; <nl> - <nl> - / * fail ( msg , err_ret = Json ( ) ) <nl> - * <nl> - * Mark this parse as failed . <nl> - * / <nl> - Json fail ( string & & msg ) { <nl> - return fail ( move ( msg ) , Json ( ) ) ; <nl> - } <nl> - <nl> - template < typename T > <nl> - T fail ( string & & msg , const T err_ret ) { <nl> - if ( ! failed ) <nl> - err = std : : move ( msg ) ; <nl> - failed = true ; <nl> - return err_ret ; <nl> - } <nl> - <nl> - / * consume_whitespace ( ) <nl> - * <nl> - * Advance until the current character is non - whitespace . <nl> - * / <nl> - void consume_whitespace ( ) { <nl> - while ( str [ i ] = = ' ' | | str [ i ] = = ' \ r ' | | str [ i ] = = ' \ n ' | | str [ i ] = = ' \ t ' ) <nl> - i + + ; <nl> - } <nl> - <nl> - / * consume_comment ( ) <nl> - * <nl> - * Advance comments ( c - style inline and multiline ) . <nl> - * / <nl> - bool consume_comment ( ) { <nl> - bool comment_found = false ; <nl> - if ( str [ i ] = = ' / ' ) { <nl> + / * State <nl> + * / <nl> + const char * str ; <nl> + const size_t str_len ; <nl> + size_t i ; <nl> + string * err ; <nl> + bool failed ; <nl> + const JsonParse strategy ; <nl> + <nl> + / * fail ( msg , err_ret = Json ( ) ) <nl> + * <nl> + * Mark this parse as failed . <nl> + * / <nl> + Json fail ( string & & msg ) { return fail ( move ( msg ) , Json ( ) ) ; } <nl> + <nl> + template < typename T > <nl> + T fail ( string & & msg , const T err_ret ) { <nl> + if ( ! failed ) * err = std : : move ( msg ) ; <nl> + failed = true ; <nl> + return err_ret ; <nl> + } <nl> + <nl> + / * consume_whitespace ( ) <nl> + * <nl> + * Advance until the current character is non - whitespace . <nl> + * / <nl> + void consume_whitespace ( ) { <nl> + while ( str [ i ] = = ' ' | | str [ i ] = = ' \ r ' | | str [ i ] = = ' \ n ' | | str [ i ] = = ' \ t ' ) <nl> + i + + ; <nl> + } <nl> + <nl> + / * consume_comment ( ) <nl> + * <nl> + * Advance comments ( c - style inline and multiline ) . <nl> + * / <nl> + bool consume_comment ( ) { <nl> + bool comment_found = false ; <nl> + if ( str [ i ] = = ' / ' ) { <nl> + i + + ; <nl> + if ( i = = str_len ) <nl> + return fail ( " Unexpected end of input after start of comment " , false ) ; <nl> + if ( str [ i ] = = ' / ' ) { / / inline comment <nl> i + + ; <nl> - if ( i = = str_len ) <nl> - return fail ( " Unexpected end of input after start of comment " , false ) ; <nl> - if ( str [ i ] = = ' / ' ) { / / inline comment <nl> + / / advance until next line , or end of input <nl> + while ( i < str_len & & str [ i ] ! = ' \ n ' ) { <nl> i + + ; <nl> - / / advance until next line , or end of input <nl> - while ( i < str_len & & str [ i ] ! = ' \ n ' ) { <nl> - i + + ; <nl> - } <nl> - comment_found = true ; <nl> - } else if ( str [ i ] = = ' * ' ) { / / multiline comment <nl> + } <nl> + comment_found = true ; <nl> + } else if ( str [ i ] = = ' * ' ) { / / multiline comment <nl> + i + + ; <nl> + if ( i > str_len - 2 ) <nl> + return fail ( " Unexpected end of input inside multi - line comment " , <nl> + false ) ; <nl> + / / advance until closing tokens <nl> + while ( ! ( str [ i ] = = ' * ' & & str [ i + 1 ] = = ' / ' ) ) { <nl> i + + ; <nl> if ( i > str_len - 2 ) <nl> - return fail ( " Unexpected end of input inside multi - line comment " , false ) ; <nl> - / / advance until closing tokens <nl> - while ( ! ( str [ i ] = = ' * ' & & str [ i + 1 ] = = ' / ' ) ) { <nl> - i + + ; <nl> - if ( i > str_len - 2 ) <nl> - return fail ( " Unexpected end of input inside multi - line comment " , false ) ; <nl> - } <nl> - i + = 2 ; <nl> - comment_found = true ; <nl> - } else { <nl> - return fail ( " Malformed comment " , false ) ; <nl> + return fail ( " Unexpected end of input inside multi - line comment " , <nl> + false ) ; <nl> } <nl> + i + = 2 ; <nl> + comment_found = true ; <nl> + } else { <nl> + return fail ( " Malformed comment " , false ) ; <nl> } <nl> - return comment_found ; <nl> } <nl> + return comment_found ; <nl> + } <nl> + <nl> + / * consume_garbage ( ) <nl> + * <nl> + * Advance until the current character is non - whitespace and non - comment . <nl> + * / <nl> + void consume_garbage ( ) { <nl> + consume_whitespace ( ) ; <nl> + if ( strategy = = JsonParse : : COMMENTS ) { <nl> + bool comment_found = false ; <nl> + do { <nl> + comment_found = consume_comment ( ) ; <nl> + if ( failed ) return ; <nl> + consume_whitespace ( ) ; <nl> + } while ( comment_found ) ; <nl> + } <nl> + } <nl> + <nl> + / * get_next_token ( ) <nl> + * <nl> + * Return the next non - whitespace character . If the end of the input is <nl> + * reached , flag an error and return 0 . <nl> + * / <nl> + char get_next_token ( ) { <nl> + consume_garbage ( ) ; <nl> + if ( failed ) return char { 0 } ; <nl> + if ( i = = str_len ) return fail ( " Unexpected end of input " , char { 0 } ) ; <nl> + <nl> + return str [ i + + ] ; <nl> + } <nl> + <nl> + / * encode_utf8 ( pt , out ) <nl> + * <nl> + * Encode pt as UTF - 8 and add it to out . <nl> + * / <nl> + void encode_utf8 ( int64_t pt , string * out ) { <nl> + if ( pt < 0 ) return ; <nl> + <nl> + if ( pt < 0x80 ) { <nl> + * out + = static_cast < char > ( pt ) ; <nl> + } else if ( pt < 0x800 ) { <nl> + * out + = static_cast < char > ( ( pt > > 6 ) | 0xC0 ) ; <nl> + * out + = static_cast < char > ( ( pt & 0x3F ) | 0x80 ) ; <nl> + } else if ( pt < 0x10000 ) { <nl> + * out + = static_cast < char > ( ( pt > > 12 ) | 0xE0 ) ; <nl> + * out + = static_cast < char > ( ( ( pt > > 6 ) & 0x3F ) | 0x80 ) ; <nl> + * out + = static_cast < char > ( ( pt & 0x3F ) | 0x80 ) ; <nl> + } else { <nl> + * out + = static_cast < char > ( ( pt > > 18 ) | 0xF0 ) ; <nl> + * out + = static_cast < char > ( ( ( pt > > 12 ) & 0x3F ) | 0x80 ) ; <nl> + * out + = static_cast < char > ( ( ( pt > > 6 ) & 0x3F ) | 0x80 ) ; <nl> + * out + = static_cast < char > ( ( pt & 0x3F ) | 0x80 ) ; <nl> + } <nl> + } <nl> + <nl> + / * parse_string ( ) <nl> + * <nl> + * Parse a string , starting at the current position . <nl> + * / <nl> + string parse_string ( ) { <nl> + string out ; <nl> + int64_t last_escaped_codepoint = - 1 ; <nl> + while ( true ) { <nl> + if ( i = = str_len ) return fail ( " Unexpected end of input in string " , " " ) ; <nl> + <nl> + char ch = str [ i + + ] ; <nl> + <nl> + if ( ch = = ' " ' ) { <nl> + encode_utf8 ( last_escaped_codepoint , & out ) ; <nl> + return out ; <nl> + } <nl> <nl> - / * consume_garbage ( ) <nl> - * <nl> - * Advance until the current character is non - whitespace and non - comment . <nl> - * / <nl> - void consume_garbage ( ) { <nl> - consume_whitespace ( ) ; <nl> - if ( strategy = = JsonParse : : COMMENTS ) { <nl> - bool comment_found = false ; <nl> - do { <nl> - comment_found = consume_comment ( ) ; <nl> - if ( failed ) return ; <nl> - consume_whitespace ( ) ; <nl> - } while ( comment_found ) ; <nl> + if ( in_range < int64_t > ( ch , 0 , 0x1f ) ) <nl> + return fail ( " Unescaped " + esc ( ch ) + " in string " , " " ) ; <nl> + <nl> + / / The usual case : non - escaped characters <nl> + if ( ch ! = ' \ \ ' ) { <nl> + encode_utf8 ( last_escaped_codepoint , & out ) ; <nl> + last_escaped_codepoint = - 1 ; <nl> + out + = ch ; <nl> + continue ; <nl> } <nl> - } <nl> <nl> - / * get_next_token ( ) <nl> - * <nl> - * Return the next non - whitespace character . If the end of the input is reached , <nl> - * flag an error and return 0 . <nl> - * / <nl> - char get_next_token ( ) { <nl> - consume_garbage ( ) ; <nl> - if ( failed ) return char { 0 } ; <nl> - if ( i = = str_len ) <nl> - return fail ( " Unexpected end of input " , char { 0 } ) ; <nl> - <nl> - return str [ i + + ] ; <nl> - } <nl> + / / Handle escapes <nl> + if ( i = = str_len ) return fail ( " Unexpected end of input in string " , " " ) ; <nl> <nl> - / * encode_utf8 ( pt , out ) <nl> - * <nl> - * Encode pt as UTF - 8 and add it to out . <nl> - * / <nl> - void encode_utf8 ( long pt , string & out ) { <nl> - if ( pt < 0 ) <nl> - return ; <nl> - <nl> - if ( pt < 0x80 ) { <nl> - out + = static_cast < char > ( pt ) ; <nl> - } else if ( pt < 0x800 ) { <nl> - out + = static_cast < char > ( ( pt > > 6 ) | 0xC0 ) ; <nl> - out + = static_cast < char > ( ( pt & 0x3F ) | 0x80 ) ; <nl> - } else if ( pt < 0x10000 ) { <nl> - out + = static_cast < char > ( ( pt > > 12 ) | 0xE0 ) ; <nl> - out + = static_cast < char > ( ( ( pt > > 6 ) & 0x3F ) | 0x80 ) ; <nl> - out + = static_cast < char > ( ( pt & 0x3F ) | 0x80 ) ; <nl> - } else { <nl> - out + = static_cast < char > ( ( pt > > 18 ) | 0xF0 ) ; <nl> - out + = static_cast < char > ( ( ( pt > > 12 ) & 0x3F ) | 0x80 ) ; <nl> - out + = static_cast < char > ( ( ( pt > > 6 ) & 0x3F ) | 0x80 ) ; <nl> - out + = static_cast < char > ( ( pt & 0x3F ) | 0x80 ) ; <nl> - } <nl> - } <nl> + ch = str [ i + + ] ; <nl> <nl> - / * parse_string ( ) <nl> - * <nl> - * Parse a string , starting at the current position . <nl> - * / <nl> - string parse_string ( ) { <nl> - string out ; <nl> - long last_escaped_codepoint = - 1 ; <nl> - while ( true ) { <nl> - if ( i = = str_len ) <nl> - return fail ( " Unexpected end of input in string " , " " ) ; <nl> - <nl> - char ch = str [ i + + ] ; <nl> - <nl> - if ( ch = = ' " ' ) { <nl> - encode_utf8 ( last_escaped_codepoint , out ) ; <nl> - return out ; <nl> - } <nl> - <nl> - if ( in_range ( ch , 0 , 0x1f ) ) <nl> - return fail ( " Unescaped " + esc ( ch ) + " in string " , " " ) ; <nl> - <nl> - / / The usual case : non - escaped characters <nl> - if ( ch ! = ' \ \ ' ) { <nl> - encode_utf8 ( last_escaped_codepoint , out ) ; <nl> - last_escaped_codepoint = - 1 ; <nl> - out + = ch ; <nl> - continue ; <nl> - } <nl> - <nl> - / / Handle escapes <nl> - if ( i = = str_len ) <nl> - return fail ( " Unexpected end of input in string " , " " ) ; <nl> - <nl> - ch = str [ i + + ] ; <nl> - <nl> - if ( ch = = ' u ' ) { <nl> - / / Extract 4 - byte escape sequence <nl> - string esc = string ( str + i , 4 ) ; <nl> - / / Explicitly check length of the substring . The following loop <nl> - / / relies on std : : string returning the terminating NUL when <nl> - / / accessing str [ length ] . Checking here reduces brittleness . <nl> - if ( esc . length ( ) < 4 ) { <nl> - return fail ( " Bad \ \ u escape : " + esc , " " ) ; <nl> - } <nl> - for ( size_t j = 0 ; j < 4 ; j + + ) { <nl> - if ( ! in_range ( esc [ j ] , ' a ' , ' f ' ) & & ! in_range ( esc [ j ] , ' A ' , ' F ' ) <nl> - & & ! in_range ( esc [ j ] , ' 0 ' , ' 9 ' ) ) <nl> - return fail ( " Bad \ \ u escape : " + esc , " " ) ; <nl> - } <nl> - <nl> - long codepoint = strtol ( esc . data ( ) , nullptr , 16 ) ; <nl> - <nl> - / / JSON specifies that characters outside the BMP shall be encoded as a pair <nl> - / / of 4 - hex - digit \ u escapes encoding their surrogate pair components . Check <nl> - / / whether we ' re in the middle of such a beast : the previous codepoint was an <nl> - / / escaped lead ( high ) surrogate , and this is a trail ( low ) surrogate . <nl> - if ( in_range ( last_escaped_codepoint , 0xD800 , 0xDBFF ) <nl> - & & in_range ( codepoint , 0xDC00 , 0xDFFF ) ) { <nl> - / / Reassemble the two surrogate pairs into one astral - plane character , per <nl> - / / the UTF - 16 algorithm . <nl> - encode_utf8 ( ( ( ( last_escaped_codepoint - 0xD800 ) < < 10 ) <nl> - | ( codepoint - 0xDC00 ) ) + 0x10000 , out ) ; <nl> - last_escaped_codepoint = - 1 ; <nl> - } else { <nl> - encode_utf8 ( last_escaped_codepoint , out ) ; <nl> - last_escaped_codepoint = codepoint ; <nl> - } <nl> - <nl> - i + = 4 ; <nl> - continue ; <nl> - } <nl> - <nl> - encode_utf8 ( last_escaped_codepoint , out ) ; <nl> - last_escaped_codepoint = - 1 ; <nl> - <nl> - if ( ch = = ' b ' ) { <nl> - out + = ' \ b ' ; <nl> - } else if ( ch = = ' f ' ) { <nl> - out + = ' \ f ' ; <nl> - } else if ( ch = = ' n ' ) { <nl> - out + = ' \ n ' ; <nl> - } else if ( ch = = ' r ' ) { <nl> - out + = ' \ r ' ; <nl> - } else if ( ch = = ' t ' ) { <nl> - out + = ' \ t ' ; <nl> - } else if ( ch = = ' " ' | | ch = = ' \ \ ' | | ch = = ' / ' ) { <nl> - out + = ch ; <nl> - } else { <nl> - return fail ( " Invalid escape character " + esc ( ch ) , " " ) ; <nl> - } <nl> + if ( ch = = ' u ' ) { <nl> + / / Extract 4 - byte escape sequence <nl> + string esc = string ( str + i , 4 ) ; <nl> + / / Explicitly check length of the substring . The following loop <nl> + / / relies on std : : string returning the terminating NUL when <nl> + / / accessing str [ length ] . Checking here reduces brittleness . <nl> + if ( esc . length ( ) < 4 ) { <nl> + return fail ( " Bad \ \ u escape : " + esc , " " ) ; <nl> + } <nl> + for ( size_t j = 0 ; j < 4 ; j + + ) { <nl> + if ( ! in_range ( esc [ j ] , ' a ' , ' f ' ) & & ! in_range ( esc [ j ] , ' A ' , ' F ' ) & & <nl> + ! in_range ( esc [ j ] , ' 0 ' , ' 9 ' ) ) <nl> + return fail ( " Bad \ \ u escape : " + esc , " " ) ; <nl> } <nl> - } <nl> <nl> - / * parse_number ( ) <nl> - * <nl> - * Parse a double . <nl> - * / <nl> - Json parse_number ( ) { <nl> - size_t start_pos = i ; <nl> - <nl> - if ( str [ i ] = = ' - ' ) <nl> - i + + ; <nl> - <nl> - / / Integer part <nl> - if ( str [ i ] = = ' 0 ' ) { <nl> - i + + ; <nl> - if ( in_range ( str [ i ] , ' 0 ' , ' 9 ' ) ) <nl> - return fail ( " Leading 0s not permitted in numbers " ) ; <nl> - } else if ( in_range ( str [ i ] , ' 1 ' , ' 9 ' ) ) { <nl> - i + + ; <nl> - while ( in_range ( str [ i ] , ' 0 ' , ' 9 ' ) ) <nl> - i + + ; <nl> + int64_t codepoint = <nl> + static_cast < int64_t > ( strtol ( esc . data ( ) , nullptr , 16 ) ) ; <nl> + <nl> + / / JSON specifies that characters outside the BMP shall be encoded as a <nl> + / / pair of 4 - hex - digit \ u escapes encoding their surrogate pair <nl> + / / components . Check whether we ' re in the middle of such a beast : the <nl> + / / previous codepoint was an escaped lead ( high ) surrogate , and this is <nl> + / / a trail ( low ) surrogate . <nl> + if ( in_range < int64_t > ( last_escaped_codepoint , 0xD800 , 0xDBFF ) & & <nl> + in_range < int64_t > ( codepoint , 0xDC00 , 0xDFFF ) ) { <nl> + / / Reassemble the two surrogate pairs into one astral - plane character , <nl> + / / per the UTF - 16 algorithm . <nl> + encode_utf8 ( ( ( ( last_escaped_codepoint - 0xD800 ) < < 10 ) | <nl> + ( codepoint - 0xDC00 ) ) + <nl> + 0x10000 , <nl> + & out ) ; <nl> + last_escaped_codepoint = - 1 ; <nl> } else { <nl> - return fail ( " Invalid " + esc ( str [ i ] ) + " in number " ) ; <nl> + encode_utf8 ( last_escaped_codepoint , & out ) ; <nl> + last_escaped_codepoint = codepoint ; <nl> } <nl> <nl> - if ( str [ i ] ! = ' . ' & & str [ i ] ! = ' e ' & & str [ i ] ! = ' E ' <nl> - & & ( i - start_pos ) < = static_cast < size_t > ( std : : numeric_limits < int > : : digits10 ) ) { <nl> - return std : : atoi ( str + start_pos ) ; <nl> - } <nl> + i + = 4 ; <nl> + continue ; <nl> + } <nl> <nl> - / / Decimal part <nl> - if ( str [ i ] = = ' . ' ) { <nl> - i + + ; <nl> - if ( ! in_range ( str [ i ] , ' 0 ' , ' 9 ' ) ) <nl> - return fail ( " At least one digit required in fractional part " ) ; <nl> + encode_utf8 ( last_escaped_codepoint , & out ) ; <nl> + last_escaped_codepoint = - 1 ; <nl> + <nl> + if ( ch = = ' b ' ) { <nl> + out + = ' \ b ' ; <nl> + } else if ( ch = = ' f ' ) { <nl> + out + = ' \ f ' ; <nl> + } else if ( ch = = ' n ' ) { <nl> + out + = ' \ n ' ; <nl> + } else if ( ch = = ' r ' ) { <nl> + out + = ' \ r ' ; <nl> + } else if ( ch = = ' t ' ) { <nl> + out + = ' \ t ' ; <nl> + } else if ( ch = = ' " ' | | ch = = ' \ \ ' | | ch = = ' / ' ) { <nl> + out + = ch ; <nl> + } else { <nl> + return fail ( " Invalid escape character " + esc ( ch ) , " " ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + / * parse_number ( ) <nl> + * <nl> + * Parse a double . <nl> + * / <nl> + Json parse_number ( ) { <nl> + size_t start_pos = i ; <nl> + <nl> + if ( str [ i ] = = ' - ' ) i + + ; <nl> + <nl> + / / Integer part <nl> + if ( str [ i ] = = ' 0 ' ) { <nl> + i + + ; <nl> + if ( in_range ( str [ i ] , ' 0 ' , ' 9 ' ) ) <nl> + return fail ( " Leading 0s not permitted in numbers " ) ; <nl> + } else if ( in_range ( str [ i ] , ' 1 ' , ' 9 ' ) ) { <nl> + i + + ; <nl> + while ( in_range ( str [ i ] , ' 0 ' , ' 9 ' ) ) i + + ; <nl> + } else { <nl> + return fail ( " Invalid " + esc ( str [ i ] ) + " in number " ) ; <nl> + } <nl> <nl> - while ( in_range ( str [ i ] , ' 0 ' , ' 9 ' ) ) <nl> - i + + ; <nl> - } <nl> + if ( str [ i ] ! = ' . ' & & str [ i ] ! = ' e ' & & str [ i ] ! = ' E ' & & <nl> + ( i - start_pos ) < = <nl> + static_cast < size_t > ( std : : numeric_limits < int > : : digits10 ) ) { <nl> + return Json ( std : : atoi ( str + start_pos ) ) ; <nl> + } <nl> + <nl> + / / Decimal part <nl> + if ( str [ i ] = = ' . ' ) { <nl> + i + + ; <nl> + if ( ! in_range ( str [ i ] , ' 0 ' , ' 9 ' ) ) <nl> + return fail ( " At least one digit required in fractional part " ) ; <nl> <nl> - / / Exponent part <nl> - if ( str [ i ] = = ' e ' | | str [ i ] = = ' E ' ) { <nl> - i + + ; <nl> + while ( in_range ( str [ i ] , ' 0 ' , ' 9 ' ) ) i + + ; <nl> + } <nl> <nl> - if ( str [ i ] = = ' + ' | | str [ i ] = = ' - ' ) <nl> - i + + ; <nl> + / / Exponent part <nl> + if ( str [ i ] = = ' e ' | | str [ i ] = = ' E ' ) { <nl> + i + + ; <nl> <nl> - if ( ! in_range ( str [ i ] , ' 0 ' , ' 9 ' ) ) <nl> - return fail ( " At least one digit required in exponent " ) ; <nl> + if ( str [ i ] = = ' + ' | | str [ i ] = = ' - ' ) i + + ; <nl> <nl> - while ( in_range ( str [ i ] , ' 0 ' , ' 9 ' ) ) <nl> - i + + ; <nl> - } <nl> + if ( ! in_range ( str [ i ] , ' 0 ' , ' 9 ' ) ) <nl> + return fail ( " At least one digit required in exponent " ) ; <nl> <nl> - return std : : strtod ( str + start_pos , nullptr ) ; <nl> + while ( in_range ( str [ i ] , ' 0 ' , ' 9 ' ) ) i + + ; <nl> } <nl> <nl> - / * expect ( str , res ) <nl> - * <nl> - * Expect that ' str ' starts at the character that was just read . If it does , advance <nl> - * the input and return res . If not , flag an error . <nl> - * / <nl> - Json expect ( const string & expected , Json res ) { <nl> - CHECK_NE ( i , 0 ) <nl> - i - - ; <nl> - auto substr = string ( str + i , expected . length ( ) ) ; <nl> - if ( substr = = expected ) { <nl> - i + = expected . length ( ) ; <nl> - return res ; <nl> - } else { <nl> - return fail ( " Parse error : expected " + expected + " , got " + substr ) ; <nl> - } <nl> + return Json ( std : : strtod ( str + start_pos , nullptr ) ) ; <nl> + } <nl> + <nl> + / * expect ( str , res ) <nl> + * <nl> + * Expect that ' str ' starts at the character that was just read . If it does , <nl> + * advance the input and return res . If not , flag an error . <nl> + * / <nl> + Json expect ( const string & expected , Json res ) { <nl> + CHECK_NE ( i , 0 ) <nl> + i - - ; <nl> + auto substr = string ( str + i , expected . length ( ) ) ; <nl> + if ( substr = = expected ) { <nl> + i + = expected . length ( ) ; <nl> + return res ; <nl> + } else { <nl> + return fail ( " Parse error : expected " + expected + " , got " + substr ) ; <nl> + } <nl> + } <nl> + <nl> + / * parse_json ( ) <nl> + * <nl> + * Parse a JSON object . <nl> + * / <nl> + Json parse_json ( int depth ) { <nl> + if ( depth > max_depth ) { <nl> + return fail ( " Exceeded maximum nesting depth " ) ; <nl> } <nl> <nl> - / * parse_json ( ) <nl> - * <nl> - * Parse a JSON object . <nl> - * / <nl> - Json parse_json ( int depth ) { <nl> - if ( depth > max_depth ) { <nl> - return fail ( " Exceeded maximum nesting depth " ) ; <nl> - } <nl> + char ch = get_next_token ( ) ; <nl> + if ( failed ) return Json ( ) ; <nl> <nl> - char ch = get_next_token ( ) ; <nl> - if ( failed ) <nl> - return Json ( ) ; <nl> + if ( ch = = ' - ' | | ( ch > = ' 0 ' & & ch < = ' 9 ' ) ) { <nl> + i - - ; <nl> + return parse_number ( ) ; <nl> + } <nl> <nl> - if ( ch = = ' - ' | | ( ch > = ' 0 ' & & ch < = ' 9 ' ) ) { <nl> - i - - ; <nl> - return parse_number ( ) ; <nl> - } <nl> + if ( ch = = ' t ' ) return expect ( " true " , Json ( true ) ) ; <nl> <nl> - if ( ch = = ' t ' ) <nl> - return expect ( " true " , true ) ; <nl> + if ( ch = = ' f ' ) return expect ( " false " , Json ( false ) ) ; <nl> <nl> - if ( ch = = ' f ' ) <nl> - return expect ( " false " , false ) ; <nl> + if ( ch = = ' n ' ) return expect ( " null " , Json ( ) ) ; <nl> <nl> - if ( ch = = ' n ' ) <nl> - return expect ( " null " , Json ( ) ) ; <nl> + if ( ch = = ' " ' ) return Json ( parse_string ( ) ) ; <nl> <nl> - if ( ch = = ' " ' ) <nl> - return parse_string ( ) ; <nl> + if ( ch = = ' { ' ) { <nl> + map < string , Json > data ; <nl> + ch = get_next_token ( ) ; <nl> + if ( ch = = ' } ' ) return Json ( data ) ; <nl> <nl> - if ( ch = = ' { ' ) { <nl> - map < string , Json > data ; <nl> - ch = get_next_token ( ) ; <nl> - if ( ch = = ' } ' ) <nl> - return data ; <nl> + while ( 1 ) { <nl> + if ( ch ! = ' " ' ) return fail ( " Expected ' \ " ' in object , got " + esc ( ch ) ) ; <nl> <nl> - while ( 1 ) { <nl> - if ( ch ! = ' " ' ) <nl> - return fail ( " Expected ' \ " ' in object , got " + esc ( ch ) ) ; <nl> + string key = parse_string ( ) ; <nl> + if ( failed ) return Json ( ) ; <nl> <nl> - string key = parse_string ( ) ; <nl> - if ( failed ) <nl> - return Json ( ) ; <nl> + ch = get_next_token ( ) ; <nl> + if ( ch ! = ' : ' ) return fail ( " Expected ' : ' in object , got " + esc ( ch ) ) ; <nl> <nl> - ch = get_next_token ( ) ; <nl> - if ( ch ! = ' : ' ) <nl> - return fail ( " Expected ' : ' in object , got " + esc ( ch ) ) ; <nl> + data [ std : : move ( key ) ] = parse_json ( depth + 1 ) ; <nl> + if ( failed ) return Json ( ) ; <nl> <nl> - data [ std : : move ( key ) ] = parse_json ( depth + 1 ) ; <nl> - if ( failed ) <nl> - return Json ( ) ; <nl> + ch = get_next_token ( ) ; <nl> + if ( ch = = ' } ' ) break ; <nl> + if ( ch ! = ' , ' ) return fail ( " Expected ' , ' in object , got " + esc ( ch ) ) ; <nl> <nl> - ch = get_next_token ( ) ; <nl> - if ( ch = = ' } ' ) <nl> - break ; <nl> - if ( ch ! = ' , ' ) <nl> - return fail ( " Expected ' , ' in object , got " + esc ( ch ) ) ; <nl> + ch = get_next_token ( ) ; <nl> + } <nl> + return Json ( data ) ; <nl> + } <nl> <nl> - ch = get_next_token ( ) ; <nl> - } <nl> - return data ; <nl> - } <nl> + if ( ch = = ' [ ' ) { <nl> + vector < Json > data ; <nl> + ch = get_next_token ( ) ; <nl> + if ( ch = = ' ] ' ) return Json ( data ) ; <nl> <nl> - if ( ch = = ' [ ' ) { <nl> - vector < Json > data ; <nl> - ch = get_next_token ( ) ; <nl> - if ( ch = = ' ] ' ) <nl> - return data ; <nl> - <nl> - while ( 1 ) { <nl> - i - - ; <nl> - data . push_back ( parse_json ( depth + 1 ) ) ; <nl> - if ( failed ) <nl> - return Json ( ) ; <nl> - <nl> - ch = get_next_token ( ) ; <nl> - if ( ch = = ' ] ' ) <nl> - break ; <nl> - if ( ch ! = ' , ' ) <nl> - return fail ( " Expected ' , ' in list , got " + esc ( ch ) ) ; <nl> - <nl> - ch = get_next_token ( ) ; <nl> - ( void ) ch ; <nl> - } <nl> - return data ; <nl> - } <nl> + while ( 1 ) { <nl> + i - - ; <nl> + data . push_back ( parse_json ( depth + 1 ) ) ; <nl> + if ( failed ) return Json ( ) ; <nl> <nl> - return fail ( " Expected value , got " + esc ( ch ) ) ; <nl> + ch = get_next_token ( ) ; <nl> + if ( ch = = ' ] ' ) break ; <nl> + if ( ch ! = ' , ' ) return fail ( " Expected ' , ' in list , got " + esc ( ch ) ) ; <nl> + <nl> + ch = get_next_token ( ) ; <nl> + ( void ) ch ; <nl> + } <nl> + return Json ( data ) ; <nl> } <nl> + <nl> + return fail ( " Expected value , got " + esc ( ch ) ) ; <nl> + } <nl> } ; <nl> } / / namespace <nl> <nl> - Json Json : : parse ( const string & in , string & err , JsonParse strategy ) { <nl> - JsonParser parser { in . c_str ( ) , in . size ( ) , 0 , err , false , strategy } ; <nl> - Json result = parser . parse_json ( 0 ) ; <nl> + Json Json : : parse ( const string & in , string * err , JsonParse strategy ) { <nl> + JsonParser parser { in . c_str ( ) , in . size ( ) , 0 , err , false , strategy } ; <nl> + Json result = parser . parse_json ( 0 ) ; <nl> <nl> - / / Check for any trailing garbage <nl> - parser . consume_garbage ( ) ; <nl> - if ( parser . failed ) <nl> - return Json ( ) ; <nl> - if ( parser . i ! = in . size ( ) ) <nl> - return parser . fail ( " Unexpected trailing " + esc ( in [ parser . i ] ) ) ; <nl> + / / Check for any trailing garbage <nl> + parser . consume_garbage ( ) ; <nl> + if ( parser . failed ) return Json ( ) ; <nl> + if ( parser . i ! = in . size ( ) ) <nl> + return parser . fail ( " Unexpected trailing " + esc ( in [ parser . i ] ) ) ; <nl> <nl> - return result ; <nl> + return result ; <nl> } <nl> <nl> / / Documented in json11 . hpp <nl> vector < Json > Json : : parse_multi ( const string & in , <nl> - std : : string : : size_type & parser_stop_pos , <nl> - string & err , <nl> - JsonParse strategy ) { <nl> - JsonParser parser { in . c_str ( ) , in . size ( ) , 0 , err , false , strategy } ; <nl> - parser_stop_pos = 0 ; <nl> - vector < Json > json_vec ; <nl> - while ( parser . i ! = in . size ( ) & & ! parser . failed ) { <nl> - json_vec . push_back ( parser . parse_json ( 0 ) ) ; <nl> - if ( parser . failed ) <nl> - break ; <nl> - <nl> - / / Check for another object <nl> - parser . consume_garbage ( ) ; <nl> - if ( parser . failed ) <nl> - break ; <nl> - parser_stop_pos = parser . i ; <nl> - } <nl> - return json_vec ; <nl> + std : : string : : size_type * parser_stop_pos , <nl> + string * err , JsonParse strategy ) { <nl> + JsonParser parser { in . c_str ( ) , in . size ( ) , 0 , err , false , strategy } ; <nl> + * parser_stop_pos = 0 ; <nl> + vector < Json > json_vec ; <nl> + while ( parser . i ! = in . size ( ) & & ! parser . failed ) { <nl> + json_vec . push_back ( parser . parse_json ( 0 ) ) ; <nl> + if ( parser . failed ) break ; <nl> + <nl> + / / Check for another object <nl> + parser . consume_garbage ( ) ; <nl> + if ( parser . failed ) break ; <nl> + * parser_stop_pos = parser . i ; <nl> + } <nl> + return json_vec ; <nl> } <nl> <nl> / * * * * * * * * * * * * * * * * * * * * <nl> * Shape - checking <nl> * / <nl> <nl> - bool Json : : has_shape ( const shape & types , string & err ) const { <nl> - if ( ! is_object ( ) ) { <nl> - err = " Expected JSON object , got " + dump ( ) ; <nl> - return false ; <nl> - } <nl> + bool Json : : has_shape ( const shape & types , string * err ) const { <nl> + if ( ! is_object ( ) ) { <nl> + * err = " Expected JSON object , got " + dump ( ) ; <nl> + return false ; <nl> + } <nl> <nl> - for ( auto & item : types ) { <nl> - if ( ( * this ) [ item . first ] . type ( ) ! = item . second ) { <nl> - err = " Bad type for " + item . first + " in " + dump ( ) ; <nl> - return false ; <nl> - } <nl> + for ( auto & item : types ) { <nl> + if ( ( * this ) [ item . first ] . type ( ) ! = item . second ) { <nl> + * err = " Bad type for " + item . first + " in " + dump ( ) ; <nl> + return false ; <nl> } <nl> + } <nl> <nl> - return true ; <nl> + return true ; <nl> } <nl> <nl> } / / namespace json11 <nl>
|
fix cpp lint in json11 ( )
|
microsoft/LightGBM
|
5c201e48f2cf853fede4352de236233cee7289b4
|
2020-04-08T12:31:33Z
|
mmm a / hphp / hack / src / name_index / sqlite / consts . rs <nl> ppp b / hphp / hack / src / name_index / sqlite / consts . rs <nl> use crate : : datatypes : : * ; <nl> <nl> use oxidized : : relative_path : : RelativePath ; <nl> use rusqlite : : { params , Connection } ; <nl> - use std : : sync : : Arc ; <nl> + use std : : sync : : { Arc , Mutex } ; <nl> <nl> # [ derive ( Debug ) ] <nl> pub ( crate ) struct ConstsTable { <nl> - connection : Arc < Connection > , <nl> + connection : Arc < Mutex < Connection > > , <nl> } <nl> <nl> # [ derive ( Debug ) ] <nl> pub ( crate ) struct ConstItem { <nl> / / TODO : some functions is only used in unit tests for now <nl> # [ allow ( dead_code ) ] <nl> impl ConstsTable { <nl> - pub fn new ( connection : Arc < Connection > ) - > Self { <nl> + pub fn new ( connection : Arc < Mutex < Connection > > ) - > Self { <nl> ConstsTable { <nl> connection : connection . clone ( ) , <nl> } <nl> impl ConstsTable { <nl> FILE_INFO_ID INTEGER NOT NULL <nl> ) ; " ; <nl> <nl> - self . connection . execute ( & statement , params ! [ ] ) . unwrap ( ) ; <nl> + self . connection <nl> + . lock ( ) <nl> + . unwrap ( ) <nl> + . execute ( & statement , params ! [ ] ) <nl> + . unwrap ( ) ; <nl> } <nl> <nl> pub fn insert ( self , items : & [ ConstItem ] ) { <nl> impl ConstsTable { <nl> ) VALUES ( <nl> ? , ? <nl> ) ; " ; <nl> - let mut insert_statement = self . connection . prepare ( & insert_statement ) . unwrap ( ) ; <nl> + <nl> + let connection = self . connection . lock ( ) . unwrap ( ) ; <nl> + let mut insert_statement = connection . prepare ( & insert_statement ) . unwrap ( ) ; <nl> <nl> for item in items { <nl> let hash = Convert : : name_to_hash ( & item . name ) ; <nl> impl ConstsTable { <nl> NAMING_CONSTS . HASH = ? <nl> " ; <nl> <nl> - let mut select_statement = self . connection . prepare ( & select_statement ) . unwrap ( ) ; <nl> + let connection = self . connection . lock ( ) . unwrap ( ) ; <nl> + let mut select_statement = connection . prepare ( & select_statement ) . unwrap ( ) ; <nl> names <nl> . into_iter ( ) <nl> . map ( | name | { <nl> mod tests { <nl> <nl> # [ test ] <nl> fn test_add_const ( ) { <nl> - let const_table = ConstsTable : : new ( Arc : : new ( Connection : : open_in_memory ( ) . unwrap ( ) ) ) ; <nl> + let const_table = <nl> + ConstsTable : : new ( Arc : : new ( Mutex : : new ( Connection : : open_in_memory ( ) . unwrap ( ) ) ) ) ; <nl> const_table . create ( ) ; <nl> let consts = [ ConstItem { <nl> name : " Foo " . to_string ( ) , <nl> mmm a / hphp / hack / src / name_index / sqlite / file_infos . rs <nl> ppp b / hphp / hack / src / name_index / sqlite / file_infos . rs <nl> use ocamlrep : : rc : : RcOc ; <nl> use oxidized : : file_info : : FileInfo ; <nl> use oxidized : : relative_path : : RelativePath ; <nl> use rusqlite : : { params , Connection } ; <nl> - use std : : sync : : Arc ; <nl> + use std : : sync : : { Arc , Mutex } ; <nl> <nl> # [ derive ( Debug ) ] <nl> pub ( crate ) struct FileInfoTable { <nl> - connection : Arc < Connection > , <nl> + connection : Arc < Mutex < Connection > > , <nl> } <nl> <nl> # [ derive ( Debug ) ] <nl> pub ( crate ) struct FileInfoItem { <nl> / / TODO : some functions is only used in unit tests for now <nl> # [ allow ( dead_code ) ] <nl> impl FileInfoTable { <nl> - pub fn new ( connection : Arc < Connection > ) - > Self { <nl> + pub fn new ( connection : Arc < Mutex < Connection > > ) - > Self { <nl> FileInfoTable { <nl> connection : connection . clone ( ) , <nl> } <nl> impl FileInfoTable { <nl> TYPEDEFS TEXT <nl> ) ; " ; <nl> <nl> - self . connection . execute ( & statement , params ! [ ] ) . unwrap ( ) ; <nl> + self . connection <nl> + . lock ( ) <nl> + . unwrap ( ) <nl> + . execute ( & statement , params ! [ ] ) <nl> + . unwrap ( ) ; <nl> } <nl> <nl> pub fn insert ( self , items : & [ FileInfoItem ] ) { <nl> impl FileInfoTable { <nl> ) VALUES ( <nl> ? , ? , ? , ? , ? , ? , ? , ? , ? <nl> ) ; " ; <nl> - let mut insert_statement = self . connection . prepare ( & insert_statement ) . unwrap ( ) ; <nl> + let connection = self . connection . lock ( ) . unwrap ( ) ; <nl> + let mut insert_statement = connection . prepare ( & insert_statement ) . unwrap ( ) ; <nl> <nl> for item in items { <nl> let path_prefix_type = Convert : : prefix_to_i64 ( item . path . prefix ( ) ) ; <nl> mod tests { <nl> <nl> # [ test ] <nl> fn test_add_file_info ( ) { <nl> - let file_info_table = FileInfoTable : : new ( Arc : : new ( Connection : : open_in_memory ( ) . unwrap ( ) ) ) ; <nl> + let file_info_table = <nl> + FileInfoTable : : new ( Arc : : new ( Mutex : : new ( Connection : : open_in_memory ( ) . unwrap ( ) ) ) ) ; <nl> file_info_table . create ( ) ; <nl> let path = RcOc : : new ( RelativePath : : make ( Prefix : : Root , PathBuf : : from ( " foo . php " ) ) ) ; <nl> let file_infos = [ FileInfoItem { <nl> mmm a / hphp / hack / src / name_index / sqlite / names . rs <nl> ppp b / hphp / hack / src / name_index / sqlite / names . rs <nl> use crate : : file_infos : : * ; <nl> use oxidized : : relative_path : : RelativePath ; <nl> use rusqlite : : { Connection , OpenFlags } ; <nl> use std : : path : : Path ; <nl> - use std : : sync : : Arc ; <nl> + use std : : sync : : { Arc , Mutex } ; <nl> <nl> / / TODO : file_infos is not used yet <nl> # [ allow ( dead_code ) ] <nl> pub struct Names { <nl> <nl> impl Names { <nl> pub fn new ( path : & Path ) - > Self { <nl> - let connection = <nl> - Arc : : new ( Connection : : open_with_flags ( path , OpenFlags : : SQLITE_OPEN_READ_ONLY ) . unwrap ( ) ) ; <nl> + let connection = Arc : : new ( Mutex : : new ( <nl> + Connection : : open_with_flags ( path , OpenFlags : : SQLITE_OPEN_READ_ONLY ) . unwrap ( ) , <nl> + ) ) ; <nl> <nl> Names { <nl> consts : ConstsTable : : new ( connection . clone ( ) ) , <nl>
|
Naming : SQLite connection should be held in a Mutex
|
facebook/hhvm
|
d833e59b1406f4308836bc783335730c00a681c9
|
2019-11-04T03:44:59Z
|
mmm a / Tests / UnitTests / BrainScriptTests / BrainScriptTests . vcxproj <nl> ppp b / Tests / UnitTests / BrainScriptTests / BrainScriptTests . vcxproj <nl> <nl> < ItemGroup > <nl> < ClInclude Include = " . . \ . . \ . . \ Source \ CNTK \ BrainScript \ BrainScriptEvaluator . h " / > <nl> < ClInclude Include = " . . \ . . \ . . \ Source \ CNTK \ BrainScript \ BrainScriptParser . h " / > <nl> - < ClInclude Include = " ParserTestsData . h " / > <nl> < ClInclude Include = " stdafx . h " / > <nl> < ClInclude Include = " targetver . h " / > <nl> < / ItemGroup > <nl> mmm a / Tests / UnitTests / BrainScriptTests / BrainScriptTests . vcxproj . filters <nl> ppp b / Tests / UnitTests / BrainScriptTests / BrainScriptTests . vcxproj . filters <nl> <nl> < ClInclude Include = " . . \ . . \ . . \ Source \ CNTK \ BrainScript \ BrainScriptParser . h " > <nl> < Filter > From Brainscript < / Filter > <nl> < / ClInclude > <nl> - < ClInclude Include = " ParserTestsData . h " / > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> < Filter Include = " From Brainscript " > <nl> new file mode 100644 <nl> index 00000000000 . . f796ec54496 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput1 . txt <nl> <nl> + [ ] <nl> + do = <nl> + + <nl> + * <nl> + ( <nl> + Parameter <nl> + ( ) <nl> + 13 <nl> + 42 <nl> + <nl> + <nl> + ( <nl> + Input <nl> + ( ) <nl> + 42 <nl> + <nl> + <nl> + <nl> + ( <nl> + Parameter <nl> + ( ) <nl> + 13 <nl> + 1 <nl> + <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 46889097847 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput10 . txt <nl> <nl> + [ ] <nl> + arr = <nl> + array <nl> + 1 <nl> + 10 <nl> + = > <nl> + ( ) <nl> + i <nl> + <nl> + * <nl> + 2 <nl> + i <nl> + <nl> + <nl> + <nl> + do = <nl> + ( <nl> + Print <nl> + ( ) <nl> + val <nl> + <nl> + <nl> + val = <nl> + if <nl> + ! ( <nl> + 0 <nl> + <nl> + 42 <nl> + : <nl> + - ( <nl> + + ( <nl> + - ( <nl> + + ( <nl> + + ( <nl> + - ( <nl> + 13 <nl> + <nl> + <nl> + <nl> + <nl> + <nl> + <nl> + [ ] <nl> + a = <nl> + ' a ' <nl> + b = <nl> + 42 <nl> + <nl> + + ( <nl> + 14 <nl> + <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 55946dc4c5b <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput11 . txt <nl> <nl> + [ ] <nl> + N = <nl> + 5 <nl> + arg = <nl> + arr <nl> + arr = <nl> + array <nl> + 1 <nl> + N <nl> + = > <nl> + ( ) <nl> + i <nl> + <nl> + if <nl> + < <nl> + i <nl> + N <nl> + <nl> + * <nl> + [ <nl> + arr <nl> + + <nl> + i <nl> + 1 <nl> + <nl> + <nl> + i <nl> + <nl> + N <nl> + <nl> + <nl> + <nl> + do = <nl> + ( <nl> + Print <nl> + ( ) <nl> + arg <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . ab38a4cd521 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput12 . txt <nl> <nl> + [ ] <nl> + do = <nl> + ( <nl> + Print <nl> + ( ) <nl> + val <nl> + <nl> + <nl> + offset = <nl> + 13 <nl> + val = <nl> + ( <nl> + . v <nl> + [ ] <nl> + v = <nl> + = > <nl> + ( ) <nl> + i <nl> + <nl> + + <nl> + i <nl> + offset <nl> + <nl> + <nl> + <nl> + <nl> + ( ) <nl> + 42 <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . a1d2c649400 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput13 . txt <nl> <nl> + [ ] <nl> + do = <nl> + ( <nl> + Print <nl> + ( ) <nl> + val <nl> + <nl> + <nl> + val = <nl> + new NDLComputationNetwork <nl> + [ ] <nl> + CE = <nl> + ( <nl> + CrossEntropyWithSoftmax <nl> + ( ) <nl> + myLabels <nl> + outZ <nl> + <nl> + <nl> + Err = <nl> + ( <nl> + ErrorPrediction <nl> + ( ) <nl> + myLabels <nl> + outZ <nl> + <nl> + <nl> + HiddenStack = <nl> + = > <nl> + ( ) <nl> + layer <nl> + <nl> + if <nl> + > <nl> + layer <nl> + 1 <nl> + <nl> + ( <nl> + SBFF <nl> + ( ) <nl> + . Eh <nl> + ( <nl> + HiddenStack <nl> + ( ) <nl> + - <nl> + layer <nl> + 1 <nl> + <nl> + <nl> + <nl> + <nl> + hiddenDim <nl> + hiddenDim <nl> + <nl> + <nl> + ( <nl> + SBFF <nl> + ( ) <nl> + featNorm <nl> + hiddenDim <nl> + featDim <nl> + <nl> + <nl> + <nl> + <nl> + ScaledLogLikelihood = <nl> + - <nl> + outZ <nl> + logPrior <nl> + <nl> + featDim = <nl> + * <nl> + 40 <nl> + 31 <nl> + <nl> + featNorm = <nl> + ( <nl> + MeanVarNorm <nl> + ( ) <nl> + myFeatures <nl> + <nl> + <nl> + hiddenDim = <nl> + 2048 <nl> + labelDim = <nl> + 9000 <nl> + logPrior = <nl> + ( <nl> + LogPrior <nl> + ( ) <nl> + myLabels <nl> + <nl> + <nl> + myFeatures = <nl> + ( <nl> + Input <nl> + ( ) <nl> + featDim <nl> + <nl> + <nl> + myLabels = <nl> + ( <nl> + Input <nl> + ( ) <nl> + labelDim <nl> + <nl> + <nl> + numHiddenLayers = <nl> + 3 <nl> + outLayer = <nl> + ( <nl> + BFF <nl> + ( ) <nl> + . Eh <nl> + ( <nl> + HiddenStack <nl> + ( ) <nl> + numHiddenLayers <nl> + <nl> + <nl> + <nl> + labelDim <nl> + hiddenDim <nl> + <nl> + <nl> + outZ = <nl> + . z <nl> + outLayer <nl> + <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 0c1a099df27 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput14 . txt <nl> <nl> + [ ] <nl> + do = <nl> + ( <nl> + Print <nl> + ( ) <nl> + ( <nl> + fac <nl> + ( ) <nl> + 5 <nl> + <nl> + <nl> + <nl> + <nl> + fac = <nl> + = > <nl> + ( ) <nl> + i <nl> + <nl> + if <nl> + > <nl> + i <nl> + 1 <nl> + <nl> + * <nl> + ( <nl> + fac <nl> + ( ) <nl> + - <nl> + i <nl> + 1 <nl> + <nl> + <nl> + <nl> + i <nl> + <nl> + 1 <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 982c96d100d <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput15 . txt <nl> <nl> + [ ] <nl> + do = <nl> + ( <nl> + Print <nl> + ( ) <nl> + ( <nl> + fibs <nl> + ( ) <nl> + 10 <nl> + <nl> + <nl> + <nl> + <nl> + fibs = <nl> + = > <nl> + ( ) <nl> + n <nl> + <nl> + [ <nl> + . vals <nl> + [ ] <nl> + vals = <nl> + array <nl> + 1 <nl> + n <nl> + = > <nl> + ( ) <nl> + i <nl> + <nl> + if <nl> + < <nl> + i <nl> + 3 <nl> + <nl> + - <nl> + i <nl> + 1 <nl> + <nl> + + <nl> + [ <nl> + vals <nl> + - <nl> + i <nl> + 1 <nl> + <nl> + <nl> + [ <nl> + vals <nl> + - <nl> + i <nl> + 2 <nl> + <nl> + <nl> + <nl> + <nl> + <nl> + <nl> + <nl> + <nl> + n <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 8047e4e0362 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput16 . txt <nl> <nl> + [ ] <nl> + do = <nl> + ( <nl> + Print <nl> + ( ) <nl> + val <nl> + <nl> + <nl> + val = <nl> + new NDLComputationNetwork <nl> + [ ] <nl> + CE = <nl> + ( <nl> + CrossEntropyWithSoftmax <nl> + ( ) <nl> + myLabels <nl> + outZ <nl> + <nl> + <nl> + Err = <nl> + ( <nl> + ErrorPrediction <nl> + ( ) <nl> + myLabels <nl> + outZ <nl> + <nl> + <nl> + ScaledLogLikelihood = <nl> + - <nl> + outZ <nl> + logPrior <nl> + <nl> + featDim = <nl> + * <nl> + 40 <nl> + 31 <nl> + <nl> + featNorm = <nl> + ( <nl> + MeanVarNorm <nl> + ( ) <nl> + myFeatures <nl> + <nl> + <nl> + hiddenDim = <nl> + 2048 <nl> + labelDim = <nl> + 9000 <nl> + layers = <nl> + array <nl> + 1 <nl> + numHiddenLayers <nl> + = > <nl> + ( ) <nl> + layer <nl> + <nl> + if <nl> + > <nl> + layer <nl> + 1 <nl> + <nl> + ( <nl> + SBFF <nl> + ( ) <nl> + . Eh <nl> + [ <nl> + layers <nl> + - <nl> + layer <nl> + 1 <nl> + <nl> + <nl> + <nl> + hiddenDim <nl> + hiddenDim <nl> + <nl> + <nl> + ( <nl> + SBFF <nl> + ( ) <nl> + featNorm <nl> + hiddenDim <nl> + featDim <nl> + <nl> + <nl> + <nl> + <nl> + <nl> + logPrior = <nl> + ( <nl> + LogPrior <nl> + ( ) <nl> + myLabels <nl> + <nl> + <nl> + myFeatures = <nl> + ( <nl> + Input <nl> + ( ) <nl> + featDim <nl> + <nl> + tag = <nl> + ' features ' <nl> + <nl> + <nl> + myLabels = <nl> + ( <nl> + Input <nl> + ( ) <nl> + labelDim <nl> + <nl> + tag = <nl> + ' labels ' <nl> + <nl> + <nl> + numHiddenLayers = <nl> + 3 <nl> + outLayer = <nl> + ( <nl> + BFF <nl> + ( ) <nl> + . Eh <nl> + [ <nl> + layers <nl> + numHiddenLayers <nl> + <nl> + <nl> + labelDim <nl> + hiddenDim <nl> + <nl> + <nl> + outZ = <nl> + + <nl> + . z <nl> + outLayer <nl> + <nl> + ( <nl> + Delay <nl> + ( ) <nl> + outZ <nl> + 1 <nl> + <nl> + <nl> + <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 8306a685e71 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput17 . txt <nl> <nl> + [ ] <nl> + do = <nl> + ( <nl> + Print <nl> + ( ) <nl> + val <nl> + <nl> + <nl> + val = <nl> + new NDLComputationNetwork <nl> + [ ] <nl> + CE = <nl> + ( <nl> + CrossEntropyWithSoftmax <nl> + ( ) <nl> + myLabels <nl> + outZ <nl> + <nl> + <nl> + Err = <nl> + ( <nl> + ErrorPrediction <nl> + ( ) <nl> + myLabels <nl> + outZ <nl> + <nl> + <nl> + ScaledLogLikelihood = <nl> + - <nl> + outZ <nl> + logPrior <nl> + <nl> + T = <nl> + 3 <nl> + featDim = <nl> + 40 <nl> + hiddenDim = <nl> + 512 <nl> + labelDim = <nl> + 9000 <nl> + layers = <nl> + array <nl> + 1 <nl> + numHiddenLayers <nl> + = > <nl> + ( ) <nl> + layer <nl> + <nl> + [ ] <nl> + H_bwd = <nl> + ( <nl> + Parameter <nl> + ( ) <nl> + hiddenDim <nl> + hiddenDim <nl> + <nl> + <nl> + H_fwd = <nl> + ( <nl> + Parameter <nl> + ( ) <nl> + hiddenDim <nl> + hiddenDim <nl> + <nl> + <nl> + W_bwd = <nl> + if <nl> + > <nl> + layer <nl> + 1 <nl> + <nl> + ( <nl> + Parameter <nl> + ( ) <nl> + hiddenDim <nl> + hiddenDim <nl> + <nl> + <nl> + ( <nl> + Fail <nl> + ( ) <nl> + ' no W_bwd ' <nl> + <nl> + <nl> + <nl> + W_fwd = <nl> + ( <nl> + Parameter <nl> + ( ) <nl> + hiddenDim <nl> + featDim <nl> + <nl> + <nl> + b = <nl> + ( <nl> + Parameter <nl> + ( ) <nl> + hiddenDim <nl> + 1 <nl> + <nl> + <nl> + h_bwd = <nl> + array <nl> + 0 <nl> + - <nl> + T <nl> + 1 <nl> + <nl> + = > <nl> + ( ) <nl> + t <nl> + <nl> + ( <nl> + step <nl> + ( ) <nl> + H_bwd <nl> + h_bwd <nl> + 1 <nl> + t <nl> + <nl> + <nl> + <nl> + <nl> + h_fwd = <nl> + array <nl> + 0 <nl> + - <nl> + T <nl> + 1 <nl> + <nl> + = > <nl> + ( ) <nl> + t <nl> + <nl> + ( <nl> + step <nl> + ( ) <nl> + H_fwd <nl> + h_fwd <nl> + - ( <nl> + 1 <nl> + <nl> + t <nl> + <nl> + <nl> + <nl> + <nl> + step = <nl> + = > <nl> + ( ) <nl> + H <nl> + h <nl> + dt <nl> + t <nl> + <nl> + ( <nl> + Sigmoid <nl> + ( ) <nl> + if <nl> + & & <nl> + > = <nl> + + <nl> + t <nl> + dt <nl> + <nl> + 0 <nl> + <nl> + < <nl> + + <nl> + t <nl> + dt <nl> + <nl> + T <nl> + <nl> + <nl> + + <nl> + [ <nl> + z_shared <nl> + t <nl> + <nl> + * <nl> + H <nl> + [ <nl> + h <nl> + + <nl> + t <nl> + dt <nl> + <nl> + <nl> + <nl> + <nl> + [ <nl> + z_shared <nl> + t <nl> + <nl> + <nl> + <nl> + <nl> + <nl> + z_shared = <nl> + array <nl> + 0 <nl> + - <nl> + T <nl> + 1 <nl> + <nl> + = > <nl> + ( ) <nl> + t <nl> + <nl> + + <nl> + if <nl> + > <nl> + layer <nl> + 1 <nl> + <nl> + + <nl> + * <nl> + W_fwd <nl> + [ <nl> + . h_fwd <nl> + [ <nl> + layers <nl> + - <nl> + layer <nl> + 1 <nl> + <nl> + <nl> + <nl> + t <nl> + <nl> + <nl> + * <nl> + W_bwd <nl> + [ <nl> + . h_bwd <nl> + [ <nl> + layers <nl> + - <nl> + layer <nl> + 1 <nl> + <nl> + <nl> + <nl> + t <nl> + <nl> + <nl> + <nl> + * <nl> + W_fwd <nl> + [ <nl> + subframes <nl> + t <nl> + <nl> + <nl> + <nl> + b <nl> + <nl> + <nl> + <nl> + <nl> + <nl> + <nl> + logPrior = <nl> + ( <nl> + LogPrior <nl> + ( ) <nl> + myLabels <nl> + <nl> + <nl> + myFeatures = <nl> + ( <nl> + Input <nl> + ( ) <nl> + featDim <nl> + <nl> + <nl> + myLabels = <nl> + ( <nl> + Input <nl> + ( ) <nl> + labelDim <nl> + <nl> + <nl> + numHiddenLayers = <nl> + 2 <nl> + outLayer = <nl> + [ ] <nl> + W_bwd = <nl> + ( <nl> + Parameter <nl> + ( ) <nl> + labelDim <nl> + hiddenDim <nl> + <nl> + <nl> + W_fwd = <nl> + ( <nl> + Parameter <nl> + ( ) <nl> + labelDim <nl> + hiddenDim <nl> + <nl> + <nl> + b = <nl> + ( <nl> + Parameter <nl> + ( ) <nl> + labelDim <nl> + 1 <nl> + <nl> + <nl> + centerT = <nl> + ( <nl> + Floor <nl> + ( ) <nl> + / <nl> + T <nl> + 2 <nl> + <nl> + <nl> + <nl> + topHiddenLayer = <nl> + [ <nl> + layers <nl> + numHiddenLayers <nl> + <nl> + z = <nl> + + <nl> + + <nl> + * <nl> + W_fwd <nl> + [ <nl> + . h_fwd <nl> + topHiddenLayer <nl> + <nl> + centerT <nl> + <nl> + <nl> + * <nl> + W_bwd <nl> + [ <nl> + . h_bwd <nl> + topHiddenLayer <nl> + <nl> + centerT <nl> + <nl> + <nl> + <nl> + b <nl> + <nl> + <nl> + outZ = <nl> + . z <nl> + outLayer <nl> + <nl> + subframes = <nl> + array <nl> + 0 <nl> + - <nl> + T <nl> + 1 <nl> + <nl> + = > <nl> + ( ) <nl> + t <nl> + <nl> + ( <nl> + RowSlice <nl> + ( ) <nl> + * <nl> + t <nl> + featDim <nl> + <nl> + featDim <nl> + myFeatures <nl> + <nl> + <nl> + <nl> + <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 1a7454307a1 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput18 . txt <nl> <nl> + [ ] <nl> + dict = <nl> + [ ] <nl> + outY = <nl> + ( <nl> + Input <nl> + ( ) <nl> + 13 <nl> + <nl> + <nl> + <nl> + do = <nl> + ( <nl> + Print <nl> + ( ) <nl> + val <nl> + <nl> + <nl> + val = <nl> + new NDLComputationNetwork <nl> + [ ] <nl> + outZ = <nl> + . outY <nl> + dict <nl> + <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . f1b272900c4 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput19 . txt <nl> <nl> + [ ] <nl> + do = <nl> + ( <nl> + f <nl> + ( ) <nl> + 42 <nl> + <nl> + option = <nl> + ' value ' <nl> + <nl> + <nl> + f = <nl> + = > <nl> + ( ) <nl> + x <nl> + <nl> + option = <nl> + ' default ' <nl> + <nl> + ( <nl> + Print <nl> + ( ) <nl> + option <nl> + <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . c8b00d2d821 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput2 . txt <nl> <nl> + [ ] <nl> + do = <nl> + ( <nl> + Print <nl> + ( ) <nl> + array <nl> + 1 <nl> + 10 <nl> + = > <nl> + ( ) <nl> + i <nl> + <nl> + * <nl> + i <nl> + i <nl> + <nl> + <nl> + <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 8b66e130b91 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput3 . txt <nl> <nl> + [ ] <nl> + do = <nl> + new PrintAction <nl> + [ ] <nl> + what = <nl> + ' abc ' <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 269ae998d25 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput4 . txt <nl> <nl> + [ ] <nl> + do = <nl> + ( <nl> + Print <nl> + ( ) <nl> + new StringFunction <nl> + [ ] <nl> + arg = <nl> + * <nl> + x <nl> + y <nl> + <nl> + how = <nl> + ' . 2 ' <nl> + what = <nl> + ' Format ' <nl> + x = <nl> + 13 <nl> + y = <nl> + 42 <nl> + <nl> + <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . ff8c657d629 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput5 . txt <nl> <nl> + [ ] <nl> + do = <nl> + ( <nl> + Print <nl> + ( ) <nl> + ' new StringFunction [ what = ' Format ' ; how = ' . 2 ' ; arg = ' 13 > 42 ' ] ' <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 626b2a1c333 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput6 . txt <nl> <nl> + [ ] <nl> + do = <nl> + new PrintAction <nl> + [ ] <nl> + what = <nl> + if <nl> + | | <nl> + > <nl> + 13 <nl> + 42 <nl> + <nl> + > <nl> + 12 <nl> + 1 <nl> + <nl> + <nl> + + <nl> + ' Hello World ' <nl> + ' ! ' <nl> + <nl> + ' Oops ? ' <nl> + <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 26b89db47d1 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput7 . txt <nl> <nl> + [ ] <nl> + delta = <nl> + 42 <nl> + do = <nl> + ( <nl> + Print <nl> + ( ) <nl> + + <nl> + ' result = ' <nl> + ( <nl> + i2s <nl> + ( ) <nl> + + <nl> + ( <nl> + . v <nl> + [ ] <nl> + v = <nl> + = > <nl> + ( ) <nl> + i <nl> + <nl> + + <nl> + i <nl> + delta <nl> + <nl> + <nl> + <nl> + <nl> + ( ) <nl> + 5 <nl> + <nl> + <nl> + 13 <nl> + <nl> + <nl> + <nl> + <nl> + <nl> + <nl> + i2s = <nl> + = > <nl> + ( ) <nl> + i <nl> + <nl> + new StringFunction <nl> + [ ] <nl> + arg = <nl> + i <nl> + how = <nl> + ' . 2 ' <nl> + what = <nl> + ' Format ' <nl> + <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 4a1731ce9f2 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput8 . txt <nl> <nl> + [ ] <nl> + do = <nl> + : <nl> + ( <nl> + Print <nl> + ( ) <nl> + + <nl> + 1 <nl> + * <nl> + 2 <nl> + 3 <nl> + <nl> + <nl> + <nl> + <nl> + ( <nl> + Print <nl> + ( ) <nl> + + <nl> + ' hello ' <nl> + ' world ' <nl> + <nl> + <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 290c50674a0 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / ExpectedOutput9 . txt <nl> <nl> + [ ] <nl> + do = <nl> + ( <nl> + Print <nl> + ( ) <nl> + ( <nl> + Format <nl> + ( ) <nl> + : <nl> + 13 <nl> + : <nl> + fortytwo <nl> + 1 <nl> + <nl> + 100 <nl> + <nl> + ' ' <nl> + <nl> + <nl> + <nl> + <nl> + fortytwo = <nl> + 42 <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 332aee3096e <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input1 . txt <nl> @ @ - 0 , 0 + 1 @ @ <nl> + do = Parameter ( 13 , 42 ) * Input ( 42 ) + Parameter ( 13 , 1 ) <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . d1ac842b3ac <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input10 . txt <nl> @ @ - 0 , 0 + 1 @ @ <nl> + do = Print ( val ) ; val = if ! false then 42 else - + - + + - 13 : [ a = ' a ' ; b = 42 ] : + 14 ; arr = array [ 1 . . 10 ] ( i = > 2 * i ) <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . ad65be96b87 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input11 . txt <nl> @ @ - 0 , 0 + 1 @ @ <nl> + do = Print ( arg ) ; N = 5 ; arr = array [ 1 . . N ] ( i = > if i < N then arr [ i + 1 ] * i else N ) ; arg = arr <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . fcd5a9d8a97 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input12 . txt <nl> @ @ - 0 , 0 + 1 @ @ <nl> + do = Print ( val ) ; val = [ v = ( i = > i + offset ) ] . v ( 42 ) ; offset = 13 <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . 544e2665a96 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input13 . txt <nl> <nl> + do = Print ( val ) <nl> + val = new NDLComputationNetwork [ <nl> + featDim = 40 * 31 ; labelDim = 9000 ; hiddenDim = 2048 ; numHiddenLayers = 3 <nl> + myFeatures = Input ( featDim ) ; myLabels = Input ( labelDim ) <nl> + featNorm = MeanVarNorm ( myFeatures ) <nl> + HiddenStack ( layer ) = if layer > 1 then SBFF ( HiddenStack ( layer - 1 ) . Eh , hiddenDim , hiddenDim ) else SBFF ( featNorm , hiddenDim , featDim ) <nl> + outLayer = BFF ( HiddenStack ( numHiddenLayers ) . Eh , labelDim , hiddenDim ) <nl> + outZ = outLayer . z <nl> + CE = CrossEntropyWithSoftmax ( myLabels , outZ ) <nl> + Err = ErrorPrediction ( myLabels , outZ ) <nl> + logPrior = LogPrior ( myLabels ) <nl> + ScaledLogLikelihood = outZ - logPrior <nl> + ] <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . c8e220ce468 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input14 . txt <nl> @ @ - 0 , 0 + 1 @ @ <nl> + do = Print ( fac ( 5 ) ) ; fac ( i ) = if i > 1 then fac ( i - 1 ) * i else 1 <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . 6feeb8a7fb5 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input15 . txt <nl> @ @ - 0 , 0 + 1 @ @ <nl> + do = Print ( fibs ( 10 ) ) ; fibs ( n ) = [ vals = array [ 1 . . n ] ( i = > if i < 3 then i - 1 else vals [ i - 1 ] + vals [ i - 2 ] ) ] . vals [ n ] <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . 769c0ec08ff <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input16 . txt <nl> <nl> + do = Print ( val ) <nl> + val = new NDLComputationNetwork [ <nl> + featDim = 40 * 31 ; labelDim = 9000 ; hiddenDim = 2048 ; numHiddenLayers = 3 <nl> + myFeatures = Input ( featDim , tag = ' features ' ) ; myLabels = Input ( labelDim , tag = ' labels ' ) <nl> + featNorm = MeanVarNorm ( myFeatures ) <nl> + layers [ layer : 1 . . numHiddenLayers ] = if layer > 1 then SBFF ( layers [ layer - 1 ] . Eh , hiddenDim , hiddenDim ) else SBFF ( featNorm , hiddenDim , featDim ) <nl> + outLayer = BFF ( layers [ numHiddenLayers ] . Eh , labelDim , hiddenDim ) <nl> + outZ = outLayer . z + Delay ( outZ , 1 ) <nl> + CE = CrossEntropyWithSoftmax ( myLabels , outZ ) <nl> + Err = ErrorPrediction ( myLabels , outZ ) <nl> + logPrior = LogPrior ( myLabels ) <nl> + ScaledLogLikelihood = outZ - logPrior <nl> + ] <nl> new file mode 100644 <nl> index 00000000000 . . 248a435f45d <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input17 . txt <nl> <nl> + do = Print ( val ) <nl> + val = new NDLComputationNetwork [ <nl> + hiddenDim = 512 <nl> + numHiddenLayers = 2 <nl> + T = 3 / / total context window <nl> + <nl> + / / data sources <nl> + featDim = 40 ; labelDim = 9000 <nl> + myFeatures = Input ( featDim ) ; myLabels = Input ( labelDim ) <nl> + <nl> + / / split the augmented input vector into individual frame vectors <nl> + subframes [ t : 0 . . T - 1 ] = RowSlice ( t * featDim , featDim , myFeatures ) <nl> + <nl> + / / hidden layers <nl> + layers [ layer : 1 . . numHiddenLayers ] = [ / / each layer stores a dict that stores its hidden fwd and bwd state vectors <nl> + / / model parameters <nl> + W_fwd = Parameter ( hiddenDim , featDim ) / / Parameter ( outdim , indim ) <nl> + W_bwd = if layer > 1 then Parameter ( hiddenDim , hiddenDim ) else Fail ( ' no W_bwd ' ) / / input - to - hidden <nl> + H_fwd = Parameter ( hiddenDim , hiddenDim ) / / hidden - to - hidden <nl> + H_bwd = Parameter ( hiddenDim , hiddenDim ) <nl> + b = Parameter ( hiddenDim , 1 ) / / bias <nl> + / / shared part of activations ( input connections and bias ) <nl> + z_shared [ t : 0 . . T - 1 ] = ( if layer > 1 <nl> + then W_fwd * layers [ layer - 1 ] . h_fwd [ t ] + W_bwd * layers [ layer - 1 ] . h_bwd [ t ] <nl> + else W_fwd * subframes [ t ] <nl> + ) + b <nl> + / / recurrent part and non - linearity <nl> + step ( H , h , dt , t ) = Sigmoid ( if ( t + dt > = 0 & & t + dt < T ) <nl> + then z_shared [ t ] + H * h [ t + dt ] <nl> + else z_shared [ t ] ) <nl> + h_fwd [ t : 0 . . T - 1 ] = step ( H_fwd , h_fwd , - 1 , t ) <nl> + h_bwd [ t : 0 . . T - 1 ] = step ( H_bwd , h_bwd , 1 , t ) <nl> + ] <nl> + / / output layer - - linear only at this point ; Softmax is applied later <nl> + outLayer = [ <nl> + / / model parameters <nl> + W_fwd = Parameter ( labelDim , hiddenDim ) <nl> + W_bwd = Parameter ( labelDim , hiddenDim ) <nl> + b = Parameter ( labelDim , 1 ) <nl> + / / output <nl> + topHiddenLayer = layers [ numHiddenLayers ] <nl> + centerT = Floor ( T / 2 ) <nl> + z = W_fwd * topHiddenLayer . h_fwd [ centerT ] + W_bwd * topHiddenLayer . h_bwd [ centerT ] + b <nl> + ] <nl> + outZ = outLayer . z / / we only want this one & don ' t care about the rest of this dictionary <nl> + <nl> + / / define criterion nodes <nl> + CE = CrossEntropyWithSoftmax ( myLabels , outZ ) <nl> + Err = ErrorPrediction ( myLabels , outZ ) <nl> + <nl> + / / define output node for decoding <nl> + logPrior = LogPrior ( myLabels ) <nl> + ScaledLogLikelihood = outZ - logPrior / / before : Minus ( CE . BFF . FF . P , logPrior , tag = Output ) <nl> + ] <nl> new file mode 100644 <nl> index 00000000000 . . 0988f0d498d <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input18 . txt <nl> <nl> + do = Print ( val ) <nl> + dict = [ outY = Input ( 13 ) ] ; val = new NDLComputationNetwork [ outZ = dict . outY <nl> + ] <nl> new file mode 100644 <nl> index 00000000000 . . 928967413bf <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input19 . txt <nl> @ @ - 0 , 0 + 1 @ @ <nl> + f ( x , option = ' default ' ) = Print ( option ) ; do = f ( 42 , option = ' value ' ) <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . 489050da28b <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input2 . txt <nl> @ @ - 0 , 0 + 1 @ @ <nl> + do = Print ( array [ 1 . . 10 ] ( i = > i * i ) ) <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . 0f4ead75cc5 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input3 . txt <nl> @ @ - 0 , 0 + 1 @ @ <nl> + do = new PrintAction [ what = ' abc ' ] <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . 7f07863eb6b <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input4 . txt <nl> @ @ - 0 , 0 + 1 @ @ <nl> + do = Print ( new StringFunction [ x = 13 ; y = 42 ; what = ' Format ' ; how = ' . 2 ' ; arg = x * y ] ) <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . d64dc6fc636 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input5 . txt <nl> @ @ - 0 , 0 + 1 @ @ <nl> + do = Print ( " new StringFunction [ what = ' Format ' ; how = ' . 2 ' ; arg = ' 13 > 42 ' ] " ) <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . 4250cc8eeac <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input6 . txt <nl> @ @ - 0 , 0 + 1 @ @ <nl> + do = new PrintAction [ what = if 13 > 42 | | 12 > 1 then ' Hello World ' + " ! " else ' Oops ? ' ] <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . 6b63fb240f6 <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input7 . txt <nl> @ @ - 0 , 0 + 1 @ @ <nl> + i2s ( i ) = new StringFunction [ what = ' Format ' ; arg = i ; how = ' . 2 ' ] ; do = Print ( ' result = ' + i2s ( ( ( [ v = ( i = > i + delta ) ] . v ( 5 ) ) ) + 13 ) ) ; delta = 42 <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . 856303902ee <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input8 . txt <nl> @ @ - 0 , 0 + 1 @ @ <nl> + do = Print ( 1 + 2 * 3 ) : Print ( ' hello ' + ' world ' ) <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . b5e4b63a9ad <nl> mmm / dev / null <nl> ppp b / Tests / UnitTests / BrainScriptTests / Data / Parser / Input9 . txt <nl> @ @ - 0 , 0 + 1 @ @ <nl> + do = Print ( Format ( ( 13 : ( fortytwo : 1 ) : 100 ) , ' ' ) ) ; fortytwo = 42 <nl> \ No newline at end of file <nl> mmm a / Tests / UnitTests / BrainScriptTests / ParserTests . cpp <nl> ppp b / Tests / UnitTests / BrainScriptTests / ParserTests . cpp <nl> <nl> # include " stdafx . h " <nl> # include " Basics . h " <nl> # include " BrainScriptParser . h " <nl> - # include " ParserTestsData . h " <nl> + # include " boost / filesystem . hpp " <nl> <nl> # include < utility > <nl> <nl> using namespace Microsoft : : MSR : : CNTK ; <nl> # define let const auto <nl> # endif <nl> <nl> + struct ParserTestsFixture <nl> + { <nl> + public : <nl> + ParserTestsFixture ( ) { <nl> + boost : : filesystem : : path path ( boost : : unit_test : : framework : : master_test_suite ( ) . argv [ 0 ] ) ; <nl> + wstring parentPath = boost : : filesystem : : canonical ( path . parent_path ( ) ) . generic_wstring ( ) ; <nl> + <nl> + m_testDataPath = parentPath + L " / . . / . . / . . / Tests / UnitTests / BrainScriptTests " ; <nl> + boost : : filesystem : : path absTestPath ( m_testDataPath ) ; <nl> + absTestPath = boost : : filesystem : : canonical ( absTestPath ) ; <nl> + m_testDataPath = absTestPath . generic_wstring ( ) ; <nl> + } <nl> + <nl> + const wstring getDataPath ( ) { <nl> + return m_testDataPath ; <nl> + } <nl> + private : <nl> + wstring m_testDataPath ; <nl> + } ; <nl> + <nl> + <nl> namespace Microsoft { namespace MSR { namespace CNTK { namespace Test { <nl> <nl> <nl> - BOOST_AUTO_TEST_SUITE ( ParserTests ) <nl> + BOOST_FIXTURE_TEST_SUITE ( ParserTests , ParserTestsFixture ) <nl> <nl> - void parseLine ( const std : : pair < wstring , wstring > & testLine ) <nl> + void parseLine ( const wstring & input , const wstring & expectedOutput ) <nl> { <nl> - let expr = BS : : ParseConfigDictFromString ( testLine . first , L " Test " , vector < wstring > ( ) ) ; <nl> + let expr = BS : : ParseConfigDictFromString ( input , L " Test " , vector < wstring > ( ) ) ; <nl> <nl> wstringstream actualStream ; <nl> expr - > DumpToStream ( actualStream ) ; <nl> <nl> - BOOST_TEST ( actualStream . str ( ) = = testLine . second , boost : : test_tools : : per_element ( ) ) ; <nl> - <nl> + BOOST_TEST ( actualStream . str ( ) = = expectedOutput , boost : : test_tools : : per_element ( ) ) ; <nl> } <nl> <nl> BOOST_AUTO_TEST_CASE ( ParseExpressionsAndCompareTree ) <nl> { <nl> - int testCount = 0 ; <nl> - for ( auto & testPair : parserTestVector ) <nl> + wstring inputPrefix ( L " Input " ) ; <nl> + wstring outputPrefix ( L " ExpectedOutput " ) ; <nl> + <nl> + wstring dataPath = getDataPath ( ) + L " / Data / Parser / " ; <nl> + <nl> + bool filesAvailable = true ; <nl> + int testCount = 1 ; <nl> + while ( filesAvailable ) <nl> { <nl> - fprintf ( stderr , " Test % d : \ n " , testCount ) ; <nl> - parseLine ( testPair ) ; <nl> + wifstream inputFile ( dataPath + inputPrefix + to_wstring ( testCount ) + L " . txt " ) ; <nl> + wifstream outputFile ( dataPath + outputPrefix + to_wstring ( testCount ) + L " . txt " ) ; <nl> + <nl> + if ( ! inputFile . is_open ( ) ) { <nl> + filesAvailable = false ; <nl> + continue ; <nl> + } <nl> + <nl> + fprintf ( stderr , " Test % d . . . \ n " , testCount ) ; <nl> + <nl> + auto inputStream = std : : wostringstream { } ; <nl> + inputStream < < inputFile . rdbuf ( ) ; <nl> + <nl> + auto expectedStream = std : : wostringstream { } ; <nl> + expectedStream < < outputFile . rdbuf ( ) ; <nl> + <nl> + parseLine ( inputStream . str ( ) . c_str ( ) , expectedStream . str ( ) . c_str ( ) ) ; <nl> testCount + + ; <nl> } <nl> } <nl> deleted file mode 100644 <nl> index 0cdc967ff81 . . 00000000000 <nl> mmm a / Tests / UnitTests / BrainScriptTests / ParserTestsData . h <nl> ppp / dev / null <nl> <nl> - / / <nl> - / / Copyright ( c ) Microsoft . All rights reserved . <nl> - / / Licensed under the MIT license . See LICENSE . md file in the project root for full license information . <nl> - / / <nl> - <nl> - # pragma once <nl> - <nl> - # include < iostream > <nl> - # include < vector > <nl> - # include < utility > <nl> - <nl> - / / first string in the pair corresponds to BrainScript line to be parsed , second string is the expected tree string after parsed <nl> - extern const std : : vector < std : : pair < std : : wstring , std : : wstring > > parserTestVector { <nl> - std : : make_pair ( / / # 0 <nl> - L " do = Parameter ( 13 , 42 ) * Input ( 42 ) + Parameter ( 13 , 1 ) " , <nl> - L " [ ] \ n " <nl> - L " do = \ n " <nl> - L " + \ n " <nl> - L " * \ n " <nl> - L " ( \ n " <nl> - L " Parameter \ n " <nl> - L " ( ) \ n " <nl> - L " 13 \ n " <nl> - L " 42 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " ( \ n " <nl> - L " Input \ n " <nl> - L " ( ) \ n " <nl> - L " 42 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " ( \ n " <nl> - L " Parameter \ n " <nl> - L " ( ) \ n " <nl> - L " 13 \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " " ) , <nl> - std : : make_pair ( / / # 1 <nl> - L " do = Print ( array [ 1 . . 10 ] ( i = > i * i ) ) " , <nl> - L " [ ] \ n " <nl> - L " do = \ n " <nl> - L " ( \ n " <nl> - L " Print \ n " <nl> - L " ( ) \ n " <nl> - L " array \ n " <nl> - L " 1 \ n " <nl> - L " 10 \ n " <nl> - L " = > \ n " <nl> - L " ( ) \ n " <nl> - L " i \ n " <nl> - L " \ n " <nl> - L " * \ n " <nl> - L " i \ n " <nl> - L " i \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " " ) , <nl> - std : : make_pair ( / / # 2 <nl> - L " do = new PrintAction [ what = ' abc ' ] " , <nl> - L " [ ] \ n " <nl> - L " do = \ n " <nl> - L " new PrintAction \ n " <nl> - L " [ ] \ n " <nl> - L " what = \ n " <nl> - L " ' abc ' \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " " ) , <nl> - std : : make_pair ( / / # 3 <nl> - L " do = Print ( new StringFunction [ x = 13 ; y = 42 ; what = ' Format ' ; how = ' . 2 ' ; arg = x * y ] ) " , <nl> - L " [ ] \ n " <nl> - L " do = \ n " <nl> - L " ( \ n " <nl> - L " Print \ n " <nl> - L " ( ) \ n " <nl> - L " new StringFunction \ n " <nl> - L " [ ] \ n " <nl> - L " arg = \ n " <nl> - L " * \ n " <nl> - L " x \ n " <nl> - L " y \ n " <nl> - L " \ n " <nl> - L " how = \ n " <nl> - L " ' . 2 ' \ n " <nl> - L " what = \ n " <nl> - L " ' Format ' \ n " <nl> - L " x = \ n " <nl> - L " 13 \ n " <nl> - L " y = \ n " <nl> - L " 42 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " " ) , <nl> - std : : make_pair ( / / # 4 <nl> - L " do = Print ( \ " new StringFunction [ what = ' Format ' ; how = ' . 2 ' ; arg = ' 13 > 42 ' ] \ " ) " , <nl> - L " [ ] \ n " <nl> - L " do = \ n " <nl> - L " ( \ n " <nl> - L " Print \ n " <nl> - L " ( ) \ n " <nl> - L " ' new StringFunction [ what = ' Format ' ; how = ' . 2 ' ; arg = ' 13 > 42 ' ] ' \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " " ) , <nl> - std : : make_pair ( / / # 5 <nl> - L " do = new PrintAction [ what = if 13 > 42 | | 12 > 1 then ' Hello World ' + \ " ! \ " else ' Oops ? ' ] " , <nl> - L " [ ] \ n " <nl> - L " do = \ n " <nl> - L " new PrintAction \ n " <nl> - L " [ ] \ n " <nl> - L " what = \ n " <nl> - L " if \ n " <nl> - L " | | \ n " <nl> - L " > \ n " <nl> - L " 13 \ n " <nl> - L " 42 \ n " <nl> - L " \ n " <nl> - L " > \ n " <nl> - L " 12 \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " + \ n " <nl> - L " ' Hello World ' \ n " <nl> - L " ' ! ' \ n " <nl> - L " \ n " <nl> - L " ' Oops ? ' \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " " ) , <nl> - std : : make_pair ( / / # 6 <nl> - L " i2s ( i ) = new StringFunction [ what = ' Format ' ; arg = i ; how = ' . 2 ' ] ; do = Print ( ' result = ' + i2s ( ( ( [ v = ( i = > i + delta " L " ) ] . v ( 5 ) ) ) + 13 ) ) ; delta = 42 " , <nl> - L " [ ] \ n " <nl> - L " delta = \ n " <nl> - L " 42 \ n " <nl> - L " do = \ n " <nl> - L " ( \ n " <nl> - L " Print \ n " <nl> - L " ( ) \ n " <nl> - L " + \ n " <nl> - L " ' result = ' \ n " <nl> - L " ( \ n " <nl> - L " i2s \ n " <nl> - L " ( ) \ n " <nl> - L " + \ n " <nl> - L " ( \ n " <nl> - L " . v \ n " <nl> - L " [ ] \ n " <nl> - L " v = \ n " <nl> - L " = > \ n " <nl> - L " ( ) \ n " <nl> - L " i \ n " <nl> - L " \ n " <nl> - L " + \ n " <nl> - L " i \ n " <nl> - L " delta \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " ( ) \ n " <nl> - L " 5 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " 13 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " i2s = \ n " <nl> - L " = > \ n " <nl> - L " ( ) \ n " <nl> - L " i \ n " <nl> - L " \ n " <nl> - L " new StringFunction \ n " <nl> - L " [ ] \ n " <nl> - L " arg = \ n " <nl> - L " i \ n " <nl> - L " how = \ n " <nl> - L " ' . 2 ' \ n " <nl> - L " what = \ n " <nl> - L " ' Format ' \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " " ) , <nl> - std : : make_pair ( / / # 7 <nl> - L " do = Print ( 1 + 2 * 3 ) : Print ( ' hello ' + ' world ' ) " , <nl> - L " [ ] \ n " <nl> - L " do = \ n " <nl> - L " : \ n " <nl> - L " ( \ n " <nl> - L " Print \ n " <nl> - L " ( ) \ n " <nl> - L " + \ n " <nl> - L " 1 \ n " <nl> - L " * \ n " <nl> - L " 2 \ n " <nl> - L " 3 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " ( \ n " <nl> - L " Print \ n " <nl> - L " ( ) \ n " <nl> - L " + \ n " <nl> - L " ' hello ' \ n " <nl> - L " ' world ' \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " " ) , <nl> - std : : make_pair ( / / # 8 <nl> - L " do = Print ( Format ( ( 13 : ( fortytwo : 1 ) : 100 ) , ' ' ) ) ; fortytwo = 42 " , <nl> - L " [ ] \ n " <nl> - L " do = \ n " <nl> - L " ( \ n " <nl> - L " Print \ n " <nl> - L " ( ) \ n " <nl> - L " ( \ n " <nl> - L " Format \ n " <nl> - L " ( ) \ n " <nl> - L " : \ n " <nl> - L " 13 \ n " <nl> - L " : \ n " <nl> - L " fortytwo \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " 100 \ n " <nl> - L " \ n " <nl> - L " ' ' \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " fortytwo = \ n " <nl> - L " 42 \ n " <nl> - L " \ n " <nl> - L " " ) , <nl> - std : : make_pair ( / / # 9 <nl> - L " do = Print ( val ) ; val = if ! false then 42 else - + - + + - 13 : [ a = ' a ' ; b = 42 ] : + 14 ; arr = array [ 1 . . 10 ] ( i = > 2 * i ) " , <nl> - L " [ ] \ n " <nl> - L " arr = \ n " <nl> - L " array \ n " <nl> - L " 1 \ n " <nl> - L " 10 \ n " <nl> - L " = > \ n " <nl> - L " ( ) \ n " <nl> - L " i \ n " <nl> - L " \ n " <nl> - L " * \ n " <nl> - L " 2 \ n " <nl> - L " i \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " do = \ n " <nl> - L " ( \ n " <nl> - L " Print \ n " <nl> - L " ( ) \ n " <nl> - L " val \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " val = \ n " <nl> - L " if \ n " <nl> - L " ! ( \ n " <nl> - L " 0 \ n " <nl> - L " \ n " <nl> - L " 42 \ n " <nl> - L " : \ n " <nl> - L " - ( \ n " <nl> - L " + ( \ n " <nl> - L " - ( \ n " <nl> - L " + ( \ n " <nl> - L " + ( \ n " <nl> - L " - ( \ n " <nl> - L " 13 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " [ ] \ n " <nl> - L " a = \ n " <nl> - L " ' a ' \ n " <nl> - L " b = \ n " <nl> - L " 42 \ n " <nl> - L " \ n " <nl> - L " + ( \ n " <nl> - L " 14 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " " ) , <nl> - std : : make_pair ( / / # 10 <nl> - L " do = Print ( arg ) ; N = 5 ; arr = array [ 1 . . N ] ( i = > if i < N then arr [ i + 1 ] * i else N ) ; arg = arr " , <nl> - L " [ ] \ n " <nl> - L " N = \ n " <nl> - L " 5 \ n " <nl> - L " arg = \ n " <nl> - L " arr \ n " <nl> - L " arr = \ n " <nl> - L " array \ n " <nl> - L " 1 \ n " <nl> - L " N \ n " <nl> - L " = > \ n " <nl> - L " ( ) \ n " <nl> - L " i \ n " <nl> - L " \ n " <nl> - L " if \ n " <nl> - L " < \ n " <nl> - L " i \ n " <nl> - L " N \ n " <nl> - L " \ n " <nl> - L " * \ n " <nl> - L " [ \ n " <nl> - L " arr \ n " <nl> - L " + \ n " <nl> - L " i \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " i \ n " <nl> - L " \ n " <nl> - L " N \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " do = \ n " <nl> - L " ( \ n " <nl> - L " Print \ n " <nl> - L " ( ) \ n " <nl> - L " arg \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " " ) , <nl> - std : : make_pair ( / / # 11 <nl> - L " do = Print ( val ) ; val = [ v = ( i = > i + offset ) ] . v ( 42 ) ; offset = 13 " , <nl> - L " [ ] \ n " <nl> - L " do = \ n " <nl> - L " ( \ n " <nl> - L " Print \ n " <nl> - L " ( ) \ n " <nl> - L " val \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " offset = \ n " <nl> - L " 13 \ n " <nl> - L " val = \ n " <nl> - L " ( \ n " <nl> - L " . v \ n " <nl> - L " [ ] \ n " <nl> - L " v = \ n " <nl> - L " = > \ n " <nl> - L " ( ) \ n " <nl> - L " i \ n " <nl> - L " \ n " <nl> - L " + \ n " <nl> - L " i \ n " <nl> - L " offset \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " ( ) \ n " <nl> - L " 42 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " " ) , <nl> - std : : make_pair ( / / # 12 : DNN with recursion <nl> - L " do = Print ( val ) \ n " <nl> - L " val = new NDLComputationNetwork [ \ n " <nl> - L " featDim = 40 * 31 ; labelDim = 9000 ; hiddenDim = 2048 ; numHiddenLayers = 3 \ n " <nl> - L " myFeatures = Input ( featDim ) ; myLabels = Input ( labelDim ) \ n " <nl> - L " featNorm = MeanVarNorm ( myFeatures ) \ n " <nl> - L " HiddenStack ( layer ) = if layer > 1 then SBFF ( HiddenStack ( layer - 1 ) . Eh , hiddenDim , hiddenDim ) else SBFF ( featNorm , hiddenDim , featDim ) \ n " <nl> - L " outLayer = BFF ( HiddenStack ( numHiddenLayers ) . Eh , labelDim , hiddenDim ) \ n " <nl> - L " outZ = outLayer . z \ n " <nl> - L " CE = CrossEntropyWithSoftmax ( myLabels , outZ ) \ n " <nl> - L " Err = ErrorPrediction ( myLabels , outZ ) \ n " <nl> - L " logPrior = LogPrior ( myLabels ) \ n " <nl> - L " ScaledLogLikelihood = outZ - logPrior \ n " <nl> - L " ] \ n " <nl> - L " " , <nl> - L " [ ] \ n " <nl> - L " do = \ n " <nl> - L " ( \ n " <nl> - L " Print \ n " <nl> - L " ( ) \ n " <nl> - L " val \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " val = \ n " <nl> - L " new NDLComputationNetwork \ n " <nl> - L " [ ] \ n " <nl> - L " CE = \ n " <nl> - L " ( \ n " <nl> - L " CrossEntropyWithSoftmax \ n " <nl> - L " ( ) \ n " <nl> - L " myLabels \ n " <nl> - L " outZ \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " Err = \ n " <nl> - L " ( \ n " <nl> - L " ErrorPrediction \ n " <nl> - L " ( ) \ n " <nl> - L " myLabels \ n " <nl> - L " outZ \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " HiddenStack = \ n " <nl> - L " = > \ n " <nl> - L " ( ) \ n " <nl> - L " layer \ n " <nl> - L " \ n " <nl> - L " if \ n " <nl> - L " > \ n " <nl> - L " layer \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " ( \ n " <nl> - L " SBFF \ n " <nl> - L " ( ) \ n " <nl> - L " . Eh \ n " <nl> - L " ( \ n " <nl> - L " HiddenStack \ n " <nl> - L " ( ) \ n " <nl> - L " - \ n " <nl> - L " layer \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " hiddenDim \ n " <nl> - L " hiddenDim \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " ( \ n " <nl> - L " SBFF \ n " <nl> - L " ( ) \ n " <nl> - L " featNorm \ n " <nl> - L " hiddenDim \ n " <nl> - L " featDim \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " ScaledLogLikelihood = \ n " <nl> - L " - \ n " <nl> - L " outZ \ n " <nl> - L " logPrior \ n " <nl> - L " \ n " <nl> - L " featDim = \ n " <nl> - L " * \ n " <nl> - L " 40 \ n " <nl> - L " 31 \ n " <nl> - L " \ n " <nl> - L " featNorm = \ n " <nl> - L " ( \ n " <nl> - L " MeanVarNorm \ n " <nl> - L " ( ) \ n " <nl> - L " myFeatures \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " hiddenDim = \ n " <nl> - L " 2048 \ n " <nl> - L " labelDim = \ n " <nl> - L " 9000 \ n " <nl> - L " logPrior = \ n " <nl> - L " ( \ n " <nl> - L " LogPrior \ n " <nl> - L " ( ) \ n " <nl> - L " myLabels \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " myFeatures = \ n " <nl> - L " ( \ n " <nl> - L " Input \ n " <nl> - L " ( ) \ n " <nl> - L " featDim \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " myLabels = \ n " <nl> - L " ( \ n " <nl> - L " Input \ n " <nl> - L " ( ) \ n " <nl> - L " labelDim \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " numHiddenLayers = \ n " <nl> - L " 3 \ n " <nl> - L " outLayer = \ n " <nl> - L " ( \ n " <nl> - L " BFF \ n " <nl> - L " ( ) \ n " <nl> - L " . Eh \ n " <nl> - L " ( \ n " <nl> - L " HiddenStack \ n " <nl> - L " ( ) \ n " <nl> - L " numHiddenLayers \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " labelDim \ n " <nl> - L " hiddenDim \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " outZ = \ n " <nl> - L " . z \ n " <nl> - L " outLayer \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " " ) , <nl> - std : : make_pair ( / / # 13 : factorial <nl> - L " do = Print ( fac ( 5 ) ) ; fac ( i ) = if i > 1 then fac ( i - 1 ) * i else 1 " , <nl> - L " [ ] \ n " <nl> - L " do = \ n " <nl> - L " ( \ n " <nl> - L " Print \ n " <nl> - L " ( ) \ n " <nl> - L " ( \ n " <nl> - L " fac \ n " <nl> - L " ( ) \ n " <nl> - L " 5 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " fac = \ n " <nl> - L " = > \ n " <nl> - L " ( ) \ n " <nl> - L " i \ n " <nl> - L " \ n " <nl> - L " if \ n " <nl> - L " > \ n " <nl> - L " i \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " * \ n " <nl> - L " ( \ n " <nl> - L " fac \ n " <nl> - L " ( ) \ n " <nl> - L " - \ n " <nl> - L " i \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " i \ n " <nl> - L " \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " " ) , <nl> - std : : make_pair ( / / # 14 : Fibonacci sequence with memoization <nl> - L " do = Print ( fibs ( 10 ) ) ; fibs ( n ) = [ vals = array [ 1 . . n ] ( i = > if i < 3 then i - 1 else vals [ i - 1 ] + vals [ i - 2 ] ) ] . vals [ n ] " , <nl> - L " [ ] \ n " <nl> - L " do = \ n " <nl> - L " ( \ n " <nl> - L " Print \ n " <nl> - L " ( ) \ n " <nl> - L " ( \ n " <nl> - L " fibs \ n " <nl> - L " ( ) \ n " <nl> - L " 10 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " fibs = \ n " <nl> - L " = > \ n " <nl> - L " ( ) \ n " <nl> - L " n \ n " <nl> - L " \ n " <nl> - L " [ \ n " <nl> - L " . vals \ n " <nl> - L " [ ] \ n " <nl> - L " vals = \ n " <nl> - L " array \ n " <nl> - L " 1 \ n " <nl> - L " n \ n " <nl> - L " = > \ n " <nl> - L " ( ) \ n " <nl> - L " i \ n " <nl> - L " \ n " <nl> - L " if \ n " <nl> - L " < \ n " <nl> - L " i \ n " <nl> - L " 3 \ n " <nl> - L " \ n " <nl> - L " - \ n " <nl> - L " i \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " + \ n " <nl> - L " [ \ n " <nl> - L " vals \ n " <nl> - L " - \ n " <nl> - L " i \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " [ \ n " <nl> - L " vals \ n " <nl> - L " - \ n " <nl> - L " i \ n " <nl> - L " 2 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " n \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " " ) , <nl> - std : : make_pair ( / / # 15 : DNN with array <nl> - L " do = Print ( val ) \ n " <nl> - L " val = new NDLComputationNetwork [ \ n " <nl> - L " featDim = 40 * 31 ; labelDim = 9000 ; hiddenDim = 2048 ; numHiddenLayers = 3 \ n " <nl> - L " myFeatures = Input ( featDim , tag = ' features ' ) ; myLabels = Input ( labelDim , tag = ' labels ' ) \ n " <nl> - L " featNorm = MeanVarNorm ( myFeatures ) \ n " <nl> - L " layers [ layer : 1 . . numHiddenLayers ] = if layer > 1 then SBFF ( layers [ layer - 1 ] . Eh , hiddenDim , hiddenDim ) else SBFF ( featNorm , hiddenDim , featDim ) \ n " <nl> - L " outLayer = BFF ( layers [ numHiddenLayers ] . Eh , labelDim , hiddenDim ) \ n " <nl> - L " outZ = outLayer . z + Delay ( outZ , 1 ) \ n " <nl> - L " CE = CrossEntropyWithSoftmax ( myLabels , outZ ) \ n " <nl> - L " Err = ErrorPrediction ( myLabels , outZ ) \ n " <nl> - L " logPrior = LogPrior ( myLabels ) \ n " <nl> - L " ScaledLogLikelihood = outZ - logPrior \ n " <nl> - L " ] \ n " <nl> - L " " , <nl> - L " [ ] \ n " <nl> - L " do = \ n " <nl> - L " ( \ n " <nl> - L " Print \ n " <nl> - L " ( ) \ n " <nl> - L " val \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " val = \ n " <nl> - L " new NDLComputationNetwork \ n " <nl> - L " [ ] \ n " <nl> - L " CE = \ n " <nl> - L " ( \ n " <nl> - L " CrossEntropyWithSoftmax \ n " <nl> - L " ( ) \ n " <nl> - L " myLabels \ n " <nl> - L " outZ \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " Err = \ n " <nl> - L " ( \ n " <nl> - L " ErrorPrediction \ n " <nl> - L " ( ) \ n " <nl> - L " myLabels \ n " <nl> - L " outZ \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " ScaledLogLikelihood = \ n " <nl> - L " - \ n " <nl> - L " outZ \ n " <nl> - L " logPrior \ n " <nl> - L " \ n " <nl> - L " featDim = \ n " <nl> - L " * \ n " <nl> - L " 40 \ n " <nl> - L " 31 \ n " <nl> - L " \ n " <nl> - L " featNorm = \ n " <nl> - L " ( \ n " <nl> - L " MeanVarNorm \ n " <nl> - L " ( ) \ n " <nl> - L " myFeatures \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " hiddenDim = \ n " <nl> - L " 2048 \ n " <nl> - L " labelDim = \ n " <nl> - L " 9000 \ n " <nl> - L " layers = \ n " <nl> - L " array \ n " <nl> - L " 1 \ n " <nl> - L " numHiddenLayers \ n " <nl> - L " = > \ n " <nl> - L " ( ) \ n " <nl> - L " layer \ n " <nl> - L " \ n " <nl> - L " if \ n " <nl> - L " > \ n " <nl> - L " layer \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " ( \ n " <nl> - L " SBFF \ n " <nl> - L " ( ) \ n " <nl> - L " . Eh \ n " <nl> - L " [ \ n " <nl> - L " layers \ n " <nl> - L " - \ n " <nl> - L " layer \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " hiddenDim \ n " <nl> - L " hiddenDim \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " ( \ n " <nl> - L " SBFF \ n " <nl> - L " ( ) \ n " <nl> - L " featNorm \ n " <nl> - L " hiddenDim \ n " <nl> - L " featDim \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " logPrior = \ n " <nl> - L " ( \ n " <nl> - L " LogPrior \ n " <nl> - L " ( ) \ n " <nl> - L " myLabels \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " myFeatures = \ n " <nl> - L " ( \ n " <nl> - L " Input \ n " <nl> - L " ( ) \ n " <nl> - L " featDim \ n " <nl> - L " \ n " <nl> - L " tag = \ n " <nl> - L " ' features ' \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " myLabels = \ n " <nl> - L " ( \ n " <nl> - L " Input \ n " <nl> - L " ( ) \ n " <nl> - L " labelDim \ n " <nl> - L " \ n " <nl> - L " tag = \ n " <nl> - L " ' labels ' \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " numHiddenLayers = \ n " <nl> - L " 3 \ n " <nl> - L " outLayer = \ n " <nl> - L " ( \ n " <nl> - L " BFF \ n " <nl> - L " ( ) \ n " <nl> - L " . Eh \ n " <nl> - L " [ \ n " <nl> - L " layers \ n " <nl> - L " numHiddenLayers \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " labelDim \ n " <nl> - L " hiddenDim \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " outZ = \ n " <nl> - L " + \ n " <nl> - L " . z \ n " <nl> - L " outLayer \ n " <nl> - L " \ n " <nl> - L " ( \ n " <nl> - L " Delay \ n " <nl> - L " ( ) \ n " <nl> - L " outZ \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " " ) , <nl> - std : : make_pair ( / / # 16 : windowed RNN <nl> - L " do = Print ( val ) \ n " <nl> - L " val = new NDLComputationNetwork [ \ n " <nl> - L " hiddenDim = 512 \ n " <nl> - L " numHiddenLayers = 2 \ n " <nl> - L " T = 3 / / total context window \ n " <nl> - L " \ n " <nl> - L " / / data sources \ n " <nl> - L " featDim = 40 ; labelDim = 9000 \ n " <nl> - L " myFeatures = Input ( featDim ) ; myLabels = Input ( labelDim ) \ n " <nl> - L " \ n " <nl> - L " / / split the augmented input vector into individual frame vectors \ n " <nl> - L " subframes [ t : 0 . . T - 1 ] = RowSlice ( t * featDim , featDim , myFeatures ) \ n " <nl> - L " \ n " <nl> - L " / / hidden layers \ n " <nl> - L " layers [ layer : 1 . . numHiddenLayers ] = [ / / each layer stores a dict that stores its hidden fwd and bwd state vectors \ n " <nl> - L " / / model parameters \ n " <nl> - L " W_fwd = Parameter ( hiddenDim , featDim ) / / Parameter ( outdim , indim ) \ n " <nl> - L " W_bwd = if layer > 1 then Parameter ( hiddenDim , hiddenDim ) else Fail ( ' no W_bwd ' ) / / input - to - hidden \ n " <nl> - L " H_fwd = Parameter ( hiddenDim , hiddenDim ) / / hidden - to - hidden \ n " <nl> - L " H_bwd = Parameter ( hiddenDim , hiddenDim ) \ n " <nl> - L " b = Parameter ( hiddenDim , 1 ) / / bias \ n " <nl> - L " / / shared part of activations ( input connections and bias ) \ n " <nl> - L " z_shared [ t : 0 . . T - 1 ] = ( if layer > 1 \ n " <nl> - L " then W_fwd * layers [ layer - 1 ] . h_fwd [ t ] + W_bwd * layers [ layer - 1 ] . h_bwd [ t ] \ n " <nl> - L " else W_fwd * subframes [ t ] \ n " <nl> - L " ) + b \ n " <nl> - L " / / recurrent part and non - linearity \ n " <nl> - L " step ( H , h , dt , t ) = Sigmoid ( if ( t + dt > = 0 & & t + dt < T ) \ n " <nl> - L " then z_shared [ t ] + H * h [ t + dt ] \ n " <nl> - L " else z_shared [ t ] ) \ n " <nl> - L " h_fwd [ t : 0 . . T - 1 ] = step ( H_fwd , h_fwd , - 1 , t ) \ n " <nl> - L " h_bwd [ t : 0 . . T - 1 ] = step ( H_bwd , h_bwd , 1 , t ) \ n " <nl> - L " ] \ n " <nl> - L " / / output layer - - linear only at this point ; Softmax is applied later \ n " <nl> - L " outLayer = [ \ n " <nl> - L " / / model parameters \ n " <nl> - L " W_fwd = Parameter ( labelDim , hiddenDim ) \ n " <nl> - L " W_bwd = Parameter ( labelDim , hiddenDim ) \ n " <nl> - L " b = Parameter ( labelDim , 1 ) \ n " <nl> - L " / / output \ n " <nl> - L " topHiddenLayer = layers [ numHiddenLayers ] \ n " <nl> - L " centerT = Floor ( T / 2 ) \ n " <nl> - L " z = W_fwd * topHiddenLayer . h_fwd [ centerT ] + W_bwd * topHiddenLayer . h_bwd [ centerT ] + b \ n " <nl> - L " ] \ n " <nl> - L " outZ = outLayer . z / / we only want this one & don ' t care about the rest of this dictionary \ n " <nl> - L " \ n " <nl> - L " / / define criterion nodes \ n " <nl> - L " CE = CrossEntropyWithSoftmax ( myLabels , outZ ) \ n " <nl> - L " Err = ErrorPrediction ( myLabels , outZ ) \ n " <nl> - L " \ n " <nl> - L " / / define output node for decoding \ n " <nl> - L " logPrior = LogPrior ( myLabels ) \ n " <nl> - L " ScaledLogLikelihood = outZ - logPrior / / before : Minus ( CE . BFF . FF . P , logPrior , tag = Output ) \ n " <nl> - L " ] \ n " <nl> - L " " , <nl> - L " [ ] \ n " <nl> - L " do = \ n " <nl> - L " ( \ n " <nl> - L " Print \ n " <nl> - L " ( ) \ n " <nl> - L " val \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " val = \ n " <nl> - L " new NDLComputationNetwork \ n " <nl> - L " [ ] \ n " <nl> - L " CE = \ n " <nl> - L " ( \ n " <nl> - L " CrossEntropyWithSoftmax \ n " <nl> - L " ( ) \ n " <nl> - L " myLabels \ n " <nl> - L " outZ \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " Err = \ n " <nl> - L " ( \ n " <nl> - L " ErrorPrediction \ n " <nl> - L " ( ) \ n " <nl> - L " myLabels \ n " <nl> - L " outZ \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " ScaledLogLikelihood = \ n " <nl> - L " - \ n " <nl> - L " outZ \ n " <nl> - L " logPrior \ n " <nl> - L " \ n " <nl> - L " T = \ n " <nl> - L " 3 \ n " <nl> - L " featDim = \ n " <nl> - L " 40 \ n " <nl> - L " hiddenDim = \ n " <nl> - L " 512 \ n " <nl> - L " labelDim = \ n " <nl> - L " 9000 \ n " <nl> - L " layers = \ n " <nl> - L " array \ n " <nl> - L " 1 \ n " <nl> - L " numHiddenLayers \ n " <nl> - L " = > \ n " <nl> - L " ( ) \ n " <nl> - L " layer \ n " <nl> - L " \ n " <nl> - L " [ ] \ n " <nl> - L " H_bwd = \ n " <nl> - L " ( \ n " <nl> - L " Parameter \ n " <nl> - L " ( ) \ n " <nl> - L " hiddenDim \ n " <nl> - L " hiddenDim \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " H_fwd = \ n " <nl> - L " ( \ n " <nl> - L " Parameter \ n " <nl> - L " ( ) \ n " <nl> - L " hiddenDim \ n " <nl> - L " hiddenDim \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " W_bwd = \ n " <nl> - L " if \ n " <nl> - L " > \ n " <nl> - L " layer \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " ( \ n " <nl> - L " Parameter \ n " <nl> - L " ( ) \ n " <nl> - L " hiddenDim \ n " <nl> - L " hiddenDim \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " ( \ n " <nl> - L " Fail \ n " <nl> - L " ( ) \ n " <nl> - L " ' no W_bwd ' \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " W_fwd = \ n " <nl> - L " ( \ n " <nl> - L " Parameter \ n " <nl> - L " ( ) \ n " <nl> - L " hiddenDim \ n " <nl> - L " featDim \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " b = \ n " <nl> - L " ( \ n " <nl> - L " Parameter \ n " <nl> - L " ( ) \ n " <nl> - L " hiddenDim \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " h_bwd = \ n " <nl> - L " array \ n " <nl> - L " 0 \ n " <nl> - L " - \ n " <nl> - L " T \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " = > \ n " <nl> - L " ( ) \ n " <nl> - L " t \ n " <nl> - L " \ n " <nl> - L " ( \ n " <nl> - L " step \ n " <nl> - L " ( ) \ n " <nl> - L " H_bwd \ n " <nl> - L " h_bwd \ n " <nl> - L " 1 \ n " <nl> - L " t \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " h_fwd = \ n " <nl> - L " array \ n " <nl> - L " 0 \ n " <nl> - L " - \ n " <nl> - L " T \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " = > \ n " <nl> - L " ( ) \ n " <nl> - L " t \ n " <nl> - L " \ n " <nl> - L " ( \ n " <nl> - L " step \ n " <nl> - L " ( ) \ n " <nl> - L " H_fwd \ n " <nl> - L " h_fwd \ n " <nl> - L " - ( \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " t \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " step = \ n " <nl> - L " = > \ n " <nl> - L " ( ) \ n " <nl> - L " H \ n " <nl> - L " h \ n " <nl> - L " dt \ n " <nl> - L " t \ n " <nl> - L " \ n " <nl> - L " ( \ n " <nl> - L " Sigmoid \ n " <nl> - L " ( ) \ n " <nl> - L " if \ n " <nl> - L " & & \ n " <nl> - L " > = \ n " <nl> - L " + \ n " <nl> - L " t \ n " <nl> - L " dt \ n " <nl> - L " \ n " <nl> - L " 0 \ n " <nl> - L " \ n " <nl> - L " < \ n " <nl> - L " + \ n " <nl> - L " t \ n " <nl> - L " dt \ n " <nl> - L " \ n " <nl> - L " T \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " + \ n " <nl> - L " [ \ n " <nl> - L " z_shared \ n " <nl> - L " t \ n " <nl> - L " \ n " <nl> - L " * \ n " <nl> - L " H \ n " <nl> - L " [ \ n " <nl> - L " h \ n " <nl> - L " + \ n " <nl> - L " t \ n " <nl> - L " dt \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " [ \ n " <nl> - L " z_shared \ n " <nl> - L " t \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " z_shared = \ n " <nl> - L " array \ n " <nl> - L " 0 \ n " <nl> - L " - \ n " <nl> - L " T \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " = > \ n " <nl> - L " ( ) \ n " <nl> - L " t \ n " <nl> - L " \ n " <nl> - L " + \ n " <nl> - L " if \ n " <nl> - L " > \ n " <nl> - L " layer \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " + \ n " <nl> - L " * \ n " <nl> - L " W_fwd \ n " <nl> - L " [ \ n " <nl> - L " . h_fwd \ n " <nl> - L " [ \ n " <nl> - L " layers \ n " <nl> - L " - \ n " <nl> - L " layer \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " t \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " * \ n " <nl> - L " W_bwd \ n " <nl> - L " [ \ n " <nl> - L " . h_bwd \ n " <nl> - L " [ \ n " <nl> - L " layers \ n " <nl> - L " - \ n " <nl> - L " layer \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " t \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " * \ n " <nl> - L " W_fwd \ n " <nl> - L " [ \ n " <nl> - L " subframes \ n " <nl> - L " t \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " b \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " logPrior = \ n " <nl> - L " ( \ n " <nl> - L " LogPrior \ n " <nl> - L " ( ) \ n " <nl> - L " myLabels \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " myFeatures = \ n " <nl> - L " ( \ n " <nl> - L " Input \ n " <nl> - L " ( ) \ n " <nl> - L " featDim \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " myLabels = \ n " <nl> - L " ( \ n " <nl> - L " Input \ n " <nl> - L " ( ) \ n " <nl> - L " labelDim \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " numHiddenLayers = \ n " <nl> - L " 2 \ n " <nl> - L " outLayer = \ n " <nl> - L " [ ] \ n " <nl> - L " W_bwd = \ n " <nl> - L " ( \ n " <nl> - L " Parameter \ n " <nl> - L " ( ) \ n " <nl> - L " labelDim \ n " <nl> - L " hiddenDim \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " W_fwd = \ n " <nl> - L " ( \ n " <nl> - L " Parameter \ n " <nl> - L " ( ) \ n " <nl> - L " labelDim \ n " <nl> - L " hiddenDim \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " b = \ n " <nl> - L " ( \ n " <nl> - L " Parameter \ n " <nl> - L " ( ) \ n " <nl> - L " labelDim \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " centerT = \ n " <nl> - L " ( \ n " <nl> - L " Floor \ n " <nl> - L " ( ) \ n " <nl> - L " / \ n " <nl> - L " T \ n " <nl> - L " 2 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " topHiddenLayer = \ n " <nl> - L " [ \ n " <nl> - L " layers \ n " <nl> - L " numHiddenLayers \ n " <nl> - L " \ n " <nl> - L " z = \ n " <nl> - L " + \ n " <nl> - L " + \ n " <nl> - L " * \ n " <nl> - L " W_fwd \ n " <nl> - L " [ \ n " <nl> - L " . h_fwd \ n " <nl> - L " topHiddenLayer \ n " <nl> - L " \ n " <nl> - L " centerT \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " * \ n " <nl> - L " W_bwd \ n " <nl> - L " [ \ n " <nl> - L " . h_bwd \ n " <nl> - L " topHiddenLayer \ n " <nl> - L " \ n " <nl> - L " centerT \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " b \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " outZ = \ n " <nl> - L " . z \ n " <nl> - L " outLayer \ n " <nl> - L " \ n " <nl> - L " subframes = \ n " <nl> - L " array \ n " <nl> - L " 0 \ n " <nl> - L " - \ n " <nl> - L " T \ n " <nl> - L " 1 \ n " <nl> - L " \ n " <nl> - L " = > \ n " <nl> - L " ( ) \ n " <nl> - L " t \ n " <nl> - L " \ n " <nl> - L " ( \ n " <nl> - L " RowSlice \ n " <nl> - L " ( ) \ n " <nl> - L " * \ n " <nl> - L " t \ n " <nl> - L " featDim \ n " <nl> - L " \ n " <nl> - L " featDim \ n " <nl> - L " myFeatures \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " " ) , <nl> - std : : make_pair ( L " \ n " <nl> - L " " / / this fails because dict is outside val ; expression name is not local to it <nl> - L " do = Print ( val ) \ n " <nl> - L " dict = [ outY = Input ( 13 ) ] ; val = new NDLComputationNetwork [ outZ = dict . outY \ n " <nl> - L " ] \ n " <nl> - L " " , <nl> - L " [ ] \ n " <nl> - L " dict = \ n " <nl> - L " [ ] \ n " <nl> - L " outY = \ n " <nl> - L " ( \ n " <nl> - L " Input \ n " <nl> - L " ( ) \ n " <nl> - L " 13 \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " do = \ n " <nl> - L " ( \ n " <nl> - L " Print \ n " <nl> - L " ( ) \ n " <nl> - L " val \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " val = \ n " <nl> - L " new NDLComputationNetwork \ n " <nl> - L " [ ] \ n " <nl> - L " outZ = \ n " <nl> - L " . outY \ n " <nl> - L " dict \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " " ) , <nl> - std : : make_pair ( L " f ( x , option = ' default ' ) = Print ( option ) ; do = f ( 42 , option = ' value ' ) " , <nl> - L " [ ] \ n " <nl> - L " do = \ n " <nl> - L " ( \ n " <nl> - L " f \ n " <nl> - L " ( ) \ n " <nl> - L " 42 \ n " <nl> - L " \ n " <nl> - L " option = \ n " <nl> - L " ' value ' \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " f = \ n " <nl> - L " = > \ n " <nl> - L " ( ) \ n " <nl> - L " x \ n " <nl> - L " \ n " <nl> - L " option = \ n " <nl> - L " ' default ' \ n " <nl> - L " \ n " <nl> - L " ( \ n " <nl> - L " Print \ n " <nl> - L " ( ) \ n " <nl> - L " option \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " \ n " <nl> - L " " ) <nl> - } ; <nl> \ No newline at end of file <nl>
|
Use input and output files for each test
|
microsoft/CNTK
|
74fffe337baab40d601a105941019569b4bce59c
|
2016-08-03T10:56:19Z
|
mmm a / CONTRIBUTORS . md <nl> ppp b / CONTRIBUTORS . md <nl> List of Contributors <nl> * [ yang1fan2 ] ( https : / / github . com / yang1fan2 ) <nl> * [ Wang Gu ] ( https : / / github . com / wangg12 ) <nl> * [ Zhenchuan Huang ] ( https : / / github . com / chuan92 ) <nl> + * [ Hang Su ] ( https : / / github . com / suhangpro ) <nl> + * [ Rinu Boney ] ( https : / / github . com / rinuboney ) <nl> + * [ nowozin ] ( https : / / github . com / nowozin ) <nl> + * [ Mathis ] ( https : / / github . com / sveitser ) <nl>
|
Update CONTRIBUTORS . md
|
apache/incubator-mxnet
|
d42e2c666e5eec89579bb5ff924a722df977795f
|
2015-12-02T05:31:03Z
|
mmm a / modules / stitching / perf / perf_matchers . cpp <nl> ppp b / modules / stitching / perf / perf_matchers . cpp <nl> PERF_TEST_P ( match , bestOf2Nearest , TEST_DETECTORS ) <nl> Mat R ( pairwise_matches . H , Range : : all ( ) , Range ( 0 , 2 ) ) ; <nl> / / separate transform matrix , use lower error on rotations <nl> SANITY_CHECK ( dist , 1 . , ERROR_ABSOLUTE ) ; <nl> - SANITY_CHECK ( R , . 015 , ERROR_ABSOLUTE ) ; <nl> + SANITY_CHECK ( R , . 06 , ERROR_ABSOLUTE ) ; <nl> } <nl> <nl> PERF_TEST_P ( matchVector , bestOf2NearestVectorFeatures , testing : : Combine ( <nl>
|
Merge pull request from nangchoo : bugfix / increase_magic_threshold_for_perf_test
|
opencv/opencv
|
df6728e64c06d91e1b297e5e18dd3fa314ea0fad
|
2018-10-17T17:31:19Z
|
mmm a / tensorflow / stream_executor / cuda / cuda_dnn . cc <nl> ppp b / tensorflow / stream_executor / cuda / cuda_dnn . cc <nl> bool CudnnSupport : : DoConvolveImpl ( <nl> / / Doing so by default make a few TensorFlow test cases to fail . Users can <nl> / / explicitly enable them through an env - var " TF_ENABLE_WINOGRAD_NONFUSED = 1 " . <nl> / / https : / / github . com / tensorflow / tensorflow / pull / 4901 <nl> + template < bool DefaultFlag > <nl> class WinogradNonfused { <nl> public : <nl> static bool IsEnabled ( ) { <nl> class WinogradNonfused { <nl> } <nl> / / TODO ( zhengxq ) : turn the default to True when the test failure is <nl> / / resolved . <nl> - return false ; <nl> + return DefaultFlag ; <nl> } <nl> } ; <nl> <nl> bool CudnnSupport : : GetConvolveAlgorithms ( <nl> / / clang - format on <nl> } ) ; <nl> # if CUDNN_VERSION > = 5100 <nl> - if ( WinogradNonfused : : IsEnabled ( ) ) { <nl> + if ( WinogradNonfused < true > : : IsEnabled ( ) ) { <nl> out_algorithms - > push_back ( CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED ) ; <nl> } <nl> # endif <nl> bool CudnnSupport : : GetConvolveBackwardDataAlgorithms ( <nl> / / clang - format on <nl> } ) ; <nl> # if CUDNN_VERSION > = 5100 <nl> - if ( WinogradNonfused : : IsEnabled ( ) ) { <nl> + if ( WinogradNonfused < true > : : IsEnabled ( ) ) { <nl> out_algorithms - > push_back ( <nl> CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD_NONFUSED ) ; <nl> } <nl> bool CudnnSupport : : GetConvolveBackwardFilterAlgorithms ( <nl> / / clang - format on <nl> } ) ; <nl> # if CUDNN_VERSION > = 5100 <nl> - if ( WinogradNonfused : : IsEnabled ( ) ) { <nl> + # if CUDNN_VERSION > = 5110 <nl> + static constexpr bool kDefaultFlagWinogradNonfused = true ; <nl> + # else <nl> + static constexpr bool kDefaultFlagWinogradNonfused = false ; <nl> + # endif <nl> + if ( WinogradNonfused < kDefaultFlagWinogradNonfused > : : IsEnabled ( ) ) { <nl> out_algorithms - > push_back ( <nl> / / Based on cudnn . h , the following is not implemented . <nl> / / CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD , <nl>
|
Fixed the logic for winograd_nonfused for cudnn v > = 5100
|
tensorflow/tensorflow
|
2c3469018589ffece9938797f618e5b3228074fa
|
2017-02-19T04:30:17Z
|
mmm a / lib / IRGen / IRGenModule . h <nl> ppp b / lib / IRGen / IRGenModule . h <nl> class IRGenModule { <nl> llvm : : LLVMContext & LLVMContext ; <nl> const llvm : : TargetData & TargetData ; <nl> <nl> - llvm : : Type * VoidTy ; <nl> - llvm : : IntegerType * Int1Ty ; <nl> - llvm : : IntegerType * Int8Ty ; <nl> - llvm : : IntegerType * Int16Ty ; <nl> - llvm : : IntegerType * Int32Ty ; <nl> - llvm : : IntegerType * Int64Ty ; <nl> - llvm : : IntegerType * SizeTy ; <nl> - llvm : : PointerType * Int8PtrTy ; <nl> - llvm : : StructType * RefCountedTy ; <nl> - llvm : : PointerType * RefCountedPtrTy ; <nl> - llvm : : StructType * FunctionPairTy ; <nl> + llvm : : Type * VoidTy ; / / / void ( usually { } ) <nl> + llvm : : IntegerType * Int1Ty ; / / / i1 <nl> + llvm : : IntegerType * Int8Ty ; / / / i8 <nl> + llvm : : IntegerType * Int16Ty ; / / / i16 <nl> + llvm : : IntegerType * Int32Ty ; / / / i32 <nl> + llvm : : IntegerType * Int64Ty ; / / / i64 <nl> + llvm : : IntegerType * SizeTy ; / / / usually i32 or i64 <nl> + llvm : : PointerType * Int8PtrTy ; / / / i8 * <nl> + llvm : : StructType * RefCountedTy ; / / / % swift . refcounted = type { i8 * } <nl> + llvm : : PointerType * RefCountedPtrTy ; / / / % swift . refcounted * <nl> + llvm : : StructType * FunctionPairTy ; / / / { i8 * , % swift . refcounted * } <nl> <nl> Size getPointerSize ( ) const { return PtrSize ; } <nl> Alignment getPointerAlignment ( ) const { <nl>
|
Document the various cached bits of IR on IRGenModule .
|
apple/swift
|
d6b05b38a6c9e4f04bc5a46f0339755538097192
|
2012-03-20T19:41:54Z
|
mmm a / dbms / src / Dictionaries / CacheDictionary . h <nl> ppp b / dbms / src / Dictionaries / CacheDictionary . h <nl> class CacheDictionary final : public IDictionary <nl> const DictionaryLifetime dict_lifetime , <nl> const size_t size ) ; <nl> <nl> - std : : exception_ptr getCreationException ( ) const override { return { } ; } <nl> - <nl> std : : string getName ( ) const override { return name ; } <nl> <nl> std : : string getTypeName ( ) const override { return " Cache " ; } <nl> class CacheDictionary final : public IDictionary <nl> <nl> const DictionaryStructure & getStructure ( ) const override { return dict_struct ; } <nl> <nl> - std : : chrono : : time_point < std : : chrono : : system_clock > getCreationTime ( ) const override { return creation_time ; } <nl> - <nl> bool isInjective ( const std : : string & attribute_name ) const override <nl> { <nl> return dict_struct . attributes [ & getAttribute ( attribute_name ) - attributes . data ( ) ] . injective ; <nl> class CacheDictionary final : public IDictionary <nl> mutable std : : atomic < size_t > element_count { 0 } ; <nl> mutable std : : atomic < size_t > hit_count { 0 } ; <nl> mutable std : : atomic < size_t > query_count { 0 } ; <nl> - <nl> - const std : : chrono : : time_point < std : : chrono : : system_clock > creation_time = std : : chrono : : system_clock : : now ( ) ; <nl> } ; <nl> <nl> } <nl> mmm a / dbms / src / Dictionaries / ComplexKeyCacheDictionary . h <nl> ppp b / dbms / src / Dictionaries / ComplexKeyCacheDictionary . h <nl> class ComplexKeyCacheDictionary final : public IDictionaryBase <nl> <nl> std : : string getKeyDescription ( ) const { return key_description ; } <nl> <nl> - std : : exception_ptr getCreationException ( ) const override { return { } ; } <nl> - <nl> std : : string getName ( ) const override { return name ; } <nl> <nl> std : : string getTypeName ( ) const override { return " ComplexKeyCache " ; } <nl> class ComplexKeyCacheDictionary final : public IDictionaryBase <nl> <nl> const DictionaryStructure & getStructure ( ) const override { return dict_struct ; } <nl> <nl> - std : : chrono : : time_point < std : : chrono : : system_clock > getCreationTime ( ) const override { return creation_time ; } <nl> - <nl> bool isInjective ( const std : : string & attribute_name ) const override <nl> { <nl> return dict_struct . attributes [ & getAttribute ( attribute_name ) - attributes . data ( ) ] . injective ; <nl> mmm a / dbms / src / Dictionaries / ComplexKeyHashedDictionary . cpp <nl> ppp b / dbms / src / Dictionaries / ComplexKeyHashedDictionary . cpp <nl> ComplexKeyHashedDictionary : : ComplexKeyHashedDictionary ( <nl> , saved_block { std : : move ( saved_block ) } <nl> { <nl> createAttributes ( ) ; <nl> - <nl> - try <nl> - { <nl> - loadData ( ) ; <nl> - calculateBytesAllocated ( ) ; <nl> - } <nl> - catch ( . . . ) <nl> - { <nl> - creation_exception = std : : current_exception ( ) ; <nl> - } <nl> - <nl> - creation_time = std : : chrono : : system_clock : : now ( ) ; <nl> + loadData ( ) ; <nl> + calculateBytesAllocated ( ) ; <nl> } <nl> <nl> # define DECLARE ( TYPE ) \ <nl> mmm a / dbms / src / Dictionaries / ComplexKeyHashedDictionary . h <nl> ppp b / dbms / src / Dictionaries / ComplexKeyHashedDictionary . h <nl> class ComplexKeyHashedDictionary final : public IDictionaryBase <nl> <nl> std : : string getKeyDescription ( ) const { return key_description ; } <nl> <nl> - std : : exception_ptr getCreationException ( ) const override { return creation_exception ; } <nl> - <nl> std : : string getName ( ) const override { return name ; } <nl> <nl> std : : string getTypeName ( ) const override { return " ComplexKeyHashed " ; } <nl> class ComplexKeyHashedDictionary final : public IDictionaryBase <nl> <nl> const DictionaryStructure & getStructure ( ) const override { return dict_struct ; } <nl> <nl> - std : : chrono : : time_point < std : : chrono : : system_clock > getCreationTime ( ) const override { return creation_time ; } <nl> - <nl> bool isInjective ( const std : : string & attribute_name ) const override <nl> { <nl> return dict_struct . attributes [ & getAttribute ( attribute_name ) - attributes . data ( ) ] . injective ; <nl> class ComplexKeyHashedDictionary final : public IDictionaryBase <nl> size_t bucket_count = 0 ; <nl> mutable std : : atomic < size_t > query_count { 0 } ; <nl> <nl> - std : : chrono : : time_point < std : : chrono : : system_clock > creation_time ; <nl> - <nl> - std : : exception_ptr creation_exception ; <nl> - <nl> BlockPtr saved_block ; <nl> } ; <nl> <nl> mmm a / dbms / src / Dictionaries / FlatDictionary . cpp <nl> ppp b / dbms / src / Dictionaries / FlatDictionary . cpp <nl> FlatDictionary : : FlatDictionary ( <nl> , saved_block { std : : move ( saved_block ) } <nl> { <nl> createAttributes ( ) ; <nl> - <nl> - try <nl> - { <nl> - loadData ( ) ; <nl> - calculateBytesAllocated ( ) ; <nl> - } <nl> - catch ( . . . ) <nl> - { <nl> - creation_exception = std : : current_exception ( ) ; <nl> - } <nl> - <nl> - creation_time = std : : chrono : : system_clock : : now ( ) ; <nl> + loadData ( ) ; <nl> + calculateBytesAllocated ( ) ; <nl> } <nl> <nl> <nl> mmm a / dbms / src / Dictionaries / FlatDictionary . h <nl> ppp b / dbms / src / Dictionaries / FlatDictionary . h <nl> class FlatDictionary final : public IDictionary <nl> bool require_nonempty , <nl> BlockPtr saved_block = nullptr ) ; <nl> <nl> - std : : exception_ptr getCreationException ( ) const override { return creation_exception ; } <nl> - <nl> std : : string getName ( ) const override { return name ; } <nl> <nl> std : : string getTypeName ( ) const override { return " Flat " ; } <nl> class FlatDictionary final : public IDictionary <nl> <nl> const DictionaryStructure & getStructure ( ) const override { return dict_struct ; } <nl> <nl> - std : : chrono : : time_point < std : : chrono : : system_clock > getCreationTime ( ) const override { return creation_time ; } <nl> - <nl> bool isInjective ( const std : : string & attribute_name ) const override <nl> { <nl> return dict_struct . attributes [ & getAttribute ( attribute_name ) - attributes . data ( ) ] . injective ; <nl> class FlatDictionary final : public IDictionary <nl> size_t bucket_count = 0 ; <nl> mutable std : : atomic < size_t > query_count { 0 } ; <nl> <nl> - std : : chrono : : time_point < std : : chrono : : system_clock > creation_time ; <nl> - <nl> - std : : exception_ptr creation_exception ; <nl> - <nl> BlockPtr saved_block ; <nl> } ; <nl> <nl> mmm a / dbms / src / Dictionaries / HashedDictionary . cpp <nl> ppp b / dbms / src / Dictionaries / HashedDictionary . cpp <nl> HashedDictionary : : HashedDictionary ( <nl> , saved_block { std : : move ( saved_block ) } <nl> { <nl> createAttributes ( ) ; <nl> - <nl> - try <nl> - { <nl> - loadData ( ) ; <nl> - calculateBytesAllocated ( ) ; <nl> - } <nl> - catch ( . . . ) <nl> - { <nl> - creation_exception = std : : current_exception ( ) ; <nl> - } <nl> - <nl> - creation_time = std : : chrono : : system_clock : : now ( ) ; <nl> + loadData ( ) ; <nl> + calculateBytesAllocated ( ) ; <nl> } <nl> <nl> <nl> mmm a / dbms / src / Dictionaries / HashedDictionary . h <nl> ppp b / dbms / src / Dictionaries / HashedDictionary . h <nl> class HashedDictionary final : public IDictionary <nl> bool require_nonempty , <nl> BlockPtr saved_block = nullptr ) ; <nl> <nl> - std : : exception_ptr getCreationException ( ) const override { return creation_exception ; } <nl> - <nl> std : : string getName ( ) const override { return name ; } <nl> <nl> std : : string getTypeName ( ) const override { return " Hashed " ; } <nl> class HashedDictionary final : public IDictionary <nl> <nl> const DictionaryStructure & getStructure ( ) const override { return dict_struct ; } <nl> <nl> - std : : chrono : : time_point < std : : chrono : : system_clock > getCreationTime ( ) const override { return creation_time ; } <nl> - <nl> bool isInjective ( const std : : string & attribute_name ) const override <nl> { <nl> return dict_struct . attributes [ & getAttribute ( attribute_name ) - attributes . data ( ) ] . injective ; <nl> class HashedDictionary final : public IDictionary <nl> size_t bucket_count = 0 ; <nl> mutable std : : atomic < size_t > query_count { 0 } ; <nl> <nl> - std : : chrono : : time_point < std : : chrono : : system_clock > creation_time ; <nl> - <nl> - std : : exception_ptr creation_exception ; <nl> - <nl> BlockPtr saved_block ; <nl> } ; <nl> <nl> mmm a / dbms / src / Dictionaries / RangeHashedDictionary . cpp <nl> ppp b / dbms / src / Dictionaries / RangeHashedDictionary . cpp <nl> RangeHashedDictionary : : RangeHashedDictionary ( <nl> , require_nonempty ( require_nonempty ) <nl> { <nl> createAttributes ( ) ; <nl> - <nl> - try <nl> - { <nl> - loadData ( ) ; <nl> - calculateBytesAllocated ( ) ; <nl> - } <nl> - catch ( . . . ) <nl> - { <nl> - creation_exception = std : : current_exception ( ) ; <nl> - } <nl> - <nl> - creation_time = std : : chrono : : system_clock : : now ( ) ; <nl> + loadData ( ) ; <nl> + calculateBytesAllocated ( ) ; <nl> } <nl> <nl> <nl> mmm a / dbms / src / Dictionaries / RangeHashedDictionary . h <nl> ppp b / dbms / src / Dictionaries / RangeHashedDictionary . h <nl> class RangeHashedDictionary final : public IDictionaryBase <nl> const DictionaryLifetime dict_lifetime , <nl> bool require_nonempty ) ; <nl> <nl> - std : : exception_ptr getCreationException ( ) const override { return creation_exception ; } <nl> - <nl> std : : string getName ( ) const override { return dictionary_name ; } <nl> <nl> std : : string getTypeName ( ) const override { return " RangeHashed " ; } <nl> class RangeHashedDictionary final : public IDictionaryBase <nl> <nl> const DictionaryStructure & getStructure ( ) const override { return dict_struct ; } <nl> <nl> - std : : chrono : : time_point < std : : chrono : : system_clock > getCreationTime ( ) const override { return creation_time ; } <nl> - <nl> bool isInjective ( const std : : string & attribute_name ) const override <nl> { <nl> return dict_struct . attributes [ & getAttribute ( attribute_name ) - attributes . data ( ) ] . injective ; <nl> class RangeHashedDictionary final : public IDictionaryBase <nl> size_t element_count = 0 ; <nl> size_t bucket_count = 0 ; <nl> mutable std : : atomic < size_t > query_count { 0 } ; <nl> - <nl> - std : : chrono : : time_point < std : : chrono : : system_clock > creation_time ; <nl> - <nl> - std : : exception_ptr creation_exception ; <nl> } ; <nl> <nl> } <nl> mmm a / dbms / src / Dictionaries / TrieDictionary . h <nl> ppp b / dbms / src / Dictionaries / TrieDictionary . h <nl> class TrieDictionary final : public IDictionaryBase <nl> <nl> std : : string getKeyDescription ( ) const { return key_description ; } <nl> <nl> - std : : exception_ptr getCreationException ( ) const override { return creation_exception ; } <nl> - <nl> std : : string getName ( ) const override { return name ; } <nl> <nl> std : : string getTypeName ( ) const override { return " Trie " ; } <nl> class TrieDictionary final : public IDictionaryBase <nl> <nl> const DictionaryStructure & getStructure ( ) const override { return dict_struct ; } <nl> <nl> - std : : chrono : : time_point < std : : chrono : : system_clock > getCreationTime ( ) const override { return creation_time ; } <nl> - <nl> bool isInjective ( const std : : string & attribute_name ) const override <nl> { <nl> return dict_struct . attributes [ & getAttribute ( attribute_name ) - attributes . data ( ) ] . injective ; <nl> mmm a / dbms / src / Interpreters / CatBoostModel . cpp <nl> ppp b / dbms / src / Interpreters / CatBoostModel . cpp <nl> std : : shared_ptr < CatBoostLibHolder > getCatBoostWrapperHolder ( const std : : string & <nl> CatBoostModel : : CatBoostModel ( std : : string name_ , std : : string model_path_ , std : : string lib_path_ , <nl> const ExternalLoadableLifetime & lifetime ) <nl> : name ( std : : move ( name_ ) ) , model_path ( std : : move ( model_path_ ) ) , lib_path ( std : : move ( lib_path_ ) ) , lifetime ( lifetime ) <nl> - { <nl> - try <nl> - { <nl> - init ( ) ; <nl> - } <nl> - catch ( . . . ) <nl> - { <nl> - creation_exception = std : : current_exception ( ) ; <nl> - } <nl> - <nl> - creation_time = std : : chrono : : system_clock : : now ( ) ; <nl> - } <nl> - <nl> - void CatBoostModel : : init ( ) <nl> { <nl> api_provider = getCatBoostWrapperHolder ( lib_path ) ; <nl> api = & api_provider - > getAPI ( ) ; <nl> mmm a / dbms / src / Interpreters / CatBoostModel . h <nl> ppp b / dbms / src / Interpreters / CatBoostModel . h <nl> class CatBoostModel : public IModel <nl> <nl> std : : shared_ptr < const IExternalLoadable > clone ( ) const override ; <nl> <nl> - std : : chrono : : time_point < std : : chrono : : system_clock > getCreationTime ( ) const override { return creation_time ; } <nl> - std : : exception_ptr getCreationException ( ) const override { return creation_exception ; } <nl> - <nl> private : <nl> std : : string name ; <nl> std : : string model_path ; <nl> class CatBoostModel : public IModel <nl> size_t cat_features_count ; <nl> size_t tree_count ; <nl> <nl> - std : : chrono : : time_point < std : : chrono : : system_clock > creation_time ; <nl> - std : : exception_ptr creation_exception ; <nl> - <nl> void init ( ) ; <nl> } ; <nl> <nl> mmm a / dbms / src / Interpreters / ExternalLoader . cpp <nl> ppp b / dbms / src / Interpreters / ExternalLoader . cpp <nl> class ExternalLoader : : LoadingDispatcher : private boost : : noncopyable <nl> { <nl> public : <nl> / / / Called to load or reload an object . <nl> - using CreateObjectFunction = std : : function < ObjectWithException ( <nl> + using CreateObjectFunction = std : : function < LoadablePtr ( <nl> const String & / * name * / , const ObjectConfig & / * config * / , bool config_changed , const LoadablePtr & / * previous_version * / ) > ; <nl> <nl> / / / Called after loading / reloading an object to calculate the time of the next update . <nl> class ExternalLoader : : LoadingDispatcher : private boost : : noncopyable <nl> std : : exception_ptr new_exception ; <nl> try <nl> { <nl> - std : : tie ( new_object , new_exception ) = create_object ( name , config , config_changed , previous_version ) ; <nl> + new_object = create_object ( name , config , config_changed , previous_version ) ; <nl> } <nl> catch ( . . . ) <nl> { <nl> class ExternalLoader : : LoadingDispatcher : private boost : : noncopyable <nl> <nl> if ( ! new_object & & ! new_exception ) <nl> throw Exception ( " No object created and no exception raised for " + type_name , ErrorCodes : : LOGICAL_ERROR ) ; <nl> - if ( new_object & & new_exception ) <nl> - new_object = nullptr ; <nl> <nl> / / / Calculate a new update time . <nl> TimePoint next_update_time ; <nl> void ExternalLoader : : reload ( bool load_never_loading ) <nl> loading_dispatcher - > reload ( load_never_loading ) ; <nl> } <nl> <nl> - ExternalLoader : : ObjectWithException ExternalLoader : : createObject ( <nl> + ExternalLoader : : LoadablePtr ExternalLoader : : createObject ( <nl> const String & name , const ObjectConfig & config , bool config_changed , const LoadablePtr & previous_version ) const <nl> { <nl> if ( previous_version & & ! config_changed ) <nl> - { <nl> - auto new_object = previous_version - > clone ( ) ; <nl> - return { new_object , new_object - > getCreationException ( ) } ; <nl> - } <nl> + return previous_version - > clone ( ) ; <nl> <nl> - auto new_object = create ( name , * config . config , config . key_in_config ) ; <nl> - return { new_object , new_object - > getCreationException ( ) } ; <nl> + return create ( name , * config . config , config . key_in_config ) ; <nl> } <nl> <nl> ExternalLoader : : TimePoint ExternalLoader : : calculateNextUpdateTime ( const LoadablePtr & loaded_object , size_t error_count ) const <nl> mmm a / dbms / src / Interpreters / ExternalLoader . h <nl> ppp b / dbms / src / Interpreters / ExternalLoader . h <nl> class ExternalLoader <nl> <nl> private : <nl> struct ObjectConfig ; <nl> - using ObjectWithException = std : : pair < LoadablePtr , std : : exception_ptr > ; <nl> <nl> - ObjectWithException <nl> - createObject ( const String & name , const ObjectConfig & config , bool config_changed , const LoadablePtr & previous_version ) const ; <nl> + LoadablePtr createObject ( const String & name , const ObjectConfig & config , bool config_changed , const LoadablePtr & previous_version ) const ; <nl> TimePoint calculateNextUpdateTime ( const LoadablePtr & loaded_object , size_t error_count ) const ; <nl> <nl> class ConfigFilesReader ; <nl> mmm a / dbms / src / Interpreters / IExternalLoadable . h <nl> ppp b / dbms / src / Interpreters / IExternalLoadable . h <nl> <nl> # pragma once <nl> <nl> - # include < chrono > <nl> # include < string > <nl> # include < memory > <nl> # include < boost / noncopyable . hpp > <nl> class IExternalLoadable : public std : : enable_shared_from_this < IExternalLoadable > <nl> virtual bool isModified ( ) const = 0 ; <nl> / / / Returns new object with the same configuration . Is used to update modified object when lifetime exceeded . <nl> virtual std : : shared_ptr < const IExternalLoadable > clone ( ) const = 0 ; <nl> - <nl> - virtual std : : chrono : : time_point < std : : chrono : : system_clock > getCreationTime ( ) const = 0 ; <nl> - <nl> - virtual std : : exception_ptr getCreationException ( ) const = 0 ; <nl> } ; <nl> <nl> } <nl>
|
Merge pull request from vitlibar / remove - unnecessary - try - catch
|
ClickHouse/ClickHouse
|
a20a39caac7ee5335ca8dc5d788cc11fec93fe7d
|
2019-07-17T20:34:37Z
|
mmm a / src / rdb_protocol / changefeed . cc <nl> ppp b / src / rdb_protocol / changefeed . cc <nl> class feed_t : public home_thread_mixin_t , public slow_atomic_countable_t < feed_t <nl> cond_t queues_ready ; <nl> <nl> typedef std : : vector < std : : set < subscription_t * > > subvec_t ; <nl> - friend class keyspec_visitor_t ; <nl> subvec_t table_subs ; <nl> std : : map < counted_t < const datum_t > , subvec_t > point_subs ; <nl> rwlock_t table_subs_lock , point_subs_lock ; <nl> INSTANTIATE_SERIALIZABLE_FOR_CLUSTER ( keyspec_t : : point_t ) ; <nl> RDB_MAKE_SERIALIZABLE_1 ( keyspec_t , spec ) ; <nl> INSTANTIATE_SERIALIZABLE_FOR_CLUSTER ( keyspec_t ) ; <nl> <nl> - enum class action_t { ADD , DEL } ; <nl> - class keyspec_visitor_t : public boost : : static_visitor < void > { <nl> - public : <nl> - keyspec_visitor_t ( feed_t * _feed , action_t _action , subscription_t * _sub ) <nl> - : feed ( _feed ) , action ( _action ) , sub ( _sub ) { } <nl> - <nl> - void operator ( ) ( const keyspec_t : : all_t & ) const { <nl> - auto_drainer_t : : lock_t lock ( & feed - > drainer ) ; <nl> - rwlock_in_line_t spot ( & feed - > table_subs_lock , access_t : : write ) ; <nl> - spot . write_signal ( ) - > wait_lazily_unordered ( ) ; <nl> - switch ( action ) { <nl> - case action_t : : ADD : { <nl> - feed - > table_subs [ sub - > home_thread ( ) . threadnum ] . insert ( sub ) ; <nl> - } break ; <nl> - case action_t : : DEL : { <nl> - size_t erased = feed - > table_subs [ sub - > home_thread ( ) . threadnum ] . erase ( sub ) ; <nl> - guarantee ( erased = = 1 ) ; <nl> - } break ; <nl> - default : unreachable ( ) ; <nl> - } <nl> - } <nl> - void operator ( ) ( const keyspec_t : : point_t & point_keyspec ) const { <nl> - auto_drainer_t : : lock_t lock ( & feed - > drainer ) ; <nl> - rwlock_in_line_t spot ( & feed - > point_subs_lock , access_t : : write ) ; <nl> - spot . read_signal ( ) - > wait_lazily_unordered ( ) ; <nl> - auto point_subs = & feed - > point_subs ; <nl> - auto subvec_it = point_subs - > find ( point_keyspec . key ) ; <nl> - spot . write_signal ( ) - > wait_lazily_unordered ( ) ; <nl> - switch ( action ) { <nl> - case action_t : : ADD : { <nl> - if ( subvec_it = = point_subs - > end ( ) ) { <nl> - subvec_it = point_subs - > insert ( <nl> - std : : make_pair ( <nl> - point_keyspec . key , <nl> - decltype ( subvec_it - > second ) ( get_num_threads ( ) ) ) ) . first ; <nl> - } <nl> - ( subvec_it - > second ) [ sub - > home_thread ( ) . threadnum ] . insert ( sub ) ; <nl> - } break ; <nl> - case action_t : : DEL : { <nl> - guarantee ( subvec_it ! = point_subs - > end ( ) ) ; <nl> - size_t erased = ( subvec_it - > second ) [ sub - > home_thread ( ) . threadnum ] . erase ( sub ) ; <nl> - guarantee ( erased = = 1 ) ; <nl> - <nl> - / / If there are no more subscribers , remove the key from the map . <nl> - auto it = subvec_it - > second . begin ( ) ; <nl> - for ( ; it ! = subvec_it - > second . end ( ) ; + + it ) { <nl> - if ( it - > size ( ) ! = 0 ) { <nl> - break ; <nl> - } <nl> - } <nl> - if ( it = = subvec_it - > second . end ( ) ) { <nl> - point_subs - > erase ( subvec_it ) ; <nl> - } <nl> - } break ; <nl> - default : unreachable ( ) ; <nl> - } <nl> - } <nl> - private : <nl> - feed_t * feed ; <nl> - action_t action ; <nl> - subscription_t * sub ; <nl> - } ; <nl> - <nl> / / If this throws we might leak the increment to ` num_subs ` . <nl> void feed_t : : add_point_sub ( subscription_t * sub , <nl> const counted_t < const datum_t > & key ) THROWS_NOTHING { <nl>
|
Removed dead class .
|
rethinkdb/rethinkdb
|
eddc67f8853abc3aa09c1ebeeff9cbb8ac052f4d
|
2014-07-22T05:18:21Z
|
mmm a / tensorflow / python / keras / metrics . py <nl> ppp b / tensorflow / python / keras / metrics . py <nl> def sparse_categorical_accuracy ( y_true , y_pred ) : <nl> y_true = array_ops . squeeze ( y_true , [ - 1 ] ) <nl> y_pred = math_ops . argmax ( y_pred , axis = - 1 ) <nl> <nl> - # If the expected labels are float , we need to cast the int returned by <nl> - # argmax to compare . <nl> - if K . dtype ( y_true ) = = K . floatx ( ) : <nl> - y_pred = math_ops . cast ( y_pred , K . floatx ( ) ) <nl> + # If the predicted output and actual output types don ' t match , force cast them <nl> + # to match . <nl> + if K . dtype ( y_pred ) ! = K . dtype ( y_true ) : <nl> + y_pred = math_ops . cast ( y_pred , K . dtype ( y_true ) ) <nl> <nl> return math_ops . cast ( math_ops . equal ( y_true , y_pred ) , K . floatx ( ) ) <nl> <nl>
|
Make predicted and output types match , so equal op can run .
|
tensorflow/tensorflow
|
6a81e4414ba4a0a1fa77791f7f1aa647b1b8ac10
|
2018-10-11T21:08:03Z
|
mmm a / src / network / Worker . c <nl> ppp b / src / network / Worker . c <nl> int swWorker_send2worker ( swWorker * dst_worker , void * buf , int n , int flag ) <nl> msg . mtype = dst_worker - > id + 1 ; <nl> memcpy ( & msg . buf , buf , n ) ; <nl> <nl> - ret = dst_worker - > pool - > queue - > in ( dst_worker - > pool - > queue , ( swQueue_data * ) & msg , n ) ; <nl> + return dst_worker - > pool - > queue - > in ( dst_worker - > pool - > queue , ( swQueue_data * ) & msg , n ) ; <nl> } <nl> <nl> if ( flag & SW_PIPE_NONBLOCK ) <nl>
|
fixed error message
|
swoole/swoole-src
|
161ebd6a97dbe9d495ffc47c59a682c678d95b8a
|
2015-02-13T11:30:07Z
|
mmm a / src / compiler / mips64 / code - generator - mips64 . cc <nl> ppp b / src / compiler / mips64 / code - generator - mips64 . cc <nl> CodeGenerator : : CodeGenResult CodeGenerator : : AssembleArchInstruction ( <nl> case kAtomicStoreWord32 : <nl> ASSEMBLE_ATOMIC_STORE_INTEGER ( sw ) ; <nl> break ; <nl> + case kMips64AssertEqual : <nl> + __ Assert ( eq , static_cast < BailoutReason > ( i . InputOperand ( 2 ) . immediate ( ) ) , <nl> + i . InputRegister ( 0 ) , Operand ( i . InputRegister ( 1 ) ) ) ; <nl> + break ; <nl> } <nl> return kSuccess ; <nl> } / / NOLINT ( readability / fn_size ) <nl> mmm a / src / compiler / mips64 / instruction - codes - mips64 . h <nl> ppp b / src / compiler / mips64 / instruction - codes - mips64 . h <nl> namespace compiler { <nl> V ( Mips64ByteSwap32 ) \ <nl> V ( Mips64StackClaim ) \ <nl> V ( Mips64Seb ) \ <nl> - V ( Mips64Seh ) <nl> + V ( Mips64Seh ) \ <nl> + V ( Mips64AssertEqual ) <nl> <nl> / / Addressing modes represent the " shape " of inputs to an instruction . <nl> / / Many instructions support multiple addressing modes . Addressing modes <nl> mmm a / src / compiler / mips64 / instruction - selector - mips64 . cc <nl> ppp b / src / compiler / mips64 / instruction - selector - mips64 . cc <nl> void VisitWordCompare ( InstructionSelector * selector , Node * node , <nl> } <nl> } <nl> <nl> + bool IsNodeUnsigned ( Node * n ) { <nl> + NodeMatcher m ( n ) ; <nl> + <nl> + if ( m . IsLoad ( ) ) { <nl> + LoadRepresentation load_rep = LoadRepresentationOf ( n - > op ( ) ) ; <nl> + return load_rep . IsUnsigned ( ) ; <nl> + } else if ( m . IsUnalignedLoad ( ) ) { <nl> + UnalignedLoadRepresentation load_rep = <nl> + UnalignedLoadRepresentationOf ( n - > op ( ) ) ; <nl> + return load_rep . IsUnsigned ( ) ; <nl> + } else { <nl> + return m . IsUint32Div ( ) | | m . IsUint32LessThan ( ) | | <nl> + m . IsUint32LessThanOrEqual ( ) | | m . IsUint32Mod ( ) | | <nl> + m . IsUint32MulHigh ( ) | | m . IsChangeFloat64ToUint32 ( ) | | <nl> + m . IsTruncateFloat64ToUint32 ( ) | | m . IsTruncateFloat32ToUint32 ( ) ; <nl> + } <nl> + } <nl> + <nl> + / / Shared routine for multiple word compare operations . <nl> + void VisitFullWord32Compare ( InstructionSelector * selector , Node * node , <nl> + InstructionCode opcode , FlagsContinuation * cont ) { <nl> + Mips64OperandGenerator g ( selector ) ; <nl> + InstructionOperand leftOp = g . TempRegister ( ) ; <nl> + InstructionOperand rightOp = g . TempRegister ( ) ; <nl> + <nl> + selector - > Emit ( kMips64Dshl , leftOp , g . UseRegister ( node - > InputAt ( 0 ) ) , <nl> + g . TempImmediate ( 32 ) ) ; <nl> + selector - > Emit ( kMips64Dshl , rightOp , g . UseRegister ( node - > InputAt ( 1 ) ) , <nl> + g . TempImmediate ( 32 ) ) ; <nl> + <nl> + VisitCompare ( selector , opcode , leftOp , rightOp , cont ) ; <nl> + } <nl> + <nl> + void VisitOptimizedWord32Compare ( InstructionSelector * selector , Node * node , <nl> + InstructionCode opcode , <nl> + FlagsContinuation * cont ) { <nl> + if ( FLAG_debug_code ) { <nl> + Mips64OperandGenerator g ( selector ) ; <nl> + InstructionOperand leftOp = g . TempRegister ( ) ; <nl> + InstructionOperand rightOp = g . TempRegister ( ) ; <nl> + InstructionOperand optimizedResult = g . TempRegister ( ) ; <nl> + InstructionOperand fullResult = g . TempRegister ( ) ; <nl> + FlagsCondition condition = cont - > condition ( ) ; <nl> + InstructionCode testOpcode = opcode | <nl> + FlagsConditionField : : encode ( condition ) | <nl> + FlagsModeField : : encode ( kFlags_set ) ; <nl> + <nl> + selector - > Emit ( testOpcode , optimizedResult , g . UseRegister ( node - > InputAt ( 0 ) ) , <nl> + g . UseRegister ( node - > InputAt ( 1 ) ) ) ; <nl> + <nl> + selector - > Emit ( kMips64Dshl , leftOp , g . UseRegister ( node - > InputAt ( 0 ) ) , <nl> + g . TempImmediate ( 32 ) ) ; <nl> + selector - > Emit ( kMips64Dshl , rightOp , g . UseRegister ( node - > InputAt ( 1 ) ) , <nl> + g . TempImmediate ( 32 ) ) ; <nl> + selector - > Emit ( testOpcode , fullResult , leftOp , rightOp ) ; <nl> + <nl> + selector - > Emit ( <nl> + kMips64AssertEqual , g . NoOutput ( ) , optimizedResult , fullResult , <nl> + g . TempImmediate ( BailoutReason : : kUnsupportedNonPrimitiveCompare ) ) ; <nl> + } <nl> + <nl> + VisitWordCompare ( selector , node , opcode , cont , false ) ; <nl> + } <nl> <nl> void VisitWord32Compare ( InstructionSelector * selector , Node * node , <nl> FlagsContinuation * cont ) { <nl> - VisitWordCompare ( selector , node , kMips64Cmp , cont , false ) ; <nl> + / / MIPS64 doesn ' t support Word32 compare instructions . Instead it relies <nl> + / / that the values in registers are correctly sign - extended and uses <nl> + / / Word64 comparison instead . This behavior is correct in most cases , <nl> + / / but doesn ' t work when comparing signed with unsigned operands . <nl> + / / We could simulate full Word32 compare in all cases but this would <nl> + / / create an unnecessary overhead since unsigned integers are rarely <nl> + / / used in JavaScript . <nl> + / / The solution proposed here tries to match a comparison of signed <nl> + / / with unsigned operand , and perform full Word32Compare only <nl> + / / in those cases . Unfortunately , the solution is not complete because <nl> + / / it might skip cases where Word32 full compare is needed , so <nl> + / / basically it is a hack . <nl> + if ( IsNodeUnsigned ( node - > InputAt ( 0 ) ) ! = IsNodeUnsigned ( node - > InputAt ( 1 ) ) ) { <nl> + VisitFullWord32Compare ( selector , node , kMips64Cmp , cont ) ; <nl> + } else { <nl> + VisitOptimizedWord32Compare ( selector , node , kMips64Cmp , cont ) ; <nl> + } <nl> } <nl> <nl> <nl> mmm a / test / unittests / compiler / mips64 / instruction - selector - mips64 - unittest . cc <nl> ppp b / test / unittests / compiler / mips64 / instruction - selector - mips64 - unittest . cc <nl> TEST_P ( InstructionSelectorCmpTest , Parameter ) { <nl> StreamBuilder m ( this , type , type , type ) ; <nl> m . Return ( ( m . * cmp . mi . constructor ) ( m . Parameter ( 0 ) , m . Parameter ( 1 ) ) ) ; <nl> Stream s = m . Build ( ) ; <nl> - ASSERT_EQ ( cmp . expected_size , s . size ( ) ) ; <nl> - EXPECT_EQ ( cmp . mi . arch_opcode , s [ 0 ] - > arch_opcode ( ) ) ; <nl> - EXPECT_EQ ( 2U , s [ 0 ] - > InputCount ( ) ) ; <nl> - EXPECT_EQ ( 1U , s [ 0 ] - > OutputCount ( ) ) ; <nl> + <nl> + if ( FLAG_debug_code & & <nl> + type . representation ( ) = = MachineRepresentation : : kWord32 ) { <nl> + ASSERT_EQ ( 6 , s . size ( ) ) ; <nl> + <nl> + EXPECT_EQ ( cmp . mi . arch_opcode , s [ 0 ] - > arch_opcode ( ) ) ; <nl> + EXPECT_EQ ( 2U , s [ 0 ] - > InputCount ( ) ) ; <nl> + EXPECT_EQ ( 1U , s [ 0 ] - > OutputCount ( ) ) ; <nl> + <nl> + EXPECT_EQ ( kMips64Dshl , s [ 1 ] - > arch_opcode ( ) ) ; <nl> + EXPECT_EQ ( 2U , s [ 1 ] - > InputCount ( ) ) ; <nl> + EXPECT_EQ ( 1U , s [ 1 ] - > OutputCount ( ) ) ; <nl> + <nl> + EXPECT_EQ ( kMips64Dshl , s [ 2 ] - > arch_opcode ( ) ) ; <nl> + EXPECT_EQ ( 2U , s [ 2 ] - > InputCount ( ) ) ; <nl> + EXPECT_EQ ( 1U , s [ 2 ] - > OutputCount ( ) ) ; <nl> + <nl> + EXPECT_EQ ( cmp . mi . arch_opcode , s [ 3 ] - > arch_opcode ( ) ) ; <nl> + EXPECT_EQ ( 2U , s [ 3 ] - > InputCount ( ) ) ; <nl> + EXPECT_EQ ( 1U , s [ 3 ] - > OutputCount ( ) ) ; <nl> + <nl> + EXPECT_EQ ( kMips64AssertEqual , s [ 4 ] - > arch_opcode ( ) ) ; <nl> + EXPECT_EQ ( 3U , s [ 4 ] - > InputCount ( ) ) ; <nl> + EXPECT_EQ ( 0U , s [ 4 ] - > OutputCount ( ) ) ; <nl> + <nl> + EXPECT_EQ ( cmp . mi . arch_opcode , s [ 5 ] - > arch_opcode ( ) ) ; <nl> + EXPECT_EQ ( 2U , s [ 5 ] - > InputCount ( ) ) ; <nl> + EXPECT_EQ ( 1U , s [ 5 ] - > OutputCount ( ) ) ; <nl> + } else { <nl> + ASSERT_EQ ( cmp . expected_size , s . size ( ) ) ; <nl> + EXPECT_EQ ( cmp . mi . arch_opcode , s [ 0 ] - > arch_opcode ( ) ) ; <nl> + EXPECT_EQ ( 2U , s [ 0 ] - > InputCount ( ) ) ; <nl> + EXPECT_EQ ( 1U , s [ 0 ] - > OutputCount ( ) ) ; <nl> + } <nl> } <nl> <nl> INSTANTIATE_TEST_CASE_P ( InstructionSelectorTest , InstructionSelectorCmpTest , <nl>
|
MIPS64 : Fix Word32Compare turbofan operator implementation when comparing signed with unsigned operand
|
v8/v8
|
7499d92d7f4074c3ad7461ea70cbf896e30e6866
|
2016-10-18T12:13:58Z
|
mmm a / BUILD <nl> ppp b / BUILD <nl> cc_library ( <nl> " src / core / iomgr / iomgr_internal . h " , <nl> " src / core / iomgr / iomgr_posix . h " , <nl> " src / core / iomgr / pollset . h " , <nl> - " src / core / iomgr / pollset_kick . h " , <nl> " src / core / iomgr / pollset_kick_posix . h " , <nl> - " src / core / iomgr / pollset_kick_windows . h " , <nl> " src / core / iomgr / pollset_posix . h " , <nl> + " src / core / iomgr / pollset_set_posix . h " , <nl> + " src / core / iomgr / pollset_set_windows . h " , <nl> " src / core / iomgr / pollset_windows . h " , <nl> " src / core / iomgr / resolve_address . h " , <nl> " src / core / iomgr / sockaddr . h " , <nl> cc_library ( <nl> " src / core / iomgr / iomgr . c " , <nl> " src / core / iomgr / iomgr_posix . c " , <nl> " src / core / iomgr / iomgr_windows . c " , <nl> - " src / core / iomgr / pollset_kick . c " , <nl> + " src / core / iomgr / pollset_kick_posix . c " , <nl> " src / core / iomgr / pollset_multipoller_with_epoll . c " , <nl> " src / core / iomgr / pollset_multipoller_with_poll_posix . c " , <nl> " src / core / iomgr / pollset_posix . c " , <nl> + " src / core / iomgr / pollset_set_posix . c " , <nl> + " src / core / iomgr / pollset_set_windows . c " , <nl> " src / core / iomgr / pollset_windows . c " , <nl> " src / core / iomgr / resolve_address_posix . c " , <nl> " src / core / iomgr / resolve_address_windows . c " , <nl> cc_library ( <nl> " src / core / iomgr / iomgr_internal . h " , <nl> " src / core / iomgr / iomgr_posix . h " , <nl> " src / core / iomgr / pollset . h " , <nl> - " src / core / iomgr / pollset_kick . h " , <nl> " src / core / iomgr / pollset_kick_posix . h " , <nl> - " src / core / iomgr / pollset_kick_windows . h " , <nl> " src / core / iomgr / pollset_posix . h " , <nl> + " src / core / iomgr / pollset_set_posix . h " , <nl> + " src / core / iomgr / pollset_set_windows . h " , <nl> " src / core / iomgr / pollset_windows . h " , <nl> " src / core / iomgr / resolve_address . h " , <nl> " src / core / iomgr / sockaddr . h " , <nl> cc_library ( <nl> " src / core / iomgr / iomgr . c " , <nl> " src / core / iomgr / iomgr_posix . c " , <nl> " src / core / iomgr / iomgr_windows . c " , <nl> - " src / core / iomgr / pollset_kick . c " , <nl> + " src / core / iomgr / pollset_kick_posix . c " , <nl> " src / core / iomgr / pollset_multipoller_with_epoll . c " , <nl> " src / core / iomgr / pollset_multipoller_with_poll_posix . c " , <nl> " src / core / iomgr / pollset_posix . c " , <nl> + " src / core / iomgr / pollset_set_posix . c " , <nl> + " src / core / iomgr / pollset_set_windows . c " , <nl> " src / core / iomgr / pollset_windows . c " , <nl> " src / core / iomgr / resolve_address_posix . c " , <nl> " src / core / iomgr / resolve_address_windows . c " , <nl> mmm a / Makefile <nl> ppp b / Makefile <nl> CC_tsan = clang <nl> CXX_tsan = clang + + <nl> LD_tsan = clang <nl> LDXX_tsan = clang + + <nl> - CPPFLAGS_tsan = - O1 - fsanitize = thread - fno - omit - frame - pointer <nl> + CPPFLAGS_tsan = - O0 - fsanitize = thread - fno - omit - frame - pointer <nl> LDFLAGS_tsan = - fsanitize = thread <nl> DEFINES_tsan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR = 10 <nl> <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / transport_security_test | | ( echo test transport_security_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fake_security_bad_hostname_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fake_security_bad_hostname_test | | ( echo test chttp2_fake_security_bad_hostname_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_fake_security_cancel_after_accept_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fake_security_cancel_after_accept_test | | ( echo test chttp2_fake_security_cancel_after_accept_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fake_security_cancel_after_accept_and_writes_closed_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fake_security_cancel_after_accept_and_writes_closed_test | | ( echo test chttp2_fake_security_cancel_after_accept_and_writes_closed_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fake_security_cancel_after_invoke_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fake_security_empty_batch_test | | ( echo test chttp2_fake_security_empty_batch_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fake_security_graceful_server_shutdown_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fake_security_graceful_server_shutdown_test | | ( echo test chttp2_fake_security_graceful_server_shutdown_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_fake_security_invoke_large_request_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fake_security_invoke_large_request_test | | ( echo test chttp2_fake_security_invoke_large_request_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fake_security_max_concurrent_streams_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fake_security_max_concurrent_streams_test | | ( echo test chttp2_fake_security_max_concurrent_streams_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fake_security_max_message_length_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fake_security_simple_request_with_high_initial_sequence_number_test | | ( echo test chttp2_fake_security_simple_request_with_high_initial_sequence_number_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_bad_hostname_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_bad_hostname_test | | ( echo test chttp2_fullstack_bad_hostname_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_fullstack_cancel_after_accept_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_cancel_after_accept_test | | ( echo test chttp2_fullstack_cancel_after_accept_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_cancel_after_accept_and_writes_closed_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_cancel_after_accept_and_writes_closed_test | | ( echo test chttp2_fullstack_cancel_after_accept_and_writes_closed_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_cancel_after_invoke_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_empty_batch_test | | ( echo test chttp2_fullstack_empty_batch_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_graceful_server_shutdown_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_graceful_server_shutdown_test | | ( echo test chttp2_fullstack_graceful_server_shutdown_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_fullstack_invoke_large_request_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_invoke_large_request_test | | ( echo test chttp2_fullstack_invoke_large_request_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_max_concurrent_streams_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_max_concurrent_streams_test | | ( echo test chttp2_fullstack_max_concurrent_streams_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_max_message_length_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_simple_request_with_high_initial_sequence_number_test | | ( echo test chttp2_fullstack_simple_request_with_high_initial_sequence_number_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_uds_posix_bad_hostname_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_uds_posix_bad_hostname_test | | ( echo test chttp2_fullstack_uds_posix_bad_hostname_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_fullstack_uds_posix_cancel_after_accept_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_uds_posix_cancel_after_accept_test | | ( echo test chttp2_fullstack_uds_posix_cancel_after_accept_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_uds_posix_cancel_after_accept_and_writes_closed_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_uds_posix_cancel_after_accept_and_writes_closed_test | | ( echo test chttp2_fullstack_uds_posix_cancel_after_accept_and_writes_closed_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_uds_posix_cancel_after_invoke_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_uds_posix_empty_batch_test | | ( echo test chttp2_fullstack_uds_posix_empty_batch_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_uds_posix_graceful_server_shutdown_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_uds_posix_graceful_server_shutdown_test | | ( echo test chttp2_fullstack_uds_posix_graceful_server_shutdown_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_fullstack_uds_posix_invoke_large_request_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_uds_posix_invoke_large_request_test | | ( echo test chttp2_fullstack_uds_posix_invoke_large_request_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_uds_posix_max_concurrent_streams_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_uds_posix_max_concurrent_streams_test | | ( echo test chttp2_fullstack_uds_posix_max_concurrent_streams_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_uds_posix_max_message_length_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_uds_posix_simple_request_with_high_initial_sequence_number_test | | ( echo test chttp2_fullstack_uds_posix_simple_request_with_high_initial_sequence_number_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_with_poll_bad_hostname_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_with_poll_bad_hostname_test | | ( echo test chttp2_fullstack_with_poll_bad_hostname_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_fullstack_with_poll_cancel_after_accept_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_with_poll_cancel_after_accept_test | | ( echo test chttp2_fullstack_with_poll_cancel_after_accept_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_with_poll_cancel_after_accept_and_writes_closed_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_with_poll_cancel_after_accept_and_writes_closed_test | | ( echo test chttp2_fullstack_with_poll_cancel_after_accept_and_writes_closed_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_with_poll_cancel_after_invoke_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_with_poll_empty_batch_test | | ( echo test chttp2_fullstack_with_poll_empty_batch_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_with_poll_graceful_server_shutdown_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_with_poll_graceful_server_shutdown_test | | ( echo test chttp2_fullstack_with_poll_graceful_server_shutdown_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_fullstack_with_poll_invoke_large_request_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_with_poll_invoke_large_request_test | | ( echo test chttp2_fullstack_with_poll_invoke_large_request_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_with_poll_max_concurrent_streams_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_with_poll_max_concurrent_streams_test | | ( echo test chttp2_fullstack_with_poll_max_concurrent_streams_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_with_poll_max_message_length_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_with_poll_simple_request_with_high_initial_sequence_number_test | | ( echo test chttp2_fullstack_with_poll_simple_request_with_high_initial_sequence_number_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_bad_hostname_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_bad_hostname_test | | ( echo test chttp2_simple_ssl_fullstack_bad_hostname_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_cancel_after_accept_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_cancel_after_accept_test | | ( echo test chttp2_simple_ssl_fullstack_cancel_after_accept_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_test | | ( echo test chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_cancel_after_invoke_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_empty_batch_test | | ( echo test chttp2_simple_ssl_fullstack_empty_batch_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_graceful_server_shutdown_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_graceful_server_shutdown_test | | ( echo test chttp2_simple_ssl_fullstack_graceful_server_shutdown_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_invoke_large_request_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_invoke_large_request_test | | ( echo test chttp2_simple_ssl_fullstack_invoke_large_request_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_max_concurrent_streams_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_max_concurrent_streams_test | | ( echo test chttp2_simple_ssl_fullstack_max_concurrent_streams_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_max_message_length_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_simple_request_with_high_initial_sequence_number_test | | ( echo test chttp2_simple_ssl_fullstack_simple_request_with_high_initial_sequence_number_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_with_poll_bad_hostname_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_with_poll_bad_hostname_test | | ( echo test chttp2_simple_ssl_fullstack_with_poll_bad_hostname_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_with_poll_cancel_after_accept_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_with_poll_cancel_after_accept_test | | ( echo test chttp2_simple_ssl_fullstack_with_poll_cancel_after_accept_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_with_poll_cancel_after_accept_and_writes_closed_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_with_poll_cancel_after_accept_and_writes_closed_test | | ( echo test chttp2_simple_ssl_fullstack_with_poll_cancel_after_accept_and_writes_closed_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_with_poll_cancel_after_invoke_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_with_poll_empty_batch_test | | ( echo test chttp2_simple_ssl_fullstack_with_poll_empty_batch_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_with_poll_graceful_server_shutdown_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_with_poll_graceful_server_shutdown_test | | ( echo test chttp2_simple_ssl_fullstack_with_poll_graceful_server_shutdown_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_with_poll_invoke_large_request_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_with_poll_invoke_large_request_test | | ( echo test chttp2_simple_ssl_fullstack_with_poll_invoke_large_request_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_with_poll_max_concurrent_streams_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_with_poll_max_concurrent_streams_test | | ( echo test chttp2_simple_ssl_fullstack_with_poll_max_concurrent_streams_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_with_poll_max_message_length_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_with_poll_simple_request_with_high_initial_sequence_number_test | | ( echo test chttp2_simple_ssl_fullstack_with_poll_simple_request_with_high_initial_sequence_number_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_with_oauth2_fullstack_bad_hostname_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_with_oauth2_fullstack_bad_hostname_test | | ( echo test chttp2_simple_ssl_with_oauth2_fullstack_bad_hostname_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_test | | ( echo test chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_test | | ( echo test chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_with_oauth2_fullstack_empty_batch_test | | ( echo test chttp2_simple_ssl_with_oauth2_fullstack_empty_batch_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_test | | ( echo test chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_test | | ( echo test chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_test | | ( echo test chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_with_oauth2_fullstack_max_message_length_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_with_oauth2_fullstack_simple_request_with_high_initial_sequence_number_test | | ( echo test chttp2_simple_ssl_with_oauth2_fullstack_simple_request_with_high_initial_sequence_number_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_socket_pair_bad_hostname_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_bad_hostname_test | | ( echo test chttp2_socket_pair_bad_hostname_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_socket_pair_cancel_after_accept_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_cancel_after_accept_test | | ( echo test chttp2_socket_pair_cancel_after_accept_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_socket_pair_cancel_after_accept_and_writes_closed_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_cancel_after_accept_and_writes_closed_test | | ( echo test chttp2_socket_pair_cancel_after_accept_and_writes_closed_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_socket_pair_cancel_after_invoke_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_empty_batch_test | | ( echo test chttp2_socket_pair_empty_batch_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_socket_pair_graceful_server_shutdown_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_graceful_server_shutdown_test | | ( echo test chttp2_socket_pair_graceful_server_shutdown_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_socket_pair_invoke_large_request_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_invoke_large_request_test | | ( echo test chttp2_socket_pair_invoke_large_request_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_socket_pair_max_concurrent_streams_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_max_concurrent_streams_test | | ( echo test chttp2_socket_pair_max_concurrent_streams_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_socket_pair_max_message_length_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_simple_request_with_high_initial_sequence_number_test | | ( echo test chttp2_socket_pair_simple_request_with_high_initial_sequence_number_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_socket_pair_one_byte_at_a_time_bad_hostname_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_one_byte_at_a_time_bad_hostname_test | | ( echo test chttp2_socket_pair_one_byte_at_a_time_bad_hostname_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_test | | ( echo test chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_test | | ( echo test chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_one_byte_at_a_time_empty_batch_test | | ( echo test chttp2_socket_pair_one_byte_at_a_time_empty_batch_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_test | | ( echo test chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_test | | ( echo test chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_test | | ( echo test chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_socket_pair_one_byte_at_a_time_max_message_length_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_one_byte_at_a_time_simple_request_with_high_initial_sequence_number_test | | ( echo test chttp2_socket_pair_one_byte_at_a_time_simple_request_with_high_initial_sequence_number_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_socket_pair_with_grpc_trace_bad_hostname_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_with_grpc_trace_bad_hostname_test | | ( echo test chttp2_socket_pair_with_grpc_trace_bad_hostname_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_socket_pair_with_grpc_trace_cancel_after_accept_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_with_grpc_trace_cancel_after_accept_test | | ( echo test chttp2_socket_pair_with_grpc_trace_cancel_after_accept_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_socket_pair_with_grpc_trace_cancel_after_accept_and_writes_closed_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_with_grpc_trace_cancel_after_accept_and_writes_closed_test | | ( echo test chttp2_socket_pair_with_grpc_trace_cancel_after_accept_and_writes_closed_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_socket_pair_with_grpc_trace_cancel_after_invoke_test " <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_with_grpc_trace_empty_batch_test | | ( echo test chttp2_socket_pair_with_grpc_trace_empty_batch_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_socket_pair_with_grpc_trace_graceful_server_shutdown_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_with_grpc_trace_graceful_server_shutdown_test | | ( echo test chttp2_socket_pair_with_grpc_trace_graceful_server_shutdown_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing chttp2_socket_pair_with_grpc_trace_invoke_large_request_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_with_grpc_trace_invoke_large_request_test | | ( echo test chttp2_socket_pair_with_grpc_trace_invoke_large_request_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_socket_pair_with_grpc_trace_max_concurrent_streams_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_with_grpc_trace_max_concurrent_streams_test | | ( echo test chttp2_socket_pair_with_grpc_trace_max_concurrent_streams_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_socket_pair_with_grpc_trace_max_message_length_test " <nl> test_c : buildtests_c <nl> <nl> <nl> flaky_test_c : buildtests_c <nl> - $ ( E ) " [ RUN ] Testing chttp2_fake_security_cancel_after_accept_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fake_security_cancel_after_accept_test | | ( echo test chttp2_fake_security_cancel_after_accept_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_fake_security_invoke_large_request_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fake_security_invoke_large_request_test | | ( echo test chttp2_fake_security_invoke_large_request_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_fullstack_cancel_after_accept_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_cancel_after_accept_test | | ( echo test chttp2_fullstack_cancel_after_accept_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_fullstack_invoke_large_request_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_invoke_large_request_test | | ( echo test chttp2_fullstack_invoke_large_request_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_fullstack_uds_posix_cancel_after_accept_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_uds_posix_cancel_after_accept_test | | ( echo test chttp2_fullstack_uds_posix_cancel_after_accept_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_fullstack_uds_posix_invoke_large_request_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_uds_posix_invoke_large_request_test | | ( echo test chttp2_fullstack_uds_posix_invoke_large_request_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_fullstack_with_poll_cancel_after_accept_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_with_poll_cancel_after_accept_test | | ( echo test chttp2_fullstack_with_poll_cancel_after_accept_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_fullstack_with_poll_invoke_large_request_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_with_poll_invoke_large_request_test | | ( echo test chttp2_fullstack_with_poll_invoke_large_request_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_cancel_after_accept_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_cancel_after_accept_test | | ( echo test chttp2_simple_ssl_fullstack_cancel_after_accept_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_invoke_large_request_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_invoke_large_request_test | | ( echo test chttp2_simple_ssl_fullstack_invoke_large_request_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_with_poll_cancel_after_accept_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_with_poll_cancel_after_accept_test | | ( echo test chttp2_simple_ssl_fullstack_with_poll_cancel_after_accept_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_fullstack_with_poll_invoke_large_request_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_fullstack_with_poll_invoke_large_request_test | | ( echo test chttp2_simple_ssl_fullstack_with_poll_invoke_large_request_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_test | | ( echo test chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_test | | ( echo test chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_socket_pair_cancel_after_accept_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_cancel_after_accept_test | | ( echo test chttp2_socket_pair_cancel_after_accept_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_socket_pair_invoke_large_request_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_invoke_large_request_test | | ( echo test chttp2_socket_pair_invoke_large_request_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_test | | ( echo test chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_test | | ( echo test chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_socket_pair_with_grpc_trace_cancel_after_accept_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_with_grpc_trace_cancel_after_accept_test | | ( echo test chttp2_socket_pair_with_grpc_trace_cancel_after_accept_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing chttp2_socket_pair_with_grpc_trace_invoke_large_request_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_socket_pair_with_grpc_trace_invoke_large_request_test | | ( echo test chttp2_socket_pair_with_grpc_trace_invoke_large_request_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_invoke_large_request_unsecure_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / chttp2_fullstack_invoke_large_request_unsecure_test | | ( echo test chttp2_fullstack_invoke_large_request_unsecure_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing chttp2_fullstack_uds_posix_invoke_large_request_unsecure_test " <nl> LIBGRPC_SRC = \ <nl> src / core / iomgr / iomgr . c \ <nl> src / core / iomgr / iomgr_posix . c \ <nl> src / core / iomgr / iomgr_windows . c \ <nl> - src / core / iomgr / pollset_kick . c \ <nl> + src / core / iomgr / pollset_kick_posix . c \ <nl> src / core / iomgr / pollset_multipoller_with_epoll . c \ <nl> src / core / iomgr / pollset_multipoller_with_poll_posix . c \ <nl> src / core / iomgr / pollset_posix . c \ <nl> + src / core / iomgr / pollset_set_posix . c \ <nl> + src / core / iomgr / pollset_set_windows . c \ <nl> src / core / iomgr / pollset_windows . c \ <nl> src / core / iomgr / resolve_address_posix . c \ <nl> src / core / iomgr / resolve_address_windows . c \ <nl> LIBGRPC_UNSECURE_SRC = \ <nl> src / core / iomgr / iomgr . c \ <nl> src / core / iomgr / iomgr_posix . c \ <nl> src / core / iomgr / iomgr_windows . c \ <nl> - src / core / iomgr / pollset_kick . c \ <nl> + src / core / iomgr / pollset_kick_posix . c \ <nl> src / core / iomgr / pollset_multipoller_with_epoll . c \ <nl> src / core / iomgr / pollset_multipoller_with_poll_posix . c \ <nl> src / core / iomgr / pollset_posix . c \ <nl> + src / core / iomgr / pollset_set_posix . c \ <nl> + src / core / iomgr / pollset_set_windows . c \ <nl> src / core / iomgr / pollset_windows . c \ <nl> src / core / iomgr / resolve_address_posix . c \ <nl> src / core / iomgr / resolve_address_windows . c \ <nl> mmm a / build . json <nl> ppp b / build . json <nl> <nl> " src / core / iomgr / iomgr_internal . h " , <nl> " src / core / iomgr / iomgr_posix . h " , <nl> " src / core / iomgr / pollset . h " , <nl> - " src / core / iomgr / pollset_kick . h " , <nl> " src / core / iomgr / pollset_kick_posix . h " , <nl> - " src / core / iomgr / pollset_kick_windows . h " , <nl> " src / core / iomgr / pollset_posix . h " , <nl> + " src / core / iomgr / pollset_set_posix . h " , <nl> + " src / core / iomgr / pollset_set_windows . h " , <nl> " src / core / iomgr / pollset_windows . h " , <nl> " src / core / iomgr / resolve_address . h " , <nl> " src / core / iomgr / sockaddr . h " , <nl> <nl> " src / core / iomgr / iomgr . c " , <nl> " src / core / iomgr / iomgr_posix . c " , <nl> " src / core / iomgr / iomgr_windows . c " , <nl> - " src / core / iomgr / pollset_kick . c " , <nl> + " src / core / iomgr / pollset_kick_posix . c " , <nl> " src / core / iomgr / pollset_multipoller_with_epoll . c " , <nl> " src / core / iomgr / pollset_multipoller_with_poll_posix . c " , <nl> " src / core / iomgr / pollset_posix . c " , <nl> + " src / core / iomgr / pollset_set_posix . c " , <nl> + " src / core / iomgr / pollset_set_windows . c " , <nl> " src / core / iomgr / pollset_windows . c " , <nl> " src / core / iomgr / resolve_address_posix . c " , <nl> " src / core / iomgr / resolve_address_windows . c " , <nl> mmm a / gRPC . podspec <nl> ppp b / gRPC . podspec <nl> Pod : : Spec . new do | s | <nl> <nl> # Core cross - platform gRPC library , written in C . <nl> s . subspec ' C - Core ' do | cs | <nl> - cs . source_files = ' src / core / support / env . h ' , ' src / core / support / file . h ' , ' src / core / support / murmur_hash . h ' , ' src / core / support / grpc_string . h ' , ' src / core / support / string_win32 . h ' , ' src / core / support / thd_internal . h ' , ' include / grpc / support / alloc . h ' , ' include / grpc / support / atm . h ' , ' include / grpc / support / atm_gcc_atomic . h ' , ' include / grpc / support / atm_gcc_sync . h ' , ' include / grpc / support / atm_win32 . h ' , ' include / grpc / support / cancellable_platform . h ' , ' include / grpc / support / cmdline . h ' , ' include / grpc / support / cpu . h ' , ' include / grpc / support / histogram . h ' , ' include / grpc / support / host_port . h ' , ' include / grpc / support / log . h ' , ' include / grpc / support / log_win32 . h ' , ' include / grpc / support / port_platform . h ' , ' include / grpc / support / slice . h ' , ' include / grpc / support / slice_buffer . h ' , ' include / grpc / support / string_util . h ' , ' include / grpc / support / subprocess . h ' , ' include / grpc / support / sync . h ' , ' include / grpc / support / sync_generic . h ' , ' include / grpc / support / sync_posix . h ' , ' include / grpc / support / sync_win32 . h ' , ' include / grpc / support / thd . h ' , ' include / grpc / support / grpc_time . h ' , ' include / grpc / support / tls . h ' , ' include / grpc / support / tls_gcc . h ' , ' include / grpc / support / tls_msvc . h ' , ' include / grpc / support / tls_pthread . h ' , ' include / grpc / support / useful . h ' , ' src / core / support / alloc . c ' , ' src / core / support / cancellable . c ' , ' src / core / support / cmdline . c ' , ' src / core / support / cpu_iphone . c ' , ' src / core / support / cpu_linux . c ' , ' src / core / support / cpu_posix . c ' , ' src / core / support / cpu_windows . c ' , ' src / core / support / env_linux . c ' , ' src / core / support / env_posix . c ' , ' src / core / support / env_win32 . c ' , ' src / core / support / file . c ' , ' src / core / support / file_posix . c ' , ' src / core / support / file_win32 . c ' , ' src / core / support / histogram . c ' , ' src / core / support / host_port . c ' , ' src / core / support / log . c ' , ' src / core / support / log_android . c ' , ' src / core / support / log_linux . c ' , ' src / core / support / log_posix . c ' , ' src / core / support / log_win32 . c ' , ' src / core / support / murmur_hash . c ' , ' src / core / support / slice . c ' , ' src / core / support / slice_buffer . c ' , ' src / core / support / string . c ' , ' src / core / support / string_posix . c ' , ' src / core / support / string_win32 . c ' , ' src / core / support / subprocess_posix . c ' , ' src / core / support / sync . c ' , ' src / core / support / sync_posix . c ' , ' src / core / support / sync_win32 . c ' , ' src / core / support / thd . c ' , ' src / core / support / thd_posix . c ' , ' src / core / support / thd_win32 . c ' , ' src / core / support / time . c ' , ' src / core / support / time_posix . c ' , ' src / core / support / time_win32 . c ' , ' src / core / support / tls_pthread . c ' , ' src / core / httpcli / format_request . h ' , ' src / core / httpcli / httpcli . h ' , ' src / core / httpcli / httpcli_security_connector . h ' , ' src / core / httpcli / parser . h ' , ' src / core / security / auth_filters . h ' , ' src / core / security / base64 . h ' , ' src / core / security / credentials . h ' , ' src / core / security / json_token . h ' , ' src / core / security / secure_endpoint . h ' , ' src / core / security / secure_transport_setup . h ' , ' src / core / security / security_connector . h ' , ' src / core / security / security_context . h ' , ' src / core / tsi / fake_transport_security . h ' , ' src / core / tsi / ssl_transport_security . h ' , ' src / core / tsi / transport_security . h ' , ' src / core / tsi / transport_security_interface . h ' , ' src / core / census / grpc_context . h ' , ' src / core / channel / census_filter . h ' , ' src / core / channel / channel_args . h ' , ' src / core / channel / channel_stack . h ' , ' src / core / channel / child_channel . h ' , ' src / core / channel / client_channel . h ' , ' src / core / channel / client_setup . h ' , ' src / core / channel / connected_channel . h ' , ' src / core / channel / context . h ' , ' src / core / channel / http_client_filter . h ' , ' src / core / channel / http_server_filter . h ' , ' src / core / channel / noop_filter . h ' , ' src / core / compression / message_compress . h ' , ' src / core / debug / trace . h ' , ' src / core / iomgr / alarm . h ' , ' src / core / iomgr / alarm_heap . h ' , ' src / core / iomgr / alarm_internal . h ' , ' src / core / iomgr / endpoint . h ' , ' src / core / iomgr / endpoint_pair . h ' , ' src / core / iomgr / fd_posix . h ' , ' src / core / iomgr / iocp_windows . h ' , ' src / core / iomgr / iomgr . h ' , ' src / core / iomgr / iomgr_internal . h ' , ' src / core / iomgr / iomgr_posix . h ' , ' src / core / iomgr / pollset . h ' , ' src / core / iomgr / pollset_kick . h ' , ' src / core / iomgr / pollset_kick_posix . h ' , ' src / core / iomgr / pollset_kick_windows . h ' , ' src / core / iomgr / pollset_posix . h ' , ' src / core / iomgr / pollset_windows . h ' , ' src / core / iomgr / resolve_address . h ' , ' src / core / iomgr / sockaddr . h ' , ' src / core / iomgr / sockaddr_posix . h ' , ' src / core / iomgr / sockaddr_utils . h ' , ' src / core / iomgr / sockaddr_win32 . h ' , ' src / core / iomgr / socket_utils_posix . h ' , ' src / core / iomgr / socket_windows . h ' , ' src / core / iomgr / tcp_client . h ' , ' src / core / iomgr / tcp_posix . h ' , ' src / core / iomgr / tcp_server . h ' , ' src / core / iomgr / tcp_windows . h ' , ' src / core / iomgr / time_averaged_stats . h ' , ' src / core / iomgr / wakeup_fd_pipe . h ' , ' src / core / iomgr / wakeup_fd_posix . h ' , ' src / core / json / json . h ' , ' src / core / json / json_common . h ' , ' src / core / json / json_reader . h ' , ' src / core / json / json_writer . h ' , ' src / core / profiling / timers . h ' , ' src / core / profiling / timers_preciseclock . h ' , ' src / core / surface / byte_buffer_queue . h ' , ' src / core / surface / call . h ' , ' src / core / surface / channel . h ' , ' src / core / surface / client . h ' , ' src / core / surface / completion_queue . h ' , ' src / core / surface / event_string . h ' , ' src / core / surface / init . h ' , ' src / core / surface / server . h ' , ' src / core / surface / surface_trace . h ' , ' src / core / transport / chttp2 / alpn . h ' , ' src / core / transport / chttp2 / bin_encoder . h ' , ' src / core / transport / chttp2 / frame . h ' , ' src / core / transport / chttp2 / frame_data . h ' , ' src / core / transport / chttp2 / frame_goaway . h ' , ' src / core / transport / chttp2 / frame_ping . h ' , ' src / core / transport / chttp2 / frame_rst_stream . h ' , ' src / core / transport / chttp2 / frame_settings . h ' , ' src / core / transport / chttp2 / frame_window_update . h ' , ' src / core / transport / chttp2 / hpack_parser . h ' , ' src / core / transport / chttp2 / hpack_table . h ' , ' src / core / transport / chttp2 / http2_errors . h ' , ' src / core / transport / chttp2 / huffsyms . h ' , ' src / core / transport / chttp2 / status_conversion . h ' , ' src / core / transport / chttp2 / stream_encoder . h ' , ' src / core / transport / chttp2 / stream_map . h ' , ' src / core / transport / chttp2 / timeout_encoding . h ' , ' src / core / transport / chttp2 / varint . h ' , ' src / core / transport / chttp2_transport . h ' , ' src / core / transport / metadata . h ' , ' src / core / transport / stream_op . h ' , ' src / core / transport / transport . h ' , ' src / core / transport / transport_impl . h ' , ' src / core / census / context . h ' , ' include / grpc / grpc_security . h ' , ' include / grpc / byte_buffer . h ' , ' include / grpc / byte_buffer_reader . h ' , ' include / grpc / compression . h ' , ' include / grpc / grpc . h ' , ' include / grpc / status . h ' , ' include / grpc / census . h ' , ' src / core / httpcli / format_request . c ' , ' src / core / httpcli / httpcli . c ' , ' src / core / httpcli / httpcli_security_connector . c ' , ' src / core / httpcli / parser . c ' , ' src / core / security / base64 . c ' , ' src / core / security / client_auth_filter . c ' , ' src / core / security / credentials . c ' , ' src / core / security / credentials_metadata . c ' , ' src / core / security / credentials_posix . c ' , ' src / core / security / credentials_win32 . c ' , ' src / core / security / google_default_credentials . c ' , ' src / core / security / json_token . c ' , ' src / core / security / secure_endpoint . c ' , ' src / core / security / secure_transport_setup . c ' , ' src / core / security / security_connector . c ' , ' src / core / security / security_context . c ' , ' src / core / security / server_auth_filter . c ' , ' src / core / security / server_secure_chttp2 . c ' , ' src / core / surface / init_secure . c ' , ' src / core / surface / secure_channel_create . c ' , ' src / core / tsi / fake_transport_security . c ' , ' src / core / tsi / ssl_transport_security . c ' , ' src / core / tsi / transport_security . c ' , ' src / core / census / grpc_context . c ' , ' src / core / channel / channel_args . c ' , ' src / core / channel / channel_stack . c ' , ' src / core / channel / child_channel . c ' , ' src / core / channel / client_channel . c ' , ' src / core / channel / client_setup . c ' , ' src / core / channel / connected_channel . c ' , ' src / core / channel / http_client_filter . c ' , ' src / core / channel / http_server_filter . c ' , ' src / core / channel / noop_filter . c ' , ' src / core / compression / algorithm . c ' , ' src / core / compression / message_compress . c ' , ' src / core / debug / trace . c ' , ' src / core / iomgr / alarm . c ' , ' src / core / iomgr / alarm_heap . c ' , ' src / core / iomgr / endpoint . c ' , ' src / core / iomgr / endpoint_pair_posix . c ' , ' src / core / iomgr / endpoint_pair_windows . c ' , ' src / core / iomgr / fd_posix . c ' , ' src / core / iomgr / iocp_windows . c ' , ' src / core / iomgr / iomgr . c ' , ' src / core / iomgr / iomgr_posix . c ' , ' src / core / iomgr / iomgr_windows . c ' , ' src / core / iomgr / pollset_kick . c ' , ' src / core / iomgr / pollset_multipoller_with_epoll . c ' , ' src / core / iomgr / pollset_multipoller_with_poll_posix . c ' , ' src / core / iomgr / pollset_posix . c ' , ' src / core / iomgr / pollset_windows . c ' , ' src / core / iomgr / resolve_address_posix . c ' , ' src / core / iomgr / resolve_address_windows . c ' , ' src / core / iomgr / sockaddr_utils . c ' , ' src / core / iomgr / socket_utils_common_posix . c ' , ' src / core / iomgr / socket_utils_linux . c ' , ' src / core / iomgr / socket_utils_posix . c ' , ' src / core / iomgr / socket_windows . c ' , ' src / core / iomgr / tcp_client_posix . c ' , ' src / core / iomgr / tcp_client_windows . c ' , ' src / core / iomgr / tcp_posix . c ' , ' src / core / iomgr / tcp_server_posix . c ' , ' src / core / iomgr / tcp_server_windows . c ' , ' src / core / iomgr / tcp_windows . c ' , ' src / core / iomgr / time_averaged_stats . c ' , ' src / core / iomgr / wakeup_fd_eventfd . c ' , ' src / core / iomgr / wakeup_fd_nospecial . c ' , ' src / core / iomgr / wakeup_fd_pipe . c ' , ' src / core / iomgr / wakeup_fd_posix . c ' , ' src / core / json / json . c ' , ' src / core / json / json_reader . c ' , ' src / core / json / json_string . c ' , ' src / core / json / json_writer . c ' , ' src / core / profiling / basic_timers . c ' , ' src / core / profiling / stap_timers . c ' , ' src / core / surface / byte_buffer . c ' , ' src / core / surface / byte_buffer_queue . c ' , ' src / core / surface / byte_buffer_reader . c ' , ' src / core / surface / call . c ' , ' src / core / surface / call_details . c ' , ' src / core / surface / call_log_batch . c ' , ' src / core / surface / channel . c ' , ' src / core / surface / channel_create . c ' , ' src / core / surface / client . c ' , ' src / core / surface / completion_queue . c ' , ' src / core / surface / event_string . c ' , ' src / core / surface / init . c ' , ' src / core / surface / lame_client . c ' , ' src / core / surface / metadata_array . c ' , ' src / core / surface / server . c ' , ' src / core / surface / server_chttp2 . c ' , ' src / core / surface / server_create . c ' , ' src / core / surface / surface_trace . c ' , ' src / core / transport / chttp2 / alpn . c ' , ' src / core / transport / chttp2 / bin_encoder . c ' , ' src / core / transport / chttp2 / frame_data . c ' , ' src / core / transport / chttp2 / frame_goaway . c ' , ' src / core / transport / chttp2 / frame_ping . c ' , ' src / core / transport / chttp2 / frame_rst_stream . c ' , ' src / core / transport / chttp2 / frame_settings . c ' , ' src / core / transport / chttp2 / frame_window_update . c ' , ' src / core / transport / chttp2 / hpack_parser . c ' , ' src / core / transport / chttp2 / hpack_table . c ' , ' src / core / transport / chttp2 / huffsyms . c ' , ' src / core / transport / chttp2 / status_conversion . c ' , ' src / core / transport / chttp2 / stream_encoder . c ' , ' src / core / transport / chttp2 / stream_map . c ' , ' src / core / transport / chttp2 / timeout_encoding . c ' , ' src / core / transport / chttp2 / varint . c ' , ' src / core / transport / chttp2_transport . c ' , ' src / core / transport / metadata . c ' , ' src / core / transport / stream_op . c ' , ' src / core / transport / transport . c ' , ' src / core / transport / transport_op_string . c ' , ' src / core / census / context . c ' , ' src / core / census / initialize . c ' , <nl> - cs . private_header_files = ' src / core / support / env . h ' , ' src / core / support / file . h ' , ' src / core / support / murmur_hash . h ' , ' src / core / support / string . h ' , ' src / core / support / string_win32 . h ' , ' src / core / support / thd_internal . h ' , ' src / core / httpcli / format_request . h ' , ' src / core / httpcli / httpcli . h ' , ' src / core / httpcli / httpcli_security_connector . h ' , ' src / core / httpcli / parser . h ' , ' src / core / security / auth_filters . h ' , ' src / core / security / base64 . h ' , ' src / core / security / credentials . h ' , ' src / core / security / json_token . h ' , ' src / core / security / secure_endpoint . h ' , ' src / core / security / secure_transport_setup . h ' , ' src / core / security / security_connector . h ' , ' src / core / security / security_context . h ' , ' src / core / tsi / fake_transport_security . h ' , ' src / core / tsi / ssl_transport_security . h ' , ' src / core / tsi / transport_security . h ' , ' src / core / tsi / transport_security_interface . h ' , ' src / core / census / grpc_context . h ' , ' src / core / channel / census_filter . h ' , ' src / core / channel / channel_args . h ' , ' src / core / channel / channel_stack . h ' , ' src / core / channel / child_channel . h ' , ' src / core / channel / client_channel . h ' , ' src / core / channel / client_setup . h ' , ' src / core / channel / connected_channel . h ' , ' src / core / channel / context . h ' , ' src / core / channel / http_client_filter . h ' , ' src / core / channel / http_server_filter . h ' , ' src / core / channel / noop_filter . h ' , ' src / core / compression / message_compress . h ' , ' src / core / debug / trace . h ' , ' src / core / iomgr / alarm . h ' , ' src / core / iomgr / alarm_heap . h ' , ' src / core / iomgr / alarm_internal . h ' , ' src / core / iomgr / endpoint . h ' , ' src / core / iomgr / endpoint_pair . h ' , ' src / core / iomgr / fd_posix . h ' , ' src / core / iomgr / iocp_windows . h ' , ' src / core / iomgr / iomgr . h ' , ' src / core / iomgr / iomgr_internal . h ' , ' src / core / iomgr / iomgr_posix . h ' , ' src / core / iomgr / pollset . h ' , ' src / core / iomgr / pollset_kick . h ' , ' src / core / iomgr / pollset_kick_posix . h ' , ' src / core / iomgr / pollset_kick_windows . h ' , ' src / core / iomgr / pollset_posix . h ' , ' src / core / iomgr / pollset_windows . h ' , ' src / core / iomgr / resolve_address . h ' , ' src / core / iomgr / sockaddr . h ' , ' src / core / iomgr / sockaddr_posix . h ' , ' src / core / iomgr / sockaddr_utils . h ' , ' src / core / iomgr / sockaddr_win32 . h ' , ' src / core / iomgr / socket_utils_posix . h ' , ' src / core / iomgr / socket_windows . h ' , ' src / core / iomgr / tcp_client . h ' , ' src / core / iomgr / tcp_posix . h ' , ' src / core / iomgr / tcp_server . h ' , ' src / core / iomgr / tcp_windows . h ' , ' src / core / iomgr / time_averaged_stats . h ' , ' src / core / iomgr / wakeup_fd_pipe . h ' , ' src / core / iomgr / wakeup_fd_posix . h ' , ' src / core / json / json . h ' , ' src / core / json / json_common . h ' , ' src / core / json / json_reader . h ' , ' src / core / json / json_writer . h ' , ' src / core / profiling / timers . h ' , ' src / core / profiling / timers_preciseclock . h ' , ' src / core / surface / byte_buffer_queue . h ' , ' src / core / surface / call . h ' , ' src / core / surface / channel . h ' , ' src / core / surface / client . h ' , ' src / core / surface / completion_queue . h ' , ' src / core / surface / event_string . h ' , ' src / core / surface / init . h ' , ' src / core / surface / server . h ' , ' src / core / surface / surface_trace . h ' , ' src / core / transport / chttp2 / alpn . h ' , ' src / core / transport / chttp2 / bin_encoder . h ' , ' src / core / transport / chttp2 / frame . h ' , ' src / core / transport / chttp2 / frame_data . h ' , ' src / core / transport / chttp2 / frame_goaway . h ' , ' src / core / transport / chttp2 / frame_ping . h ' , ' src / core / transport / chttp2 / frame_rst_stream . h ' , ' src / core / transport / chttp2 / frame_settings . h ' , ' src / core / transport / chttp2 / frame_window_update . h ' , ' src / core / transport / chttp2 / hpack_parser . h ' , ' src / core / transport / chttp2 / hpack_table . h ' , ' src / core / transport / chttp2 / http2_errors . h ' , ' src / core / transport / chttp2 / huffsyms . h ' , ' src / core / transport / chttp2 / status_conversion . h ' , ' src / core / transport / chttp2 / stream_encoder . h ' , ' src / core / transport / chttp2 / stream_map . h ' , ' src / core / transport / chttp2 / timeout_encoding . h ' , ' src / core / transport / chttp2 / varint . h ' , ' src / core / transport / chttp2_transport . h ' , ' src / core / transport / metadata . h ' , ' src / core / transport / stream_op . h ' , ' src / core / transport / transport . h ' , ' src / core / transport / transport_impl . h ' , ' src / core / census / context . h ' , <nl> + cs . source_files = ' src / core / support / env . h ' , ' src / core / support / file . h ' , ' src / core / support / murmur_hash . h ' , ' src / core / support / grpc_string . h ' , ' src / core / support / string_win32 . h ' , ' src / core / support / thd_internal . h ' , ' include / grpc / support / alloc . h ' , ' include / grpc / support / atm . h ' , ' include / grpc / support / atm_gcc_atomic . h ' , ' include / grpc / support / atm_gcc_sync . h ' , ' include / grpc / support / atm_win32 . h ' , ' include / grpc / support / cancellable_platform . h ' , ' include / grpc / support / cmdline . h ' , ' include / grpc / support / cpu . h ' , ' include / grpc / support / histogram . h ' , ' include / grpc / support / host_port . h ' , ' include / grpc / support / log . h ' , ' include / grpc / support / log_win32 . h ' , ' include / grpc / support / port_platform . h ' , ' include / grpc / support / slice . h ' , ' include / grpc / support / slice_buffer . h ' , ' include / grpc / support / string_util . h ' , ' include / grpc / support / subprocess . h ' , ' include / grpc / support / sync . h ' , ' include / grpc / support / sync_generic . h ' , ' include / grpc / support / sync_posix . h ' , ' include / grpc / support / sync_win32 . h ' , ' include / grpc / support / thd . h ' , ' include / grpc / support / grpc_time . h ' , ' include / grpc / support / tls . h ' , ' include / grpc / support / tls_gcc . h ' , ' include / grpc / support / tls_msvc . h ' , ' include / grpc / support / tls_pthread . h ' , ' include / grpc / support / useful . h ' , ' src / core / support / alloc . c ' , ' src / core / support / cancellable . c ' , ' src / core / support / cmdline . c ' , ' src / core / support / cpu_iphone . c ' , ' src / core / support / cpu_linux . c ' , ' src / core / support / cpu_posix . c ' , ' src / core / support / cpu_windows . c ' , ' src / core / support / env_linux . c ' , ' src / core / support / env_posix . c ' , ' src / core / support / env_win32 . c ' , ' src / core / support / file . c ' , ' src / core / support / file_posix . c ' , ' src / core / support / file_win32 . c ' , ' src / core / support / histogram . c ' , ' src / core / support / host_port . c ' , ' src / core / support / log . c ' , ' src / core / support / log_android . c ' , ' src / core / support / log_linux . c ' , ' src / core / support / log_posix . c ' , ' src / core / support / log_win32 . c ' , ' src / core / support / murmur_hash . c ' , ' src / core / support / slice . c ' , ' src / core / support / slice_buffer . c ' , ' src / core / support / string . c ' , ' src / core / support / string_posix . c ' , ' src / core / support / string_win32 . c ' , ' src / core / support / subprocess_posix . c ' , ' src / core / support / sync . c ' , ' src / core / support / sync_posix . c ' , ' src / core / support / sync_win32 . c ' , ' src / core / support / thd . c ' , ' src / core / support / thd_posix . c ' , ' src / core / support / thd_win32 . c ' , ' src / core / support / time . c ' , ' src / core / support / time_posix . c ' , ' src / core / support / time_win32 . c ' , ' src / core / support / tls_pthread . c ' , ' src / core / httpcli / format_request . h ' , ' src / core / httpcli / httpcli . h ' , ' src / core / httpcli / httpcli_security_connector . h ' , ' src / core / httpcli / parser . h ' , ' src / core / security / auth_filters . h ' , ' src / core / security / base64 . h ' , ' src / core / security / credentials . h ' , ' src / core / security / json_token . h ' , ' src / core / security / secure_endpoint . h ' , ' src / core / security / secure_transport_setup . h ' , ' src / core / security / security_connector . h ' , ' src / core / security / security_context . h ' , ' src / core / tsi / fake_transport_security . h ' , ' src / core / tsi / ssl_transport_security . h ' , ' src / core / tsi / transport_security . h ' , ' src / core / tsi / transport_security_interface . h ' , ' src / core / census / grpc_context . h ' , ' src / core / channel / census_filter . h ' , ' src / core / channel / channel_args . h ' , ' src / core / channel / channel_stack . h ' , ' src / core / channel / child_channel . h ' , ' src / core / channel / client_channel . h ' , ' src / core / channel / client_setup . h ' , ' src / core / channel / connected_channel . h ' , ' src / core / channel / context . h ' , ' src / core / channel / http_client_filter . h ' , ' src / core / channel / http_server_filter . h ' , ' src / core / channel / noop_filter . h ' , ' src / core / compression / message_compress . h ' , ' src / core / debug / trace . h ' , ' src / core / iomgr / alarm . h ' , ' src / core / iomgr / alarm_heap . h ' , ' src / core / iomgr / alarm_internal . h ' , ' src / core / iomgr / endpoint . h ' , ' src / core / iomgr / endpoint_pair . h ' , ' src / core / iomgr / fd_posix . h ' , ' src / core / iomgr / iocp_windows . h ' , ' src / core / iomgr / iomgr . h ' , ' src / core / iomgr / iomgr_internal . h ' , ' src / core / iomgr / iomgr_posix . h ' , ' src / core / iomgr / pollset . h ' , ' src / core / iomgr / pollset_kick_posix . h ' , ' src / core / iomgr / pollset_posix . h ' , ' src / core / iomgr / pollset_set_posix . h ' , ' src / core / iomgr / pollset_set_windows . h ' , ' src / core / iomgr / pollset_windows . h ' , ' src / core / iomgr / resolve_address . h ' , ' src / core / iomgr / sockaddr . h ' , ' src / core / iomgr / sockaddr_posix . h ' , ' src / core / iomgr / sockaddr_utils . h ' , ' src / core / iomgr / sockaddr_win32 . h ' , ' src / core / iomgr / socket_utils_posix . h ' , ' src / core / iomgr / socket_windows . h ' , ' src / core / iomgr / tcp_client . h ' , ' src / core / iomgr / tcp_posix . h ' , ' src / core / iomgr / tcp_server . h ' , ' src / core / iomgr / tcp_windows . h ' , ' src / core / iomgr / time_averaged_stats . h ' , ' src / core / iomgr / wakeup_fd_pipe . h ' , ' src / core / iomgr / wakeup_fd_posix . h ' , ' src / core / json / json . h ' , ' src / core / json / json_common . h ' , ' src / core / json / json_reader . h ' , ' src / core / json / json_writer . h ' , ' src / core / profiling / timers . h ' , ' src / core / profiling / timers_preciseclock . h ' , ' src / core / surface / byte_buffer_queue . h ' , ' src / core / surface / call . h ' , ' src / core / surface / channel . h ' , ' src / core / surface / client . h ' , ' src / core / surface / completion_queue . h ' , ' src / core / surface / event_string . h ' , ' src / core / surface / init . h ' , ' src / core / surface / server . h ' , ' src / core / surface / surface_trace . h ' , ' src / core / transport / chttp2 / alpn . h ' , ' src / core / transport / chttp2 / bin_encoder . h ' , ' src / core / transport / chttp2 / frame . h ' , ' src / core / transport / chttp2 / frame_data . h ' , ' src / core / transport / chttp2 / frame_goaway . h ' , ' src / core / transport / chttp2 / frame_ping . h ' , ' src / core / transport / chttp2 / frame_rst_stream . h ' , ' src / core / transport / chttp2 / frame_settings . h ' , ' src / core / transport / chttp2 / frame_window_update . h ' , ' src / core / transport / chttp2 / hpack_parser . h ' , ' src / core / transport / chttp2 / hpack_table . h ' , ' src / core / transport / chttp2 / http2_errors . h ' , ' src / core / transport / chttp2 / huffsyms . h ' , ' src / core / transport / chttp2 / status_conversion . h ' , ' src / core / transport / chttp2 / stream_encoder . h ' , ' src / core / transport / chttp2 / stream_map . h ' , ' src / core / transport / chttp2 / timeout_encoding . h ' , ' src / core / transport / chttp2 / varint . h ' , ' src / core / transport / chttp2_transport . h ' , ' src / core / transport / metadata . h ' , ' src / core / transport / stream_op . h ' , ' src / core / transport / transport . h ' , ' src / core / transport / transport_impl . h ' , ' src / core / census / context . h ' , ' include / grpc / grpc_security . h ' , ' include / grpc / byte_buffer . h ' , ' include / grpc / byte_buffer_reader . h ' , ' include / grpc / compression . h ' , ' include / grpc / grpc . h ' , ' include / grpc / status . h ' , ' include / grpc / census . h ' , ' src / core / httpcli / format_request . c ' , ' src / core / httpcli / httpcli . c ' , ' src / core / httpcli / httpcli_security_connector . c ' , ' src / core / httpcli / parser . c ' , ' src / core / security / base64 . c ' , ' src / core / security / client_auth_filter . c ' , ' src / core / security / credentials . c ' , ' src / core / security / credentials_metadata . c ' , ' src / core / security / credentials_posix . c ' , ' src / core / security / credentials_win32 . c ' , ' src / core / security / google_default_credentials . c ' , ' src / core / security / json_token . c ' , ' src / core / security / secure_endpoint . c ' , ' src / core / security / secure_transport_setup . c ' , ' src / core / security / security_connector . c ' , ' src / core / security / security_context . c ' , ' src / core / security / server_auth_filter . c ' , ' src / core / security / server_secure_chttp2 . c ' , ' src / core / surface / init_secure . c ' , ' src / core / surface / secure_channel_create . c ' , ' src / core / tsi / fake_transport_security . c ' , ' src / core / tsi / ssl_transport_security . c ' , ' src / core / tsi / transport_security . c ' , ' src / core / census / grpc_context . c ' , ' src / core / channel / channel_args . c ' , ' src / core / channel / channel_stack . c ' , ' src / core / channel / child_channel . c ' , ' src / core / channel / client_channel . c ' , ' src / core / channel / client_setup . c ' , ' src / core / channel / connected_channel . c ' , ' src / core / channel / http_client_filter . c ' , ' src / core / channel / http_server_filter . c ' , ' src / core / channel / noop_filter . c ' , ' src / core / compression / algorithm . c ' , ' src / core / compression / message_compress . c ' , ' src / core / debug / trace . c ' , ' src / core / iomgr / alarm . c ' , ' src / core / iomgr / alarm_heap . c ' , ' src / core / iomgr / endpoint . c ' , ' src / core / iomgr / endpoint_pair_posix . c ' , ' src / core / iomgr / endpoint_pair_windows . c ' , ' src / core / iomgr / fd_posix . c ' , ' src / core / iomgr / iocp_windows . c ' , ' src / core / iomgr / iomgr . c ' , ' src / core / iomgr / iomgr_posix . c ' , ' src / core / iomgr / iomgr_windows . c ' , ' src / core / iomgr / pollset_kick_posix . c ' , ' src / core / iomgr / pollset_multipoller_with_epoll . c ' , ' src / core / iomgr / pollset_multipoller_with_poll_posix . c ' , ' src / core / iomgr / pollset_posix . c ' , ' src / core / iomgr / pollset_set_posix . c ' , ' src / core / iomgr / pollset_set_windows . c ' , ' src / core / iomgr / pollset_windows . c ' , ' src / core / iomgr / resolve_address_posix . c ' , ' src / core / iomgr / resolve_address_windows . c ' , ' src / core / iomgr / sockaddr_utils . c ' , ' src / core / iomgr / socket_utils_common_posix . c ' , ' src / core / iomgr / socket_utils_linux . c ' , ' src / core / iomgr / socket_utils_posix . c ' , ' src / core / iomgr / socket_windows . c ' , ' src / core / iomgr / tcp_client_posix . c ' , ' src / core / iomgr / tcp_client_windows . c ' , ' src / core / iomgr / tcp_posix . c ' , ' src / core / iomgr / tcp_server_posix . c ' , ' src / core / iomgr / tcp_server_windows . c ' , ' src / core / iomgr / tcp_windows . c ' , ' src / core / iomgr / time_averaged_stats . c ' , ' src / core / iomgr / wakeup_fd_eventfd . c ' , ' src / core / iomgr / wakeup_fd_nospecial . c ' , ' src / core / iomgr / wakeup_fd_pipe . c ' , ' src / core / iomgr / wakeup_fd_posix . c ' , ' src / core / json / json . c ' , ' src / core / json / json_reader . c ' , ' src / core / json / json_string . c ' , ' src / core / json / json_writer . c ' , ' src / core / profiling / basic_timers . c ' , ' src / core / profiling / stap_timers . c ' , ' src / core / surface / byte_buffer . c ' , ' src / core / surface / byte_buffer_queue . c ' , ' src / core / surface / byte_buffer_reader . c ' , ' src / core / surface / call . c ' , ' src / core / surface / call_details . c ' , ' src / core / surface / call_log_batch . c ' , ' src / core / surface / channel . c ' , ' src / core / surface / channel_create . c ' , ' src / core / surface / client . c ' , ' src / core / surface / completion_queue . c ' , ' src / core / surface / event_string . c ' , ' src / core / surface / init . c ' , ' src / core / surface / lame_client . c ' , ' src / core / surface / metadata_array . c ' , ' src / core / surface / server . c ' , ' src / core / surface / server_chttp2 . c ' , ' src / core / surface / server_create . c ' , ' src / core / surface / surface_trace . c ' , ' src / core / transport / chttp2 / alpn . c ' , ' src / core / transport / chttp2 / bin_encoder . c ' , ' src / core / transport / chttp2 / frame_data . c ' , ' src / core / transport / chttp2 / frame_goaway . c ' , ' src / core / transport / chttp2 / frame_ping . c ' , ' src / core / transport / chttp2 / frame_rst_stream . c ' , ' src / core / transport / chttp2 / frame_settings . c ' , ' src / core / transport / chttp2 / frame_window_update . c ' , ' src / core / transport / chttp2 / hpack_parser . c ' , ' src / core / transport / chttp2 / hpack_table . c ' , ' src / core / transport / chttp2 / huffsyms . c ' , ' src / core / transport / chttp2 / status_conversion . c ' , ' src / core / transport / chttp2 / stream_encoder . c ' , ' src / core / transport / chttp2 / stream_map . c ' , ' src / core / transport / chttp2 / timeout_encoding . c ' , ' src / core / transport / chttp2 / varint . c ' , ' src / core / transport / chttp2_transport . c ' , ' src / core / transport / metadata . c ' , ' src / core / transport / stream_op . c ' , ' src / core / transport / transport . c ' , ' src / core / transport / transport_op_string . c ' , ' src / core / census / context . c ' , ' src / core / census / initialize . c ' , <nl> + cs . private_header_files = ' src / core / support / env . h ' , ' src / core / support / file . h ' , ' src / core / support / murmur_hash . h ' , ' src / core / support / string . h ' , ' src / core / support / string_win32 . h ' , ' src / core / support / thd_internal . h ' , ' src / core / httpcli / format_request . h ' , ' src / core / httpcli / httpcli . h ' , ' src / core / httpcli / httpcli_security_connector . h ' , ' src / core / httpcli / parser . h ' , ' src / core / security / auth_filters . h ' , ' src / core / security / base64 . h ' , ' src / core / security / credentials . h ' , ' src / core / security / json_token . h ' , ' src / core / security / secure_endpoint . h ' , ' src / core / security / secure_transport_setup . h ' , ' src / core / security / security_connector . h ' , ' src / core / security / security_context . h ' , ' src / core / tsi / fake_transport_security . h ' , ' src / core / tsi / ssl_transport_security . h ' , ' src / core / tsi / transport_security . h ' , ' src / core / tsi / transport_security_interface . h ' , ' src / core / census / grpc_context . h ' , ' src / core / channel / census_filter . h ' , ' src / core / channel / channel_args . h ' , ' src / core / channel / channel_stack . h ' , ' src / core / channel / child_channel . h ' , ' src / core / channel / client_channel . h ' , ' src / core / channel / client_setup . h ' , ' src / core / channel / connected_channel . h ' , ' src / core / channel / context . h ' , ' src / core / channel / http_client_filter . h ' , ' src / core / channel / http_server_filter . h ' , ' src / core / channel / noop_filter . h ' , ' src / core / compression / message_compress . h ' , ' src / core / debug / trace . h ' , ' src / core / iomgr / alarm . h ' , ' src / core / iomgr / alarm_heap . h ' , ' src / core / iomgr / alarm_internal . h ' , ' src / core / iomgr / endpoint . h ' , ' src / core / iomgr / endpoint_pair . h ' , ' src / core / iomgr / fd_posix . h ' , ' src / core / iomgr / iocp_windows . h ' , ' src / core / iomgr / iomgr . h ' , ' src / core / iomgr / iomgr_internal . h ' , ' src / core / iomgr / iomgr_posix . h ' , ' src / core / iomgr / pollset . h ' , ' src / core / iomgr / pollset_kick_posix . h ' , ' src / core / iomgr / pollset_posix . h ' , ' src / core / iomgr / pollset_set_posix . h ' , ' src / core / iomgr / pollset_set_windows . h ' , ' src / core / iomgr / pollset_windows . h ' , ' src / core / iomgr / resolve_address . h ' , ' src / core / iomgr / sockaddr . h ' , ' src / core / iomgr / sockaddr_posix . h ' , ' src / core / iomgr / sockaddr_utils . h ' , ' src / core / iomgr / sockaddr_win32 . h ' , ' src / core / iomgr / socket_utils_posix . h ' , ' src / core / iomgr / socket_windows . h ' , ' src / core / iomgr / tcp_client . h ' , ' src / core / iomgr / tcp_posix . h ' , ' src / core / iomgr / tcp_server . h ' , ' src / core / iomgr / tcp_windows . h ' , ' src / core / iomgr / time_averaged_stats . h ' , ' src / core / iomgr / wakeup_fd_pipe . h ' , ' src / core / iomgr / wakeup_fd_posix . h ' , ' src / core / json / json . h ' , ' src / core / json / json_common . h ' , ' src / core / json / json_reader . h ' , ' src / core / json / json_writer . h ' , ' src / core / profiling / timers . h ' , ' src / core / profiling / timers_preciseclock . h ' , ' src / core / surface / byte_buffer_queue . h ' , ' src / core / surface / call . h ' , ' src / core / surface / channel . h ' , ' src / core / surface / client . h ' , ' src / core / surface / completion_queue . h ' , ' src / core / surface / event_string . h ' , ' src / core / surface / init . h ' , ' src / core / surface / server . h ' , ' src / core / surface / surface_trace . h ' , ' src / core / transport / chttp2 / alpn . h ' , ' src / core / transport / chttp2 / bin_encoder . h ' , ' src / core / transport / chttp2 / frame . h ' , ' src / core / transport / chttp2 / frame_data . h ' , ' src / core / transport / chttp2 / frame_goaway . h ' , ' src / core / transport / chttp2 / frame_ping . h ' , ' src / core / transport / chttp2 / frame_rst_stream . h ' , ' src / core / transport / chttp2 / frame_settings . h ' , ' src / core / transport / chttp2 / frame_window_update . h ' , ' src / core / transport / chttp2 / hpack_parser . h ' , ' src / core / transport / chttp2 / hpack_table . h ' , ' src / core / transport / chttp2 / http2_errors . h ' , ' src / core / transport / chttp2 / huffsyms . h ' , ' src / core / transport / chttp2 / status_conversion . h ' , ' src / core / transport / chttp2 / stream_encoder . h ' , ' src / core / transport / chttp2 / stream_map . h ' , ' src / core / transport / chttp2 / timeout_encoding . h ' , ' src / core / transport / chttp2 / varint . h ' , ' src / core / transport / chttp2_transport . h ' , ' src / core / transport / metadata . h ' , ' src / core / transport / stream_op . h ' , ' src / core / transport / transport . h ' , ' src / core / transport / transport_impl . h ' , ' src / core / census / context . h ' , <nl> cs . header_mappings_dir = ' . ' <nl> # The core library includes its headers as either " src / core / . . . " or " grpc / . . . " , meaning we have <nl> # to tell XCode to look for headers under the " include " subdirectory too . <nl> mmm a / include / grpc / byte_buffer . h <nl> ppp b / include / grpc / byte_buffer . h <nl> size_t grpc_byte_buffer_length ( grpc_byte_buffer * bb ) ; <nl> / * * Destroys \ a byte_buffer deallocating all its memory . * / <nl> void grpc_byte_buffer_destroy ( grpc_byte_buffer * byte_buffer ) ; <nl> <nl> - <nl> / * * Reader for byte buffers . Iterates over slices in the byte buffer * / <nl> struct grpc_byte_buffer_reader ; <nl> typedef struct grpc_byte_buffer_reader grpc_byte_buffer_reader ; <nl> int grpc_byte_buffer_reader_next ( grpc_byte_buffer_reader * reader , <nl> } <nl> # endif <nl> <nl> - # endif / * GRPC_BYTE_BUFFER_H * / <nl> + # endif / * GRPC_BYTE_BUFFER_H * / <nl> mmm a / include / grpc / byte_buffer_reader . h <nl> ppp b / include / grpc / byte_buffer_reader . h <nl> struct grpc_byte_buffer_reader { <nl> } <nl> # endif <nl> <nl> - # endif / * GRPC_BYTE_BUFFER_READER_H * / <nl> + # endif / * GRPC_BYTE_BUFFER_READER_H * / <nl> mmm a / include / grpc / compression . h <nl> ppp b / include / grpc / compression . h <nl> const char * grpc_compression_algorithm_name ( <nl> grpc_compression_algorithm grpc_compression_algorithm_for_level ( <nl> grpc_compression_level level ) ; <nl> <nl> - # endif / * GRPC_COMPRESSION_H * / <nl> + # endif / * GRPC_COMPRESSION_H * / <nl> mmm a / include / grpc / grpc . h <nl> ppp b / include / grpc / grpc . h <nl> typedef enum grpc_call_error { <nl> / * the flags value was illegal for this call * / <nl> GRPC_CALL_ERROR_INVALID_FLAGS , <nl> / * invalid metadata was passed to this call * / <nl> - GRPC_CALL_ERROR_INVALID_METADATA <nl> + GRPC_CALL_ERROR_INVALID_METADATA , <nl> + / * completion queue for notification has not been registered with the server <nl> + * / <nl> + GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE <nl> } grpc_call_error ; <nl> <nl> / * Write Flags : * / <nl> typedef enum { <nl> no arguments ) * / <nl> typedef struct grpc_op { <nl> grpc_op_type op ; <nl> - gpr_uint32 flags ; / * * < Write flags bitset for grpc_begin_messages * / <nl> + gpr_uint32 flags ; / * * < Write flags bitset for grpc_begin_messages * / <nl> union { <nl> struct { <nl> size_t count ; <nl> void grpc_shutdown ( void ) ; <nl> grpc_completion_queue * grpc_completion_queue_create ( void ) ; <nl> <nl> / * * Blocks until an event is available , the completion queue is being shut down , <nl> - or deadline is reached . <nl> + or deadline is reached . <nl> <nl> Returns a grpc_event with type GRPC_QUEUE_TIMEOUT on timeout , <nl> otherwise a grpc_event describing the event that occurred . <nl> grpc_event grpc_completion_queue_next ( grpc_completion_queue * cq , <nl> gpr_timespec deadline ) ; <nl> <nl> / * * Blocks until an event with tag ' tag ' is available , the completion queue is <nl> - being shutdown or deadline is reached . <nl> + being shutdown or deadline is reached . <nl> <nl> Returns a grpc_event with type GRPC_QUEUE_TIMEOUT on timeout , <nl> otherwise a grpc_event describing the event that occurred . <nl> void grpc_server_destroy ( grpc_server * server ) ; <nl> <nl> Tracers ( usually controlled by the environment variable GRPC_TRACE ) <nl> allow printf - style debugging on GRPC internals , and are useful for <nl> - tracking down problems in the field . <nl> + tracking down problems in the field . <nl> <nl> - Use of this function is not strictly thread - safe , but the <nl> + Use of this function is not strictly thread - safe , but the <nl> thread - safety issues raised by it should not be of concern . * / <nl> int grpc_tracer_set_enabled ( const char * name , int enabled ) ; <nl> <nl> mmm a / include / grpc / grpc_security . h <nl> ppp b / include / grpc / grpc_security . h <nl> grpc_call_error grpc_call_set_credentials ( grpc_call * call , <nl> <nl> / * TODO ( jboeuf ) : Define some well - known property names . * / <nl> <nl> - # define GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME \ <nl> - " transport_security_type " <nl> + # define GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME " transport_security_type " <nl> # define GRPC_FAKE_TRANSPORT_SECURITY_TYPE " fake " <nl> # define GRPC_SSL_TRANSPORT_SECURITY_TYPE " ssl " <nl> <nl> const grpc_auth_context * grpc_call_auth_context ( grpc_call * call ) ; <nl> } <nl> # endif <nl> <nl> - # endif / * GRPC_GRPC_SECURITY_H * / <nl> + # endif / * GRPC_GRPC_SECURITY_H * / <nl> mmm a / include / grpc / support / slice . h <nl> ppp b / include / grpc / support / slice . h <nl> int gpr_slice_str_cmp ( gpr_slice a , const char * b ) ; <nl> } <nl> # endif <nl> <nl> - # endif / * GRPC_SUPPORT_SLICE_H * / <nl> + # endif / * GRPC_SUPPORT_SLICE_H * / <nl> mmm a / include / grpc / support / tls_pthread . h <nl> ppp b / include / grpc / support / tls_pthread . h <nl> <nl> # ifndef GRPC_SUPPORT_TLS_PTHREAD_H <nl> # define GRPC_SUPPORT_TLS_PTHREAD_H <nl> <nl> - # include < grpc / support / log . h > / * for GPR_ASSERT * / <nl> + # include < grpc / support / log . h > / * for GPR_ASSERT * / <nl> # include < pthread . h > <nl> <nl> / * Thread local storage based on pthread library calls . <nl> struct gpr_pthread_thread_local { <nl> pthread_key_t key ; <nl> } ; <nl> <nl> - # define GPR_TLS_DECL ( name ) \ <nl> - static struct gpr_pthread_thread_local name = { 0 } <nl> + # define GPR_TLS_DECL ( name ) static struct gpr_pthread_thread_local name = { 0 } <nl> <nl> # define gpr_tls_init ( tls ) GPR_ASSERT ( 0 = = pthread_key_create ( & ( tls ) - > key , NULL ) ) <nl> # define gpr_tls_destroy ( tls ) pthread_key_delete ( ( tls ) - > key ) <nl> mmm a / src / core / channel / channel_stack . c <nl> ppp b / src / core / channel / channel_stack . c <nl> void grpc_call_element_send_cancel ( grpc_call_element * cur_elem ) { <nl> op . cancel_with_status = GRPC_STATUS_CANCELLED ; <nl> grpc_call_next_op ( cur_elem , & op ) ; <nl> } <nl> - <nl> - void grpc_call_element_recv_status ( grpc_call_element * cur_elem , <nl> - grpc_status_code status , <nl> - const char * message ) { <nl> - abort ( ) ; <nl> - } <nl> mmm a / src / core / channel / child_channel . c <nl> ppp b / src / core / channel / child_channel . c <nl> static void lb_destroy_channel_elem ( grpc_channel_element * elem ) { <nl> } <nl> <nl> const grpc_channel_filter grpc_child_channel_top_filter = { <nl> - lb_start_transport_op , lb_channel_op , sizeof ( lb_call_data ) , <nl> - lb_init_call_elem , lb_destroy_call_elem , sizeof ( lb_channel_data ) , <nl> - lb_init_channel_elem , lb_destroy_channel_elem , " child - channel " , <nl> + lb_start_transport_op , lb_channel_op , <nl> + sizeof ( lb_call_data ) , lb_init_call_elem , lb_destroy_call_elem , <nl> + sizeof ( lb_channel_data ) , lb_init_channel_elem , lb_destroy_channel_elem , <nl> + " child - channel " , <nl> } ; <nl> <nl> / * grpc_child_channel proper * / <nl> mmm a / src / core / channel / client_channel . c <nl> ppp b / src / core / channel / client_channel . c <nl> <nl> # include " src / core / channel / child_channel . h " <nl> # include " src / core / channel / connected_channel . h " <nl> # include " src / core / iomgr / iomgr . h " <nl> + # include " src / core / iomgr / pollset_set . h " <nl> # include " src / core / support / string . h " <nl> # include < grpc / support / alloc . h > <nl> # include < grpc / support / log . h > <nl> struct call_data { <nl> static int prepare_activate ( grpc_call_element * elem , <nl> grpc_child_channel * on_child ) { <nl> call_data * calld = elem - > call_data ; <nl> + channel_data * chand = elem - > channel_data ; <nl> if ( calld - > state = = CALL_CANCELLED ) return 0 ; <nl> <nl> / * no more access to calld - > s . waiting allowed * / <nl> GPR_ASSERT ( calld - > state = = CALL_WAITING ) ; <nl> + <nl> + if ( calld - > s . waiting_op . bind_pollset ) { <nl> + grpc_transport_setup_del_interested_party ( chand - > transport_setup , <nl> + calld - > s . waiting_op . bind_pollset ) ; <nl> + } <nl> + <nl> calld - > state = CALL_ACTIVE ; <nl> <nl> / * create a child call * / <nl> static void remove_waiting_child ( channel_data * chand , call_data * calld ) { <nl> size_t new_count ; <nl> size_t i ; <nl> for ( i = 0 , new_count = 0 ; i < chand - > waiting_child_count ; i + + ) { <nl> - if ( chand - > waiting_children [ i ] = = calld ) continue ; <nl> + if ( chand - > waiting_children [ i ] = = calld ) { <nl> + grpc_transport_setup_del_interested_party ( <nl> + chand - > transport_setup , calld - > s . waiting_op . bind_pollset ) ; <nl> + continue ; <nl> + } <nl> chand - > waiting_children [ new_count + + ] = chand - > waiting_children [ i ] ; <nl> } <nl> GPR_ASSERT ( new_count = = chand - > waiting_child_count - 1 | | <nl> static void handle_op_after_cancellation ( grpc_call_element * elem , <nl> * op - > recv_state = GRPC_STREAM_CLOSED ; <nl> op - > on_done_recv ( op - > recv_user_data , 1 ) ; <nl> } <nl> + if ( op - > on_consumed ) { <nl> + op - > on_consumed ( op - > on_consumed_user_data , 0 ) ; <nl> + } <nl> } <nl> <nl> static void cc_start_transport_op ( grpc_call_element * elem , <nl> static void cc_start_transport_op ( grpc_call_element * elem , <nl> handle_op_after_cancellation ( elem , op ) ; <nl> } else { <nl> calld - > state = CALL_WAITING ; <nl> + calld - > s . waiting_op . bind_pollset = NULL ; <nl> if ( chand - > active_child ) { <nl> / * channel is connected - use the connected stack * / <nl> if ( prepare_activate ( elem , chand - > active_child ) ) { <nl> static void cc_start_transport_op ( grpc_call_element * elem , <nl> } <nl> calld - > s . waiting_op = * op ; <nl> chand - > waiting_children [ chand - > waiting_child_count + + ] = calld ; <nl> + grpc_transport_setup_add_interested_party ( chand - > transport_setup , <nl> + op - > bind_pollset ) ; <nl> gpr_mu_unlock ( & chand - > mu ) ; <nl> <nl> / * finally initiate transport setup if needed * / <nl> static void cc_start_transport_op ( grpc_call_element * elem , <nl> calld - > s . waiting_op . recv_user_data = op - > recv_user_data ; <nl> } <nl> gpr_mu_unlock ( & chand - > mu ) ; <nl> + if ( op - > on_consumed ) { <nl> + op - > on_consumed ( op - > on_consumed_user_data , 0 ) ; <nl> + } <nl> } <nl> break ; <nl> case CALL_CANCELLED : <nl> static void init_call_elem ( grpc_call_element * elem , <nl> / * Destructor for call_data * / <nl> static void destroy_call_elem ( grpc_call_element * elem ) { <nl> call_data * calld = elem - > call_data ; <nl> + channel_data * chand = elem - > channel_data ; <nl> <nl> / * if the call got activated , we need to destroy the child stack also , and <nl> remove it from the in - flight requests tracked by the child_entry we <nl> picked * / <nl> - if ( calld - > state = = CALL_ACTIVE ) { <nl> - grpc_child_call_destroy ( calld - > s . active . child_call ) ; <nl> + gpr_mu_lock ( & chand - > mu ) ; <nl> + switch ( calld - > state ) { <nl> + case CALL_ACTIVE : <nl> + gpr_mu_unlock ( & chand - > mu ) ; <nl> + grpc_child_call_destroy ( calld - > s . active . child_call ) ; <nl> + break ; <nl> + case CALL_WAITING : <nl> + remove_waiting_child ( chand , calld ) ; <nl> + gpr_mu_unlock ( & chand - > mu ) ; <nl> + break ; <nl> + default : <nl> + gpr_mu_unlock ( & chand - > mu ) ; <nl> + break ; <nl> } <nl> GPR_ASSERT ( calld - > state ! = CALL_WAITING ) ; <nl> } <nl> static void destroy_channel_elem ( grpc_channel_element * elem ) { <nl> } <nl> <nl> const grpc_channel_filter grpc_client_channel_filter = { <nl> - cc_start_transport_op , channel_op , sizeof ( call_data ) , init_call_elem , <nl> - destroy_call_elem , sizeof ( channel_data ) , init_channel_elem , <nl> - destroy_channel_elem , " client - channel " , <nl> + cc_start_transport_op , channel_op , sizeof ( call_data ) , <nl> + init_call_elem , destroy_call_elem , sizeof ( channel_data ) , <nl> + init_channel_elem , destroy_channel_elem , " client - channel " , <nl> } ; <nl> <nl> grpc_transport_setup_result grpc_client_channel_transport_setup_complete ( <nl> mmm a / src / core / channel / client_setup . c <nl> ppp b / src / core / channel / client_setup . c <nl> struct grpc_client_setup { <nl> gpr_cv cv ; <nl> grpc_client_setup_request * active_request ; <nl> int refs ; <nl> + / * * The set of pollsets that are currently interested in this <nl> + connection being established * / <nl> + grpc_pollset_set interested_parties ; <nl> } ; <nl> <nl> struct grpc_client_setup_request { <nl> gpr_timespec grpc_client_setup_request_deadline ( grpc_client_setup_request * r ) { <nl> return r - > deadline ; <nl> } <nl> <nl> + grpc_pollset_set * grpc_client_setup_get_interested_parties ( <nl> + grpc_client_setup_request * r ) { <nl> + return & r - > setup - > interested_parties ; <nl> + } <nl> + <nl> static void destroy_setup ( grpc_client_setup * s ) { <nl> gpr_mu_destroy ( & s - > mu ) ; <nl> gpr_cv_destroy ( & s - > cv ) ; <nl> s - > done ( s - > user_data ) ; <nl> grpc_channel_args_destroy ( s - > args ) ; <nl> + grpc_pollset_set_destroy ( & s - > interested_parties ) ; <nl> gpr_free ( s ) ; <nl> } <nl> <nl> + static void destroy_request ( grpc_client_setup_request * r ) { gpr_free ( r ) ; } <nl> + <nl> / * initiate handshaking * / <nl> static void setup_initiate ( grpc_transport_setup * sp ) { <nl> grpc_client_setup * s = ( grpc_client_setup * ) sp ; <nl> static void setup_initiate ( grpc_transport_setup * sp ) { <nl> int in_alarm = 0 ; <nl> <nl> r - > setup = s ; <nl> - / * TODO ( klempner ) : Actually set a deadline * / <nl> - r - > deadline = gpr_inf_future ; <nl> + r - > deadline = gpr_time_add ( gpr_now ( ) , gpr_time_from_seconds ( 60 ) ) ; <nl> <nl> gpr_mu_lock ( & s - > mu ) ; <nl> GPR_ASSERT ( s - > refs > 0 ) ; <nl> static void setup_initiate ( grpc_transport_setup * sp ) { <nl> if ( ! in_alarm ) { <nl> s - > initiate ( s - > user_data , r ) ; <nl> } else { <nl> - gpr_free ( r ) ; <nl> + destroy_request ( r ) ; <nl> } <nl> } <nl> <nl> + / * * implementation of add_interested_party for setup vtable * / <nl> + static void setup_add_interested_party ( grpc_transport_setup * sp , <nl> + grpc_pollset * pollset ) { <nl> + grpc_client_setup * s = ( grpc_client_setup * ) sp ; <nl> + <nl> + gpr_mu_lock ( & s - > mu ) ; <nl> + grpc_pollset_set_add_pollset ( & s - > interested_parties , pollset ) ; <nl> + gpr_mu_unlock ( & s - > mu ) ; <nl> + } <nl> + <nl> + / * * implementation of del_interested_party for setup vtable * / <nl> + static void setup_del_interested_party ( grpc_transport_setup * sp , <nl> + grpc_pollset * pollset ) { <nl> + grpc_client_setup * s = ( grpc_client_setup * ) sp ; <nl> + <nl> + gpr_mu_lock ( & s - > mu ) ; <nl> + grpc_pollset_set_del_pollset ( & s - > interested_parties , pollset ) ; <nl> + gpr_mu_unlock ( & s - > mu ) ; <nl> + } <nl> + <nl> / * cancel handshaking : cancel all requests , and shutdown ( the caller promises <nl> not to initiate again ) * / <nl> static void setup_cancel ( grpc_transport_setup * sp ) { <nl> static void setup_cancel ( grpc_transport_setup * sp ) { <nl> } <nl> } <nl> <nl> - int grpc_client_setup_cb_begin ( grpc_client_setup_request * r ) { <nl> + int grpc_client_setup_cb_begin ( grpc_client_setup_request * r , <nl> + const char * reason ) { <nl> gpr_mu_lock ( & r - > setup - > mu ) ; <nl> if ( r - > setup - > cancelled ) { <nl> gpr_mu_unlock ( & r - > setup - > mu ) ; <nl> int grpc_client_setup_cb_begin ( grpc_client_setup_request * r ) { <nl> return 1 ; <nl> } <nl> <nl> - void grpc_client_setup_cb_end ( grpc_client_setup_request * r ) { <nl> + void grpc_client_setup_cb_end ( grpc_client_setup_request * r , <nl> + const char * reason ) { <nl> gpr_mu_lock ( & r - > setup - > mu ) ; <nl> r - > setup - > in_cb - - ; <nl> if ( r - > setup - > cancelled ) gpr_cv_signal ( & r - > setup - > cv ) ; <nl> void grpc_client_setup_cb_end ( grpc_client_setup_request * r ) { <nl> } <nl> <nl> / * vtable for transport setup * / <nl> - static const grpc_transport_setup_vtable setup_vtable = { setup_initiate , <nl> - setup_cancel } ; <nl> + static const grpc_transport_setup_vtable setup_vtable = { <nl> + setup_initiate , setup_add_interested_party , setup_del_interested_party , <nl> + setup_cancel } ; <nl> <nl> void grpc_client_setup_create_and_attach ( <nl> grpc_channel_stack * newly_minted_channel , const grpc_channel_args * args , <nl> void grpc_client_setup_create_and_attach ( <nl> s - > in_alarm = 0 ; <nl> s - > in_cb = 0 ; <nl> s - > cancelled = 0 ; <nl> + grpc_pollset_set_init ( & s - > interested_parties ) ; <nl> <nl> grpc_client_channel_set_transport_setup ( newly_minted_channel , & s - > base ) ; <nl> } <nl> <nl> - int grpc_client_setup_request_should_continue ( grpc_client_setup_request * r ) { <nl> + int grpc_client_setup_request_should_continue ( grpc_client_setup_request * r , <nl> + const char * reason ) { <nl> int result ; <nl> if ( gpr_time_cmp ( gpr_now ( ) , r - > deadline ) > 0 ) { <nl> - return 0 ; <nl> + result = 0 ; <nl> + } else { <nl> + gpr_mu_lock ( & r - > setup - > mu ) ; <nl> + result = r - > setup - > active_request = = r ; <nl> + gpr_mu_unlock ( & r - > setup - > mu ) ; <nl> } <nl> - gpr_mu_lock ( & r - > setup - > mu ) ; <nl> - result = r - > setup - > active_request = = r ; <nl> - gpr_mu_unlock ( & r - > setup - > mu ) ; <nl> return result ; <nl> } <nl> <nl> - static void backoff_alarm_done ( void * arg / * grpc_client_setup * / , int success ) { <nl> - grpc_client_setup * s = arg ; <nl> - grpc_client_setup_request * r = gpr_malloc ( sizeof ( grpc_client_setup_request ) ) ; <nl> - r - > setup = s ; <nl> - / * TODO ( klempner ) : Set this to something useful * / <nl> - r - > deadline = gpr_inf_future ; <nl> + static void backoff_alarm_done ( void * arg / * grpc_client_setup_request * / , <nl> + int success ) { <nl> + grpc_client_setup_request * r = arg ; <nl> + grpc_client_setup * s = r - > setup ; <nl> / * Handle status cancelled ? * / <nl> gpr_mu_lock ( & s - > mu ) ; <nl> - s - > active_request = r ; <nl> s - > in_alarm = 0 ; <nl> - if ( ! success ) { <nl> + if ( s - > active_request ! = NULL | | ! success ) { <nl> if ( 0 = = - - s - > refs ) { <nl> gpr_mu_unlock ( & s - > mu ) ; <nl> destroy_setup ( s ) ; <nl> - gpr_free ( r ) ; <nl> + destroy_request ( r ) ; <nl> return ; <nl> } else { <nl> gpr_mu_unlock ( & s - > mu ) ; <nl> + destroy_request ( r ) ; <nl> return ; <nl> } <nl> } <nl> + s - > active_request = r ; <nl> gpr_mu_unlock ( & s - > mu ) ; <nl> s - > initiate ( s - > user_data , r ) ; <nl> } <nl> void grpc_client_setup_request_finish ( grpc_client_setup_request * r , <nl> } else { <nl> retry = 0 ; <nl> } <nl> + <nl> if ( ! retry & & 0 = = - - s - > refs ) { <nl> gpr_mu_unlock ( & s - > mu ) ; <nl> destroy_setup ( s ) ; <nl> - gpr_free ( r ) ; <nl> - return ; <nl> - } <nl> - <nl> - gpr_free ( r ) ; <nl> - <nl> - if ( retry ) { <nl> + destroy_request ( r ) ; <nl> + } else if ( retry ) { <nl> / * TODO ( klempner ) : Replace these values with further consideration . 2x is <nl> probably too aggressive of a backoff . * / <nl> gpr_timespec max_backoff = gpr_time_from_minutes ( 2 ) ; <nl> void grpc_client_setup_request_finish ( grpc_client_setup_request * r , <nl> gpr_timespec deadline = gpr_time_add ( s - > current_backoff_interval , now ) ; <nl> GPR_ASSERT ( ! s - > in_alarm ) ; <nl> s - > in_alarm = 1 ; <nl> - grpc_alarm_init ( & s - > backoff_alarm , deadline , backoff_alarm_done , s , now ) ; <nl> + grpc_alarm_init ( & s - > backoff_alarm , deadline , backoff_alarm_done , r , now ) ; <nl> s - > current_backoff_interval = <nl> gpr_time_add ( s - > current_backoff_interval , s - > current_backoff_interval ) ; <nl> if ( gpr_time_cmp ( s - > current_backoff_interval , max_backoff ) > 0 ) { <nl> s - > current_backoff_interval = max_backoff ; <nl> } <nl> + gpr_mu_unlock ( & s - > mu ) ; <nl> + } else { <nl> + gpr_mu_unlock ( & s - > mu ) ; <nl> + destroy_request ( r ) ; <nl> } <nl> - <nl> - gpr_mu_unlock ( & s - > mu ) ; <nl> } <nl> <nl> const grpc_channel_args * grpc_client_setup_get_channel_args ( <nl> mmm a / src / core / channel / client_setup . h <nl> ppp b / src / core / channel / client_setup . h <nl> void grpc_client_setup_create_and_attach ( <nl> / * Check that r is the active request : needs to be performed at each callback . <nl> If this races , we ' ll have two connection attempts running at once and the <nl> old one will get cleaned up in due course , which is fine . * / <nl> - int grpc_client_setup_request_should_continue ( grpc_client_setup_request * r ) ; <nl> + int grpc_client_setup_request_should_continue ( grpc_client_setup_request * r , <nl> + const char * reason ) ; <nl> void grpc_client_setup_request_finish ( grpc_client_setup_request * r , <nl> int was_successful ) ; <nl> const grpc_channel_args * grpc_client_setup_get_channel_args ( <nl> const grpc_channel_args * grpc_client_setup_get_channel_args ( <nl> / * Call before calling back into the setup listener , and call only if <nl> this function returns 1 . If it returns 1 , also promise to call <nl> grpc_client_setup_cb_end * / <nl> - int grpc_client_setup_cb_begin ( grpc_client_setup_request * r ) ; <nl> - void grpc_client_setup_cb_end ( grpc_client_setup_request * r ) ; <nl> + int grpc_client_setup_cb_begin ( grpc_client_setup_request * r , <nl> + const char * reason ) ; <nl> + void grpc_client_setup_cb_end ( grpc_client_setup_request * r , const char * reason ) ; <nl> <nl> / * Get the deadline for a request passed in to initiate . Implementations should <nl> make a best effort to honor this deadline . * / <nl> gpr_timespec grpc_client_setup_request_deadline ( grpc_client_setup_request * r ) ; <nl> + grpc_pollset_set * grpc_client_setup_get_interested_parties ( <nl> + grpc_client_setup_request * r ) ; <nl> <nl> grpc_mdctx * grpc_client_setup_get_mdctx ( grpc_client_setup_request * r ) ; <nl> <nl> - # endif / * GRPC_INTERNAL_CORE_CHANNEL_CLIENT_SETUP_H * / <nl> + # endif / * GRPC_INTERNAL_CORE_CHANNEL_CLIENT_SETUP_H * / <nl> mmm a / src / core / compression / message_compress . h <nl> ppp b / src / core / compression / message_compress . h <nl> int grpc_msg_compress ( grpc_compression_algorithm algorithm , <nl> int grpc_msg_decompress ( grpc_compression_algorithm algorithm , <nl> gpr_slice_buffer * input , gpr_slice_buffer * output ) ; <nl> <nl> - # endif / * GRPC_INTERNAL_CORE_COMPRESSION_MESSAGE_COMPRESS_H * / <nl> + # endif / * GRPC_INTERNAL_CORE_COMPRESSION_MESSAGE_COMPRESS_H * / <nl> mmm a / src / core / httpcli / httpcli . c <nl> ppp b / src / core / httpcli / httpcli . c <nl> typedef struct { <nl> int use_ssl ; <nl> grpc_httpcli_response_cb on_response ; <nl> void * user_data ; <nl> + grpc_httpcli_context * context ; <nl> + grpc_pollset * pollset ; <nl> + grpc_iomgr_object iomgr_obj ; <nl> } internal_request ; <nl> <nl> static grpc_httpcli_get_override g_get_override = NULL ; <nl> static grpc_httpcli_post_override g_post_override = NULL ; <nl> <nl> + void grpc_httpcli_context_init ( grpc_httpcli_context * context ) { <nl> + grpc_pollset_set_init ( & context - > pollset_set ) ; <nl> + } <nl> + <nl> + void grpc_httpcli_context_destroy ( grpc_httpcli_context * context ) { <nl> + grpc_pollset_set_destroy ( & context - > pollset_set ) ; <nl> + } <nl> + <nl> static void next_address ( internal_request * req ) ; <nl> <nl> static void finish ( internal_request * req , int success ) { <nl> + grpc_pollset_set_del_pollset ( & req - > context - > pollset_set , req - > pollset ) ; <nl> req - > on_response ( req - > user_data , success ? & req - > parser . r : NULL ) ; <nl> grpc_httpcli_parser_destroy ( & req - > parser ) ; <nl> if ( req - > addresses ! = NULL ) { <nl> static void finish ( internal_request * req , int success ) { <nl> } <nl> gpr_slice_unref ( req - > request_text ) ; <nl> gpr_free ( req - > host ) ; <nl> + grpc_iomgr_unregister_object ( & req - > iomgr_obj ) ; <nl> gpr_free ( req ) ; <nl> } <nl> <nl> static void next_address ( internal_request * req ) { <nl> return ; <nl> } <nl> addr = & req - > addresses - > addrs [ req - > next_address + + ] ; <nl> - grpc_tcp_client_connect ( on_connected , req , ( struct sockaddr * ) & addr - > addr , <nl> - addr - > len , req - > deadline ) ; <nl> + grpc_tcp_client_connect ( on_connected , req , & req - > context - > pollset_set , <nl> + ( struct sockaddr * ) & addr - > addr , addr - > len , <nl> + req - > deadline ) ; <nl> } <nl> <nl> static void on_resolved ( void * arg , grpc_resolved_addresses * addresses ) { <nl> static void on_resolved ( void * arg , grpc_resolved_addresses * addresses ) { <nl> next_address ( req ) ; <nl> } <nl> <nl> - void grpc_httpcli_get ( const grpc_httpcli_request * request , <nl> + void grpc_httpcli_get ( grpc_httpcli_context * context , grpc_pollset * pollset , <nl> + const grpc_httpcli_request * request , <nl> gpr_timespec deadline , <nl> grpc_httpcli_response_cb on_response , void * user_data ) { <nl> internal_request * req ; <nl> + char * name ; <nl> if ( g_get_override & & <nl> g_get_override ( request , deadline , on_response , user_data ) ) { <nl> return ; <nl> void grpc_httpcli_get ( const grpc_httpcli_request * request , <nl> req - > user_data = user_data ; <nl> req - > deadline = deadline ; <nl> req - > use_ssl = request - > use_ssl ; <nl> + req - > context = context ; <nl> + req - > pollset = pollset ; <nl> + gpr_asprintf ( & name , " HTTP : GET : % s : % s " , request - > host , request - > path ) ; <nl> + grpc_iomgr_register_object ( & req - > iomgr_obj , name ) ; <nl> + gpr_free ( name ) ; <nl> if ( req - > use_ssl ) { <nl> req - > host = gpr_strdup ( request - > host ) ; <nl> } <nl> <nl> + grpc_pollset_set_add_pollset ( & req - > context - > pollset_set , req - > pollset ) ; <nl> grpc_resolve_address ( request - > host , req - > use_ssl ? " https " : " http " , <nl> on_resolved , req ) ; <nl> } <nl> <nl> - void grpc_httpcli_post ( const grpc_httpcli_request * request , <nl> + void grpc_httpcli_post ( grpc_httpcli_context * context , grpc_pollset * pollset , <nl> + const grpc_httpcli_request * request , <nl> const char * body_bytes , size_t body_size , <nl> gpr_timespec deadline , <nl> grpc_httpcli_response_cb on_response , void * user_data ) { <nl> internal_request * req ; <nl> + char * name ; <nl> if ( g_post_override & & g_post_override ( request , body_bytes , body_size , <nl> deadline , on_response , user_data ) ) { <nl> return ; <nl> void grpc_httpcli_post ( const grpc_httpcli_request * request , <nl> req - > user_data = user_data ; <nl> req - > deadline = deadline ; <nl> req - > use_ssl = request - > use_ssl ; <nl> + req - > context = context ; <nl> + req - > pollset = pollset ; <nl> + gpr_asprintf ( & name , " HTTP : GET : % s : % s " , request - > host , request - > path ) ; <nl> + grpc_iomgr_register_object ( & req - > iomgr_obj , name ) ; <nl> + gpr_free ( name ) ; <nl> if ( req - > use_ssl ) { <nl> req - > host = gpr_strdup ( request - > host ) ; <nl> } <nl> <nl> + grpc_pollset_set_add_pollset ( & req - > context - > pollset_set , req - > pollset ) ; <nl> grpc_resolve_address ( request - > host , req - > use_ssl ? " https " : " http " , <nl> on_resolved , req ) ; <nl> } <nl> mmm a / src / core / httpcli / httpcli . h <nl> ppp b / src / core / httpcli / httpcli . h <nl> <nl> <nl> # include < grpc / support / time . h > <nl> <nl> + # include " src / core / iomgr / pollset_set . h " <nl> + <nl> / * User agent this library reports * / <nl> # define GRPC_HTTPCLI_USER_AGENT " grpc - httpcli / 0 . 0 " <nl> / * Maximum length of a header string of the form ' Key : Value \ r \ n ' * / <nl> typedef struct grpc_httpcli_header { <nl> char * value ; <nl> } grpc_httpcli_header ; <nl> <nl> + / * Tracks in - progress http requests <nl> + TODO ( ctiller ) : allow caching and capturing multiple requests for the <nl> + same content and combining them * / <nl> + typedef struct grpc_httpcli_context { <nl> + grpc_pollset_set pollset_set ; <nl> + } grpc_httpcli_context ; <nl> + <nl> / * A request * / <nl> typedef struct grpc_httpcli_request { <nl> / * The host name to connect to * / <nl> typedef struct grpc_httpcli_response { <nl> typedef void ( * grpc_httpcli_response_cb ) ( void * user_data , <nl> const grpc_httpcli_response * response ) ; <nl> <nl> + void grpc_httpcli_context_init ( grpc_httpcli_context * context ) ; <nl> + void grpc_httpcli_context_destroy ( grpc_httpcli_context * context ) ; <nl> + <nl> / * Asynchronously perform a HTTP GET . <nl> + ' context ' specifies the http context under which to do the get <nl> + ' pollset ' indicates a grpc_pollset that is interested in the result <nl> + of the get - work on this pollset may be used to progress the get <nl> + operation <nl> ' request ' contains request parameters - these are caller owned and can be <nl> destroyed once the call returns <nl> ' deadline ' contains a deadline for the request ( or gpr_inf_future ) <nl> typedef void ( * grpc_httpcli_response_cb ) ( void * user_data , <nl> lifetime of the request <nl> ' on_response ' is a callback to report results to ( and ' user_data ' is a user <nl> supplied pointer to pass to said call ) * / <nl> - void grpc_httpcli_get ( const grpc_httpcli_request * request , <nl> + void grpc_httpcli_get ( grpc_httpcli_context * context , grpc_pollset * pollset , <nl> + const grpc_httpcli_request * request , <nl> gpr_timespec deadline , <nl> grpc_httpcli_response_cb on_response , void * user_data ) ; <nl> <nl> / * Asynchronously perform a HTTP POST . <nl> - When there is no body , pass in NULL as body_bytes . <nl> + ' context ' specifies the http context under which to do the post <nl> + ' pollset ' indicates a grpc_pollset that is interested in the result <nl> + of the post - work on this pollset may be used to progress the post <nl> + operation <nl> + ' request ' contains request parameters - these are caller owned and can be <nl> + destroyed once the call returns <nl> + ' body_bytes ' and ' body_size ' specify the payload for the post . <nl> + When there is no body , pass in NULL as body_bytes . <nl> + ' deadline ' contains a deadline for the request ( or gpr_inf_future ) <nl> + ' em ' points to a caller owned event manager that must be alive for the <nl> + lifetime of the request <nl> + ' on_response ' is a callback to report results to ( and ' user_data ' is a user <nl> + supplied pointer to pass to said call ) <nl> Does not support ? var1 = val1 & var2 = val2 in the path . * / <nl> - void grpc_httpcli_post ( const grpc_httpcli_request * request , <nl> + void grpc_httpcli_post ( grpc_httpcli_context * context , grpc_pollset * pollset , <nl> + const grpc_httpcli_request * request , <nl> const char * body_bytes , size_t body_size , <nl> gpr_timespec deadline , <nl> grpc_httpcli_response_cb on_response , void * user_data ) ; <nl> typedef int ( * grpc_httpcli_post_override ) ( const grpc_httpcli_request * request , <nl> void grpc_httpcli_set_override ( grpc_httpcli_get_override get , <nl> grpc_httpcli_post_override post ) ; <nl> <nl> - # endif / * GRPC_INTERNAL_CORE_HTTPCLI_HTTPCLI_H * / <nl> + # endif / * GRPC_INTERNAL_CORE_HTTPCLI_HTTPCLI_H * / <nl> mmm a / src / core / iomgr / fd_posix . c <nl> ppp b / src / core / iomgr / fd_posix . c <nl> static void destroy ( grpc_fd * fd ) { <nl> gpr_free ( fd ) ; <nl> } <nl> <nl> + # ifdef GRPC_FD_REF_COUNT_DEBUG <nl> + # define REF_BY ( fd , n , reason ) ref_by ( fd , n , reason , __FILE__ , __LINE__ ) <nl> + # define UNREF_BY ( fd , n , reason ) unref_by ( fd , n , reason , __FILE__ , __LINE__ ) <nl> + static void ref_by ( grpc_fd * fd , int n , const char * reason , const char * file , <nl> + int line ) { <nl> + gpr_log ( GPR_DEBUG , " FD % d % p ref % d % d - > % d [ % s ; % s : % d ] " , fd - > fd , fd , n , <nl> + gpr_atm_no_barrier_load ( & fd - > refst ) , <nl> + gpr_atm_no_barrier_load ( & fd - > refst ) + n , reason , file , line ) ; <nl> + # else <nl> + # define REF_BY ( fd , n , reason ) ref_by ( fd , n ) <nl> + # define UNREF_BY ( fd , n , reason ) unref_by ( fd , n ) <nl> static void ref_by ( grpc_fd * fd , int n ) { <nl> + # endif <nl> GPR_ASSERT ( gpr_atm_no_barrier_fetch_add ( & fd - > refst , n ) > 0 ) ; <nl> } <nl> <nl> + # ifdef GRPC_FD_REF_COUNT_DEBUG <nl> + static void unref_by ( grpc_fd * fd , int n , const char * reason , const char * file , <nl> + int line ) { <nl> + gpr_atm old ; <nl> + gpr_log ( GPR_DEBUG , " FD % d % p unref % d % d - > % d [ % s ; % s : % d ] " , fd - > fd , fd , n , <nl> + gpr_atm_no_barrier_load ( & fd - > refst ) , <nl> + gpr_atm_no_barrier_load ( & fd - > refst ) - n , reason , file , line ) ; <nl> + # else <nl> static void unref_by ( grpc_fd * fd , int n ) { <nl> - gpr_atm old = gpr_atm_full_fetch_add ( & fd - > refst , - n ) ; <nl> + gpr_atm old ; <nl> + # endif <nl> + old = gpr_atm_full_fetch_add ( & fd - > refst , - n ) ; <nl> if ( old = = n ) { <nl> - grpc_iomgr_add_callback ( & fd - > on_done_closure ) ; <nl> - freelist_fd ( fd ) ; <nl> + if ( fd - > on_done_closure ) { <nl> + grpc_iomgr_add_callback ( fd - > on_done_closure ) ; <nl> + } <nl> grpc_iomgr_unregister_object ( & fd - > iomgr_object ) ; <nl> + freelist_fd ( fd ) ; <nl> } else { <nl> GPR_ASSERT ( old > n ) ; <nl> } <nl> void grpc_fd_global_shutdown ( void ) { <nl> gpr_mu_destroy ( & fd_freelist_mu ) ; <nl> } <nl> <nl> - static void do_nothing ( void * ignored , int success ) { } <nl> - <nl> grpc_fd * grpc_fd_create ( int fd , const char * name ) { <nl> grpc_fd * r = alloc_fd ( fd ) ; <nl> grpc_iomgr_register_object ( & r - > iomgr_object , name ) ; <nl> - grpc_pollset_add_fd ( grpc_backup_pollset ( ) , r ) ; <nl> return r ; <nl> } <nl> <nl> static void wake_all_watchers_locked ( grpc_fd * fd ) { <nl> } <nl> } <nl> <nl> - void grpc_fd_orphan ( grpc_fd * fd , grpc_iomgr_cb_func on_done , void * user_data ) { <nl> - grpc_iomgr_closure_init ( & fd - > on_done_closure , on_done ? on_done : do_nothing , <nl> - user_data ) ; <nl> + void grpc_fd_orphan ( grpc_fd * fd , grpc_iomgr_closure * on_done , <nl> + const char * reason ) { <nl> + fd - > on_done_closure = on_done ; <nl> shutdown ( fd - > fd , SHUT_RDWR ) ; <nl> - ref_by ( fd , 1 ) ; / * remove active status , but keep referenced * / <nl> + REF_BY ( fd , 1 , reason ) ; / * remove active status , but keep referenced * / <nl> gpr_mu_lock ( & fd - > watcher_mu ) ; <nl> wake_all_watchers_locked ( fd ) ; <nl> gpr_mu_unlock ( & fd - > watcher_mu ) ; <nl> - unref_by ( fd , 2 ) ; / * drop the reference * / <nl> + UNREF_BY ( fd , 2 , reason ) ; / * drop the reference * / <nl> } <nl> <nl> / * increment refcount by two to avoid changing the orphan bit * / <nl> + # ifdef GRPC_FD_REF_COUNT_DEBUG <nl> + void grpc_fd_ref ( grpc_fd * fd , const char * reason , const char * file , int line ) { <nl> + ref_by ( fd , 2 , reason , file , line ) ; <nl> + } <nl> + <nl> + void grpc_fd_unref ( grpc_fd * fd , const char * reason , const char * file , <nl> + int line ) { <nl> + unref_by ( fd , 2 , reason , file , line ) ; <nl> + } <nl> + # else <nl> void grpc_fd_ref ( grpc_fd * fd ) { ref_by ( fd , 2 ) ; } <nl> <nl> void grpc_fd_unref ( grpc_fd * fd ) { unref_by ( fd , 2 ) ; } <nl> + # endif <nl> <nl> static void process_callback ( grpc_iomgr_closure * closure , int success , <nl> - int allow_synchronous_callback ) { <nl> + int allow_synchronous_callback ) { <nl> if ( allow_synchronous_callback ) { <nl> closure - > cb ( closure - > cb_arg , success ) ; <nl> } else { <nl> static void notify_on ( grpc_fd * fd , gpr_atm * st , grpc_iomgr_closure * closure , <nl> GPR_ASSERT ( gpr_atm_no_barrier_load ( st ) = = READY ) ; <nl> gpr_atm_rel_store ( st , NOT_READY ) ; <nl> process_callback ( closure , ! gpr_atm_acq_load ( & fd - > shutdown ) , <nl> - allow_synchronous_callback ) ; <nl> + allow_synchronous_callback ) ; <nl> return ; <nl> default : / * WAITING * / <nl> / * upcallptr was set to a different closure . This is an error ! * / <nl> static void set_ready ( grpc_fd * fd , gpr_atm * st , <nl> / * only one set_ready can be active at once ( but there may be a racing <nl> notify_on ) * / <nl> int success ; <nl> - grpc_iomgr_closure * closure ; <nl> + grpc_iomgr_closure * closure ; <nl> size_t ncb = 0 ; <nl> <nl> gpr_mu_lock ( & fd - > set_state_mu ) ; <nl> gpr_uint32 grpc_fd_begin_poll ( grpc_fd * fd , grpc_pollset * pollset , <nl> gpr_uint32 mask = 0 ; <nl> / * keep track of pollers that have requested our events , in case they change <nl> * / <nl> - grpc_fd_ref ( fd ) ; <nl> + GRPC_FD_REF ( fd , " poll " ) ; <nl> <nl> gpr_mu_lock ( & fd - > watcher_mu ) ; <nl> / * if there is nobody polling for read , but we need to , then start doing so * / <nl> void grpc_fd_end_poll ( grpc_fd_watcher * watcher , int got_read , int got_write ) { <nl> } <nl> gpr_mu_unlock ( & fd - > watcher_mu ) ; <nl> <nl> - grpc_fd_unref ( fd ) ; <nl> + GRPC_FD_UNREF ( fd , " poll " ) ; <nl> } <nl> <nl> void grpc_fd_become_readable ( grpc_fd * fd , int allow_synchronous_callback ) { <nl> mmm a / src / core / iomgr / fd_posix . h <nl> ppp b / src / core / iomgr / fd_posix . h <nl> struct grpc_fd { <nl> gpr_atm shutdown ; <nl> <nl> / * The watcher list . <nl> - <nl> + <nl> The following watcher related fields are protected by watcher_mu . <nl> - <nl> + <nl> An fd_watcher is an ephemeral object created when an fd wants to <nl> begin polling , and destroyed after the poll . <nl> - <nl> + <nl> It denotes the fd ' s interest in whether to read poll or write poll <nl> or both or neither on this fd . <nl> <nl> struct grpc_fd { <nl> <nl> struct grpc_fd * freelist_next ; <nl> <nl> - grpc_iomgr_closure on_done_closure ; <nl> + grpc_iomgr_closure * on_done_closure ; <nl> grpc_iomgr_closure * shutdown_closures [ 2 ] ; <nl> <nl> grpc_iomgr_object iomgr_object ; <nl> grpc_fd * grpc_fd_create ( int fd , const char * name ) ; <nl> If on_done is NULL , no callback will be made . <nl> Requires : * fd initialized ; no outstanding notify_on_read or <nl> notify_on_write . * / <nl> - void grpc_fd_orphan ( grpc_fd * fd , grpc_iomgr_cb_func on_done , void * user_data ) ; <nl> + void grpc_fd_orphan ( grpc_fd * fd , grpc_iomgr_closure * on_done , <nl> + const char * reason ) ; <nl> <nl> / * Begin polling on an fd . <nl> Registers that the given pollset is interested in this fd - so that if read <nl> void grpc_fd_become_readable ( grpc_fd * fd , int allow_synchronous_callback ) ; <nl> void grpc_fd_become_writable ( grpc_fd * fd , int allow_synchronous_callback ) ; <nl> <nl> / * Reference counting for fds * / <nl> + # ifdef GRPC_FD_REF_COUNT_DEBUG <nl> + void grpc_fd_ref ( grpc_fd * fd , const char * reason , const char * file , int line ) ; <nl> + void grpc_fd_unref ( grpc_fd * fd , const char * reason , const char * file , int line ) ; <nl> + # define GRPC_FD_REF ( fd , reason ) grpc_fd_ref ( fd , reason , __FILE__ , __LINE__ ) <nl> + # define GRPC_FD_UNREF ( fd , reason ) grpc_fd_unref ( fd , reason , __FILE__ , __LINE__ ) <nl> + # else <nl> void grpc_fd_ref ( grpc_fd * fd ) ; <nl> void grpc_fd_unref ( grpc_fd * fd ) ; <nl> + # define GRPC_FD_REF ( fd , reason ) grpc_fd_ref ( fd ) <nl> + # define GRPC_FD_UNREF ( fd , reason ) grpc_fd_unref ( fd ) <nl> + # endif <nl> <nl> void grpc_fd_global_init ( void ) ; <nl> void grpc_fd_global_shutdown ( void ) ; <nl> <nl> - # endif / * GRPC_INTERNAL_CORE_IOMGR_FD_POSIX_H * / <nl> + # endif / * GRPC_INTERNAL_CORE_IOMGR_FD_POSIX_H * / <nl> mmm a / src / core / iomgr / iomgr . c <nl> ppp b / src / core / iomgr / iomgr . c <nl> void grpc_iomgr_shutdown ( void ) { <nl> gpr_timespec shutdown_deadline = <nl> gpr_time_add ( gpr_now ( ) , gpr_time_from_seconds ( 10 ) ) ; <nl> <nl> - <nl> gpr_mu_lock ( & g_mu ) ; <nl> g_shutdown = 1 ; <nl> - while ( g_cbs_head | | g_root_object . next ! = & g_root_object ) { <nl> - size_t nobjs = count_objects ( ) ; <nl> - gpr_log ( GPR_DEBUG , " Waiting for % d iomgr objects to be destroyed % s " , nobjs , <nl> - g_cbs_head ? " and executing final callbacks " : " " ) ; <nl> + while ( g_cbs_head ! = NULL | | g_root_object . next ! = & g_root_object ) { <nl> + if ( g_cbs_head ! = NULL & & g_root_object . next ! = & g_root_object ) { <nl> + gpr_log ( GPR_DEBUG , <nl> + " Waiting for % d iomgr objects to be destroyed and executing " <nl> + " final callbacks " , <nl> + count_objects ( ) ) ; <nl> + } else if ( g_cbs_head ! = NULL ) { <nl> + gpr_log ( GPR_DEBUG , " Executing final iomgr callbacks " ) ; <nl> + } else { <nl> + gpr_log ( GPR_DEBUG , " Waiting for % d iomgr objects to be destroyed " , <nl> + count_objects ( ) ) ; <nl> + } <nl> if ( g_cbs_head ) { <nl> do { <nl> closure = g_cbs_head ; <nl> void grpc_iomgr_shutdown ( void ) { <nl> } while ( g_cbs_head ) ; <nl> continue ; <nl> } <nl> - if ( nobjs > 0 ) { <nl> + if ( grpc_alarm_check ( & g_mu , gpr_inf_future , NULL ) ) { <nl> + gpr_log ( GPR_DEBUG , " got late alarm " ) ; <nl> + continue ; <nl> + } <nl> + if ( g_root_object . next ! = & g_root_object ) { <nl> int timeout = 0 ; <nl> - gpr_timespec short_deadline = gpr_time_add ( gpr_now ( ) , <nl> - gpr_time_from_millis ( 100 ) ) ; <nl> + gpr_timespec short_deadline = <nl> + gpr_time_add ( gpr_now ( ) , gpr_time_from_millis ( 100 ) ) ; <nl> while ( gpr_cv_wait ( & g_rcv , & g_mu , short_deadline ) & & g_cbs_head = = NULL ) { <nl> if ( gpr_time_cmp ( gpr_now ( ) , shutdown_deadline ) > 0 ) { <nl> timeout = 1 ; <nl> void grpc_iomgr_shutdown ( void ) { <nl> grpc_kick_poller ( ) ; <nl> gpr_event_wait ( & g_background_callback_executor_done , gpr_inf_future ) ; <nl> <nl> - grpc_iomgr_platform_shutdown ( ) ; <nl> grpc_alarm_list_shutdown ( ) ; <nl> + <nl> + grpc_iomgr_platform_shutdown ( ) ; <nl> gpr_mu_destroy ( & g_mu ) ; <nl> gpr_cv_destroy ( & g_rcv ) ; <nl> } <nl> <nl> void grpc_iomgr_register_object ( grpc_iomgr_object * obj , const char * name ) { <nl> - obj - > name = gpr_strdup ( name ) ; <nl> gpr_mu_lock ( & g_mu ) ; <nl> + obj - > name = gpr_strdup ( name ) ; <nl> obj - > next = & g_root_object ; <nl> obj - > prev = obj - > next - > prev ; <nl> obj - > next - > prev = obj - > prev - > next = obj ; <nl> void grpc_iomgr_register_object ( grpc_iomgr_object * obj , const char * name ) { <nl> } <nl> <nl> void grpc_iomgr_unregister_object ( grpc_iomgr_object * obj ) { <nl> - gpr_free ( obj - > name ) ; <nl> gpr_mu_lock ( & g_mu ) ; <nl> obj - > next - > prev = obj - > prev ; <nl> obj - > prev - > next = obj - > next ; <nl> + gpr_free ( obj - > name ) ; <nl> gpr_cv_signal ( & g_rcv ) ; <nl> gpr_mu_unlock ( & g_mu ) ; <nl> } <nl> <nl> - <nl> void grpc_iomgr_closure_init ( grpc_iomgr_closure * closure , grpc_iomgr_cb_func cb , <nl> void * cb_arg ) { <nl> closure - > cb = cb ; <nl> void grpc_iomgr_add_delayed_callback ( grpc_iomgr_closure * closure , int success ) { <nl> g_cbs_tail - > next = closure ; <nl> g_cbs_tail = closure ; <nl> } <nl> + if ( g_shutdown ) { <nl> + gpr_cv_signal ( & g_rcv ) ; <nl> + } <nl> gpr_mu_unlock ( & g_mu ) ; <nl> } <nl> <nl> - <nl> void grpc_iomgr_add_callback ( grpc_iomgr_closure * closure ) { <nl> grpc_iomgr_add_delayed_callback ( closure , 1 / * GPR_TRUE * / ) ; <nl> } <nl> <nl> - <nl> int grpc_maybe_call_delayed_callbacks ( gpr_mu * drop_mu , int success ) { <nl> int n = 0 ; <nl> gpr_mu * retake_mu = NULL ; <nl> mmm a / src / core / iomgr / pollset . h <nl> ppp b / src / core / iomgr / pollset . h <nl> <nl> # include " src / core / iomgr / pollset_windows . h " <nl> # endif <nl> <nl> - <nl> void grpc_pollset_init ( grpc_pollset * pollset ) ; <nl> void grpc_pollset_shutdown ( grpc_pollset * pollset , <nl> void ( * shutdown_done ) ( void * arg ) , <nl> void * shutdown_done_arg ) ; <nl> void grpc_pollset_destroy ( grpc_pollset * pollset ) ; <nl> <nl> - <nl> / * Do some work on a pollset . <nl> May involve invoking asynchronous callbacks , or actually polling file <nl> descriptors . <nl> void grpc_pollset_destroy ( grpc_pollset * pollset ) ; <nl> May unlock GRPC_POLLSET_MU ( pollset ) during its execution . * / <nl> int grpc_pollset_work ( grpc_pollset * pollset , gpr_timespec deadline ) ; <nl> <nl> - / * Break a pollset out of polling work <nl> + / * Break one polling thread out of polling work for this pollset . <nl> Requires GRPC_POLLSET_MU ( pollset ) locked . * / <nl> void grpc_pollset_kick ( grpc_pollset * pollset ) ; <nl> <nl> - # endif / * GRPC_INTERNAL_CORE_IOMGR_POLLSET_H * / <nl> + # endif / * GRPC_INTERNAL_CORE_IOMGR_POLLSET_H * / <nl> similarity index 81 % <nl> rename from src / core / iomgr / pollset_kick . c <nl> rename to src / core / iomgr / pollset_kick_posix . c <nl> mmm a / src / core / iomgr / pollset_kick . c <nl> ppp b / src / core / iomgr / pollset_kick_posix . c <nl> <nl> # include < grpc / support / port_platform . h > <nl> <nl> # ifdef GPR_POSIX_SOCKET <nl> - # include " src / core / iomgr / pollset_kick . h " <nl> + # include " src / core / iomgr / pollset_kick_posix . h " <nl> <nl> # include < errno . h > <nl> # include < string . h > <nl> static grpc_kick_fd_info * allocate_wfd ( void ) { <nl> return info ; <nl> } <nl> <nl> - static void destroy_wfd ( grpc_kick_fd_info * wfd ) { <nl> + static void destroy_wfd ( grpc_kick_fd_info * wfd ) { <nl> grpc_wakeup_fd_destroy ( & wfd - > wakeup_fd ) ; <nl> gpr_free ( wfd ) ; <nl> } <nl> static void free_wfd ( grpc_kick_fd_info * fd_info ) { <nl> void grpc_pollset_kick_init ( grpc_pollset_kick_state * kick_state ) { <nl> gpr_mu_init ( & kick_state - > mu ) ; <nl> kick_state - > kicked = 0 ; <nl> - kick_state - > fd_info = NULL ; <nl> + kick_state - > fd_list . next = kick_state - > fd_list . prev = & kick_state - > fd_list ; <nl> } <nl> <nl> void grpc_pollset_kick_destroy ( grpc_pollset_kick_state * kick_state ) { <nl> gpr_mu_destroy ( & kick_state - > mu ) ; <nl> - GPR_ASSERT ( kick_state - > fd_info = = NULL ) ; <nl> + GPR_ASSERT ( kick_state - > fd_list . next = = & kick_state - > fd_list ) ; <nl> } <nl> <nl> - int grpc_pollset_kick_pre_poll ( grpc_pollset_kick_state * kick_state ) { <nl> + grpc_kick_fd_info * grpc_pollset_kick_pre_poll ( <nl> + grpc_pollset_kick_state * kick_state ) { <nl> + grpc_kick_fd_info * fd_info ; <nl> gpr_mu_lock ( & kick_state - > mu ) ; <nl> if ( kick_state - > kicked ) { <nl> kick_state - > kicked = 0 ; <nl> gpr_mu_unlock ( & kick_state - > mu ) ; <nl> - return - 1 ; <nl> + return NULL ; <nl> } <nl> - kick_state - > fd_info = allocate_wfd ( ) ; <nl> + fd_info = allocate_wfd ( ) ; <nl> + fd_info - > next = & kick_state - > fd_list ; <nl> + fd_info - > prev = fd_info - > next - > prev ; <nl> + fd_info - > next - > prev = fd_info - > prev - > next = fd_info ; <nl> gpr_mu_unlock ( & kick_state - > mu ) ; <nl> - return GRPC_WAKEUP_FD_GET_READ_FD ( & kick_state - > fd_info - > wakeup_fd ) ; <nl> + return fd_info ; <nl> } <nl> <nl> - void grpc_pollset_kick_consume ( grpc_pollset_kick_state * kick_state ) { <nl> - grpc_wakeup_fd_consume_wakeup ( & kick_state - > fd_info - > wakeup_fd ) ; <nl> + void grpc_pollset_kick_consume ( grpc_pollset_kick_state * kick_state , <nl> + grpc_kick_fd_info * fd_info ) { <nl> + grpc_wakeup_fd_consume_wakeup ( & fd_info - > wakeup_fd ) ; <nl> } <nl> <nl> - void grpc_pollset_kick_post_poll ( grpc_pollset_kick_state * kick_state ) { <nl> + void grpc_pollset_kick_post_poll ( grpc_pollset_kick_state * kick_state , <nl> + grpc_kick_fd_info * fd_info ) { <nl> gpr_mu_lock ( & kick_state - > mu ) ; <nl> - free_wfd ( kick_state - > fd_info ) ; <nl> - kick_state - > fd_info = NULL ; <nl> + fd_info - > next - > prev = fd_info - > prev ; <nl> + fd_info - > prev - > next = fd_info - > next ; <nl> + free_wfd ( fd_info ) ; <nl> gpr_mu_unlock ( & kick_state - > mu ) ; <nl> } <nl> <nl> void grpc_pollset_kick_kick ( grpc_pollset_kick_state * kick_state ) { <nl> gpr_mu_lock ( & kick_state - > mu ) ; <nl> - if ( kick_state - > fd_info ! = NULL ) { <nl> - grpc_wakeup_fd_wakeup ( & kick_state - > fd_info - > wakeup_fd ) ; <nl> + if ( kick_state - > fd_list . next ! = & kick_state - > fd_list ) { <nl> + grpc_wakeup_fd_wakeup ( & kick_state - > fd_list . next - > wakeup_fd ) ; <nl> } else { <nl> kick_state - > kicked = 1 ; <nl> } <nl> void grpc_pollset_kick_global_destroy ( void ) { <nl> gpr_mu_destroy ( & fd_freelist_mu ) ; <nl> } <nl> <nl> - <nl> - # endif / * GPR_POSIX_SOCKET * / <nl> + # endif / * GPR_POSIX_SOCKET * / <nl> mmm a / src / core / iomgr / pollset_kick_posix . h <nl> ppp b / src / core / iomgr / pollset_kick_posix . h <nl> <nl> # include " src / core / iomgr / wakeup_fd_posix . h " <nl> # include < grpc / support / sync . h > <nl> <nl> + / * pollset kicking allows breaking a thread out of polling work for <nl> + a given pollset . <nl> + writing a byte to a pipe is used as a posix - ly portable base <nl> + mechanism , and eventfds are utilized on Linux for better performance . * / <nl> + <nl> typedef struct grpc_kick_fd_info { <nl> grpc_wakeup_fd_info wakeup_fd ; <nl> + / * used for polling list and free list * / <nl> struct grpc_kick_fd_info * next ; <nl> + / * only used when polling * / <nl> + struct grpc_kick_fd_info * prev ; <nl> } grpc_kick_fd_info ; <nl> <nl> typedef struct grpc_pollset_kick_state { <nl> gpr_mu mu ; <nl> int kicked ; <nl> - struct grpc_kick_fd_info * fd_info ; <nl> + struct grpc_kick_fd_info fd_list ; <nl> } grpc_pollset_kick_state ; <nl> <nl> - # endif / * GRPC_INTERNAL_CORE_IOMGR_POLLSET_KICK_POSIX_H * / <nl> + # define GRPC_POLLSET_KICK_GET_FD ( kick_fd_info ) \ <nl> + GRPC_WAKEUP_FD_GET_READ_FD ( & ( kick_fd_info ) - > wakeup_fd ) <nl> + <nl> + / * This is an abstraction around the typical pipe mechanism for waking up a <nl> + thread sitting in a poll ( ) style call . * / <nl> + <nl> + void grpc_pollset_kick_global_init ( void ) ; <nl> + void grpc_pollset_kick_global_destroy ( void ) ; <nl> + <nl> + void grpc_pollset_kick_init ( grpc_pollset_kick_state * kick_state ) ; <nl> + void grpc_pollset_kick_destroy ( grpc_pollset_kick_state * kick_state ) ; <nl> + <nl> + / * Guarantees a pure posix implementation rather than a specialized one , if <nl> + * applicable . Intended for testing . * / <nl> + void grpc_pollset_kick_global_init_fallback_fd ( void ) ; <nl> + <nl> + / * Must be called before entering poll ( ) . If return value is NULL , this consumed <nl> + an existing kick . Otherwise the return value is an FD to add to the poll set . <nl> + * / <nl> + grpc_kick_fd_info * grpc_pollset_kick_pre_poll ( <nl> + grpc_pollset_kick_state * kick_state ) ; <nl> + <nl> + / * Consume an existing kick . Must be called after poll returns that the fd was <nl> + readable , and before calling kick_post_poll . * / <nl> + void grpc_pollset_kick_consume ( grpc_pollset_kick_state * kick_state , <nl> + grpc_kick_fd_info * fd_info ) ; <nl> + <nl> + / * Must be called after pre_poll , and after consume if applicable * / <nl> + void grpc_pollset_kick_post_poll ( grpc_pollset_kick_state * kick_state , <nl> + grpc_kick_fd_info * fd_info ) ; <nl> + <nl> + / * Actually kick * / <nl> + void grpc_pollset_kick_kick ( grpc_pollset_kick_state * kick_state ) ; <nl> + <nl> + # endif / * GRPC_INTERNAL_CORE_IOMGR_POLLSET_KICK_POSIX_H * / <nl> mmm a / src / core / iomgr / pollset_multipoller_with_epoll . c <nl> ppp b / src / core / iomgr / pollset_multipoller_with_epoll . c <nl> static int multipoll_with_epoll_pollset_maybe_work ( <nl> * here . <nl> * / <nl> <nl> - if ( gpr_time_cmp ( deadline , gpr_inf_future ) = = 0 ) { <nl> - timeout_ms = - 1 ; <nl> - } else { <nl> - timeout_ms = gpr_time_to_millis ( gpr_time_sub ( deadline , now ) ) ; <nl> - if ( timeout_ms < = 0 ) { <nl> - return 1 ; <nl> - } <nl> - } <nl> + timeout_ms = grpc_poll_deadline_to_millis_timeout ( deadline , now ) ; <nl> pollset - > counter + = 1 ; <nl> gpr_mu_unlock ( & pollset - > mu ) ; <nl> <nl> static int multipoll_with_epoll_pollset_maybe_work ( <nl> <nl> gpr_mu_lock ( & pollset - > mu ) ; <nl> pollset - > counter - = 1 ; <nl> - / * TODO ( klempner ) : This should signal once per event rather than broadcast , <nl> - * although it probably doesn ' t matter because threads will generally be <nl> - * blocked in epoll_wait rather than being blocked on the cv . * / <nl> - gpr_cv_broadcast ( & pollset - > cv ) ; <nl> return 1 ; <nl> } <nl> <nl> + static void multipoll_with_epoll_pollset_finish_shutdown ( <nl> + grpc_pollset * pollset ) { } <nl> + <nl> static void multipoll_with_epoll_pollset_destroy ( grpc_pollset * pollset ) { <nl> pollset_hdr * h = pollset - > data . ptr ; <nl> grpc_wakeup_fd_destroy ( & h - > wakeup_fd ) ; <nl> static void epoll_kick ( grpc_pollset * pollset ) { <nl> } <nl> <nl> static const grpc_pollset_vtable multipoll_with_epoll_pollset = { <nl> - multipoll_with_epoll_pollset_add_fd , multipoll_with_epoll_pollset_del_fd , <nl> - multipoll_with_epoll_pollset_maybe_work , epoll_kick , <nl> + multipoll_with_epoll_pollset_add_fd , <nl> + multipoll_with_epoll_pollset_del_fd , <nl> + multipoll_with_epoll_pollset_maybe_work , <nl> + epoll_kick , <nl> + multipoll_with_epoll_pollset_finish_shutdown , <nl> multipoll_with_epoll_pollset_destroy } ; <nl> <nl> static void epoll_become_multipoller ( grpc_pollset * pollset , grpc_fd * * fds , <nl> mmm a / src / core / iomgr / pollset_multipoller_with_poll_posix . c <nl> ppp b / src / core / iomgr / pollset_multipoller_with_poll_posix . c <nl> static void multipoll_with_poll_pollset_add_fd ( grpc_pollset * pollset , <nl> h - > fds = gpr_realloc ( h - > fds , sizeof ( grpc_fd * ) * h - > fd_capacity ) ; <nl> } <nl> h - > fds [ h - > fd_count + + ] = fd ; <nl> - grpc_fd_ref ( fd ) ; <nl> + GRPC_FD_REF ( fd , " multipoller " ) ; <nl> } <nl> <nl> static void multipoll_with_poll_pollset_del_fd ( grpc_pollset * pollset , <nl> static void multipoll_with_poll_pollset_del_fd ( grpc_pollset * pollset , <nl> h - > dels = gpr_realloc ( h - > dels , sizeof ( grpc_fd * ) * h - > del_capacity ) ; <nl> } <nl> h - > dels [ h - > del_count + + ] = fd ; <nl> - grpc_fd_ref ( fd ) ; <nl> + GRPC_FD_REF ( fd , " multipoller_del " ) ; <nl> } <nl> <nl> static void end_polling ( grpc_pollset * pollset ) { <nl> static int multipoll_with_poll_pollset_maybe_work ( <nl> int r ; <nl> size_t i , np , nf , nd ; <nl> pollset_hdr * h ; <nl> + grpc_kick_fd_info * kfd ; <nl> <nl> - if ( pollset - > counter ) { <nl> - return 0 ; <nl> - } <nl> h = pollset - > data . ptr ; <nl> - if ( gpr_time_cmp ( deadline , gpr_inf_future ) = = 0 ) { <nl> - timeout = - 1 ; <nl> - } else { <nl> - timeout = gpr_time_to_millis ( gpr_time_sub ( deadline , now ) ) ; <nl> - if ( timeout < = 0 ) { <nl> - return 1 ; <nl> - } <nl> - } <nl> + timeout = grpc_poll_deadline_to_millis_timeout ( deadline , now ) ; <nl> if ( h - > pfd_capacity < h - > fd_count + 1 ) { <nl> h - > pfd_capacity = GPR_MAX ( h - > pfd_capacity * 3 / 2 , h - > fd_count + 1 ) ; <nl> gpr_free ( h - > pfds ) ; <nl> static int multipoll_with_poll_pollset_maybe_work ( <nl> } <nl> nf = 0 ; <nl> np = 1 ; <nl> - h - > pfds [ 0 ] . fd = grpc_pollset_kick_pre_poll ( & pollset - > kick_state ) ; <nl> - if ( h - > pfds [ 0 ] . fd < 0 ) { <nl> + kfd = grpc_pollset_kick_pre_poll ( & pollset - > kick_state ) ; <nl> + if ( kfd = = NULL ) { <nl> / * Already kicked * / <nl> return 1 ; <nl> } <nl> + h - > pfds [ 0 ] . fd = GRPC_POLLSET_KICK_GET_FD ( kfd ) ; <nl> h - > pfds [ 0 ] . events = POLLIN ; <nl> h - > pfds [ 0 ] . revents = POLLOUT ; <nl> for ( i = 0 ; i < h - > fd_count ; i + + ) { <nl> static int multipoll_with_poll_pollset_maybe_work ( <nl> if ( h - > fds [ i ] = = h - > dels [ nd ] ) remove = 1 ; <nl> } <nl> if ( remove ) { <nl> - grpc_fd_unref ( h - > fds [ i ] ) ; <nl> + GRPC_FD_UNREF ( h - > fds [ i ] , " multipoller " ) ; <nl> } else { <nl> h - > fds [ nf + + ] = h - > fds [ i ] ; <nl> h - > watchers [ np ] . fd = h - > fds [ i ] ; <nl> static int multipoll_with_poll_pollset_maybe_work ( <nl> h - > pfd_count = np ; <nl> h - > fd_count = nf ; <nl> for ( nd = 0 ; nd < h - > del_count ; nd + + ) { <nl> - grpc_fd_unref ( h - > dels [ nd ] ) ; <nl> + GRPC_FD_UNREF ( h - > dels [ nd ] , " multipoller_del " ) ; <nl> } <nl> h - > del_count = 0 ; <nl> if ( h - > pfd_count = = 0 ) { <nl> end_polling ( pollset ) ; <nl> return 0 ; <nl> } <nl> - pollset - > counter = 1 ; <nl> + pollset - > counter + + ; <nl> gpr_mu_unlock ( & pollset - > mu ) ; <nl> <nl> for ( i = 1 ; i < np ; i + + ) { <nl> static int multipoll_with_poll_pollset_maybe_work ( <nl> / * do nothing * / <nl> } else { <nl> if ( h - > pfds [ 0 ] . revents & POLLIN ) { <nl> - grpc_pollset_kick_consume ( & pollset - > kick_state ) ; <nl> + grpc_pollset_kick_consume ( & pollset - > kick_state , kfd ) ; <nl> } <nl> for ( i = 1 ; i < np ; i + + ) { <nl> if ( h - > pfds [ i ] . revents & ( POLLIN | POLLHUP | POLLERR ) ) { <nl> static int multipoll_with_poll_pollset_maybe_work ( <nl> } <nl> } <nl> } <nl> - grpc_pollset_kick_post_poll ( & pollset - > kick_state ) ; <nl> + grpc_pollset_kick_post_poll ( & pollset - > kick_state , kfd ) ; <nl> <nl> gpr_mu_lock ( & pollset - > mu ) ; <nl> - pollset - > counter = 0 ; <nl> - gpr_cv_broadcast ( & pollset - > cv ) ; <nl> + pollset - > counter - - ; <nl> + <nl> return 1 ; <nl> } <nl> <nl> static void multipoll_with_poll_pollset_kick ( grpc_pollset * p ) { <nl> grpc_pollset_force_kick ( p ) ; <nl> } <nl> <nl> - static void multipoll_with_poll_pollset_destroy ( grpc_pollset * pollset ) { <nl> + static void multipoll_with_poll_pollset_finish_shutdown ( grpc_pollset * pollset ) { <nl> size_t i ; <nl> pollset_hdr * h = pollset - > data . ptr ; <nl> GPR_ASSERT ( pollset - > counter = = 0 ) ; <nl> for ( i = 0 ; i < h - > fd_count ; i + + ) { <nl> - grpc_fd_unref ( h - > fds [ i ] ) ; <nl> + GRPC_FD_UNREF ( h - > fds [ i ] , " multipoller " ) ; <nl> } <nl> for ( i = 0 ; i < h - > del_count ; i + + ) { <nl> - grpc_fd_unref ( h - > dels [ i ] ) ; <nl> + GRPC_FD_UNREF ( h - > dels [ i ] , " multipoller_del " ) ; <nl> } <nl> + h - > fd_count = 0 ; <nl> + h - > del_count = 0 ; <nl> + } <nl> + <nl> + static void multipoll_with_poll_pollset_destroy ( grpc_pollset * pollset ) { <nl> + pollset_hdr * h = pollset - > data . ptr ; <nl> + multipoll_with_poll_pollset_finish_shutdown ( pollset ) ; <nl> gpr_free ( h - > pfds ) ; <nl> gpr_free ( h - > watchers ) ; <nl> gpr_free ( h - > fds ) ; <nl> static void multipoll_with_poll_pollset_destroy ( grpc_pollset * pollset ) { <nl> } <nl> <nl> static const grpc_pollset_vtable multipoll_with_poll_pollset = { <nl> - multipoll_with_poll_pollset_add_fd , multipoll_with_poll_pollset_del_fd , <nl> - multipoll_with_poll_pollset_maybe_work , multipoll_with_poll_pollset_kick , <nl> + multipoll_with_poll_pollset_add_fd , <nl> + multipoll_with_poll_pollset_del_fd , <nl> + multipoll_with_poll_pollset_maybe_work , <nl> + multipoll_with_poll_pollset_kick , <nl> + multipoll_with_poll_pollset_finish_shutdown , <nl> multipoll_with_poll_pollset_destroy } ; <nl> <nl> void grpc_poll_become_multipoller ( grpc_pollset * pollset , grpc_fd * * fds , <nl> void grpc_poll_become_multipoller ( grpc_pollset * pollset , grpc_fd * * fds , <nl> h - > dels = NULL ; <nl> for ( i = 0 ; i < nfds ; i + + ) { <nl> h - > fds [ i ] = fds [ i ] ; <nl> - grpc_fd_ref ( fds [ i ] ) ; <nl> + GRPC_FD_REF ( fds [ i ] , " multipoller " ) ; <nl> } <nl> } <nl> <nl> mmm a / src / core / iomgr / pollset_posix . c <nl> ppp b / src / core / iomgr / pollset_posix . c <nl> <nl> # include < grpc / support / tls . h > <nl> # include < grpc / support / useful . h > <nl> <nl> - static grpc_pollset g_backup_pollset ; <nl> - static int g_shutdown_backup_poller ; <nl> - static gpr_event g_backup_poller_done ; <nl> - static gpr_event g_backup_pollset_shutdown_done ; <nl> - <nl> GPR_TLS_DECL ( g_current_thread_poller ) ; <nl> <nl> - static void backup_poller ( void * p ) { <nl> - gpr_timespec delta = gpr_time_from_millis ( 100 ) ; <nl> - gpr_timespec last_poll = gpr_now ( ) ; <nl> - <nl> - gpr_mu_lock ( & g_backup_pollset . mu ) ; <nl> - while ( g_shutdown_backup_poller = = 0 ) { <nl> - gpr_timespec next_poll = gpr_time_add ( last_poll , delta ) ; <nl> - grpc_pollset_work ( & g_backup_pollset , gpr_time_add ( gpr_now ( ) , gpr_time_from_seconds ( 1 ) ) ) ; <nl> - gpr_mu_unlock ( & g_backup_pollset . mu ) ; <nl> - gpr_sleep_until ( next_poll ) ; <nl> - gpr_mu_lock ( & g_backup_pollset . mu ) ; <nl> - last_poll = next_poll ; <nl> - } <nl> - gpr_mu_unlock ( & g_backup_pollset . mu ) ; <nl> - <nl> - gpr_event_set ( & g_backup_poller_done , ( void * ) 1 ) ; <nl> - } <nl> - <nl> void grpc_pollset_kick ( grpc_pollset * p ) { <nl> if ( gpr_tls_get ( & g_current_thread_poller ) ! = ( gpr_intptr ) p & & p - > counter ) { <nl> p - > vtable - > kick ( p ) ; <nl> static void kick_using_pollset_kick ( grpc_pollset * p ) { <nl> <nl> / * global state management * / <nl> <nl> - grpc_pollset * grpc_backup_pollset ( void ) { return & g_backup_pollset ; } <nl> - <nl> void grpc_pollset_global_init ( void ) { <nl> - gpr_thd_id id ; <nl> - <nl> gpr_tls_init ( & g_current_thread_poller ) ; <nl> <nl> / * Initialize kick fd state * / <nl> grpc_pollset_kick_global_init ( ) ; <nl> - <nl> - / * initialize the backup pollset * / <nl> - grpc_pollset_init ( & g_backup_pollset ) ; <nl> - <nl> - / * start the backup poller thread * / <nl> - g_shutdown_backup_poller = 0 ; <nl> - gpr_event_init ( & g_backup_poller_done ) ; <nl> - gpr_event_init ( & g_backup_pollset_shutdown_done ) ; <nl> - gpr_thd_new ( & id , backup_poller , NULL , NULL ) ; <nl> - } <nl> - <nl> - static void on_backup_pollset_shutdown_done ( void * arg ) { <nl> - gpr_event_set ( & g_backup_pollset_shutdown_done , ( void * ) 1 ) ; <nl> } <nl> <nl> void grpc_pollset_global_shutdown ( void ) { <nl> - / * terminate the backup poller thread * / <nl> - gpr_mu_lock ( & g_backup_pollset . mu ) ; <nl> - g_shutdown_backup_poller = 1 ; <nl> - gpr_mu_unlock ( & g_backup_pollset . mu ) ; <nl> - gpr_event_wait ( & g_backup_poller_done , gpr_inf_future ) ; <nl> - <nl> - grpc_pollset_shutdown ( & g_backup_pollset , on_backup_pollset_shutdown_done , <nl> - NULL ) ; <nl> - gpr_event_wait ( & g_backup_pollset_shutdown_done , gpr_inf_future ) ; <nl> - <nl> - / * destroy the backup pollset * / <nl> - grpc_pollset_destroy ( & g_backup_pollset ) ; <nl> - <nl> / * destroy the kick pipes * / <nl> grpc_pollset_kick_global_destroy ( ) ; <nl> <nl> void grpc_pollset_global_shutdown ( void ) { <nl> <nl> / * main interface * / <nl> <nl> - static void become_empty_pollset ( grpc_pollset * pollset ) ; <nl> - static void become_unary_pollset ( grpc_pollset * pollset , grpc_fd * fd ) ; <nl> + static void become_basic_pollset ( grpc_pollset * pollset , grpc_fd * fd_or_null ) ; <nl> <nl> void grpc_pollset_init ( grpc_pollset * pollset ) { <nl> gpr_mu_init ( & pollset - > mu ) ; <nl> - gpr_cv_init ( & pollset - > cv ) ; <nl> grpc_pollset_kick_init ( & pollset - > kick_state ) ; <nl> pollset - > in_flight_cbs = 0 ; <nl> pollset - > shutting_down = 0 ; <nl> - become_empty_pollset ( pollset ) ; <nl> + pollset - > called_shutdown = 0 ; <nl> + become_basic_pollset ( pollset , NULL ) ; <nl> } <nl> <nl> void grpc_pollset_add_fd ( grpc_pollset * pollset , grpc_fd * fd ) { <nl> gpr_mu_lock ( & pollset - > mu ) ; <nl> pollset - > vtable - > add_fd ( pollset , fd ) ; <nl> - gpr_cv_broadcast ( & pollset - > cv ) ; <nl> gpr_mu_unlock ( & pollset - > mu ) ; <nl> } <nl> <nl> void grpc_pollset_del_fd ( grpc_pollset * pollset , grpc_fd * fd ) { <nl> gpr_mu_lock ( & pollset - > mu ) ; <nl> pollset - > vtable - > del_fd ( pollset , fd ) ; <nl> - gpr_cv_broadcast ( & pollset - > cv ) ; <nl> gpr_mu_unlock ( & pollset - > mu ) ; <nl> } <nl> <nl> + static void finish_shutdown ( grpc_pollset * pollset ) { <nl> + pollset - > vtable - > finish_shutdown ( pollset ) ; <nl> + pollset - > shutdown_done_cb ( pollset - > shutdown_done_arg ) ; <nl> + } <nl> + <nl> int grpc_pollset_work ( grpc_pollset * pollset , gpr_timespec deadline ) { <nl> / * pollset - > mu already held * / <nl> gpr_timespec now = gpr_now ( ) ; <nl> int grpc_pollset_work ( grpc_pollset * pollset , gpr_timespec deadline ) { <nl> if ( pollset - > shutting_down ) { <nl> if ( pollset - > counter > 0 ) { <nl> grpc_pollset_kick ( pollset ) ; <nl> - } else if ( pollset - > in_flight_cbs = = 0 ) { <nl> + } else if ( ! pollset - > called_shutdown & & pollset - > in_flight_cbs = = 0 ) { <nl> + pollset - > called_shutdown = 1 ; <nl> gpr_mu_unlock ( & pollset - > mu ) ; <nl> - pollset - > shutdown_done_cb ( pollset - > shutdown_done_arg ) ; <nl> + finish_shutdown ( pollset ) ; <nl> / * Continuing to access pollset here is safe - - it is the caller ' s <nl> * responsibility to not destroy when it has outstanding calls to <nl> * grpc_pollset_work . <nl> int grpc_pollset_work ( grpc_pollset * pollset , gpr_timespec deadline ) { <nl> void grpc_pollset_shutdown ( grpc_pollset * pollset , <nl> void ( * shutdown_done ) ( void * arg ) , <nl> void * shutdown_done_arg ) { <nl> - int in_flight_cbs ; <nl> - int counter ; <nl> + int call_shutdown = 0 ; <nl> gpr_mu_lock ( & pollset - > mu ) ; <nl> + GPR_ASSERT ( ! pollset - > shutting_down ) ; <nl> pollset - > shutting_down = 1 ; <nl> - in_flight_cbs = pollset - > in_flight_cbs ; <nl> - counter = pollset - > counter ; <nl> + if ( ! pollset - > called_shutdown & & pollset - > in_flight_cbs = = 0 & & <nl> + pollset - > counter = = 0 ) { <nl> + pollset - > called_shutdown = 1 ; <nl> + call_shutdown = 1 ; <nl> + } <nl> pollset - > shutdown_done_cb = shutdown_done ; <nl> pollset - > shutdown_done_arg = shutdown_done_arg ; <nl> - if ( counter > 0 ) { <nl> + if ( pollset - > counter > 0 ) { <nl> grpc_pollset_kick ( pollset ) ; <nl> } <nl> gpr_mu_unlock ( & pollset - > mu ) ; <nl> <nl> - if ( in_flight_cbs = = 0 & & counter = = 0 ) { <nl> - shutdown_done ( shutdown_done_arg ) ; <nl> + if ( call_shutdown ) { <nl> + finish_shutdown ( pollset ) ; <nl> } <nl> } <nl> <nl> void grpc_pollset_destroy ( grpc_pollset * pollset ) { <nl> pollset - > vtable - > destroy ( pollset ) ; <nl> grpc_pollset_kick_destroy ( & pollset - > kick_state ) ; <nl> gpr_mu_destroy ( & pollset - > mu ) ; <nl> - gpr_cv_destroy ( & pollset - > cv ) ; <nl> - } <nl> - <nl> - / * <nl> - * empty_pollset - a vtable that provides polling for NO file descriptors <nl> - * / <nl> - <nl> - static void empty_pollset_add_fd ( grpc_pollset * pollset , grpc_fd * fd ) { <nl> - become_unary_pollset ( pollset , fd ) ; <nl> } <nl> <nl> - static void empty_pollset_del_fd ( grpc_pollset * pollset , grpc_fd * fd ) { } <nl> - <nl> - static int empty_pollset_maybe_work ( grpc_pollset * pollset , <nl> - gpr_timespec deadline , gpr_timespec now , <nl> - int allow_synchronous_callback ) { <nl> - return 0 ; <nl> - } <nl> - <nl> - static void empty_pollset_destroy ( grpc_pollset * pollset ) { } <nl> - <nl> - static const grpc_pollset_vtable empty_pollset = { <nl> - empty_pollset_add_fd , empty_pollset_del_fd , empty_pollset_maybe_work , <nl> - kick_using_pollset_kick , empty_pollset_destroy } ; <nl> - <nl> - static void become_empty_pollset ( grpc_pollset * pollset ) { <nl> - pollset - > vtable = & empty_pollset ; <nl> + int grpc_poll_deadline_to_millis_timeout ( gpr_timespec deadline , gpr_timespec now ) { <nl> + gpr_timespec timeout ; <nl> + static const int max_spin_polling_us = 10 ; <nl> + if ( gpr_time_cmp ( deadline , gpr_inf_future ) = = 0 ) { <nl> + return - 1 ; <nl> + } <nl> + if ( gpr_time_cmp ( <nl> + deadline , <nl> + gpr_time_add ( now , gpr_time_from_micros ( max_spin_polling_us ) ) ) < = 0 ) { <nl> + return 0 ; <nl> + } <nl> + timeout = gpr_time_sub ( deadline , now ) ; <nl> + return gpr_time_to_millis ( <nl> + gpr_time_add ( timeout , gpr_time_from_nanos ( GPR_NS_PER_SEC - 1 ) ) ) ; <nl> } <nl> <nl> / * <nl> - * unary_poll_pollset - a vtable that provides polling for one file descriptor <nl> - * via poll ( ) <nl> + * basic_pollset - a vtable that provides polling for zero or one file <nl> + * descriptor via poll ( ) <nl> * / <nl> <nl> - <nl> typedef struct grpc_unary_promote_args { <nl> const grpc_pollset_vtable * original_vtable ; <nl> grpc_pollset * pollset ; <nl> typedef struct grpc_unary_promote_args { <nl> grpc_iomgr_closure promotion_closure ; <nl> } grpc_unary_promote_args ; <nl> <nl> - static void unary_poll_do_promote ( void * args , int success ) { <nl> + static void basic_do_promote ( void * args , int success ) { <nl> grpc_unary_promote_args * up_args = args ; <nl> const grpc_pollset_vtable * original_vtable = up_args - > original_vtable ; <nl> grpc_pollset * pollset = up_args - > pollset ; <nl> static void unary_poll_do_promote ( void * args , int success ) { <nl> <nl> gpr_mu_lock ( & pollset - > mu ) ; <nl> / * First we need to ensure that nobody is polling concurrently * / <nl> - while ( pollset - > counter ! = 0 ) { <nl> + if ( pollset - > counter ! = 0 ) { <nl> grpc_pollset_kick ( pollset ) ; <nl> grpc_iomgr_add_callback ( & up_args - > promotion_closure ) ; <nl> gpr_mu_unlock ( & pollset - > mu ) ; <nl> static void unary_poll_do_promote ( void * args , int success ) { <nl> fds [ 0 ] = pollset - > data . ptr ; <nl> fds [ 1 ] = fd ; <nl> <nl> - if ( ! grpc_fd_is_orphaned ( fds [ 0 ] ) ) { <nl> + if ( fds [ 0 ] & & ! grpc_fd_is_orphaned ( fds [ 0 ] ) ) { <nl> grpc_platform_become_multipoller ( pollset , fds , GPR_ARRAY_SIZE ( fds ) ) ; <nl> - grpc_fd_unref ( fds [ 0 ] ) ; <nl> + GRPC_FD_UNREF ( fds [ 0 ] , " basicpoll " ) ; <nl> } else { <nl> / * old fd is orphaned and we haven ' t cleaned it up until now , so remain a <nl> * unary poller * / <nl> / * Note that it is possible that fds [ 1 ] is also orphaned at this point . <nl> * That ' s okay , we ' ll correct it at the next add or poll . * / <nl> - grpc_fd_unref ( fds [ 0 ] ) ; <nl> + if ( fds [ 0 ] ) GRPC_FD_UNREF ( fds [ 0 ] , " basicpoll " ) ; <nl> pollset - > data . ptr = fd ; <nl> - grpc_fd_ref ( fd ) ; <nl> + GRPC_FD_REF ( fd , " basicpoll " ) ; <nl> } <nl> } <nl> <nl> - gpr_cv_broadcast ( & pollset - > cv ) ; <nl> gpr_mu_unlock ( & pollset - > mu ) ; <nl> <nl> if ( do_shutdown_cb ) { <nl> pollset - > shutdown_done_cb ( pollset - > shutdown_done_arg ) ; <nl> } <nl> <nl> - / * Matching ref in unary_poll_pollset_add_fd * / <nl> - grpc_fd_unref ( fd ) ; <nl> + / * Matching ref in basic_pollset_add_fd * / <nl> + GRPC_FD_UNREF ( fd , " basicpoll_add " ) ; <nl> } <nl> <nl> - static void unary_poll_pollset_add_fd ( grpc_pollset * pollset , grpc_fd * fd ) { <nl> + static void basic_pollset_add_fd ( grpc_pollset * pollset , grpc_fd * fd ) { <nl> grpc_unary_promote_args * up_args ; <nl> + GPR_ASSERT ( fd ) ; <nl> if ( fd = = pollset - > data . ptr ) return ; <nl> <nl> if ( ! pollset - > counter ) { <nl> static void unary_poll_pollset_add_fd ( grpc_pollset * pollset , grpc_fd * fd ) { <nl> fds [ 0 ] = pollset - > data . ptr ; <nl> fds [ 1 ] = fd ; <nl> <nl> - if ( ! grpc_fd_is_orphaned ( fds [ 0 ] ) ) { <nl> + if ( fds [ 0 ] = = NULL ) { <nl> + pollset - > data . ptr = fd ; <nl> + GRPC_FD_REF ( fd , " basicpoll " ) ; <nl> + } else if ( ! grpc_fd_is_orphaned ( fds [ 0 ] ) ) { <nl> grpc_platform_become_multipoller ( pollset , fds , GPR_ARRAY_SIZE ( fds ) ) ; <nl> - grpc_fd_unref ( fds [ 0 ] ) ; <nl> + GRPC_FD_UNREF ( fds [ 0 ] , " basicpoll " ) ; <nl> } else { <nl> / * old fd is orphaned and we haven ' t cleaned it up until now , so remain a <nl> * unary poller * / <nl> - grpc_fd_unref ( fds [ 0 ] ) ; <nl> + GRPC_FD_UNREF ( fds [ 0 ] , " basicpoll " ) ; <nl> pollset - > data . ptr = fd ; <nl> - grpc_fd_ref ( fd ) ; <nl> + GRPC_FD_REF ( fd , " basicpoll " ) ; <nl> } <nl> return ; <nl> } <nl> <nl> / * Now we need to promote . This needs to happen when we ' re not polling . Since <nl> * this may be called from poll , the wait needs to happen asynchronously . * / <nl> - grpc_fd_ref ( fd ) ; <nl> + GRPC_FD_REF ( fd , " basicpoll_add " ) ; <nl> pollset - > in_flight_cbs + + ; <nl> up_args = gpr_malloc ( sizeof ( * up_args ) ) ; <nl> up_args - > pollset = pollset ; <nl> up_args - > fd = fd ; <nl> up_args - > original_vtable = pollset - > vtable ; <nl> - up_args - > promotion_closure . cb = unary_poll_do_promote ; <nl> + up_args - > promotion_closure . cb = basic_do_promote ; <nl> up_args - > promotion_closure . cb_arg = up_args ; <nl> grpc_iomgr_add_callback ( & up_args - > promotion_closure ) ; <nl> <nl> grpc_pollset_kick ( pollset ) ; <nl> } <nl> <nl> - static void unary_poll_pollset_del_fd ( grpc_pollset * pollset , grpc_fd * fd ) { <nl> + static void basic_pollset_del_fd ( grpc_pollset * pollset , grpc_fd * fd ) { <nl> + GPR_ASSERT ( fd ) ; <nl> if ( fd = = pollset - > data . ptr ) { <nl> - grpc_fd_unref ( pollset - > data . ptr ) ; <nl> - become_empty_pollset ( pollset ) ; <nl> + GRPC_FD_UNREF ( pollset - > data . ptr , " basicpoll " ) ; <nl> + pollset - > data . ptr = NULL ; <nl> } <nl> } <nl> <nl> - static int unary_poll_pollset_maybe_work ( grpc_pollset * pollset , <nl> - gpr_timespec deadline , <nl> - gpr_timespec now , <nl> - int allow_synchronous_callback ) { <nl> + static int basic_pollset_maybe_work ( grpc_pollset * pollset , <nl> + gpr_timespec deadline , gpr_timespec now , <nl> + int allow_synchronous_callback ) { <nl> struct pollfd pfd [ 2 ] ; <nl> grpc_fd * fd ; <nl> grpc_fd_watcher fd_watcher ; <nl> + grpc_kick_fd_info * kfd ; <nl> int timeout ; <nl> int r ; <nl> + int nfds ; <nl> <nl> - if ( pollset - > counter ) { <nl> - return 0 ; <nl> - } <nl> if ( pollset - > in_flight_cbs ) { <nl> / * Give do_promote priority so we don ' t starve it out * / <nl> - return 0 ; <nl> + gpr_mu_unlock ( & pollset - > mu ) ; <nl> + gpr_mu_lock ( & pollset - > mu ) ; <nl> + return 1 ; <nl> } <nl> fd = pollset - > data . ptr ; <nl> - if ( grpc_fd_is_orphaned ( fd ) ) { <nl> - grpc_fd_unref ( fd ) ; <nl> - become_empty_pollset ( pollset ) ; <nl> - return 0 ; <nl> + if ( fd & & grpc_fd_is_orphaned ( fd ) ) { <nl> + GRPC_FD_UNREF ( fd , " basicpoll " ) ; <nl> + fd = pollset - > data . ptr = NULL ; <nl> } <nl> - if ( gpr_time_cmp ( deadline , gpr_inf_future ) = = 0 ) { <nl> - timeout = - 1 ; <nl> - } else { <nl> - timeout = gpr_time_to_millis ( gpr_time_sub ( deadline , now ) ) ; <nl> - if ( timeout < = 0 ) { <nl> - return 1 ; <nl> - } <nl> - } <nl> - pfd [ 0 ] . fd = grpc_pollset_kick_pre_poll ( & pollset - > kick_state ) ; <nl> - if ( pfd [ 0 ] . fd < 0 ) { <nl> + timeout = grpc_poll_deadline_to_millis_timeout ( deadline , now ) ; <nl> + kfd = grpc_pollset_kick_pre_poll ( & pollset - > kick_state ) ; <nl> + if ( kfd = = NULL ) { <nl> / * Already kicked * / <nl> return 1 ; <nl> } <nl> + pfd [ 0 ] . fd = GRPC_POLLSET_KICK_GET_FD ( kfd ) ; <nl> pfd [ 0 ] . events = POLLIN ; <nl> pfd [ 0 ] . revents = 0 ; <nl> - pfd [ 1 ] . fd = fd - > fd ; <nl> - pfd [ 1 ] . revents = 0 ; <nl> - pollset - > counter = 1 ; <nl> - gpr_mu_unlock ( & pollset - > mu ) ; <nl> - <nl> - pfd [ 1 ] . events = grpc_fd_begin_poll ( fd , pollset , POLLIN , POLLOUT , & fd_watcher ) ; <nl> + nfds = 1 ; <nl> + pollset - > counter + + ; <nl> + if ( fd ) { <nl> + pfd [ 1 ] . fd = fd - > fd ; <nl> + pfd [ 1 ] . revents = 0 ; <nl> + gpr_mu_unlock ( & pollset - > mu ) ; <nl> + pfd [ 1 ] . events = <nl> + grpc_fd_begin_poll ( fd , pollset , POLLIN , POLLOUT , & fd_watcher ) ; <nl> + if ( pfd [ 1 ] . events ! = 0 ) { <nl> + nfds + + ; <nl> + } <nl> + } else { <nl> + gpr_mu_unlock ( & pollset - > mu ) ; <nl> + } <nl> <nl> / * poll fd count ( argument 2 ) is shortened by one if we have no events <nl> to poll on - such that it only includes the kicker * / <nl> - r = poll ( pfd , GPR_ARRAY_SIZE ( pfd ) - ( pfd [ 1 ] . events = = 0 ) , timeout ) ; <nl> + r = poll ( pfd , nfds , timeout ) ; <nl> GRPC_TIMER_MARK ( GRPC_PTAG_POLL_FINISHED , r ) ; <nl> <nl> - grpc_fd_end_poll ( & fd_watcher , pfd [ 1 ] . revents & POLLIN , pfd [ 1 ] . revents & POLLOUT ) ; <nl> + if ( fd ) { <nl> + grpc_fd_end_poll ( & fd_watcher , pfd [ 1 ] . revents & POLLIN , <nl> + pfd [ 1 ] . revents & POLLOUT ) ; <nl> + } <nl> <nl> if ( r < 0 ) { <nl> if ( errno ! = EINTR ) { <nl> static int unary_poll_pollset_maybe_work ( grpc_pollset * pollset , <nl> / * do nothing * / <nl> } else { <nl> if ( pfd [ 0 ] . revents & POLLIN ) { <nl> - grpc_pollset_kick_consume ( & pollset - > kick_state ) ; <nl> - } <nl> - if ( pfd [ 1 ] . revents & ( POLLIN | POLLHUP | POLLERR ) ) { <nl> - grpc_fd_become_readable ( fd , allow_synchronous_callback ) ; <nl> + grpc_pollset_kick_consume ( & pollset - > kick_state , kfd ) ; <nl> } <nl> - if ( pfd [ 1 ] . revents & ( POLLOUT | POLLHUP | POLLERR ) ) { <nl> - grpc_fd_become_writable ( fd , allow_synchronous_callback ) ; <nl> + if ( nfds > 1 ) { <nl> + if ( pfd [ 1 ] . revents & ( POLLIN | POLLHUP | POLLERR ) ) { <nl> + grpc_fd_become_readable ( fd , allow_synchronous_callback ) ; <nl> + } <nl> + if ( pfd [ 1 ] . revents & ( POLLOUT | POLLHUP | POLLERR ) ) { <nl> + grpc_fd_become_writable ( fd , allow_synchronous_callback ) ; <nl> + } <nl> } <nl> } <nl> <nl> - grpc_pollset_kick_post_poll ( & pollset - > kick_state ) ; <nl> + grpc_pollset_kick_post_poll ( & pollset - > kick_state , kfd ) ; <nl> <nl> gpr_mu_lock ( & pollset - > mu ) ; <nl> - pollset - > counter = 0 ; <nl> - gpr_cv_broadcast ( & pollset - > cv ) ; <nl> + pollset - > counter - - ; <nl> return 1 ; <nl> } <nl> <nl> - static void unary_poll_pollset_destroy ( grpc_pollset * pollset ) { <nl> + static void basic_pollset_destroy ( grpc_pollset * pollset ) { <nl> GPR_ASSERT ( pollset - > counter = = 0 ) ; <nl> - grpc_fd_unref ( pollset - > data . ptr ) ; <nl> + if ( pollset - > data . ptr ! = NULL ) { <nl> + GRPC_FD_UNREF ( pollset - > data . ptr , " basicpoll " ) ; <nl> + pollset - > data . ptr = NULL ; <nl> + } <nl> } <nl> <nl> - static const grpc_pollset_vtable unary_poll_pollset = { <nl> - unary_poll_pollset_add_fd , unary_poll_pollset_del_fd , <nl> - unary_poll_pollset_maybe_work , kick_using_pollset_kick , <nl> - unary_poll_pollset_destroy } ; <nl> + static const grpc_pollset_vtable basic_pollset = { <nl> + basic_pollset_add_fd , basic_pollset_del_fd , basic_pollset_maybe_work , <nl> + kick_using_pollset_kick , basic_pollset_destroy , basic_pollset_destroy } ; <nl> <nl> - static void become_unary_pollset ( grpc_pollset * pollset , grpc_fd * fd ) { <nl> - pollset - > vtable = & unary_poll_pollset ; <nl> + static void become_basic_pollset ( grpc_pollset * pollset , grpc_fd * fd_or_null ) { <nl> + pollset - > vtable = & basic_pollset ; <nl> pollset - > counter = 0 ; <nl> - pollset - > data . ptr = fd ; <nl> - grpc_fd_ref ( fd ) ; <nl> + pollset - > data . ptr = fd_or_null ; <nl> + if ( fd_or_null ) { <nl> + GRPC_FD_REF ( fd_or_null , " basicpoll " ) ; <nl> + } <nl> } <nl> <nl> # endif / * GPR_POSIX_POLLSET * / <nl> mmm a / src / core / iomgr / pollset_posix . h <nl> ppp b / src / core / iomgr / pollset_posix . h <nl> <nl> <nl> # include < grpc / support / sync . h > <nl> <nl> - # include " src / core / iomgr / pollset_kick . h " <nl> + # include " src / core / iomgr / pollset_kick_posix . h " <nl> <nl> typedef struct grpc_pollset_vtable grpc_pollset_vtable ; <nl> <nl> typedef struct grpc_pollset { <nl> few fds , and an epoll ( ) based implementation for many fds * / <nl> const grpc_pollset_vtable * vtable ; <nl> gpr_mu mu ; <nl> - gpr_cv cv ; <nl> grpc_pollset_kick_state kick_state ; <nl> int counter ; <nl> int in_flight_cbs ; <nl> int shutting_down ; <nl> + int called_shutdown ; <nl> void ( * shutdown_done_cb ) ( void * arg ) ; <nl> void * shutdown_done_arg ; <nl> union { <nl> struct grpc_pollset_vtable { <nl> int ( * maybe_work ) ( grpc_pollset * pollset , gpr_timespec deadline , <nl> gpr_timespec now , int allow_synchronous_callback ) ; <nl> void ( * kick ) ( grpc_pollset * pollset ) ; <nl> + void ( * finish_shutdown ) ( grpc_pollset * pollset ) ; <nl> void ( * destroy ) ( grpc_pollset * pollset ) ; <nl> } ; <nl> <nl> # define GRPC_POLLSET_MU ( pollset ) ( & ( pollset ) - > mu ) <nl> - # define GRPC_POLLSET_CV ( pollset ) ( & ( pollset ) - > cv ) <nl> <nl> / * Add an fd to a pollset * / <nl> void grpc_pollset_add_fd ( grpc_pollset * pollset , struct grpc_fd * fd ) ; <nl> int grpc_kick_read_fd ( grpc_pollset * p ) ; <nl> / * Call after polling has been kicked to leave the kicked state * / <nl> void grpc_kick_drain ( grpc_pollset * p ) ; <nl> <nl> - / * All fds get added to a backup pollset to ensure that progress is made <nl> - regardless of applications listening to events . Relying on this is slow <nl> - however ( the backup pollset only listens every 100ms or so ) - so it ' s not <nl> - to be relied on . * / <nl> - grpc_pollset * grpc_backup_pollset ( void ) ; <nl> + / * Convert a timespec to milliseconds : <nl> + - very small or negative poll times are clamped to zero to do a <nl> + non - blocking poll ( which becomes spin polling ) <nl> + - other small values are rounded up to one millisecond <nl> + - longer than a millisecond polls are rounded up to the next nearest <nl> + millisecond to avoid spinning <nl> + - infinite timeouts are converted to - 1 * / <nl> + int grpc_poll_deadline_to_millis_timeout ( gpr_timespec deadline , gpr_timespec now ) ; <nl> <nl> / * turn a pollset into a multipoller : platform specific * / <nl> typedef void ( * grpc_platform_become_multipoller_type ) ( grpc_pollset * pollset , <nl> similarity index 53 % <nl> rename from src / core / iomgr / pollset_kick . h <nl> rename to src / core / iomgr / pollset_set . h <nl> mmm a / src / core / iomgr / pollset_kick . h <nl> ppp b / src / core / iomgr / pollset_set . h <nl> <nl> * <nl> * / <nl> <nl> - # ifndef GRPC_INTERNAL_CORE_IOMGR_POLLSET_KICK_H <nl> - # define GRPC_INTERNAL_CORE_IOMGR_POLLSET_KICK_H <nl> + # ifndef GRPC_INTERNAL_CORE_IOMGR_POLLSET_SET_H <nl> + # define GRPC_INTERNAL_CORE_IOMGR_POLLSET_SET_H <nl> <nl> - # include < grpc / support / port_platform . h > <nl> + # include " src / core / iomgr / pollset . h " <nl> + <nl> + / * A grpc_pollset_set is a set of pollsets that are interested in an <nl> + action . Adding a pollset to a pollset_set automatically adds any <nl> + fd ' s ( etc ) that have been registered with the set_set with that pollset . <nl> + Registering fd ' s automatically adds them to all current pollsets . * / <nl> <nl> # ifdef GPR_POSIX_SOCKET <nl> - # include " src / core / iomgr / pollset_kick_posix . h " <nl> + # include " src / core / iomgr / pollset_set_posix . h " <nl> # endif <nl> <nl> # ifdef GPR_WIN32 <nl> - # include " src / core / iomgr / pollset_kick_windows . h " <nl> + # include " src / core / iomgr / pollset_set_windows . h " <nl> # endif <nl> <nl> - / * This is an abstraction around the typical pipe mechanism for waking up a <nl> - thread sitting in a poll ( ) style call . * / <nl> - <nl> - void grpc_pollset_kick_global_init ( void ) ; <nl> - void grpc_pollset_kick_global_destroy ( void ) ; <nl> - <nl> - void grpc_pollset_kick_init ( grpc_pollset_kick_state * kick_state ) ; <nl> - void grpc_pollset_kick_destroy ( grpc_pollset_kick_state * kick_state ) ; <nl> - <nl> - / * Guarantees a pure posix implementation rather than a specialized one , if <nl> - * applicable . Intended for testing . * / <nl> - void grpc_pollset_kick_global_init_fallback_fd ( void ) ; <nl> - <nl> - / * Must be called before entering poll ( ) . If return value is - 1 , this consumed <nl> - an existing kick . Otherwise the return value is an FD to add to the poll set . <nl> - * / <nl> - int grpc_pollset_kick_pre_poll ( grpc_pollset_kick_state * kick_state ) ; <nl> - <nl> - / * Consume an existing kick . Must be called after poll returns that the fd was <nl> - readable , and before calling kick_post_poll . * / <nl> - void grpc_pollset_kick_consume ( grpc_pollset_kick_state * kick_state ) ; <nl> - <nl> - / * Must be called after pre_poll , and after consume if applicable * / <nl> - void grpc_pollset_kick_post_poll ( grpc_pollset_kick_state * kick_state ) ; <nl> - <nl> - void grpc_pollset_kick_kick ( grpc_pollset_kick_state * kick_state ) ; <nl> + void grpc_pollset_set_init ( grpc_pollset_set * pollset_set ) ; <nl> + void grpc_pollset_set_destroy ( grpc_pollset_set * pollset_set ) ; <nl> + void grpc_pollset_set_add_pollset ( grpc_pollset_set * pollset_set , <nl> + grpc_pollset * pollset ) ; <nl> + void grpc_pollset_set_del_pollset ( grpc_pollset_set * pollset_set , <nl> + grpc_pollset * pollset ) ; <nl> <nl> - # endif / * GRPC_INTERNAL_CORE_IOMGR_POLLSET_KICK_H * / <nl> + # endif / * GRPC_INTERNAL_CORE_IOMGR_POLLSET_H * / <nl> new file mode 100644 <nl> index 00000000000 . . 005e9383982 <nl> mmm / dev / null <nl> ppp b / src / core / iomgr / pollset_set_posix . c <nl> <nl> + / * <nl> + * <nl> + * Copyright 2015 , Google Inc . <nl> + * All rights reserved . <nl> + * <nl> + * Redistribution and use in source and binary forms , with or without <nl> + * modification , are permitted provided that the following conditions are <nl> + * met : <nl> + * <nl> + * * Redistributions of source code must retain the above copyright <nl> + * notice , this list of conditions and the following disclaimer . <nl> + * * Redistributions in binary form must reproduce the above <nl> + * copyright notice , this list of conditions and the following disclaimer <nl> + * in the documentation and / or other materials provided with the <nl> + * distribution . <nl> + * * Neither the name of Google Inc . nor the names of its <nl> + * contributors may be used to endorse or promote products derived from <nl> + * this software without specific prior written permission . <nl> + * <nl> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS <nl> + * " AS IS " AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT <nl> + * LIMITED TO , THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR <nl> + * A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT <nl> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT <nl> + * LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , <nl> + * DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY <nl> + * THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT <nl> + * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE <nl> + * OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE . <nl> + * <nl> + * / <nl> + <nl> + # include < grpc / support / port_platform . h > <nl> + <nl> + # ifdef GPR_POSIX_SOCKET <nl> + <nl> + # include < stdlib . h > <nl> + # include < string . h > <nl> + <nl> + # include < grpc / support / alloc . h > <nl> + # include < grpc / support / useful . h > <nl> + <nl> + # include " src / core / iomgr / pollset_set . h " <nl> + <nl> + void grpc_pollset_set_init ( grpc_pollset_set * pollset_set ) { <nl> + memset ( pollset_set , 0 , sizeof ( * pollset_set ) ) ; <nl> + gpr_mu_init ( & pollset_set - > mu ) ; <nl> + } <nl> + <nl> + void grpc_pollset_set_destroy ( grpc_pollset_set * pollset_set ) { <nl> + size_t i ; <nl> + gpr_mu_destroy ( & pollset_set - > mu ) ; <nl> + for ( i = 0 ; i < pollset_set - > fd_count ; i + + ) { <nl> + GRPC_FD_UNREF ( pollset_set - > fds [ i ] , " pollset " ) ; <nl> + } <nl> + gpr_free ( pollset_set - > pollsets ) ; <nl> + gpr_free ( pollset_set - > fds ) ; <nl> + } <nl> + <nl> + void grpc_pollset_set_add_pollset ( grpc_pollset_set * pollset_set , <nl> + grpc_pollset * pollset ) { <nl> + size_t i ; <nl> + gpr_mu_lock ( & pollset_set - > mu ) ; <nl> + if ( pollset_set - > pollset_count = = pollset_set - > pollset_capacity ) { <nl> + pollset_set - > pollset_capacity = <nl> + GPR_MAX ( 8 , 2 * pollset_set - > pollset_capacity ) ; <nl> + pollset_set - > pollsets = <nl> + gpr_realloc ( pollset_set - > pollsets , pollset_set - > pollset_capacity * <nl> + sizeof ( * pollset_set - > pollsets ) ) ; <nl> + } <nl> + pollset_set - > pollsets [ pollset_set - > pollset_count + + ] = pollset ; <nl> + for ( i = 0 ; i < pollset_set - > fd_count ; i + + ) { <nl> + grpc_pollset_add_fd ( pollset , pollset_set - > fds [ i ] ) ; <nl> + } <nl> + gpr_mu_unlock ( & pollset_set - > mu ) ; <nl> + } <nl> + <nl> + void grpc_pollset_set_del_pollset ( grpc_pollset_set * pollset_set , <nl> + grpc_pollset * pollset ) { <nl> + size_t i ; <nl> + gpr_mu_lock ( & pollset_set - > mu ) ; <nl> + for ( i = 0 ; i < pollset_set - > pollset_count ; i + + ) { <nl> + if ( pollset_set - > pollsets [ i ] = = pollset ) { <nl> + pollset_set - > pollset_count - - ; <nl> + GPR_SWAP ( grpc_pollset * , pollset_set - > pollsets [ i ] , <nl> + pollset_set - > pollsets [ pollset_set - > pollset_count ] ) ; <nl> + break ; <nl> + } <nl> + } <nl> + gpr_mu_unlock ( & pollset_set - > mu ) ; <nl> + } <nl> + <nl> + void grpc_pollset_set_add_fd ( grpc_pollset_set * pollset_set , grpc_fd * fd ) { <nl> + size_t i ; <nl> + gpr_mu_lock ( & pollset_set - > mu ) ; <nl> + if ( pollset_set - > fd_count = = pollset_set - > fd_capacity ) { <nl> + pollset_set - > fd_capacity = GPR_MAX ( 8 , 2 * pollset_set - > fd_capacity ) ; <nl> + pollset_set - > fds = gpr_realloc ( <nl> + pollset_set - > fds , pollset_set - > fd_capacity * sizeof ( * pollset_set - > fds ) ) ; <nl> + } <nl> + GRPC_FD_REF ( fd , " pollset_set " ) ; <nl> + pollset_set - > fds [ pollset_set - > fd_count + + ] = fd ; <nl> + for ( i = 0 ; i < pollset_set - > pollset_count ; i + + ) { <nl> + grpc_pollset_add_fd ( pollset_set - > pollsets [ i ] , fd ) ; <nl> + } <nl> + gpr_mu_unlock ( & pollset_set - > mu ) ; <nl> + } <nl> + <nl> + void grpc_pollset_set_del_fd ( grpc_pollset_set * pollset_set , grpc_fd * fd ) { <nl> + size_t i ; <nl> + gpr_mu_lock ( & pollset_set - > mu ) ; <nl> + for ( i = 0 ; i < pollset_set - > fd_count ; i + + ) { <nl> + if ( pollset_set - > fds [ i ] = = fd ) { <nl> + pollset_set - > fd_count - - ; <nl> + GPR_SWAP ( grpc_fd * , pollset_set - > fds [ i ] , <nl> + pollset_set - > fds [ pollset_set - > pollset_count ] ) ; <nl> + GRPC_FD_UNREF ( fd , " pollset_set " ) ; <nl> + break ; <nl> + } <nl> + } <nl> + gpr_mu_unlock ( & pollset_set - > mu ) ; <nl> + } <nl> + <nl> + # endif / * GPR_POSIX_SOCKET * / <nl> new file mode 100644 <nl> index 00000000000 . . e88740bde1d <nl> mmm / dev / null <nl> ppp b / src / core / iomgr / pollset_set_posix . h <nl> <nl> + / * <nl> + * <nl> + * Copyright 2015 , Google Inc . <nl> + * All rights reserved . <nl> + * <nl> + * Redistribution and use in source and binary forms , with or without <nl> + * modification , are permitted provided that the following conditions are <nl> + * met : <nl> + * <nl> + * * Redistributions of source code must retain the above copyright <nl> + * notice , this list of conditions and the following disclaimer . <nl> + * * Redistributions in binary form must reproduce the above <nl> + * copyright notice , this list of conditions and the following disclaimer <nl> + * in the documentation and / or other materials provided with the <nl> + * distribution . <nl> + * * Neither the name of Google Inc . nor the names of its <nl> + * contributors may be used to endorse or promote products derived from <nl> + * this software without specific prior written permission . <nl> + * <nl> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS <nl> + * " AS IS " AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT <nl> + * LIMITED TO , THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR <nl> + * A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT <nl> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT <nl> + * LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , <nl> + * DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY <nl> + * THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT <nl> + * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE <nl> + * OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE . <nl> + * <nl> + * / <nl> + <nl> + # ifndef GRPC_INTERNAL_CORE_IOMGR_POLLSET_SET_POSIX_H <nl> + # define GRPC_INTERNAL_CORE_IOMGR_POLLSET_SET_POSIX_H <nl> + <nl> + # include " src / core / iomgr / fd_posix . h " <nl> + # include " src / core / iomgr / pollset_posix . h " <nl> + <nl> + typedef struct grpc_pollset_set { <nl> + gpr_mu mu ; <nl> + <nl> + size_t pollset_count ; <nl> + size_t pollset_capacity ; <nl> + grpc_pollset * * pollsets ; <nl> + <nl> + size_t fd_count ; <nl> + size_t fd_capacity ; <nl> + grpc_fd * * fds ; <nl> + } grpc_pollset_set ; <nl> + <nl> + void grpc_pollset_set_add_fd ( grpc_pollset_set * pollset_set , grpc_fd * fd ) ; <nl> + void grpc_pollset_set_del_fd ( grpc_pollset_set * pollset_set , grpc_fd * fd ) ; <nl> + <nl> + # endif / * GRPC_INTERNAL_CORE_IOMGR_POLLSET_WINDOWS_H * / <nl> new file mode 100644 <nl> index 00000000000 . . b9c209cd2c7 <nl> mmm / dev / null <nl> ppp b / src / core / iomgr / pollset_set_windows . c <nl> <nl> + / * <nl> + * <nl> + * Copyright 2015 , Google Inc . <nl> + * All rights reserved . <nl> + * <nl> + * Redistribution and use in source and binary forms , with or without <nl> + * modification , are permitted provided that the following conditions are <nl> + * met : <nl> + * <nl> + * * Redistributions of source code must retain the above copyright <nl> + * notice , this list of conditions and the following disclaimer . <nl> + * * Redistributions in binary form must reproduce the above <nl> + * copyright notice , this list of conditions and the following disclaimer <nl> + * in the documentation and / or other materials provided with the <nl> + * distribution . <nl> + * * Neither the name of Google Inc . nor the names of its <nl> + * contributors may be used to endorse or promote products derived from <nl> + * this software without specific prior written permission . <nl> + * <nl> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS <nl> + * " AS IS " AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT <nl> + * LIMITED TO , THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR <nl> + * A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT <nl> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT <nl> + * LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , <nl> + * DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY <nl> + * THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT <nl> + * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE <nl> + * OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE . <nl> + * <nl> + * / <nl> + <nl> + # include < grpc / support / port_platform . h > <nl> + <nl> + # ifdef GPR_WINSOCK_SOCKET <nl> + <nl> + # include " src / core / iomgr / pollset_set . h " <nl> + <nl> + void grpc_pollset_set_init ( grpc_pollset_set * pollset_set ) { } <nl> + <nl> + void grpc_pollset_set_destroy ( grpc_pollset_set * pollset_set ) { } <nl> + <nl> + void grpc_pollset_set_add_pollset ( grpc_pollset_set * pollset_set , <nl> + grpc_pollset * pollset ) { } <nl> + <nl> + void grpc_pollset_set_del_pollset ( grpc_pollset_set * pollset_set , <nl> + grpc_pollset * pollset ) { } <nl> + <nl> + # endif / * GPR_WINSOCK_SOCKET * / <nl> similarity index 78 % <nl> rename from src / core / iomgr / pollset_kick_windows . h <nl> rename to src / core / iomgr / pollset_set_windows . h <nl> mmm a / src / core / iomgr / pollset_kick_windows . h <nl> ppp b / src / core / iomgr / pollset_set_windows . h <nl> <nl> * <nl> * / <nl> <nl> - # ifndef GRPC_INTERNAL_CORE_IOMGR_POLLSET_KICK_WINDOWS_H <nl> - # define GRPC_INTERNAL_CORE_IOMGR_POLLSET_KICK_WINDOWS_H <nl> + # ifndef GRPC_INTERNAL_CORE_IOMGR_POLLSET_SET_WINDOWS_H <nl> + # define GRPC_INTERNAL_CORE_IOMGR_POLLSET_SET_WINDOWS_H <nl> <nl> - # include < grpc / support / sync . h > <nl> + typedef struct grpc_pollset_set { void * unused ; } grpc_pollset_set ; <nl> <nl> - / * There isn ' t really any such thing as a pollset under Windows , due to the <nl> - nature of the IO completion ports . * / <nl> - <nl> - struct grpc_kick_fd_info ; <nl> - <nl> - typedef struct grpc_pollset_kick_state { <nl> - int unused ; <nl> - } grpc_pollset_kick_state ; <nl> - <nl> - # endif / * GRPC_INTERNAL_CORE_IOMGR_POLLSET_KICK_WINDOWS_H * / <nl> + # endif / * GRPC_INTERNAL_CORE_IOMGR_POLLSET_WINDOWS_H * / <nl> mmm a / src / core / iomgr / pollset_windows . c <nl> ppp b / src / core / iomgr / pollset_windows . c <nl> <nl> set of features for the sake of the rest of grpc . But grpc_pollset_work <nl> won ' t actually do any polling , and return as quickly as possible . * / <nl> <nl> - void grpc_pollset_init ( grpc_pollset * pollset ) { <nl> - gpr_mu_init ( & pollset - > mu ) ; <nl> - gpr_cv_init ( & pollset - > cv ) ; <nl> - } <nl> + void grpc_pollset_init ( grpc_pollset * pollset ) { gpr_mu_init ( & pollset - > mu ) ; } <nl> <nl> void grpc_pollset_shutdown ( grpc_pollset * pollset , <nl> void ( * shutdown_done ) ( void * arg ) , <nl> void grpc_pollset_shutdown ( grpc_pollset * pollset , <nl> <nl> void grpc_pollset_destroy ( grpc_pollset * pollset ) { <nl> gpr_mu_destroy ( & pollset - > mu ) ; <nl> - gpr_cv_destroy ( & pollset - > cv ) ; <nl> } <nl> <nl> int grpc_pollset_work ( grpc_pollset * pollset , gpr_timespec deadline ) { <nl> int grpc_pollset_work ( grpc_pollset * pollset , gpr_timespec deadline ) { <nl> return 0 / * GPR_FALSE * / ; <nl> } <nl> <nl> - void grpc_pollset_kick ( grpc_pollset * p ) { } <nl> + void grpc_pollset_kick ( grpc_pollset * p ) { } <nl> <nl> - # endif / * GPR_WINSOCK_SOCKET * / <nl> + # endif / * GPR_WINSOCK_SOCKET * / <nl> mmm a / src / core / iomgr / pollset_windows . h <nl> ppp b / src / core / iomgr / pollset_windows . h <nl> <nl> # include < windows . h > <nl> # include < grpc / support / sync . h > <nl> <nl> - # include " src / core / iomgr / pollset_kick . h " <nl> # include " src / core / iomgr / socket_windows . h " <nl> <nl> / * There isn ' t really any such thing as a pollset under Windows , due to the <nl> <nl> and a condition variable , as this is the minimal set of features we need <nl> implemented for the rest of grpc . But we won ' t use them directly . * / <nl> <nl> - typedef struct grpc_pollset { <nl> - gpr_mu mu ; <nl> - gpr_cv cv ; <nl> - } grpc_pollset ; <nl> + typedef struct grpc_pollset { gpr_mu mu ; } grpc_pollset ; <nl> <nl> # define GRPC_POLLSET_MU ( pollset ) ( & ( pollset ) - > mu ) <nl> - # define GRPC_POLLSET_CV ( pollset ) ( & ( pollset ) - > cv ) <nl> <nl> - # endif / * GRPC_INTERNAL_CORE_IOMGR_POLLSET_WINDOWS_H * / <nl> + # endif / * GRPC_INTERNAL_CORE_IOMGR_POLLSET_WINDOWS_H * / <nl> mmm a / src / core / iomgr / tcp_client . h <nl> ppp b / src / core / iomgr / tcp_client . h <nl> <nl> # define GRPC_INTERNAL_CORE_IOMGR_TCP_CLIENT_H <nl> <nl> # include " src / core / iomgr / endpoint . h " <nl> + # include " src / core / iomgr / pollset_set . h " <nl> # include " src / core / iomgr / sockaddr . h " <nl> # include < grpc / support / time . h > <nl> <nl> / * Asynchronously connect to an address ( specified as ( addr , len ) ) , and call <nl> cb with arg and the completed connection when done ( or call cb with arg and <nl> - NULL on failure ) * / <nl> + NULL on failure ) . <nl> + interested_parties points to a set of pollsets that would be interested <nl> + in this connection being established ( in order to continue their work ) * / <nl> void grpc_tcp_client_connect ( void ( * cb ) ( void * arg , grpc_endpoint * tcp ) , <nl> - void * arg , const struct sockaddr * addr , <nl> - int addr_len , gpr_timespec deadline ) ; <nl> + void * arg , grpc_pollset_set * interested_parties , <nl> + const struct sockaddr * addr , int addr_len , <nl> + gpr_timespec deadline ) ; <nl> <nl> - # endif / * GRPC_INTERNAL_CORE_IOMGR_TCP_CLIENT_H * / <nl> + # endif / * GRPC_INTERNAL_CORE_IOMGR_TCP_CLIENT_H * / <nl> mmm a / src / core / iomgr / tcp_client_posix . c <nl> ppp b / src / core / iomgr / tcp_client_posix . c <nl> static void on_writable ( void * acp , int success ) { <nl> void ( * cb ) ( void * arg , grpc_endpoint * tcp ) = ac - > cb ; <nl> void * cb_arg = ac - > cb_arg ; <nl> <nl> - grpc_alarm_cancel ( & ac - > alarm ) ; <nl> - <nl> if ( success ) { <nl> do { <nl> so_error_size = sizeof ( so_error ) ; <nl> static void on_writable ( void * acp , int success ) { <nl> finish : <nl> gpr_mu_lock ( & ac - > mu ) ; <nl> if ( ! ep ) { <nl> - grpc_fd_orphan ( ac - > fd , NULL , NULL ) ; <nl> + grpc_fd_orphan ( ac - > fd , NULL , " tcp_client_orphan " ) ; <nl> } <nl> done = ( - - ac - > refs = = 0 ) ; <nl> gpr_mu_unlock ( & ac - > mu ) ; <nl> if ( done ) { <nl> gpr_mu_destroy ( & ac - > mu ) ; <nl> gpr_free ( ac ) ; <nl> + } else { <nl> + grpc_alarm_cancel ( & ac - > alarm ) ; <nl> } <nl> cb ( cb_arg , ep ) ; <nl> } <nl> <nl> void grpc_tcp_client_connect ( void ( * cb ) ( void * arg , grpc_endpoint * ep ) , <nl> - void * arg , const struct sockaddr * addr , <nl> - int addr_len , gpr_timespec deadline ) { <nl> + void * arg , grpc_pollset_set * interested_parties , <nl> + const struct sockaddr * addr , int addr_len , <nl> + gpr_timespec deadline ) { <nl> int fd ; <nl> grpc_dualstack_mode dsmode ; <nl> int err ; <nl> async_connect * ac ; <nl> struct sockaddr_in6 addr6_v4mapped ; <nl> struct sockaddr_in addr4_copy ; <nl> + grpc_fd * fdobj ; <nl> char * name ; <nl> char * addr_str ; <nl> <nl> void grpc_tcp_client_connect ( void ( * cb ) ( void * arg , grpc_endpoint * ep ) , <nl> grpc_sockaddr_to_string ( & addr_str , addr , 1 ) ; <nl> gpr_asprintf ( & name , " tcp - client : % s " , addr_str ) ; <nl> <nl> + fdobj = grpc_fd_create ( fd , name ) ; <nl> + <nl> if ( err > = 0 ) { <nl> - gpr_log ( GPR_DEBUG , " instant connect " ) ; <nl> - cb ( arg , grpc_tcp_create ( grpc_fd_create ( fd , name ) , <nl> - GRPC_TCP_DEFAULT_READ_SLICE_SIZE ) ) ; <nl> + cb ( arg , grpc_tcp_create ( fdobj , GRPC_TCP_DEFAULT_READ_SLICE_SIZE ) ) ; <nl> goto done ; <nl> } <nl> <nl> if ( errno ! = EWOULDBLOCK & & errno ! = EINPROGRESS ) { <nl> gpr_log ( GPR_ERROR , " connect error to ' % s ' : % s " , addr_str , strerror ( errno ) ) ; <nl> - close ( fd ) ; <nl> + grpc_fd_orphan ( fdobj , NULL , " tcp_client_connect_error " ) ; <nl> cb ( arg , NULL ) ; <nl> goto done ; <nl> } <nl> <nl> + grpc_pollset_set_add_fd ( interested_parties , fdobj ) ; <nl> + <nl> ac = gpr_malloc ( sizeof ( async_connect ) ) ; <nl> ac - > cb = cb ; <nl> ac - > cb_arg = arg ; <nl> - ac - > fd = grpc_fd_create ( fd , name ) ; <nl> + ac - > fd = fdobj ; <nl> gpr_mu_init ( & ac - > mu ) ; <nl> ac - > refs = 2 ; <nl> ac - > write_closure . cb = on_writable ; <nl> ac - > write_closure . cb_arg = ac ; <nl> <nl> + gpr_mu_lock ( & ac - > mu ) ; <nl> grpc_alarm_init ( & ac - > alarm , deadline , on_alarm , ac , gpr_now ( ) ) ; <nl> grpc_fd_notify_on_write ( ac - > fd , & ac - > write_closure ) ; <nl> + gpr_mu_unlock ( & ac - > mu ) ; <nl> <nl> done : <nl> gpr_free ( name ) ; <nl> mmm a / src / core / iomgr / tcp_client_windows . c <nl> ppp b / src / core / iomgr / tcp_client_windows . c <nl> <nl> # include " src / core / iomgr / socket_windows . h " <nl> <nl> typedef struct { <nl> - void ( * cb ) ( void * arg , grpc_endpoint * tcp ) ; <nl> + void ( * cb ) ( void * arg , grpc_endpoint * tcp ) ; <nl> void * cb_arg ; <nl> gpr_mu mu ; <nl> grpc_winsocket * socket ; <nl> static void on_connect ( void * acp , int from_iocp ) { <nl> SOCKET sock = ac - > socket - > socket ; <nl> grpc_endpoint * ep = NULL ; <nl> grpc_winsocket_callback_info * info = & ac - > socket - > write_info ; <nl> - void ( * cb ) ( void * arg , grpc_endpoint * tcp ) = ac - > cb ; <nl> + void ( * cb ) ( void * arg , grpc_endpoint * tcp ) = ac - > cb ; <nl> void * cb_arg = ac - > cb_arg ; <nl> int aborted ; <nl> <nl> static void on_connect ( void * acp , int from_iocp ) { <nl> DWORD transfered_bytes = 0 ; <nl> DWORD flags ; <nl> BOOL wsa_success = WSAGetOverlappedResult ( sock , & info - > overlapped , <nl> - & transfered_bytes , FALSE , <nl> - & flags ) ; <nl> + & transfered_bytes , FALSE , & flags ) ; <nl> info - > outstanding = 0 ; <nl> GPR_ASSERT ( transfered_bytes = = 0 ) ; <nl> if ( ! wsa_success ) { <nl> static void on_connect ( void * acp , int from_iocp ) { <nl> <nl> / * Tries to issue one async connection , then schedules both an IOCP <nl> notification request for the connection , and one timeout alert . * / <nl> - void grpc_tcp_client_connect ( void ( * cb ) ( void * arg , grpc_endpoint * tcp ) , <nl> - void * arg , const struct sockaddr * addr , <nl> - int addr_len , gpr_timespec deadline ) { <nl> + void grpc_tcp_client_connect ( void ( * cb ) ( void * arg , grpc_endpoint * tcp ) , <nl> + void * arg , grpc_pollset_set * interested_parties , <nl> + const struct sockaddr * addr , int addr_len , <nl> + gpr_timespec deadline ) { <nl> SOCKET sock = INVALID_SOCKET ; <nl> BOOL success ; <nl> int status ; <nl> void grpc_tcp_client_connect ( void ( * cb ) ( void * arg , grpc_endpoint * tcp ) , <nl> <nl> / * Grab the function pointer for ConnectEx for that specific socket . <nl> It may change depending on the interface . * / <nl> - status = WSAIoctl ( sock , SIO_GET_EXTENSION_FUNCTION_POINTER , <nl> - & guid , sizeof ( guid ) , & ConnectEx , sizeof ( ConnectEx ) , <nl> - & ioctl_num_bytes , NULL , NULL ) ; <nl> + status = <nl> + WSAIoctl ( sock , SIO_GET_EXTENSION_FUNCTION_POINTER , & guid , sizeof ( guid ) , <nl> + & ConnectEx , sizeof ( ConnectEx ) , & ioctl_num_bytes , NULL , NULL ) ; <nl> <nl> if ( status ! = 0 ) { <nl> message = " Unable to retrieve ConnectEx pointer : % s " ; <nl> void grpc_tcp_client_connect ( void ( * cb ) ( void * arg , grpc_endpoint * tcp ) , <nl> <nl> grpc_sockaddr_make_wildcard6 ( 0 , & local_address ) ; <nl> <nl> - status = bind ( sock , ( struct sockaddr * ) & local_address , <nl> - sizeof ( local_address ) ) ; <nl> + status = bind ( sock , ( struct sockaddr * ) & local_address , sizeof ( local_address ) ) ; <nl> if ( status ! = 0 ) { <nl> message = " Unable to bind socket : % s " ; <nl> goto failure ; <nl> void grpc_tcp_client_connect ( void ( * cb ) ( void * arg , grpc_endpoint * tcp ) , <nl> cb ( arg , NULL ) ; <nl> } <nl> <nl> - # endif / * GPR_WINSOCK_SOCKET * / <nl> + # endif / * GPR_WINSOCK_SOCKET * / <nl> mmm a / src / core / iomgr / tcp_posix . c <nl> ppp b / src / core / iomgr / tcp_posix . c <nl> typedef struct { <nl> grpc_endpoint base ; <nl> grpc_fd * em_fd ; <nl> int fd ; <nl> - int iov_size ; / * Number of slices to allocate per read attempt * / <nl> + int iov_size ; / * Number of slices to allocate per read attempt * / <nl> int finished_edge ; <nl> size_t slice_size ; <nl> gpr_refcount refcount ; <nl> static void grpc_tcp_shutdown ( grpc_endpoint * ep ) { <nl> static void grpc_tcp_unref ( grpc_tcp * tcp ) { <nl> int refcount_zero = gpr_unref ( & tcp - > refcount ) ; <nl> if ( refcount_zero ) { <nl> - grpc_fd_orphan ( tcp - > em_fd , NULL , NULL ) ; <nl> + grpc_fd_orphan ( tcp - > em_fd , NULL , " tcp_unref_orphan " ) ; <nl> gpr_free ( tcp ) ; <nl> } <nl> } <nl> static void grpc_tcp_continue_read ( grpc_tcp * tcp ) { <nl> + + tcp - > iov_size ; <nl> } <nl> GPR_ASSERT ( slice_state_has_available ( & read_state ) ) ; <nl> - slice_state_transfer_ownership ( & read_state , & final_slices , <nl> - & final_nslices ) ; <nl> + slice_state_transfer_ownership ( & read_state , & final_slices , & final_nslices ) ; <nl> call_read_cb ( tcp , final_slices , final_nslices , GRPC_ENDPOINT_CB_OK ) ; <nl> slice_state_destroy ( & read_state ) ; <nl> grpc_tcp_unref ( tcp ) ; <nl> mmm a / src / core / iomgr / tcp_server_posix . c <nl> ppp b / src / core / iomgr / tcp_server_posix . c <nl> typedef struct { <nl> } addr ; <nl> int addr_len ; <nl> grpc_iomgr_closure read_closure ; <nl> + grpc_iomgr_closure destroyed_closure ; <nl> } server_port ; <nl> <nl> static void unlink_if_unix_domain_socket ( const struct sockaddr_un * un ) { <nl> struct grpc_tcp_server { <nl> void * cb_arg ; <nl> <nl> gpr_mu mu ; <nl> - gpr_cv cv ; <nl> <nl> / * active port count : how many ports are actually still listening * / <nl> size_t active_ports ; <nl> / * destroyed port count : how many ports are completely destroyed * / <nl> size_t destroyed_ports ; <nl> <nl> + / * is this server shutting down ? ( boolean ) * / <nl> + int shutdown ; <nl> + <nl> / * all listening ports * / <nl> server_port * ports ; <nl> size_t nports ; <nl> struct grpc_tcp_server { <nl> / * shutdown callback * / <nl> void ( * shutdown_complete ) ( void * ) ; <nl> void * shutdown_complete_arg ; <nl> + <nl> + / * all pollsets interested in new connections * / <nl> + grpc_pollset * * pollsets ; <nl> + / * number of pollsets in the pollsets array * / <nl> + size_t pollset_count ; <nl> } ; <nl> <nl> grpc_tcp_server * grpc_tcp_server_create ( void ) { <nl> grpc_tcp_server * s = gpr_malloc ( sizeof ( grpc_tcp_server ) ) ; <nl> gpr_mu_init ( & s - > mu ) ; <nl> - gpr_cv_init ( & s - > cv ) ; <nl> s - > active_ports = 0 ; <nl> s - > destroyed_ports = 0 ; <nl> + s - > shutdown = 0 ; <nl> s - > cb = NULL ; <nl> s - > cb_arg = NULL ; <nl> s - > ports = gpr_malloc ( sizeof ( server_port ) * INIT_PORT_CAP ) ; <nl> static void finish_shutdown ( grpc_tcp_server * s ) { <nl> s - > shutdown_complete ( s - > shutdown_complete_arg ) ; <nl> <nl> gpr_mu_destroy ( & s - > mu ) ; <nl> - gpr_cv_destroy ( & s - > cv ) ; <nl> <nl> gpr_free ( s - > ports ) ; <nl> gpr_free ( s ) ; <nl> static void destroyed_port ( void * server , int success ) { <nl> <nl> static void dont_care_about_shutdown_completion ( void * ignored ) { } <nl> <nl> + / * called when all listening endpoints have been shutdown , so no further <nl> + events will be received on them - at this point it ' s safe to destroy <nl> + things * / <nl> + static void deactivated_all_ports ( grpc_tcp_server * s ) { <nl> + size_t i ; <nl> + <nl> + / * delete ALL the things * / <nl> + gpr_mu_lock ( & s - > mu ) ; <nl> + <nl> + if ( ! s - > shutdown ) { <nl> + gpr_mu_unlock ( & s - > mu ) ; <nl> + return ; <nl> + } <nl> + <nl> + if ( s - > nports ) { <nl> + for ( i = 0 ; i < s - > nports ; i + + ) { <nl> + server_port * sp = & s - > ports [ i ] ; <nl> + if ( sp - > addr . sockaddr . sa_family = = AF_UNIX ) { <nl> + unlink_if_unix_domain_socket ( & sp - > addr . un ) ; <nl> + } <nl> + sp - > destroyed_closure . cb = destroyed_port ; <nl> + sp - > destroyed_closure . cb_arg = s ; <nl> + grpc_fd_orphan ( sp - > emfd , & sp - > destroyed_closure , " tcp_listener_shutdown " ) ; <nl> + } <nl> + gpr_mu_unlock ( & s - > mu ) ; <nl> + } else { <nl> + gpr_mu_unlock ( & s - > mu ) ; <nl> + finish_shutdown ( s ) ; <nl> + } <nl> + } <nl> + <nl> void grpc_tcp_server_destroy ( <nl> grpc_tcp_server * s , void ( * shutdown_complete ) ( void * shutdown_complete_arg ) , <nl> void * shutdown_complete_arg ) { <nl> size_t i ; <nl> gpr_mu_lock ( & s - > mu ) ; <nl> <nl> + GPR_ASSERT ( ! s - > shutdown ) ; <nl> + s - > shutdown = 1 ; <nl> + <nl> s - > shutdown_complete = shutdown_complete <nl> ? shutdown_complete <nl> : dont_care_about_shutdown_completion ; <nl> s - > shutdown_complete_arg = shutdown_complete_arg ; <nl> <nl> / * shutdown all fd ' s * / <nl> - for ( i = 0 ; i < s - > nports ; i + + ) { <nl> - grpc_fd_shutdown ( s - > ports [ i ] . emfd ) ; <nl> - } <nl> - / * wait while that happens * / <nl> - / * TODO ( ctiller ) : make this asynchronous also * / <nl> - while ( s - > active_ports ) { <nl> - gpr_cv_wait ( & s - > cv , & s - > mu , gpr_inf_future ) ; <nl> - } <nl> - <nl> - / * delete ALL the things * / <nl> - if ( s - > nports ) { <nl> + if ( s - > active_ports ) { <nl> for ( i = 0 ; i < s - > nports ; i + + ) { <nl> - server_port * sp = & s - > ports [ i ] ; <nl> - if ( sp - > addr . sockaddr . sa_family = = AF_UNIX ) { <nl> - unlink_if_unix_domain_socket ( & sp - > addr . un ) ; <nl> - } <nl> - grpc_fd_orphan ( sp - > emfd , destroyed_port , s ) ; <nl> + grpc_fd_shutdown ( s - > ports [ i ] . emfd ) ; <nl> } <nl> gpr_mu_unlock ( & s - > mu ) ; <nl> } else { <nl> gpr_mu_unlock ( & s - > mu ) ; <nl> - finish_shutdown ( s ) ; <nl> + deactivated_all_ports ( s ) ; <nl> } <nl> } <nl> <nl> static int prepare_socket ( int fd , const struct sockaddr * addr , int addr_len ) { <nl> / * event manager callback when reads are ready * / <nl> static void on_read ( void * arg , int success ) { <nl> server_port * sp = arg ; <nl> + grpc_fd * fdobj ; <nl> + size_t i ; <nl> <nl> if ( ! success ) { <nl> goto error ; <nl> static void on_read ( void * arg , int success ) { <nl> grpc_sockaddr_to_string ( & addr_str , ( struct sockaddr * ) & addr , 1 ) ; <nl> gpr_asprintf ( & name , " tcp - server - connection : % s " , addr_str ) ; <nl> <nl> + fdobj = grpc_fd_create ( fd , name ) ; <nl> + / * TODO ( ctiller ) : revise this when we have server - side sharding <nl> + of channels - - we certainly should not be automatically adding every <nl> + incoming channel to every pollset owned by the server * / <nl> + for ( i = 0 ; i < sp - > server - > pollset_count ; i + + ) { <nl> + grpc_pollset_add_fd ( sp - > server - > pollsets [ i ] , fdobj ) ; <nl> + } <nl> sp - > server - > cb ( sp - > server - > cb_arg , <nl> - grpc_tcp_create ( grpc_fd_create ( fd , name ) , <nl> - GRPC_TCP_DEFAULT_READ_SLICE_SIZE ) ) ; <nl> + grpc_tcp_create ( fdobj , GRPC_TCP_DEFAULT_READ_SLICE_SIZE ) ) ; <nl> <nl> - gpr_free ( addr_str ) ; <nl> gpr_free ( name ) ; <nl> + gpr_free ( addr_str ) ; <nl> } <nl> <nl> abort ( ) ; <nl> static void on_read ( void * arg , int success ) { <nl> error : <nl> gpr_mu_lock ( & sp - > server - > mu ) ; <nl> if ( 0 = = - - sp - > server - > active_ports ) { <nl> - gpr_cv_broadcast ( & sp - > server - > cv ) ; <nl> + gpr_mu_unlock ( & sp - > server - > mu ) ; <nl> + deactivated_all_ports ( sp - > server ) ; <nl> + } else { <nl> + gpr_mu_unlock ( & sp - > server - > mu ) ; <nl> } <nl> - gpr_mu_unlock ( & sp - > server - > mu ) ; <nl> } <nl> <nl> static int add_socket_to_server ( grpc_tcp_server * s , int fd , <nl> void grpc_tcp_server_start ( grpc_tcp_server * s , grpc_pollset * * pollsets , <nl> GPR_ASSERT ( s - > active_ports = = 0 ) ; <nl> s - > cb = cb ; <nl> s - > cb_arg = cb_arg ; <nl> + s - > pollsets = pollsets ; <nl> + s - > pollset_count = pollset_count ; <nl> for ( i = 0 ; i < s - > nports ; i + + ) { <nl> for ( j = 0 ; j < pollset_count ; j + + ) { <nl> grpc_pollset_add_fd ( pollsets [ j ] , s - > ports [ i ] . emfd ) ; <nl> mmm a / src / core / security / client_auth_filter . c <nl> ppp b / src / core / security / client_auth_filter . c <nl> typedef struct { <nl> grpc_credentials * creds ; <nl> grpc_mdstr * host ; <nl> grpc_mdstr * method ; <nl> + / * pollset bound to this call ; if we need to make external <nl> + network requests , they should be done under this pollset <nl> + so that work can progress when this call wants work to <nl> + progress * / <nl> + grpc_pollset * pollset ; <nl> grpc_transport_op op ; <nl> size_t op_md_idx ; <nl> int sent_initial_metadata ; <nl> static void send_security_metadata ( grpc_call_element * elem , <nl> service_url = <nl> build_service_url ( chand - > security_connector - > base . url_scheme , calld ) ; <nl> calld - > op = * op ; / * Copy op ( originates from the caller ' s stack ) . * / <nl> - grpc_credentials_get_request_metadata ( calld - > creds , service_url , <nl> - on_credentials_metadata , elem ) ; <nl> + GPR_ASSERT ( calld - > pollset ) ; <nl> + grpc_credentials_get_request_metadata ( <nl> + calld - > creds , calld - > pollset , service_url , on_credentials_metadata , elem ) ; <nl> gpr_free ( service_url ) ; <nl> } <nl> <nl> static void auth_start_transport_op ( grpc_call_element * elem , <nl> <nl> / * TODO ( jboeuf ) : write the call auth context . * / <nl> <nl> + if ( op - > bind_pollset ) { <nl> + calld - > pollset = op - > bind_pollset ; <nl> + } <nl> + <nl> if ( op - > send_ops & & ! calld - > sent_initial_metadata ) { <nl> size_t nops = op - > send_ops - > nops ; <nl> grpc_stream_op * ops = op - > send_ops - > ops ; <nl> static void init_call_elem ( grpc_call_element * elem , <nl> calld - > creds = NULL ; <nl> calld - > host = NULL ; <nl> calld - > method = NULL ; <nl> + calld - > pollset = NULL ; <nl> calld - > sent_initial_metadata = 0 ; <nl> <nl> GPR_ASSERT ( ! initial_op | | ! initial_op - > send_ops ) ; <nl> static void init_channel_elem ( grpc_channel_element * elem , <nl> chand - > security_connector = <nl> ( grpc_channel_security_connector * ) grpc_security_connector_ref ( sc ) ; <nl> chand - > md_ctx = metadata_context ; <nl> - chand - > authority_string = <nl> - grpc_mdstr_from_string ( chand - > md_ctx , " : authority " ) ; <nl> + chand - > authority_string = grpc_mdstr_from_string ( chand - > md_ctx , " : authority " ) ; <nl> chand - > path_string = grpc_mdstr_from_string ( chand - > md_ctx , " : path " ) ; <nl> - chand - > error_msg_key = <nl> - grpc_mdstr_from_string ( chand - > md_ctx , " grpc - message " ) ; <nl> - chand - > status_key = <nl> - grpc_mdstr_from_string ( chand - > md_ctx , " grpc - status " ) ; <nl> + chand - > error_msg_key = grpc_mdstr_from_string ( chand - > md_ctx , " grpc - message " ) ; <nl> + chand - > status_key = grpc_mdstr_from_string ( chand - > md_ctx , " grpc - status " ) ; <nl> } <nl> <nl> / * Destructor for channel data * / <nl> static void destroy_channel_elem ( grpc_channel_element * elem ) { <nl> } <nl> <nl> const grpc_channel_filter grpc_client_auth_filter = { <nl> - auth_start_transport_op , channel_op , sizeof ( call_data ) , init_call_elem , <nl> - destroy_call_elem , sizeof ( channel_data ) , init_channel_elem , <nl> - destroy_channel_elem , " client - auth " } ; <nl> + auth_start_transport_op , channel_op , sizeof ( call_data ) , <nl> + init_call_elem , destroy_call_elem , sizeof ( channel_data ) , <nl> + init_channel_elem , destroy_channel_elem , " client - auth " } ; <nl> mmm a / src / core / security / credentials . c <nl> ppp b / src / core / security / credentials . c <nl> int grpc_credentials_has_request_metadata_only ( grpc_credentials * creds ) { <nl> } <nl> <nl> void grpc_credentials_get_request_metadata ( grpc_credentials * creds , <nl> + grpc_pollset * pollset , <nl> const char * service_url , <nl> grpc_credentials_metadata_cb cb , <nl> void * user_data ) { <nl> void grpc_credentials_get_request_metadata ( grpc_credentials * creds , <nl> } <nl> return ; <nl> } <nl> - creds - > vtable - > get_request_metadata ( creds , service_url , cb , user_data ) ; <nl> + creds - > vtable - > get_request_metadata ( creds , pollset , service_url , cb , <nl> + user_data ) ; <nl> } <nl> <nl> grpc_security_status grpc_credentials_create_security_connector ( <nl> static void ssl_server_destroy ( grpc_server_credentials * creds ) { <nl> gpr_free ( creds ) ; <nl> } <nl> <nl> - static int ssl_has_request_metadata ( const grpc_credentials * creds ) { <nl> - return 0 ; <nl> - } <nl> + static int ssl_has_request_metadata ( const grpc_credentials * creds ) { return 0 ; } <nl> <nl> static int ssl_has_request_metadata_only ( const grpc_credentials * creds ) { <nl> return 0 ; <nl> static int jwt_has_request_metadata_only ( const grpc_credentials * creds ) { <nl> return 1 ; <nl> } <nl> <nl> - <nl> static void jwt_get_request_metadata ( grpc_credentials * creds , <nl> + grpc_pollset * pollset , <nl> const char * service_url , <nl> grpc_credentials_metadata_cb cb , <nl> void * user_data ) { <nl> grpc_credentials * grpc_jwt_credentials_create ( const char * json_key , <nl> from an http service . * / <nl> <nl> typedef void ( * grpc_fetch_oauth2_func ) ( grpc_credentials_metadata_request * req , <nl> + grpc_httpcli_context * http_context , <nl> + grpc_pollset * pollset , <nl> grpc_httpcli_response_cb response_cb , <nl> gpr_timespec deadline ) ; <nl> <nl> typedef struct { <nl> gpr_mu mu ; <nl> grpc_credentials_md_store * access_token_md ; <nl> gpr_timespec token_expiration ; <nl> + grpc_httpcli_context httpcli_context ; <nl> + grpc_pollset_set pollset_set ; <nl> grpc_fetch_oauth2_func fetch_func ; <nl> } grpc_oauth2_token_fetcher_credentials ; <nl> <nl> static void oauth2_token_fetcher_destroy ( grpc_credentials * creds ) { <nl> ( grpc_oauth2_token_fetcher_credentials * ) creds ; <nl> grpc_credentials_md_store_unref ( c - > access_token_md ) ; <nl> gpr_mu_destroy ( & c - > mu ) ; <nl> + grpc_httpcli_context_destroy ( & c - > httpcli_context ) ; <nl> gpr_free ( c ) ; <nl> } <nl> <nl> static int oauth2_token_fetcher_has_request_metadata_only ( <nl> <nl> grpc_credentials_status <nl> grpc_oauth2_token_fetcher_credentials_parse_server_response ( <nl> - const grpc_httpcli_response * response , <nl> - grpc_credentials_md_store * * token_md , gpr_timespec * token_lifetime ) { <nl> + const grpc_httpcli_response * response , grpc_credentials_md_store * * token_md , <nl> + gpr_timespec * token_lifetime ) { <nl> char * null_terminated_body = NULL ; <nl> char * new_access_token = NULL ; <nl> grpc_credentials_status status = GRPC_CREDENTIALS_OK ; <nl> static void on_oauth2_token_fetcher_http_response ( <nl> } <nl> <nl> static void oauth2_token_fetcher_get_request_metadata ( <nl> - grpc_credentials * creds , const char * service_url , <nl> + grpc_credentials * creds , grpc_pollset * pollset , const char * service_url , <nl> grpc_credentials_metadata_cb cb , void * user_data ) { <nl> grpc_oauth2_token_fetcher_credentials * c = <nl> ( grpc_oauth2_token_fetcher_credentials * ) creds ; <nl> static void oauth2_token_fetcher_get_request_metadata ( <nl> if ( c - > access_token_md ! = NULL & & <nl> ( gpr_time_cmp ( gpr_time_sub ( c - > token_expiration , gpr_now ( ) ) , <nl> refresh_threshold ) > 0 ) ) { <nl> - cached_access_token_md = grpc_credentials_md_store_ref ( c - > access_token_md ) ; <nl> + cached_access_token_md = <nl> + grpc_credentials_md_store_ref ( c - > access_token_md ) ; <nl> } <nl> gpr_mu_unlock ( & c - > mu ) ; <nl> } <nl> static void oauth2_token_fetcher_get_request_metadata ( <nl> } else { <nl> c - > fetch_func ( <nl> grpc_credentials_metadata_request_create ( creds , cb , user_data ) , <nl> - on_oauth2_token_fetcher_http_response , <nl> + & c - > httpcli_context , pollset , on_oauth2_token_fetcher_http_response , <nl> gpr_time_add ( gpr_now ( ) , refresh_threshold ) ) ; <nl> } <nl> } <nl> static void init_oauth2_token_fetcher ( grpc_oauth2_token_fetcher_credentials * c , <nl> gpr_mu_init ( & c - > mu ) ; <nl> c - > token_expiration = gpr_inf_past ; <nl> c - > fetch_func = fetch_func ; <nl> + grpc_pollset_set_init ( & c - > pollset_set ) ; <nl> } <nl> <nl> / * - - ComputeEngine credentials . - - * / <nl> static grpc_credentials_vtable compute_engine_vtable = { <nl> <nl> static void compute_engine_fetch_oauth2 ( <nl> grpc_credentials_metadata_request * metadata_req , <nl> + grpc_httpcli_context * httpcli_context , grpc_pollset * pollset , <nl> grpc_httpcli_response_cb response_cb , gpr_timespec deadline ) { <nl> grpc_httpcli_header header = { " Metadata - Flavor " , " Google " } ; <nl> grpc_httpcli_request request ; <nl> static void compute_engine_fetch_oauth2 ( <nl> request . path = GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH ; <nl> request . hdr_count = 1 ; <nl> request . hdrs = & header ; <nl> - grpc_httpcli_get ( & request , deadline , response_cb , metadata_req ) ; <nl> + grpc_httpcli_get ( httpcli_context , pollset , & request , deadline , response_cb , <nl> + metadata_req ) ; <nl> } <nl> <nl> grpc_credentials * grpc_compute_engine_credentials_create ( void ) { <nl> static grpc_credentials_vtable service_account_vtable = { <nl> <nl> static void service_account_fetch_oauth2 ( <nl> grpc_credentials_metadata_request * metadata_req , <nl> + grpc_httpcli_context * httpcli_context , grpc_pollset * pollset , <nl> grpc_httpcli_response_cb response_cb , gpr_timespec deadline ) { <nl> grpc_service_account_credentials * c = <nl> ( grpc_service_account_credentials * ) metadata_req - > creds ; <nl> static void service_account_fetch_oauth2 ( <nl> request . hdr_count = 1 ; <nl> request . hdrs = & header ; <nl> request . use_ssl = 1 ; <nl> - grpc_httpcli_post ( & request , body , strlen ( body ) , deadline , response_cb , <nl> - metadata_req ) ; <nl> + grpc_httpcli_post ( httpcli_context , pollset , & request , body , strlen ( body ) , <nl> + deadline , response_cb , metadata_req ) ; <nl> gpr_free ( body ) ; <nl> gpr_free ( jwt ) ; <nl> } <nl> typedef struct { <nl> } grpc_refresh_token_credentials ; <nl> <nl> static void refresh_token_destroy ( grpc_credentials * creds ) { <nl> - grpc_refresh_token_credentials * c = <nl> - ( grpc_refresh_token_credentials * ) creds ; <nl> + grpc_refresh_token_credentials * c = ( grpc_refresh_token_credentials * ) creds ; <nl> grpc_auth_refresh_token_destruct ( & c - > refresh_token ) ; <nl> oauth2_token_fetcher_destroy ( & c - > base . base ) ; <nl> } <nl> static grpc_credentials_vtable refresh_token_vtable = { <nl> <nl> static void refresh_token_fetch_oauth2 ( <nl> grpc_credentials_metadata_request * metadata_req , <nl> + grpc_httpcli_context * httpcli_context , grpc_pollset * pollset , <nl> grpc_httpcli_response_cb response_cb , gpr_timespec deadline ) { <nl> grpc_refresh_token_credentials * c = <nl> ( grpc_refresh_token_credentials * ) metadata_req - > creds ; <nl> static void refresh_token_fetch_oauth2 ( <nl> request . hdr_count = 1 ; <nl> request . hdrs = & header ; <nl> request . use_ssl = 1 ; <nl> - grpc_httpcli_post ( & request , body , strlen ( body ) , deadline , response_cb , <nl> - metadata_req ) ; <nl> + grpc_httpcli_post ( httpcli_context , pollset , & request , body , strlen ( body ) , <nl> + deadline , response_cb , metadata_req ) ; <nl> gpr_free ( body ) ; <nl> } <nl> <nl> grpc_credentials * grpc_refresh_token_credentials_create ( <nl> grpc_auth_refresh_token_create_from_string ( json_refresh_token ) ; <nl> <nl> if ( ! grpc_auth_refresh_token_is_valid ( & refresh_token ) ) { <nl> - gpr_log ( GPR_ERROR , <nl> - " Invalid input for refresh token credentials creation " ) ; <nl> + gpr_log ( GPR_ERROR , " Invalid input for refresh token credentials creation " ) ; <nl> return NULL ; <nl> } <nl> c = gpr_malloc ( sizeof ( grpc_refresh_token_credentials ) ) ; <nl> void on_simulated_token_fetch_done ( void * user_data , int success ) { <nl> } <nl> <nl> static void fake_oauth2_get_request_metadata ( grpc_credentials * creds , <nl> + grpc_pollset * pollset , <nl> const char * service_url , <nl> grpc_credentials_metadata_cb cb , <nl> void * user_data ) { <nl> static int fake_transport_security_has_request_metadata_only ( <nl> return 0 ; <nl> } <nl> <nl> - static grpc_security_status <nl> - fake_transport_security_create_security_connector ( <nl> + static grpc_security_status fake_transport_security_create_security_connector ( <nl> grpc_credentials * c , const char * target , const grpc_channel_args * args , <nl> grpc_credentials * request_metadata_creds , <nl> grpc_channel_security_connector * * sc , grpc_channel_args * * new_args ) { <nl> typedef struct { <nl> grpc_credentials_md_store * md_elems ; <nl> char * service_url ; <nl> void * user_data ; <nl> + grpc_pollset * pollset ; <nl> grpc_credentials_metadata_cb cb ; <nl> } grpc_composite_credentials_metadata_context ; <nl> <nl> static void composite_metadata_cb ( void * user_data , <nl> grpc_credentials * inner_creds = <nl> ctx - > composite_creds - > inner . creds_array [ ctx - > creds_index + + ] ; <nl> if ( grpc_credentials_has_request_metadata ( inner_creds ) ) { <nl> - grpc_credentials_get_request_metadata ( inner_creds , ctx - > service_url , <nl> + grpc_credentials_get_request_metadata ( inner_creds , ctx - > pollset , <nl> + ctx - > service_url , <nl> composite_metadata_cb , ctx ) ; <nl> return ; <nl> } <nl> static void composite_metadata_cb ( void * user_data , <nl> } <nl> <nl> static void composite_get_request_metadata ( grpc_credentials * creds , <nl> + grpc_pollset * pollset , <nl> const char * service_url , <nl> grpc_credentials_metadata_cb cb , <nl> void * user_data ) { <nl> static void composite_get_request_metadata ( grpc_credentials * creds , <nl> ctx - > user_data = user_data ; <nl> ctx - > cb = cb ; <nl> ctx - > composite_creds = c ; <nl> + ctx - > pollset = pollset ; <nl> ctx - > md_elems = grpc_credentials_md_store_create ( c - > inner . num_creds ) ; <nl> while ( ctx - > creds_index < c - > inner . num_creds ) { <nl> grpc_credentials * inner_creds = c - > inner . creds_array [ ctx - > creds_index + + ] ; <nl> if ( grpc_credentials_has_request_metadata ( inner_creds ) ) { <nl> - grpc_credentials_get_request_metadata ( inner_creds , service_url , <nl> + grpc_credentials_get_request_metadata ( inner_creds , pollset , service_url , <nl> composite_metadata_cb , ctx ) ; <nl> return ; <nl> } <nl> static void iam_destroy ( grpc_credentials * creds ) { <nl> gpr_free ( c ) ; <nl> } <nl> <nl> - static int iam_has_request_metadata ( const grpc_credentials * creds ) { <nl> - return 1 ; <nl> - } <nl> + static int iam_has_request_metadata ( const grpc_credentials * creds ) { return 1 ; } <nl> <nl> static int iam_has_request_metadata_only ( const grpc_credentials * creds ) { <nl> return 1 ; <nl> } <nl> <nl> static void iam_get_request_metadata ( grpc_credentials * creds , <nl> + grpc_pollset * pollset , <nl> const char * service_url , <nl> grpc_credentials_metadata_cb cb , <nl> void * user_data ) { <nl> mmm a / src / core / security / credentials . h <nl> ppp b / src / core / security / credentials . h <nl> grpc_credentials_md_store * grpc_credentials_md_store_ref ( <nl> grpc_credentials_md_store * store ) ; <nl> void grpc_credentials_md_store_unref ( grpc_credentials_md_store * store ) ; <nl> <nl> - <nl> / * mmm grpc_credentials . mmm * / <nl> <nl> / * It is the caller ' s responsibility to gpr_free the result if not NULL . * / <nl> typedef struct { <nl> void ( * destroy ) ( grpc_credentials * c ) ; <nl> int ( * has_request_metadata ) ( const grpc_credentials * c ) ; <nl> int ( * has_request_metadata_only ) ( const grpc_credentials * c ) ; <nl> - void ( * get_request_metadata ) ( grpc_credentials * c , <nl> + void ( * get_request_metadata ) ( grpc_credentials * c , grpc_pollset * pollset , <nl> const char * service_url , <nl> grpc_credentials_metadata_cb cb , <nl> void * user_data ) ; <nl> typedef struct { <nl> grpc_credentials * c , const char * target , const grpc_channel_args * args , <nl> grpc_credentials * request_metadata_creds , <nl> grpc_channel_security_connector * * sc , grpc_channel_args * * new_args ) ; <nl> - <nl> } grpc_credentials_vtable ; <nl> <nl> struct grpc_credentials { <nl> void grpc_credentials_unref ( grpc_credentials * creds ) ; <nl> int grpc_credentials_has_request_metadata ( grpc_credentials * creds ) ; <nl> int grpc_credentials_has_request_metadata_only ( grpc_credentials * creds ) ; <nl> void grpc_credentials_get_request_metadata ( grpc_credentials * creds , <nl> + grpc_pollset * pollset , <nl> const char * service_url , <nl> grpc_credentials_metadata_cb cb , <nl> void * user_data ) ; <nl> grpc_credentials * grpc_credentials_contains_type ( <nl> / * Exposed for testing only . * / <nl> grpc_credentials_status <nl> grpc_oauth2_token_fetcher_credentials_parse_server_response ( <nl> - const struct grpc_httpcli_response * response , grpc_credentials_md_store * * token_md , <nl> - gpr_timespec * token_lifetime ) ; <nl> + const struct grpc_httpcli_response * response , <nl> + grpc_credentials_md_store * * token_md , gpr_timespec * token_lifetime ) ; <nl> <nl> / * Simulates an oauth2 token fetch with the specified value for testing . * / <nl> grpc_credentials * grpc_fake_oauth2_credentials_create ( <nl> struct grpc_server_credentials { <nl> grpc_security_status grpc_server_credentials_create_security_connector ( <nl> grpc_server_credentials * creds , grpc_security_connector * * sc ) ; <nl> <nl> - # endif / * GRPC_INTERNAL_CORE_SECURITY_CREDENTIALS_H * / <nl> + # endif / * GRPC_INTERNAL_CORE_SECURITY_CREDENTIALS_H * / <nl> mmm a / src / core / security / google_default_credentials . c <nl> ppp b / src / core / security / google_default_credentials . c <nl> static int compute_engine_detection_done = 0 ; <nl> static gpr_mu g_mu ; <nl> static gpr_once g_once = GPR_ONCE_INIT ; <nl> <nl> - static void init_default_credentials ( void ) { <nl> - gpr_mu_init ( & g_mu ) ; <nl> - } <nl> + static void init_default_credentials ( void ) { gpr_mu_init ( & g_mu ) ; } <nl> <nl> typedef struct { <nl> - gpr_cv cv ; <nl> - gpr_mu mu ; <nl> + grpc_pollset pollset ; <nl> int is_done ; <nl> int success ; <nl> } compute_engine_detector ; <nl> static void on_compute_engine_detection_http_response ( <nl> } <nl> } <nl> } <nl> - gpr_mu_lock ( & detector - > mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & detector - > pollset ) ) ; <nl> detector - > is_done = 1 ; <nl> - gpr_mu_unlock ( & detector - > mu ) ; <nl> - gpr_cv_signal ( & detector - > cv ) ; <nl> + grpc_pollset_kick ( & detector - > pollset ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & detector - > pollset ) ) ; <nl> } <nl> <nl> static int is_stack_running_on_compute_engine ( void ) { <nl> compute_engine_detector detector ; <nl> grpc_httpcli_request request ; <nl> + grpc_httpcli_context context ; <nl> <nl> / * The http call is local . If it takes more than one sec , it is for sure not <nl> on compute engine . * / <nl> gpr_timespec max_detection_delay = { 1 , 0 } ; <nl> <nl> - gpr_mu_init ( & detector . mu ) ; <nl> - gpr_cv_init ( & detector . cv ) ; <nl> + grpc_pollset_init ( & detector . pollset ) ; <nl> detector . is_done = 0 ; <nl> detector . success = 0 ; <nl> <nl> static int is_stack_running_on_compute_engine ( void ) { <nl> request . host = GRPC_COMPUTE_ENGINE_DETECTION_HOST ; <nl> request . path = " / " ; <nl> <nl> - grpc_httpcli_get ( & request , gpr_time_add ( gpr_now ( ) , max_detection_delay ) , <nl> + grpc_httpcli_context_init ( & context ) ; <nl> + <nl> + grpc_httpcli_get ( & context , & detector . pollset , & request , <nl> + gpr_time_add ( gpr_now ( ) , max_detection_delay ) , <nl> on_compute_engine_detection_http_response , & detector ) ; <nl> <nl> / * Block until we get the response . This is not ideal but this should only be <nl> called once for the lifetime of the process by the default credentials . * / <nl> - gpr_mu_lock ( & detector . mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & detector . pollset ) ) ; <nl> while ( ! detector . is_done ) { <nl> - gpr_cv_wait ( & detector . cv , & detector . mu , gpr_inf_future ) ; <nl> + grpc_pollset_work ( & detector . pollset , gpr_inf_future ) ; <nl> } <nl> - gpr_mu_unlock ( & detector . mu ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & detector . pollset ) ) ; <nl> + <nl> + grpc_httpcli_context_destroy ( & context ) ; <nl> + grpc_pollset_destroy ( & detector . pollset ) ; <nl> <nl> - gpr_mu_destroy ( & detector . mu ) ; <nl> - gpr_cv_destroy ( & detector . cv ) ; <nl> return detector . success ; <nl> } <nl> <nl> mmm a / src / core / security / server_secure_chttp2 . c <nl> ppp b / src / core / security / server_secure_chttp2 . c <nl> static void state_ref ( grpc_server_secure_state * state ) { <nl> <nl> static void state_unref ( grpc_server_secure_state * state ) { <nl> if ( gpr_unref ( & state - > refcount ) ) { <nl> + / * ensure all threads have unlocked * / <nl> + gpr_mu_lock ( & state - > mu ) ; <nl> + gpr_mu_unlock ( & state - > mu ) ; <nl> + / * clean up * / <nl> grpc_security_connector_unref ( state - > sc ) ; <nl> gpr_free ( state ) ; <nl> } <nl> static void start ( grpc_server * server , void * statep , grpc_pollset * * pollsets , <nl> grpc_tcp_server_start ( state - > tcp , pollsets , pollset_count , on_accept , state ) ; <nl> } <nl> <nl> + static void destroy_done ( void * statep ) { <nl> + grpc_server_secure_state * state = statep ; <nl> + grpc_server_listener_destroy_done ( state - > server ) ; <nl> + state_unref ( state ) ; <nl> + } <nl> + <nl> / * Server callback : destroy the tcp listener ( so we don ' t generate further <nl> callbacks ) * / <nl> static void destroy ( grpc_server * server , void * statep ) { <nl> grpc_server_secure_state * state = statep ; <nl> gpr_mu_lock ( & state - > mu ) ; <nl> state - > is_shutdown = 1 ; <nl> - grpc_tcp_server_destroy ( state - > tcp , grpc_server_listener_destroy_done , <nl> - server ) ; <nl> + grpc_tcp_server_destroy ( state - > tcp , destroy_done , state ) ; <nl> gpr_mu_unlock ( & state - > mu ) ; <nl> - state_unref ( state ) ; <nl> } <nl> <nl> int grpc_server_add_secure_http2_port ( grpc_server * server , const char * addr , <nl> mmm a / src / core / support / log_win32 . c <nl> ppp b / src / core / support / log_win32 . c <nl> void gpr_default_log ( gpr_log_func_args * args ) { <nl> <nl> fprintf ( stderr , " % s % s . % 09u % 5lu % s : % d ] % s \ n " , <nl> gpr_log_severity_string ( args - > severity ) , time_buffer , <nl> - ( int ) ( now . tv_nsec ) , GetCurrentThreadId ( ) , <nl> - args - > file , args - > line , args - > message ) ; <nl> + ( int ) ( now . tv_nsec ) , GetCurrentThreadId ( ) , args - > file , args - > line , <nl> + args - > message ) ; <nl> } <nl> <nl> char * gpr_format_message ( DWORD messageid ) { <nl> LPTSTR tmessage ; <nl> char * message ; <nl> - DWORD status = FormatMessage ( FORMAT_MESSAGE_ALLOCATE_BUFFER | <nl> - FORMAT_MESSAGE_FROM_SYSTEM | <nl> - FORMAT_MESSAGE_IGNORE_INSERTS , <nl> - NULL , messageid , <nl> - MAKELANGID ( LANG_NEUTRAL , SUBLANG_DEFAULT ) , <nl> - ( LPTSTR ) ( & tmessage ) , 0 , NULL ) ; <nl> + DWORD status = FormatMessage ( <nl> + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | <nl> + FORMAT_MESSAGE_IGNORE_INSERTS , <nl> + NULL , messageid , MAKELANGID ( LANG_NEUTRAL , SUBLANG_DEFAULT ) , <nl> + ( LPTSTR ) ( & tmessage ) , 0 , NULL ) ; <nl> if ( status = = 0 ) return gpr_strdup ( " Unable to retrieve error string " ) ; <nl> message = gpr_tchar_to_char ( tmessage ) ; <nl> LocalFree ( tmessage ) ; <nl> return message ; <nl> } <nl> <nl> - # endif / * GPR_WIN32 * / <nl> + # endif / * GPR_WIN32 * / <nl> mmm a / src / core / surface / byte_buffer_reader . c <nl> ppp b / src / core / surface / byte_buffer_reader . c <nl> void grpc_byte_buffer_reader_init ( grpc_byte_buffer_reader * reader , <nl> grpc_msg_decompress ( reader - > buffer_in - > data . raw . compression , <nl> & reader - > buffer_in - > data . raw . slice_buffer , <nl> & decompressed_slices_buffer ) ; <nl> - reader - > buffer_out = grpc_raw_byte_buffer_create ( <nl> - decompressed_slices_buffer . slices , <nl> - decompressed_slices_buffer . count ) ; <nl> + reader - > buffer_out = <nl> + grpc_raw_byte_buffer_create ( decompressed_slices_buffer . slices , <nl> + decompressed_slices_buffer . count ) ; <nl> gpr_slice_buffer_destroy ( & decompressed_slices_buffer ) ; <nl> - } else { / * not compressed , use the input buffer as output * / <nl> + } else { / * not compressed , use the input buffer as output * / <nl> reader - > buffer_out = reader - > buffer_in ; <nl> } <nl> reader - > current . index = 0 ; <nl> mmm a / src / core / surface / call . c <nl> ppp b / src / core / surface / call . c <nl> typedef enum { <nl> / * Status came from ' the wire ' - or somewhere below the surface <nl> layer * / <nl> STATUS_FROM_WIRE , <nl> + / * Status came from the server sending status * / <nl> + STATUS_FROM_SERVER_STATUS , <nl> STATUS_SOURCE_COUNT <nl> } status_source ; <nl> <nl> struct grpc_call { <nl> gpr_uint8 num_completed_requests ; <nl> / * are we currently reading a message ? * / <nl> gpr_uint8 reading_message ; <nl> + / * have we bound a pollset yet ? * / <nl> + gpr_uint8 bound_pollset ; <nl> / * flags with bits corresponding to write states allowing us to determine <nl> what was sent * / <nl> gpr_uint16 last_send_contains ; <nl> + / * cancel with this status on the next outgoing transport op * / <nl> + grpc_status_code cancel_with_status ; <nl> <nl> / * Active ioreqs . <nl> request_set and request_data contain one element per active ioreq <nl> static void execute_op ( grpc_call * call , grpc_transport_op * op ) ; <nl> static void recv_metadata ( grpc_call * call , grpc_metadata_batch * metadata ) ; <nl> static void finish_read_ops ( grpc_call * call ) ; <nl> static grpc_call_error cancel_with_status ( grpc_call * c , grpc_status_code status , <nl> - const char * description , <nl> - gpr_uint8 locked ) ; <nl> + const char * description ) ; <nl> + <nl> + static void lock ( grpc_call * call ) ; <nl> + static void unlock ( grpc_call * call ) ; <nl> <nl> grpc_call * grpc_call_create ( grpc_channel * channel , grpc_completion_queue * cq , <nl> const void * server_transport_data , <nl> grpc_call * grpc_call_create ( grpc_channel * channel , grpc_completion_queue * cq , <nl> gpr_mu_init ( & call - > mu ) ; <nl> call - > channel = channel ; <nl> call - > cq = cq ; <nl> + if ( cq ) { <nl> + GRPC_CQ_INTERNAL_REF ( cq , " bind " ) ; <nl> + } <nl> call - > is_client = server_transport_data = = NULL ; <nl> for ( i = 0 ; i < GRPC_IOREQ_OP_COUNT ; i + + ) { <nl> call - > request_set [ i ] = REQSET_EMPTY ; <nl> grpc_call * grpc_call_create ( grpc_channel * channel , grpc_completion_queue * cq , <nl> } <nl> call - > send_initial_metadata_count = add_initial_metadata_count ; <nl> call - > send_deadline = send_deadline ; <nl> - grpc_channel_internal_ref ( channel ) ; <nl> + GRPC_CHANNEL_INTERNAL_REF ( channel , " call " ) ; <nl> call - > metadata_context = grpc_channel_get_metadata_context ( channel ) ; <nl> grpc_sopb_init ( & call - > send_ops ) ; <nl> grpc_sopb_init ( & call - > recv_ops ) ; <nl> grpc_call * grpc_call_create ( grpc_channel * channel , grpc_completion_queue * cq , <nl> <nl> void grpc_call_set_completion_queue ( grpc_call * call , <nl> grpc_completion_queue * cq ) { <nl> + lock ( call ) ; <nl> call - > cq = cq ; <nl> + if ( cq ) { <nl> + GRPC_CQ_INTERNAL_REF ( cq , " bind " ) ; <nl> + } <nl> + unlock ( call ) ; <nl> } <nl> <nl> grpc_completion_queue * grpc_call_get_completion_queue ( grpc_call * call ) { <nl> static void destroy_call ( void * call , int ignored_success ) { <nl> size_t i ; <nl> grpc_call * c = call ; <nl> grpc_call_stack_destroy ( CALL_STACK_FROM_CALL ( c ) ) ; <nl> - grpc_channel_internal_unref ( c - > channel ) ; <nl> + GRPC_CHANNEL_INTERNAL_UNREF ( c - > channel , " call " ) ; <nl> gpr_mu_destroy ( & c - > mu ) ; <nl> for ( i = 0 ; i < STATUS_SOURCE_COUNT ; i + + ) { <nl> if ( c - > status [ i ] . details ) { <nl> static void destroy_call ( void * call , int ignored_success ) { <nl> grpc_sopb_destroy ( & c - > recv_ops ) ; <nl> grpc_bbq_destroy ( & c - > incoming_queue ) ; <nl> gpr_slice_buffer_destroy ( & c - > incoming_message ) ; <nl> + if ( c - > cq ) { <nl> + GRPC_CQ_INTERNAL_UNREF ( c - > cq , " bind " ) ; <nl> + } <nl> gpr_free ( c ) ; <nl> } <nl> <nl> static void lock ( grpc_call * call ) { gpr_mu_lock ( & call - > mu ) ; } <nl> <nl> static int need_more_data ( grpc_call * call ) { <nl> if ( call - > read_state = = READ_STATE_STREAM_CLOSED ) return 0 ; <nl> + / * TODO ( ctiller ) : this needs some serious cleanup * / <nl> return is_op_live ( call , GRPC_IOREQ_RECV_INITIAL_METADATA ) | | <nl> ( is_op_live ( call , GRPC_IOREQ_RECV_MESSAGE ) & & <nl> grpc_bbq_empty ( & call - > incoming_queue ) ) | | <nl> static int need_more_data ( grpc_call * call ) { <nl> is_op_live ( call , GRPC_IOREQ_RECV_STATUS_DETAILS ) | | <nl> ( is_op_live ( call , GRPC_IOREQ_RECV_CLOSE ) & & <nl> grpc_bbq_empty ( & call - > incoming_queue ) ) | | <nl> - ( call - > write_state = = WRITE_STATE_INITIAL & & ! call - > is_client ) ; <nl> + ( call - > write_state = = WRITE_STATE_INITIAL & & ! call - > is_client ) | | <nl> + ( call - > cancel_with_status ! = GRPC_STATUS_OK ) ; <nl> } <nl> <nl> static void unlock ( grpc_call * call ) { <nl> static void unlock ( grpc_call * call ) { <nl> <nl> memset ( & op , 0 , sizeof ( op ) ) ; <nl> <nl> + op . cancel_with_status = call - > cancel_with_status ; <nl> + start_op = op . cancel_with_status ! = GRPC_STATUS_OK ; <nl> + call - > cancel_with_status = GRPC_STATUS_OK ; / * reset * / <nl> + <nl> if ( ! call - > receiving & & need_more_data ( call ) ) { <nl> op . recv_ops = & call - > recv_ops ; <nl> op . recv_state = & call - > recv_state ; <nl> static void unlock ( grpc_call * call ) { <nl> } <nl> } <nl> <nl> + if ( ! call - > bound_pollset & & call - > cq & & ( ! call - > is_client | | start_op ) ) { <nl> + call - > bound_pollset = 1 ; <nl> + op . bind_pollset = grpc_cq_pollset ( call - > cq ) ; <nl> + start_op = 1 ; <nl> + } <nl> + <nl> if ( ! call - > completing & & call - > num_completed_requests ! = 0 ) { <nl> completing_requests = call - > num_completed_requests ; <nl> memcpy ( completed_requests , call - > completed_requests , <nl> static void finish_live_ioreq_op ( grpc_call * call , grpc_ioreq_op op , <nl> call - > write_state = WRITE_STATE_WRITE_CLOSED ; <nl> } <nl> break ; <nl> + case GRPC_IOREQ_SEND_STATUS : <nl> + if ( call - > request_data [ GRPC_IOREQ_SEND_STATUS ] . send_status . details ! = <nl> + NULL ) { <nl> + grpc_mdstr_unref ( <nl> + call - > request_data [ GRPC_IOREQ_SEND_STATUS ] . send_status . details ) ; <nl> + call - > request_data [ GRPC_IOREQ_SEND_STATUS ] . send_status . details = <nl> + NULL ; <nl> + } <nl> + break ; <nl> case GRPC_IOREQ_RECV_CLOSE : <nl> case GRPC_IOREQ_SEND_INITIAL_METADATA : <nl> case GRPC_IOREQ_SEND_TRAILING_METADATA : <nl> - case GRPC_IOREQ_SEND_STATUS : <nl> case GRPC_IOREQ_SEND_CLOSE : <nl> break ; <nl> case GRPC_IOREQ_RECV_STATUS : <nl> static int begin_message ( grpc_call * call , grpc_begin_message msg ) { <nl> gpr_asprintf ( <nl> & message , " Message terminated early ; read % d bytes , expected % d " , <nl> ( int ) call - > incoming_message . length , ( int ) call - > incoming_message_length ) ; <nl> - cancel_with_status ( call , GRPC_STATUS_INVALID_ARGUMENT , message , 1 ) ; <nl> + cancel_with_status ( call , GRPC_STATUS_INVALID_ARGUMENT , message ) ; <nl> gpr_free ( message ) ; <nl> return 0 ; <nl> } <nl> static int begin_message ( grpc_call * call , grpc_begin_message msg ) { <nl> & message , <nl> " Maximum message length of % d exceeded by a message of length % d " , <nl> grpc_channel_get_max_message_length ( call - > channel ) , msg . length ) ; <nl> - cancel_with_status ( call , GRPC_STATUS_INVALID_ARGUMENT , message , 1 ) ; <nl> + cancel_with_status ( call , GRPC_STATUS_INVALID_ARGUMENT , message ) ; <nl> gpr_free ( message ) ; <nl> return 0 ; <nl> } else if ( msg . length > 0 ) { <nl> static int add_slice_to_message ( grpc_call * call , gpr_slice slice ) { <nl> / * we have to be reading a message to know what to do here * / <nl> if ( ! call - > reading_message ) { <nl> cancel_with_status ( call , GRPC_STATUS_INVALID_ARGUMENT , <nl> - " Received payload data while not reading a message " , 1 ) ; <nl> + " Received payload data while not reading a message " ) ; <nl> return 0 ; <nl> } <nl> / * append the slice to the incoming buffer * / <nl> static int add_slice_to_message ( grpc_call * call , gpr_slice slice ) { <nl> gpr_asprintf ( <nl> & message , " Receiving message overflow ; read % d bytes , expected % d " , <nl> ( int ) call - > incoming_message . length , ( int ) call - > incoming_message_length ) ; <nl> - cancel_with_status ( call , GRPC_STATUS_INVALID_ARGUMENT , message , 1 ) ; <nl> + cancel_with_status ( call , GRPC_STATUS_INVALID_ARGUMENT , message ) ; <nl> gpr_free ( message ) ; <nl> return 0 ; <nl> } else if ( call - > incoming_message . length = = call - > incoming_message_length ) { <nl> static int fill_send_ops ( grpc_call * call , grpc_transport_op * op ) { <nl> } <nl> grpc_sopb_add_metadata ( & call - > send_ops , mdb ) ; <nl> op - > send_ops = & call - > send_ops ; <nl> - op - > bind_pollset = grpc_cq_pollset ( call - > cq ) ; <nl> call - > last_send_contains | = 1 < < GRPC_IOREQ_SEND_INITIAL_METADATA ; <nl> call - > send_initial_metadata_count = 0 ; <nl> / * fall through intended * / <nl> static int fill_send_ops ( grpc_call * call , grpc_transport_op * op ) { <nl> call - > metadata_context , <nl> grpc_mdstr_ref ( <nl> grpc_channel_get_message_string ( call - > channel ) ) , <nl> - grpc_mdstr_from_string ( call - > metadata_context , <nl> - data . send_status . details ) ) ) ; <nl> + data . send_status . details ) ) ; <nl> + call - > request_data [ GRPC_IOREQ_SEND_STATUS ] . send_status . details = <nl> + NULL ; <nl> } <nl> grpc_sopb_add_metadata ( & call - > send_ops , mdb ) ; <nl> } <nl> static grpc_call_error start_ioreq ( grpc_call * call , const grpc_ioreq * reqs , <nl> GRPC_CALL_ERROR_INVALID_METADATA ) ; <nl> } <nl> } <nl> + if ( op = = GRPC_IOREQ_SEND_STATUS ) { <nl> + set_status_code ( call , STATUS_FROM_SERVER_STATUS , <nl> + reqs [ i ] . data . send_status . code ) ; <nl> + if ( reqs [ i ] . data . send_status . details ) { <nl> + set_status_details ( call , STATUS_FROM_SERVER_STATUS , <nl> + grpc_mdstr_ref ( reqs [ i ] . data . send_status . details ) ) ; <nl> + } <nl> + } <nl> have_ops | = 1u < < op ; <nl> <nl> call - > request_data [ op ] = data ; <nl> grpc_call_error grpc_call_cancel ( grpc_call * call ) { <nl> grpc_call_error grpc_call_cancel_with_status ( grpc_call * c , <nl> grpc_status_code status , <nl> const char * description ) { <nl> - return cancel_with_status ( c , status , description , 0 ) ; <nl> + grpc_call_error r ; <nl> + lock ( c ) ; <nl> + r = cancel_with_status ( c , status , description ) ; <nl> + unlock ( c ) ; <nl> + return r ; <nl> } <nl> <nl> static grpc_call_error cancel_with_status ( grpc_call * c , grpc_status_code status , <nl> - const char * description , <nl> - gpr_uint8 locked ) { <nl> - grpc_transport_op op ; <nl> + const char * description ) { <nl> grpc_mdstr * details = <nl> description ? grpc_mdstr_from_string ( c - > metadata_context , description ) <nl> : NULL ; <nl> - memset ( & op , 0 , sizeof ( op ) ) ; <nl> - op . cancel_with_status = status ; <nl> <nl> - if ( locked = = 0 ) { <nl> - lock ( c ) ; <nl> - } <nl> + GPR_ASSERT ( status ! = GRPC_STATUS_OK ) ; <nl> + <nl> set_status_code ( c , STATUS_FROM_API_OVERRIDE , status ) ; <nl> set_status_details ( c , STATUS_FROM_API_OVERRIDE , details ) ; <nl> - if ( locked = = 0 ) { <nl> - unlock ( c ) ; <nl> - } <nl> <nl> - execute_op ( c , & op ) ; <nl> + c - > cancel_with_status = status ; <nl> <nl> return GRPC_CALL_OK ; <nl> } <nl> <nl> + static void finished_loose_op ( void * call , int success_ignored ) { <nl> + GRPC_CALL_INTERNAL_UNREF ( call , " loose - op " , 0 ) ; <nl> + } <nl> + <nl> static void execute_op ( grpc_call * call , grpc_transport_op * op ) { <nl> grpc_call_element * elem ; <nl> + <nl> + GPR_ASSERT ( op - > on_consumed = = NULL ) ; <nl> + if ( op - > cancel_with_status ! = GRPC_STATUS_OK | | op - > bind_pollset ) { <nl> + GRPC_CALL_INTERNAL_REF ( call , " loose - op " ) ; <nl> + op - > on_consumed = finished_loose_op ; <nl> + op - > on_consumed_user_data = call ; <nl> + } <nl> + <nl> elem = CALL_ELEM_FROM_CALL ( call , 0 ) ; <nl> op - > context = call - > context ; <nl> elem - > filter - > start_transport_op ( elem , op ) ; <nl> grpc_call * grpc_call_from_top_element ( grpc_call_element * elem ) { <nl> static void call_alarm ( void * arg , int success ) { <nl> grpc_call * call = arg ; <nl> if ( success ) { <nl> - if ( call - > is_client ) { <nl> - cancel_with_status ( call , GRPC_STATUS_DEADLINE_EXCEEDED , <nl> - " Deadline Exceeded " , 0 ) ; <nl> - } else { <nl> - grpc_call_cancel ( call ) ; <nl> - } <nl> + lock ( call ) ; <nl> + cancel_with_status ( call , GRPC_STATUS_DEADLINE_EXCEEDED , <nl> + " Deadline Exceeded " ) ; <nl> + unlock ( call ) ; <nl> } <nl> GRPC_CALL_INTERNAL_UNREF ( call , " alarm " , 1 ) ; <nl> } <nl> grpc_call_error grpc_call_start_batch ( grpc_call * call , const grpc_op * ops , <nl> req - > flags = op - > flags ; <nl> break ; <nl> case GRPC_OP_SEND_MESSAGE : <nl> - if ( ! are_write_flags_valid ( op - > flags ) ) { <nl> + if ( ! are_write_flags_valid ( op - > flags ) ) { <nl> return GRPC_CALL_ERROR_INVALID_FLAGS ; <nl> } <nl> req = & reqs [ out + + ] ; <nl> grpc_call_error grpc_call_start_batch ( grpc_call * call , const grpc_op * ops , <nl> req - > op = GRPC_IOREQ_SEND_STATUS ; <nl> req - > data . send_status . code = op - > data . send_status_from_server . status ; <nl> req - > data . send_status . details = <nl> - op - > data . send_status_from_server . status_details ; <nl> + op - > data . send_status_from_server . status_details ! = NULL <nl> + ? grpc_mdstr_from_string ( <nl> + call - > metadata_context , <nl> + op - > data . send_status_from_server . status_details ) <nl> + : NULL ; <nl> req = & reqs [ out + + ] ; <nl> req - > op = GRPC_IOREQ_SEND_CLOSE ; <nl> break ; <nl> mmm a / src / core / surface / call . h <nl> ppp b / src / core / surface / call . h <nl> typedef union { <nl> grpc_byte_buffer * send_message ; <nl> struct { <nl> grpc_status_code code ; <nl> - const char * details ; <nl> + grpc_mdstr * details ; <nl> } send_status ; <nl> } grpc_ioreq_data ; <nl> <nl> typedef struct { <nl> grpc_ioreq_op op ; <nl> grpc_ioreq_data data ; <nl> - gpr_uint32 flags ; / * * < A copy of the write flags from grpc_op * / <nl> + gpr_uint32 flags ; / * * < A copy of the write flags from grpc_op * / <nl> } grpc_ioreq ; <nl> <nl> typedef void ( * grpc_ioreq_completion_func ) ( grpc_call * call , int success , <nl> grpc_completion_queue * grpc_call_get_completion_queue ( grpc_call * call ) ; <nl> <nl> # ifdef GRPC_CALL_REF_COUNT_DEBUG <nl> void grpc_call_internal_ref ( grpc_call * call , const char * reason ) ; <nl> - void grpc_call_internal_unref ( grpc_call * call , const char * reason , int allow_immediate_deletion ) ; <nl> - # define GRPC_CALL_INTERNAL_REF ( call , reason ) grpc_call_internal_ref ( call , reason ) <nl> + void grpc_call_internal_unref ( grpc_call * call , const char * reason , <nl> + int allow_immediate_deletion ) ; <nl> + # define GRPC_CALL_INTERNAL_REF ( call , reason ) \ <nl> + grpc_call_internal_ref ( call , reason ) <nl> # define GRPC_CALL_INTERNAL_UNREF ( call , reason , allow_immediate_deletion ) \ <nl> grpc_call_internal_unref ( call , reason , allow_immediate_deletion ) <nl> # else <nl> void grpc_call_log_batch ( char * file , int line , gpr_log_severity severity , <nl> <nl> void grpc_server_log_request_call ( char * file , int line , <nl> gpr_log_severity severity , <nl> - grpc_server * server , <nl> - grpc_call * * call , <nl> + grpc_server * server , grpc_call * * call , <nl> grpc_call_details * details , <nl> grpc_metadata_array * initial_metadata , <nl> grpc_completion_queue * cq_bound_to_call , <nl> void grpc_server_log_request_call ( char * file , int line , <nl> <nl> / * Set a context pointer . <nl> No thread safety guarantees are made wrt this value . * / <nl> - void grpc_call_context_set ( grpc_call * call , grpc_context_index elem , void * value , <nl> - void ( * destroy ) ( void * value ) ) ; <nl> + void grpc_call_context_set ( grpc_call * call , grpc_context_index elem , <nl> + void * value , void ( * destroy ) ( void * value ) ) ; <nl> / * Get a context pointer . * / <nl> void * grpc_call_context_get ( grpc_call * call , grpc_context_index elem ) ; <nl> <nl> # define GRPC_CALL_LOG_BATCH ( sev , call , ops , nops , tag ) \ <nl> if ( grpc_trace_batch ) grpc_call_log_batch ( sev , call , ops , nops , tag ) <nl> <nl> - # define GRPC_SERVER_LOG_REQUEST_CALL ( sev , server , call , details , initial_metadata , cq_bound_to_call , cq_for_notifications , tag ) \ <nl> - if ( grpc_trace_batch ) grpc_server_log_request_call ( sev , server , call , details , initial_metadata , cq_bound_to_call , cq_for_notifications , tag ) <nl> + # define GRPC_SERVER_LOG_REQUEST_CALL ( sev , server , call , details , \ <nl> + initial_metadata , cq_bound_to_call , \ <nl> + cq_for_notifications , tag ) \ <nl> + if ( grpc_trace_batch ) \ <nl> + grpc_server_log_request_call ( sev , server , call , details , initial_metadata , \ <nl> + cq_bound_to_call , cq_for_notifications , tag ) <nl> <nl> gpr_uint8 grpc_call_is_client ( grpc_call * call ) ; <nl> <nl> mmm a / src / core / surface / channel . c <nl> ppp b / src / core / surface / channel . c <nl> grpc_call * grpc_channel_create_registered_call ( <nl> grpc_mdelem_ref ( rc - > authority ) , deadline ) ; <nl> } <nl> <nl> - void grpc_channel_internal_ref ( grpc_channel * channel ) { <nl> - gpr_ref ( & channel - > refs ) ; <nl> + # ifdef GRPC_CHANNEL_REF_COUNT_DEBUG <nl> + void grpc_channel_internal_ref ( grpc_channel * c , const char * reason ) { <nl> + gpr_log ( GPR_DEBUG , " CHANNEL : ref % p % d - > % d [ % s ] " , c , c - > refs . count , <nl> + c - > refs . count + 1 , reason ) ; <nl> + # else <nl> + void grpc_channel_internal_ref ( grpc_channel * c ) { <nl> + # endif <nl> + gpr_ref ( & c - > refs ) ; <nl> } <nl> <nl> static void destroy_channel ( void * p , int ok ) { <nl> static void destroy_channel ( void * p , int ok ) { <nl> gpr_free ( channel ) ; <nl> } <nl> <nl> + # ifdef GRPC_CHANNEL_REF_COUNT_DEBUG <nl> + void grpc_channel_internal_unref ( grpc_channel * channel , const char * reason ) { <nl> + gpr_log ( GPR_DEBUG , " CHANNEL : unref % p % d - > % d [ % s ] " , channel , <nl> + channel - > refs . count , channel - > refs . count - 1 , reason ) ; <nl> + # else <nl> void grpc_channel_internal_unref ( grpc_channel * channel ) { <nl> + # endif <nl> if ( gpr_unref ( & channel - > refs ) ) { <nl> channel - > destroy_closure . cb = destroy_channel ; <nl> channel - > destroy_closure . cb_arg = channel ; <nl> void grpc_channel_destroy ( grpc_channel * channel ) { <nl> op . dir = GRPC_CALL_DOWN ; <nl> elem - > filter - > channel_op ( elem , NULL , & op ) ; <nl> <nl> - grpc_channel_internal_unref ( channel ) ; <nl> + GRPC_CHANNEL_INTERNAL_UNREF ( channel , " channel " ) ; <nl> } <nl> <nl> void grpc_client_channel_closed ( grpc_channel_element * elem ) { <nl> - grpc_channel_internal_unref ( CHANNEL_FROM_TOP_ELEM ( elem ) ) ; <nl> + GRPC_CHANNEL_INTERNAL_UNREF ( CHANNEL_FROM_TOP_ELEM ( elem ) , " closed " ) ; <nl> } <nl> <nl> grpc_channel_stack * grpc_channel_get_channel_stack ( grpc_channel * channel ) { <nl> mmm a / src / core / surface / channel . h <nl> ppp b / src / core / surface / channel . h <nl> gpr_uint32 grpc_channel_get_max_message_length ( grpc_channel * channel ) ; <nl> <nl> void grpc_client_channel_closed ( grpc_channel_element * elem ) ; <nl> <nl> + # ifdef GRPC_CHANNEL_REF_COUNT_DEBUG <nl> + void grpc_channel_internal_ref ( grpc_channel * channel , const char * reason ) ; <nl> + void grpc_channel_internal_unref ( grpc_channel * channel , const char * reason ) ; <nl> + # define GRPC_CHANNEL_INTERNAL_REF ( channel , reason ) \ <nl> + grpc_channel_internal_ref ( channel , reason ) <nl> + # define GRPC_CHANNEL_INTERNAL_UNREF ( channel , reason ) \ <nl> + grpc_channel_internal_unref ( channel , reason ) <nl> + # else <nl> void grpc_channel_internal_ref ( grpc_channel * channel ) ; <nl> void grpc_channel_internal_unref ( grpc_channel * channel ) ; <nl> + # define GRPC_CHANNEL_INTERNAL_REF ( channel , reason ) \ <nl> + grpc_channel_internal_ref ( channel ) <nl> + # define GRPC_CHANNEL_INTERNAL_UNREF ( channel , reason ) \ <nl> + grpc_channel_internal_unref ( channel ) <nl> + # endif <nl> <nl> # endif / * GRPC_INTERNAL_CORE_SURFACE_CHANNEL_H * / <nl> mmm a / src / core / surface / channel_create . c <nl> ppp b / src / core / surface / channel_create . c <nl> static void done ( request * r , int was_successful ) { <nl> static void on_connect ( void * rp , grpc_endpoint * tcp ) { <nl> request * r = rp ; <nl> <nl> - if ( ! grpc_client_setup_request_should_continue ( r - > cs_request ) ) { <nl> + if ( ! grpc_client_setup_request_should_continue ( r - > cs_request , " on_connect " ) ) { <nl> if ( tcp ) { <nl> grpc_endpoint_shutdown ( tcp ) ; <nl> grpc_endpoint_destroy ( tcp ) ; <nl> static void on_connect ( void * rp , grpc_endpoint * tcp ) { <nl> } else { <nl> return ; <nl> } <nl> - } else if ( grpc_client_setup_cb_begin ( r - > cs_request ) ) { <nl> + } else if ( grpc_client_setup_cb_begin ( r - > cs_request , " on_connect " ) ) { <nl> grpc_create_chttp2_transport ( <nl> r - > setup - > setup_callback , r - > setup - > setup_user_data , <nl> grpc_client_setup_get_channel_args ( r - > cs_request ) , tcp , NULL , 0 , <nl> grpc_client_setup_get_mdctx ( r - > cs_request ) , 1 ) ; <nl> - grpc_client_setup_cb_end ( r - > cs_request ) ; <nl> + grpc_client_setup_cb_end ( r - > cs_request , " on_connect " ) ; <nl> done ( r , 1 ) ; <nl> return ; <nl> } else { <nl> static int maybe_try_next_resolved ( request * r ) { <nl> if ( ! r - > resolved ) return 0 ; <nl> if ( r - > resolved_index = = r - > resolved - > naddrs ) return 0 ; <nl> addr = & r - > resolved - > addrs [ r - > resolved_index + + ] ; <nl> - grpc_tcp_client_connect ( on_connect , r , ( struct sockaddr * ) & addr - > addr , <nl> - addr - > len , <nl> - grpc_client_setup_request_deadline ( r - > cs_request ) ) ; <nl> + grpc_tcp_client_connect ( <nl> + on_connect , r , grpc_client_setup_get_interested_parties ( r - > cs_request ) , <nl> + ( struct sockaddr * ) & addr - > addr , addr - > len , <nl> + grpc_client_setup_request_deadline ( r - > cs_request ) ) ; <nl> return 1 ; <nl> } <nl> <nl> static void on_resolved ( void * rp , grpc_resolved_addresses * resolved ) { <nl> request * r = rp ; <nl> <nl> / * if we ' re not still the active request , abort * / <nl> - if ( ! grpc_client_setup_request_should_continue ( r - > cs_request ) ) { <nl> + if ( ! grpc_client_setup_request_should_continue ( r - > cs_request , <nl> + " on_resolved " ) ) { <nl> if ( resolved ) { <nl> grpc_resolved_addresses_destroy ( resolved ) ; <nl> } <nl> mmm a / src / core / surface / completion_queue . c <nl> ppp b / src / core / surface / completion_queue . c <nl> typedef struct event { <nl> <nl> / * Completion queue structure * / <nl> struct grpc_completion_queue { <nl> - / * TODO ( ctiller ) : see if this can be removed * / <nl> - int allow_polling ; <nl> - <nl> / * When refs drops to zero , we are in shutdown mode , and will be destroyable <nl> once all queued events are drained * / <nl> gpr_refcount refs ; <nl> struct grpc_completion_queue { <nl> event * queue ; <nl> / * Fixed size chained hash table of events for pluck ( ) * / <nl> event * buckets [ NUM_TAG_BUCKETS ] ; <nl> + int is_server_cq ; <nl> } ; <nl> <nl> grpc_completion_queue * grpc_completion_queue_create ( void ) { <nl> grpc_completion_queue * grpc_completion_queue_create ( void ) { <nl> / * One for destroy ( ) , one for pollset_shutdown * / <nl> gpr_ref_init ( & cc - > owning_refs , 2 ) ; <nl> grpc_pollset_init ( & cc - > pollset ) ; <nl> - cc - > allow_polling = 1 ; <nl> return cc ; <nl> } <nl> <nl> + # ifdef GRPC_CQ_REF_COUNT_DEBUG <nl> + void grpc_cq_internal_ref ( grpc_completion_queue * cc , const char * reason ) { <nl> + gpr_log ( GPR_DEBUG , " CQ : % p ref % d - > % d % s " , cc , ( int ) cc - > owning_refs . count , <nl> + ( int ) cc - > owning_refs . count + 1 , reason ) ; <nl> + # else <nl> void grpc_cq_internal_ref ( grpc_completion_queue * cc ) { <nl> + # endif <nl> gpr_ref ( & cc - > owning_refs ) ; <nl> } <nl> <nl> static void on_pollset_destroy_done ( void * arg ) { <nl> grpc_completion_queue * cc = arg ; <nl> - grpc_cq_internal_unref ( cc ) ; <nl> + GRPC_CQ_INTERNAL_UNREF ( cc , " pollset_destroy " ) ; <nl> } <nl> <nl> + # ifdef GRPC_CQ_REF_COUNT_DEBUG <nl> + void grpc_cq_internal_unref ( grpc_completion_queue * cc , const char * reason ) { <nl> + gpr_log ( GPR_DEBUG , " CQ : % p unref % d - > % d % s " , cc , ( int ) cc - > owning_refs . count , <nl> + ( int ) cc - > owning_refs . count - 1 , reason ) ; <nl> + # else <nl> void grpc_cq_internal_unref ( grpc_completion_queue * cc ) { <nl> + # endif <nl> if ( gpr_unref ( & cc - > owning_refs ) ) { <nl> GPR_ASSERT ( cc - > queue = = NULL ) ; <nl> grpc_pollset_destroy ( & cc - > pollset ) ; <nl> void grpc_cq_internal_unref ( grpc_completion_queue * cc ) { <nl> } <nl> } <nl> <nl> - void grpc_completion_queue_dont_poll_test_only ( grpc_completion_queue * cc ) { <nl> - cc - > allow_polling = 0 ; <nl> - } <nl> - <nl> / * Create and append an event to the queue . Returns the event so that its data <nl> members can be filled in . <nl> Requires GRPC_POLLSET_MU ( & cc - > pollset ) locked . * / <nl> static event * add_locked ( grpc_completion_queue * cc , grpc_completion_type type , <nl> ev - > bucket_prev = cc - > buckets [ bucket ] - > bucket_prev ; <nl> ev - > bucket_next - > bucket_prev = ev - > bucket_prev - > bucket_next = ev ; <nl> } <nl> - gpr_cv_broadcast ( GRPC_POLLSET_CV ( & cc - > pollset ) ) ; <nl> grpc_pollset_kick ( & cc - > pollset ) ; <nl> return ev ; <nl> } <nl> void grpc_cq_end_op ( grpc_completion_queue * cc , void * tag , grpc_call * call , <nl> GPR_ASSERT ( ! cc - > shutdown ) ; <nl> GPR_ASSERT ( cc - > shutdown_called ) ; <nl> cc - > shutdown = 1 ; <nl> - gpr_cv_broadcast ( GRPC_POLLSET_CV ( & cc - > pollset ) ) ; <nl> shutdown = 1 ; <nl> } <nl> gpr_mu_unlock ( GRPC_POLLSET_MU ( & cc - > pollset ) ) ; <nl> grpc_event grpc_completion_queue_next ( grpc_completion_queue * cc , <nl> event * ev = NULL ; <nl> grpc_event ret ; <nl> <nl> - grpc_cq_internal_ref ( cc ) ; <nl> + GRPC_CQ_INTERNAL_REF ( cc , " next " ) ; <nl> gpr_mu_lock ( GRPC_POLLSET_MU ( & cc - > pollset ) ) ; <nl> for ( ; ; ) { <nl> if ( cc - > queue ! = NULL ) { <nl> grpc_event grpc_completion_queue_next ( grpc_completion_queue * cc , <nl> ev = create_shutdown_event ( ) ; <nl> break ; <nl> } <nl> - if ( cc - > allow_polling & & grpc_pollset_work ( & cc - > pollset , deadline ) ) { <nl> - continue ; <nl> - } <nl> - if ( gpr_cv_wait ( GRPC_POLLSET_CV ( & cc - > pollset ) , <nl> - GRPC_POLLSET_MU ( & cc - > pollset ) , deadline ) ) { <nl> + if ( ! grpc_pollset_work ( & cc - > pollset , deadline ) ) { <nl> gpr_mu_unlock ( GRPC_POLLSET_MU ( & cc - > pollset ) ) ; <nl> memset ( & ret , 0 , sizeof ( ret ) ) ; <nl> ret . type = GRPC_QUEUE_TIMEOUT ; <nl> GRPC_SURFACE_TRACE_RETURNED_EVENT ( cc , & ret ) ; <nl> - grpc_cq_internal_unref ( cc ) ; <nl> + GRPC_CQ_INTERNAL_UNREF ( cc , " next " ) ; <nl> return ret ; <nl> } <nl> } <nl> grpc_event grpc_completion_queue_next ( grpc_completion_queue * cc , <nl> ret = ev - > base ; <nl> gpr_free ( ev ) ; <nl> GRPC_SURFACE_TRACE_RETURNED_EVENT ( cc , & ret ) ; <nl> - grpc_cq_internal_unref ( cc ) ; <nl> + GRPC_CQ_INTERNAL_UNREF ( cc , " next " ) ; <nl> return ret ; <nl> } <nl> <nl> grpc_event grpc_completion_queue_pluck ( grpc_completion_queue * cc , void * tag , <nl> event * ev = NULL ; <nl> grpc_event ret ; <nl> <nl> - grpc_cq_internal_ref ( cc ) ; <nl> + GRPC_CQ_INTERNAL_REF ( cc , " pluck " ) ; <nl> gpr_mu_lock ( GRPC_POLLSET_MU ( & cc - > pollset ) ) ; <nl> for ( ; ; ) { <nl> if ( ( ev = pluck_event ( cc , tag ) ) ) { <nl> grpc_event grpc_completion_queue_pluck ( grpc_completion_queue * cc , void * tag , <nl> ev = create_shutdown_event ( ) ; <nl> break ; <nl> } <nl> - if ( cc - > allow_polling & & grpc_pollset_work ( & cc - > pollset , deadline ) ) { <nl> - continue ; <nl> - } <nl> - if ( gpr_cv_wait ( GRPC_POLLSET_CV ( & cc - > pollset ) , <nl> - GRPC_POLLSET_MU ( & cc - > pollset ) , deadline ) ) { <nl> + if ( ! grpc_pollset_work ( & cc - > pollset , deadline ) ) { <nl> gpr_mu_unlock ( GRPC_POLLSET_MU ( & cc - > pollset ) ) ; <nl> memset ( & ret , 0 , sizeof ( ret ) ) ; <nl> ret . type = GRPC_QUEUE_TIMEOUT ; <nl> GRPC_SURFACE_TRACE_RETURNED_EVENT ( cc , & ret ) ; <nl> - grpc_cq_internal_unref ( cc ) ; <nl> + GRPC_CQ_INTERNAL_UNREF ( cc , " pluck " ) ; <nl> return ret ; <nl> } <nl> } <nl> grpc_event grpc_completion_queue_pluck ( grpc_completion_queue * cc , void * tag , <nl> ret = ev - > base ; <nl> gpr_free ( ev ) ; <nl> GRPC_SURFACE_TRACE_RETURNED_EVENT ( cc , & ret ) ; <nl> - grpc_cq_internal_unref ( cc ) ; <nl> + GRPC_CQ_INTERNAL_UNREF ( cc , " pluck " ) ; <nl> return ret ; <nl> } <nl> <nl> grpc_event grpc_completion_queue_pluck ( grpc_completion_queue * cc , void * tag , <nl> to zero here , then enter shutdown mode and wake up any waiters * / <nl> void grpc_completion_queue_shutdown ( grpc_completion_queue * cc ) { <nl> gpr_mu_lock ( GRPC_POLLSET_MU ( & cc - > pollset ) ) ; <nl> + if ( cc - > shutdown_called ) { <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & cc - > pollset ) ) ; <nl> + return ; <nl> + } <nl> cc - > shutdown_called = 1 ; <nl> gpr_mu_unlock ( GRPC_POLLSET_MU ( & cc - > pollset ) ) ; <nl> <nl> void grpc_completion_queue_shutdown ( grpc_completion_queue * cc ) { <nl> gpr_mu_lock ( GRPC_POLLSET_MU ( & cc - > pollset ) ) ; <nl> GPR_ASSERT ( ! cc - > shutdown ) ; <nl> cc - > shutdown = 1 ; <nl> - gpr_cv_broadcast ( GRPC_POLLSET_CV ( & cc - > pollset ) ) ; <nl> gpr_mu_unlock ( GRPC_POLLSET_MU ( & cc - > pollset ) ) ; <nl> grpc_pollset_shutdown ( & cc - > pollset , on_pollset_destroy_done , cc ) ; <nl> } <nl> } <nl> <nl> void grpc_completion_queue_destroy ( grpc_completion_queue * cc ) { <nl> - grpc_cq_internal_unref ( cc ) ; <nl> + grpc_completion_queue_shutdown ( cc ) ; <nl> + GRPC_CQ_INTERNAL_UNREF ( cc , " destroy " ) ; <nl> } <nl> <nl> grpc_pollset * grpc_cq_pollset ( grpc_completion_queue * cc ) { <nl> void grpc_cq_hack_spin_pollset ( grpc_completion_queue * cc ) { <nl> gpr_time_add ( gpr_now ( ) , gpr_time_from_millis ( 100 ) ) ) ; <nl> gpr_mu_unlock ( GRPC_POLLSET_MU ( & cc - > pollset ) ) ; <nl> } <nl> + <nl> + void grpc_cq_mark_server_cq ( grpc_completion_queue * cc ) { cc - > is_server_cq = 1 ; } <nl> + <nl> + int grpc_cq_is_server_cq ( grpc_completion_queue * cc ) { return cc - > is_server_cq ; } <nl> mmm a / src / core / surface / completion_queue . h <nl> ppp b / src / core / surface / completion_queue . h <nl> <nl> # include " src / core / iomgr / pollset . h " <nl> # include < grpc / grpc . h > <nl> <nl> + # ifdef GRPC_CQ_REF_COUNT_DEBUG <nl> + void grpc_cq_internal_ref ( grpc_completion_queue * cc , const char * reason ) ; <nl> + void grpc_cq_internal_unref ( grpc_completion_queue * cc , const char * reason ) ; <nl> + # define GRPC_CQ_INTERNAL_REF ( cc , reason ) grpc_cq_internal_ref ( cc , reason ) <nl> + # define GRPC_CQ_INTERNAL_UNREF ( cc , reason ) grpc_cq_internal_unref ( cc , reason ) <nl> + # else <nl> void grpc_cq_internal_ref ( grpc_completion_queue * cc ) ; <nl> void grpc_cq_internal_unref ( grpc_completion_queue * cc ) ; <nl> + # define GRPC_CQ_INTERNAL_REF ( cc , reason ) grpc_cq_internal_ref ( cc ) <nl> + # define GRPC_CQ_INTERNAL_UNREF ( cc , reason ) grpc_cq_internal_unref ( cc ) <nl> + # endif <nl> <nl> / * Flag that an operation is beginning : the completion channel will not finish <nl> shutdown until a corrensponding grpc_cq_end_ * call is made * / <nl> void grpc_cq_begin_op ( grpc_completion_queue * cc , grpc_call * call ) ; <nl> void grpc_cq_end_op ( grpc_completion_queue * cc , void * tag , grpc_call * call , <nl> int success ) ; <nl> <nl> - / * disable polling for some tests * / <nl> - void grpc_completion_queue_dont_poll_test_only ( grpc_completion_queue * cc ) ; <nl> - <nl> grpc_pollset * grpc_cq_pollset ( grpc_completion_queue * cc ) ; <nl> <nl> void grpc_cq_hack_spin_pollset ( grpc_completion_queue * cc ) ; <nl> <nl> + void grpc_cq_mark_server_cq ( grpc_completion_queue * cc ) ; <nl> + int grpc_cq_is_server_cq ( grpc_completion_queue * cc ) ; <nl> + <nl> # endif / * GRPC_INTERNAL_CORE_SURFACE_COMPLETION_QUEUE_H * / <nl> mmm a / src / core / surface / lame_client . c <nl> ppp b / src / core / surface / lame_client . c <nl> static void lame_start_transport_op ( grpc_call_element * elem , <nl> * op - > recv_state = GRPC_STREAM_CLOSED ; <nl> op - > on_done_recv ( op - > recv_user_data , 1 ) ; <nl> } <nl> + if ( op - > on_consumed ) { <nl> + op - > on_consumed ( op - > on_consumed_user_data , 0 ) ; <nl> + } <nl> } <nl> <nl> static void channel_op ( grpc_channel_element * elem , <nl> static void init_channel_elem ( grpc_channel_element * elem , <nl> static void destroy_channel_elem ( grpc_channel_element * elem ) { } <nl> <nl> static const grpc_channel_filter lame_filter = { <nl> - lame_start_transport_op , channel_op , sizeof ( call_data ) , init_call_elem , <nl> - destroy_call_elem , sizeof ( channel_data ) , init_channel_elem , <nl> - destroy_channel_elem , " lame - client " , <nl> + lame_start_transport_op , channel_op , sizeof ( call_data ) , <nl> + init_call_elem , destroy_call_elem , sizeof ( channel_data ) , <nl> + init_channel_elem , destroy_channel_elem , " lame - client " , <nl> } ; <nl> <nl> grpc_channel * grpc_lame_client_channel_create ( void ) { <nl> mmm a / src / core / surface / secure_channel_create . c <nl> ppp b / src / core / surface / secure_channel_create . c <nl> static void on_secure_transport_setup_done ( void * rp , <nl> if ( status ! = GRPC_SECURITY_OK ) { <nl> gpr_log ( GPR_ERROR , " Secure transport setup failed with error % d . " , status ) ; <nl> done ( r , 0 ) ; <nl> - } else if ( grpc_client_setup_cb_begin ( r - > cs_request ) ) { <nl> + } else if ( grpc_client_setup_cb_begin ( r - > cs_request , <nl> + " on_secure_transport_setup_done " ) ) { <nl> grpc_create_chttp2_transport ( <nl> r - > setup - > setup_callback , r - > setup - > setup_user_data , <nl> grpc_client_setup_get_channel_args ( r - > cs_request ) , secure_endpoint , <nl> NULL , 0 , grpc_client_setup_get_mdctx ( r - > cs_request ) , 1 ) ; <nl> - grpc_client_setup_cb_end ( r - > cs_request ) ; <nl> + grpc_client_setup_cb_end ( r - > cs_request , " on_secure_transport_setup_done " ) ; <nl> done ( r , 1 ) ; <nl> } else { <nl> done ( r , 0 ) ; <nl> static void on_secure_transport_setup_done ( void * rp , <nl> static void on_connect ( void * rp , grpc_endpoint * tcp ) { <nl> request * r = rp ; <nl> <nl> - if ( ! grpc_client_setup_request_should_continue ( r - > cs_request ) ) { <nl> + if ( ! grpc_client_setup_request_should_continue ( r - > cs_request , <nl> + " on_connect . secure " ) ) { <nl> if ( tcp ) { <nl> grpc_endpoint_shutdown ( tcp ) ; <nl> grpc_endpoint_destroy ( tcp ) ; <nl> static int maybe_try_next_resolved ( request * r ) { <nl> if ( ! r - > resolved ) return 0 ; <nl> if ( r - > resolved_index = = r - > resolved - > naddrs ) return 0 ; <nl> addr = & r - > resolved - > addrs [ r - > resolved_index + + ] ; <nl> - grpc_tcp_client_connect ( on_connect , r , ( struct sockaddr * ) & addr - > addr , <nl> - addr - > len , <nl> - grpc_client_setup_request_deadline ( r - > cs_request ) ) ; <nl> + grpc_tcp_client_connect ( <nl> + on_connect , r , grpc_client_setup_get_interested_parties ( r - > cs_request ) , <nl> + ( struct sockaddr * ) & addr - > addr , addr - > len , <nl> + grpc_client_setup_request_deadline ( r - > cs_request ) ) ; <nl> return 1 ; <nl> } <nl> <nl> static void on_resolved ( void * rp , grpc_resolved_addresses * resolved ) { <nl> request * r = rp ; <nl> <nl> / * if we ' re not still the active request , abort * / <nl> - if ( ! grpc_client_setup_request_should_continue ( r - > cs_request ) ) { <nl> + if ( ! grpc_client_setup_request_should_continue ( r - > cs_request , <nl> + " on_resolved . secure " ) ) { <nl> if ( resolved ) { <nl> grpc_resolved_addresses_destroy ( resolved ) ; <nl> } <nl> mmm a / src / core / surface / server . c <nl> ppp b / src / core / surface / server . c <nl> typedef struct channel_registered_method { <nl> <nl> struct channel_data { <nl> grpc_server * server ; <nl> + size_t num_calls ; <nl> grpc_channel * channel ; <nl> grpc_mdstr * path_key ; <nl> grpc_mdstr * authority_key ; <nl> struct channel_data { <nl> channel_registered_method * registered_methods ; <nl> gpr_uint32 registered_method_slots ; <nl> gpr_uint32 registered_method_max_probes ; <nl> - grpc_iomgr_closure finish_shutdown_channel_closure ; <nl> grpc_iomgr_closure finish_destroy_channel_closure ; <nl> } ; <nl> <nl> struct call_data { <nl> static void begin_call ( grpc_server * server , call_data * calld , <nl> requested_call * rc ) ; <nl> static void fail_call ( grpc_server * server , requested_call * rc ) ; <nl> + static void shutdown_channel ( channel_data * chand , int send_goaway , <nl> + int send_disconnect ) ; <nl> + static void maybe_finish_shutdown ( grpc_server * server ) ; <nl> <nl> static int call_list_join ( call_data * * root , call_data * call , call_list list ) { <nl> GPR_ASSERT ( ! call - > root [ list ] ) ; <nl> static void server_delete ( grpc_server * server ) { <nl> gpr_free ( rm ) ; <nl> } <nl> for ( i = 0 ; i < server - > cq_count ; i + + ) { <nl> - grpc_cq_internal_unref ( server - > cqs [ i ] ) ; <nl> + GRPC_CQ_INTERNAL_UNREF ( server - > cqs [ i ] , " server " ) ; <nl> } <nl> gpr_free ( server - > cqs ) ; <nl> gpr_free ( server - > pollsets ) ; <nl> static void orphan_channel ( channel_data * chand ) { <nl> static void finish_destroy_channel ( void * cd , int success ) { <nl> channel_data * chand = cd ; <nl> grpc_server * server = chand - > server ; <nl> - grpc_channel_internal_unref ( chand - > channel ) ; <nl> + GRPC_CHANNEL_INTERNAL_UNREF ( chand - > channel , " server " ) ; <nl> server_unref ( server ) ; <nl> } <nl> <nl> static void destroy_channel ( channel_data * chand ) { <nl> GPR_ASSERT ( chand - > server ! = NULL ) ; <nl> orphan_channel ( chand ) ; <nl> server_ref ( chand - > server ) ; <nl> + maybe_finish_shutdown ( chand - > server ) ; <nl> chand - > finish_destroy_channel_closure . cb = finish_destroy_channel ; <nl> chand - > finish_destroy_channel_closure . cb_arg = chand ; <nl> grpc_iomgr_add_callback ( & chand - > finish_destroy_channel_closure ) ; <nl> static int num_listeners ( grpc_server * server ) { <nl> <nl> static void maybe_finish_shutdown ( grpc_server * server ) { <nl> size_t i ; <nl> - if ( server - > shutdown & & ! server - > shutdown_published & & server - > lists [ ALL_CALLS ] = = NULL & & server - > listeners_destroyed = = num_listeners ( server ) ) { <nl> - server - > shutdown_published = 1 ; <nl> - for ( i = 0 ; i < server - > num_shutdown_tags ; i + + ) { <nl> - grpc_cq_end_op ( server - > shutdown_tags [ i ] . cq , server - > shutdown_tags [ i ] . tag , <nl> - NULL , 1 ) ; <nl> - } <nl> + if ( ! server - > shutdown | | server - > shutdown_published ) { <nl> + return ; <nl> + } <nl> + if ( server - > lists [ ALL_CALLS ] ! = NULL ) { <nl> + gpr_log ( GPR_DEBUG , <nl> + " Waiting for all calls to finish before destroying server " ) ; <nl> + return ; <nl> + } <nl> + if ( server - > root_channel_data . next ! = & server - > root_channel_data ) { <nl> + gpr_log ( GPR_DEBUG , <nl> + " Waiting for all channels to close before destroying server " ) ; <nl> + return ; <nl> + } <nl> + if ( server - > listeners_destroyed < num_listeners ( server ) ) { <nl> + gpr_log ( GPR_DEBUG , " Waiting for all listeners to be destroyed ( @ % d / % d ) " , <nl> + server - > listeners_destroyed , num_listeners ( server ) ) ; <nl> + return ; <nl> + } <nl> + server - > shutdown_published = 1 ; <nl> + for ( i = 0 ; i < server - > num_shutdown_tags ; i + + ) { <nl> + grpc_cq_end_op ( server - > shutdown_tags [ i ] . cq , server - > shutdown_tags [ i ] . tag , <nl> + NULL , 1 ) ; <nl> } <nl> } <nl> <nl> static grpc_mdelem * server_filter ( void * user_data , grpc_mdelem * md ) { <nl> return md ; <nl> } <nl> <nl> + static void decrement_call_count ( channel_data * chand ) { <nl> + chand - > num_calls - - ; <nl> + if ( 0 = = chand - > num_calls & & chand - > server - > shutdown ) { <nl> + shutdown_channel ( chand , 0 , 1 ) ; <nl> + } <nl> + maybe_finish_shutdown ( chand - > server ) ; <nl> + } <nl> + <nl> static void server_on_recv ( void * ptr , int success ) { <nl> grpc_call_element * elem = ptr ; <nl> call_data * calld = elem - > call_data ; <nl> static void server_on_recv ( void * ptr , int success ) { <nl> calld - > state = ZOMBIED ; <nl> grpc_iomgr_closure_init ( & calld - > kill_zombie_closure , kill_zombie , elem ) ; <nl> grpc_iomgr_add_callback ( & calld - > kill_zombie_closure ) ; <nl> - <nl> } <nl> if ( call_list_remove ( calld , ALL_CALLS ) ) { <nl> - maybe_finish_shutdown ( chand - > server ) ; <nl> + decrement_call_count ( chand ) ; <nl> } <nl> gpr_mu_unlock ( & chand - > server - > mu ) ; <nl> break ; <nl> static void channel_op ( grpc_channel_element * elem , <nl> } <nl> } <nl> <nl> - static void finish_shutdown_channel ( void * cd , int success ) { <nl> - channel_data * chand = cd ; <nl> + typedef struct { <nl> + channel_data * chand ; <nl> + int send_goaway ; <nl> + int send_disconnect ; <nl> + grpc_iomgr_closure finish_shutdown_channel_closure ; <nl> + } shutdown_channel_args ; <nl> + <nl> + static void finish_shutdown_channel ( void * p , int success ) { <nl> + shutdown_channel_args * sca = p ; <nl> grpc_channel_op op ; <nl> - op . type = GRPC_CHANNEL_DISCONNECT ; <nl> - op . dir = GRPC_CALL_DOWN ; <nl> - channel_op ( grpc_channel_stack_element ( <nl> - grpc_channel_get_channel_stack ( chand - > channel ) , 0 ) , <nl> - NULL , & op ) ; <nl> - grpc_channel_internal_unref ( chand - > channel ) ; <nl> + <nl> + if ( sca - > send_goaway ) { <nl> + op . type = GRPC_CHANNEL_GOAWAY ; <nl> + op . dir = GRPC_CALL_DOWN ; <nl> + op . data . goaway . status = GRPC_STATUS_OK ; <nl> + op . data . goaway . message = gpr_slice_from_copied_string ( " Server shutdown " ) ; <nl> + channel_op ( grpc_channel_stack_element ( <nl> + grpc_channel_get_channel_stack ( sca - > chand - > channel ) , 0 ) , <nl> + NULL , & op ) ; <nl> + } <nl> + if ( sca - > send_disconnect ) { <nl> + op . type = GRPC_CHANNEL_DISCONNECT ; <nl> + op . dir = GRPC_CALL_DOWN ; <nl> + channel_op ( grpc_channel_stack_element ( <nl> + grpc_channel_get_channel_stack ( sca - > chand - > channel ) , 0 ) , <nl> + NULL , & op ) ; <nl> + } <nl> + GRPC_CHANNEL_INTERNAL_UNREF ( sca - > chand - > channel , " shutdown " ) ; <nl> + <nl> + gpr_free ( sca ) ; <nl> } <nl> <nl> - static void shutdown_channel ( channel_data * chand ) { <nl> - grpc_channel_internal_ref ( chand - > channel ) ; <nl> - chand - > finish_shutdown_channel_closure . cb = finish_shutdown_channel ; <nl> - chand - > finish_shutdown_channel_closure . cb_arg = chand ; <nl> - grpc_iomgr_add_callback ( & chand - > finish_shutdown_channel_closure ) ; <nl> + static void shutdown_channel ( channel_data * chand , int send_goaway , <nl> + int send_disconnect ) { <nl> + shutdown_channel_args * sca ; <nl> + GRPC_CHANNEL_INTERNAL_REF ( chand - > channel , " shutdown " ) ; <nl> + sca = gpr_malloc ( sizeof ( shutdown_channel_args ) ) ; <nl> + sca - > chand = chand ; <nl> + sca - > send_goaway = send_goaway ; <nl> + sca - > send_disconnect = send_disconnect ; <nl> + sca - > finish_shutdown_channel_closure . cb = finish_shutdown_channel ; <nl> + sca - > finish_shutdown_channel_closure . cb_arg = sca ; <nl> + grpc_iomgr_add_callback ( & sca - > finish_shutdown_channel_closure ) ; <nl> } <nl> <nl> static void init_call_elem ( grpc_call_element * elem , <nl> static void init_call_elem ( grpc_call_element * elem , <nl> <nl> gpr_mu_lock ( & chand - > server - > mu ) ; <nl> call_list_join ( & chand - > server - > lists [ ALL_CALLS ] , calld , ALL_CALLS ) ; <nl> + chand - > num_calls + + ; <nl> gpr_mu_unlock ( & chand - > server - > mu ) ; <nl> <nl> server_ref ( chand - > server ) ; <nl> static void destroy_call_elem ( grpc_call_element * elem ) { <nl> removed [ i ] = call_list_remove ( elem - > call_data , i ) ; <nl> } <nl> if ( removed [ ALL_CALLS ] ) { <nl> - maybe_finish_shutdown ( chand - > server ) ; <nl> + decrement_call_count ( chand ) ; <nl> } <nl> gpr_mu_unlock ( & chand - > server - > mu ) ; <nl> <nl> static void init_channel_elem ( grpc_channel_element * elem , <nl> GPR_ASSERT ( is_first ) ; <nl> GPR_ASSERT ( ! is_last ) ; <nl> chand - > server = NULL ; <nl> + chand - > num_calls = 0 ; <nl> chand - > channel = NULL ; <nl> chand - > path_key = grpc_mdstr_from_string ( metadata_context , " : path " ) ; <nl> chand - > authority_key = grpc_mdstr_from_string ( metadata_context , " : authority " ) ; <nl> static void destroy_channel_elem ( grpc_channel_element * elem ) { <nl> chand - > next - > prev = chand - > prev ; <nl> chand - > prev - > next = chand - > next ; <nl> chand - > next = chand - > prev = chand ; <nl> + maybe_finish_shutdown ( chand - > server ) ; <nl> gpr_mu_unlock ( & chand - > server - > mu ) ; <nl> grpc_mdstr_unref ( chand - > path_key ) ; <nl> grpc_mdstr_unref ( chand - > authority_key ) ; <nl> void grpc_server_register_completion_queue ( grpc_server * server , <nl> for ( i = 0 ; i < server - > cq_count ; i + + ) { <nl> if ( server - > cqs [ i ] = = cq ) return ; <nl> } <nl> - grpc_cq_internal_ref ( cq ) ; <nl> + GRPC_CQ_INTERNAL_REF ( cq , " server " ) ; <nl> + grpc_cq_mark_server_cq ( cq ) ; <nl> n = server - > cq_count + + ; <nl> server - > cqs = gpr_realloc ( server - > cqs , <nl> server - > cq_count * sizeof ( grpc_completion_queue * ) ) ; <nl> void * grpc_server_register_method ( grpc_server * server , const char * method , <nl> const char * host ) { <nl> registered_method * m ; <nl> if ( ! method ) { <nl> - gpr_log ( GPR_ERROR , " grpc_server_register_method method string cannot be NULL " ) ; <nl> + gpr_log ( GPR_ERROR , <nl> + " grpc_server_register_method method string cannot be NULL " ) ; <nl> return NULL ; <nl> } <nl> for ( m = server - > registered_methods ; m ; m = m - > next ) { <nl> void grpc_server_shutdown_and_notify ( grpc_server * server , <nl> grpc_completion_queue * cq , void * tag ) { <nl> listener * l ; <nl> requested_call_array requested_calls ; <nl> - channel_data * * channels ; <nl> channel_data * c ; <nl> - size_t nchannels ; <nl> size_t i ; <nl> - grpc_channel_op op ; <nl> - grpc_channel_element * elem ; <nl> registered_method * rm ; <nl> shutdown_tag * sdt ; <nl> <nl> void grpc_server_shutdown_and_notify ( grpc_server * server , <nl> return ; <nl> } <nl> <nl> - nchannels = 0 ; <nl> for ( c = server - > root_channel_data . next ; c ! = & server - > root_channel_data ; <nl> c = c - > next ) { <nl> - nchannels + + ; <nl> - } <nl> - channels = gpr_malloc ( sizeof ( channel_data * ) * nchannels ) ; <nl> - i = 0 ; <nl> - for ( c = server - > root_channel_data . next ; c ! = & server - > root_channel_data ; <nl> - c = c - > next ) { <nl> - grpc_channel_internal_ref ( c - > channel ) ; <nl> - channels [ i ] = c ; <nl> - i + + ; <nl> + shutdown_channel ( c , 1 , c - > num_calls = = 0 ) ; <nl> } <nl> <nl> / * collect all unregistered then registered calls * / <nl> void grpc_server_shutdown_and_notify ( grpc_server * server , <nl> maybe_finish_shutdown ( server ) ; <nl> gpr_mu_unlock ( & server - > mu ) ; <nl> <nl> - for ( i = 0 ; i < nchannels ; i + + ) { <nl> - c = channels [ i ] ; <nl> - elem = grpc_channel_stack_element ( <nl> - grpc_channel_get_channel_stack ( c - > channel ) , 0 ) ; <nl> - <nl> - op . type = GRPC_CHANNEL_GOAWAY ; <nl> - op . dir = GRPC_CALL_DOWN ; <nl> - op . data . goaway . status = GRPC_STATUS_OK ; <nl> - op . data . goaway . message = gpr_slice_from_copied_string ( " Server shutdown " ) ; <nl> - elem - > filter - > channel_op ( elem , NULL , & op ) ; <nl> - <nl> - grpc_channel_internal_unref ( c - > channel ) ; <nl> - } <nl> - gpr_free ( channels ) ; <nl> - <nl> / * terminate all the requested calls * / <nl> for ( i = 0 ; i < requested_calls . count ; i + + ) { <nl> fail_call ( server , & requested_calls . calls [ i ] ) ; <nl> void grpc_server_cancel_all_calls ( grpc_server * server ) { <nl> call_count = 0 ; <nl> calls = gpr_malloc ( sizeof ( grpc_call * ) * call_capacity ) ; <nl> <nl> - for ( calld = server - > lists [ ALL_CALLS ] ; calld ! = server - > lists [ ALL_CALLS ] | | is_first ; calld = calld - > links [ ALL_CALLS ] . next ) { <nl> + for ( calld = server - > lists [ ALL_CALLS ] ; <nl> + calld ! = server - > lists [ ALL_CALLS ] | | is_first ; <nl> + calld = calld - > links [ ALL_CALLS ] . next ) { <nl> if ( call_count = = call_capacity ) { <nl> call_capacity * = 2 ; <nl> calls = gpr_realloc ( calls , sizeof ( grpc_call * ) * call_capacity ) ; <nl> void grpc_server_cancel_all_calls ( grpc_server * server ) { <nl> gpr_mu_unlock ( & server - > mu ) ; <nl> <nl> for ( i = 0 ; i < call_count ; i + + ) { <nl> - grpc_call_cancel_with_status ( calls [ i ] , GRPC_STATUS_UNAVAILABLE , " Unavailable " ) ; <nl> + grpc_call_cancel_with_status ( calls [ i ] , GRPC_STATUS_UNAVAILABLE , <nl> + " Unavailable " ) ; <nl> GRPC_CALL_INTERNAL_UNREF ( calls [ i ] , " cancel_all " , 1 ) ; <nl> } <nl> <nl> void grpc_server_cancel_all_calls ( grpc_server * server ) { <nl> } <nl> <nl> void grpc_server_destroy ( grpc_server * server ) { <nl> - channel_data * c ; <nl> listener * l ; <nl> - call_data * calld ; <nl> <nl> gpr_mu_lock ( & server - > mu ) ; <nl> GPR_ASSERT ( server - > shutdown | | ! server - > listeners ) ; <nl> void grpc_server_destroy ( grpc_server * server ) { <nl> gpr_free ( l ) ; <nl> } <nl> <nl> - while ( ( calld = call_list_remove_head ( & server - > lists [ PENDING_START ] , <nl> - PENDING_START ) ) ! = NULL ) { <nl> - calld - > state = ZOMBIED ; <nl> - grpc_iomgr_closure_init ( <nl> - & calld - > kill_zombie_closure , kill_zombie , <nl> - grpc_call_stack_element ( grpc_call_get_call_stack ( calld - > call ) , 0 ) ) ; <nl> - grpc_iomgr_add_callback ( & calld - > kill_zombie_closure ) ; <nl> - } <nl> - <nl> - for ( c = server - > root_channel_data . next ; c ! = & server - > root_channel_data ; <nl> - c = c - > next ) { <nl> - shutdown_channel ( c ) ; <nl> - } <nl> gpr_mu_unlock ( & server - > mu ) ; <nl> <nl> server_unref ( server ) ; <nl> grpc_call_error grpc_server_request_call ( <nl> GRPC_SERVER_LOG_REQUEST_CALL ( GPR_INFO , server , call , details , <nl> initial_metadata , cq_bound_to_call , <nl> cq_for_notification , tag ) ; <nl> + if ( ! grpc_cq_is_server_cq ( cq_for_notification ) ) { <nl> + return GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE ; <nl> + } <nl> grpc_cq_begin_op ( cq_for_notification , NULL ) ; <nl> rc . type = BATCH_CALL ; <nl> rc . tag = tag ; <nl> grpc_call_error grpc_server_request_registered_call ( <nl> grpc_completion_queue * cq_for_notification , void * tag ) { <nl> requested_call rc ; <nl> registered_method * registered_method = rm ; <nl> + if ( ! grpc_cq_is_server_cq ( cq_for_notification ) ) { <nl> + return GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE ; <nl> + } <nl> grpc_cq_begin_op ( cq_for_notification , NULL ) ; <nl> rc . type = REGISTERED_CALL ; <nl> rc . tag = tag ; <nl> int grpc_server_has_open_connections ( grpc_server * server ) { <nl> gpr_mu_unlock ( & server - > mu ) ; <nl> return r ; <nl> } <nl> - <nl> mmm a / src / core / transport / chttp2_transport . c <nl> ppp b / src / core / transport / chttp2_transport . c <nl> static void destroy_transport ( grpc_transport * gt ) { <nl> unref_transport ( t ) ; <nl> } <nl> <nl> + static void close_transport_locked ( transport * t ) { <nl> + if ( ! t - > closed ) { <nl> + t - > closed = 1 ; <nl> + if ( t - > ep ) { <nl> + grpc_endpoint_shutdown ( t - > ep ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> static void close_transport ( grpc_transport * gt ) { <nl> transport * t = ( transport * ) gt ; <nl> gpr_mu_lock ( & t - > mu ) ; <nl> - GPR_ASSERT ( ! t - > closed ) ; <nl> - t - > closed = 1 ; <nl> - if ( t - > ep ) { <nl> - grpc_endpoint_shutdown ( t - > ep ) ; <nl> - } <nl> + close_transport_locked ( t ) ; <nl> gpr_mu_unlock ( & t - > mu ) ; <nl> } <nl> <nl> static void finalize_outbuf ( transport * t ) { <nl> <nl> while ( ( s = stream_list_remove_head ( t , WRITING ) ) ) { <nl> grpc_chttp2_encode ( s - > writing_sopb . ops , s - > writing_sopb . nops , <nl> - s - > send_closed ! = DONT_SEND_CLOSED , s - > id , & t - > hpack_compressor , & t - > outbuf ) ; <nl> + s - > send_closed ! = DONT_SEND_CLOSED , s - > id , <nl> + & t - > hpack_compressor , & t - > outbuf ) ; <nl> s - > writing_sopb . nops = 0 ; <nl> if ( s - > send_closed = = SEND_CLOSED_WITH_RST_STREAM ) { <nl> - gpr_slice_buffer_add ( & t - > outbuf , grpc_chttp2_rst_stream_create ( s - > id , GRPC_CHTTP2_NO_ERROR ) ) ; <nl> + gpr_slice_buffer_add ( & t - > outbuf , grpc_chttp2_rst_stream_create ( <nl> + s - > id , GRPC_CHTTP2_NO_ERROR ) ) ; <nl> } <nl> if ( s - > send_closed ! = DONT_SEND_CLOSED ) { <nl> stream_list_join ( t , s , WRITTEN_CLOSED ) ; <nl> static void perform_write ( transport * t , grpc_endpoint * ep ) { <nl> } <nl> } <nl> <nl> - static void add_goaway ( transport * t , gpr_uint32 goaway_error , gpr_slice goaway_text ) { <nl> + static void add_goaway ( transport * t , gpr_uint32 goaway_error , <nl> + gpr_slice goaway_text ) { <nl> if ( t - > num_pending_goaways = = t - > cap_pending_goaways ) { <nl> t - > cap_pending_goaways = GPR_MAX ( 1 , t - > cap_pending_goaways * 2 ) ; <nl> - t - > pending_goaways = <nl> - gpr_realloc ( t - > pending_goaways , <nl> - sizeof ( pending_goaway ) * t - > cap_pending_goaways ) ; <nl> + t - > pending_goaways = gpr_realloc ( <nl> + t - > pending_goaways , sizeof ( pending_goaway ) * t - > cap_pending_goaways ) ; <nl> } <nl> t - > pending_goaways [ t - > num_pending_goaways ] . status = <nl> grpc_chttp2_http2_error_to_grpc_status ( goaway_error ) ; <nl> static void add_goaway ( transport * t , gpr_uint32 goaway_error , gpr_slice goaway_t <nl> t - > num_pending_goaways + + ; <nl> } <nl> <nl> - <nl> static void maybe_start_some_streams ( transport * t ) { <nl> / * start streams where we have free stream ids and free concurrency * / <nl> - while ( <nl> - t - > next_stream_id < = MAX_CLIENT_STREAM_ID & & <nl> - grpc_chttp2_stream_map_size ( & t - > stream_map ) < <nl> - t - > settings [ PEER_SETTINGS ] [ GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS ] ) { <nl> + while ( t - > next_stream_id < = MAX_CLIENT_STREAM_ID & & <nl> + grpc_chttp2_stream_map_size ( & t - > stream_map ) < <nl> + t - > settings [ PEER_SETTINGS ] <nl> + [ GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS ] ) { <nl> stream * s = stream_list_remove_head ( t , WAITING_FOR_CONCURRENCY ) ; <nl> if ( ! s ) return ; <nl> <nl> static void maybe_start_some_streams ( transport * t ) { <nl> t - > is_client ? " CLI " : " SVR " , s , t - > next_stream_id ) ) ; <nl> <nl> if ( t - > next_stream_id = = MAX_CLIENT_STREAM_ID ) { <nl> - add_goaway ( t , GRPC_CHTTP2_NO_ERROR , gpr_slice_from_copied_string ( " Exceeded sequence number limit " ) ) ; <nl> + add_goaway ( <nl> + t , GRPC_CHTTP2_NO_ERROR , <nl> + gpr_slice_from_copied_string ( " Exceeded sequence number limit " ) ) ; <nl> } <nl> <nl> GPR_ASSERT ( s - > id = = 0 ) ; <nl> static void maybe_start_some_streams ( transport * t ) { <nl> stream * s = stream_list_remove_head ( t , WAITING_FOR_CONCURRENCY ) ; <nl> if ( ! s ) return ; <nl> <nl> - cancel_stream ( t , s , GRPC_STATUS_UNAVAILABLE , grpc_chttp2_grpc_status_to_http2_error ( GRPC_STATUS_UNAVAILABLE ) , NULL , 0 ) ; <nl> + cancel_stream ( <nl> + t , s , GRPC_STATUS_UNAVAILABLE , <nl> + grpc_chttp2_grpc_status_to_http2_error ( GRPC_STATUS_UNAVAILABLE ) , NULL , <nl> + 0 ) ; <nl> } <nl> } <nl> <nl> static void perform_op_locked ( transport * t , stream * s , grpc_transport_op * op ) { <nl> if ( op - > bind_pollset ) { <nl> add_to_pollset_locked ( t , op - > bind_pollset ) ; <nl> } <nl> + <nl> + if ( op - > on_consumed ) { <nl> + op_closure c ; <nl> + c . cb = op - > on_consumed ; <nl> + c . user_data = op - > on_consumed_user_data ; <nl> + schedule_cb ( t , c , 1 ) ; <nl> + } <nl> } <nl> <nl> static void perform_op ( grpc_transport * gt , grpc_stream * gs , <nl> static void cancel_stream_inner ( transport * t , stream * s , gpr_uint32 id , <nl> / * synthesize a status if we don ' t believe we ' ll get one * / <nl> gpr_ltoa ( local_status , buffer ) ; <nl> add_incoming_metadata ( <nl> - t , s , <nl> - grpc_mdelem_from_strings ( t - > metadata_context , " grpc - status " , buffer ) ) ; <nl> + t , s , grpc_mdelem_from_strings ( t - > metadata_context , " grpc - status " , <nl> + buffer ) ) ; <nl> if ( ! optional_message ) { <nl> switch ( local_status ) { <nl> case GRPC_STATUS_CANCELLED : <nl> static void drop_connection ( transport * t ) { <nl> if ( t - > error_state = = ERROR_STATE_NONE ) { <nl> t - > error_state = ERROR_STATE_SEEN ; <nl> } <nl> + close_transport_locked ( t ) ; <nl> end_all_the_calls ( t ) ; <nl> } <nl> <nl> static int init_header_frame_parser ( transport * t , int is_continuation ) { <nl> t - > last_incoming_stream_id , t - > incoming_stream_id ) ; <nl> return init_skip_frame ( t , 1 ) ; <nl> } else if ( ( t - > incoming_stream_id & 1 ) = = 0 ) { <nl> - gpr_log ( GPR_ERROR , " ignoring stream with non - client generated index % d " , t - > incoming_stream_id ) ; <nl> + gpr_log ( GPR_ERROR , " ignoring stream with non - client generated index % d " , <nl> + t - > incoming_stream_id ) ; <nl> return init_skip_frame ( t , 1 ) ; <nl> } <nl> t - > incoming_stream = NULL ; <nl> static int init_ping_parser ( transport * t ) { <nl> } <nl> <nl> static int init_rst_stream_parser ( transport * t ) { <nl> - int ok = GRPC_CHTTP2_PARSE_OK = = <nl> - grpc_chttp2_rst_stream_parser_begin_frame ( & t - > simple_parsers . rst_stream , <nl> - t - > incoming_frame_size , <nl> - t - > incoming_frame_flags ) ; <nl> + int ok = GRPC_CHTTP2_PARSE_OK = = grpc_chttp2_rst_stream_parser_begin_frame ( <nl> + & t - > simple_parsers . rst_stream , <nl> + t - > incoming_frame_size , <nl> + t - > incoming_frame_flags ) ; <nl> if ( ! ok ) { <nl> drop_connection ( t ) ; <nl> } <nl> static int init_settings_frame_parser ( transport * t ) { <nl> int ok ; <nl> <nl> if ( t - > incoming_stream_id ! = 0 ) { <nl> - gpr_log ( GPR_ERROR , " settings frame received for stream % d " , t - > incoming_stream_id ) ; <nl> + gpr_log ( GPR_ERROR , " settings frame received for stream % d " , <nl> + t - > incoming_stream_id ) ; <nl> drop_connection ( t ) ; <nl> return 0 ; <nl> } <nl> <nl> ok = GRPC_CHTTP2_PARSE_OK = = <nl> - grpc_chttp2_settings_parser_begin_frame ( <nl> - & t - > simple_parsers . settings , t - > incoming_frame_size , <nl> - t - > incoming_frame_flags , t - > settings [ PEER_SETTINGS ] ) ; <nl> + grpc_chttp2_settings_parser_begin_frame ( <nl> + & t - > simple_parsers . settings , t - > incoming_frame_size , <nl> + t - > incoming_frame_flags , t - > settings [ PEER_SETTINGS ] ) ; <nl> if ( ! ok ) { <nl> drop_connection ( t ) ; <nl> return 0 ; <nl> static void add_metadata_batch ( transport * t , stream * s ) { <nl> we can reconstitute the list . <nl> We can ' t do list building here as later incoming metadata may reallocate <nl> the underlying array . * / <nl> - b . list . tail = ( void * ) ( gpr_intptr ) s - > incoming_metadata_count ; <nl> + b . list . tail = ( void * ) ( gpr_intptr ) s - > incoming_metadata_count ; <nl> b . garbage . head = b . garbage . tail = NULL ; <nl> b . deadline = s - > incoming_deadline ; <nl> s - > incoming_deadline = gpr_inf_future ; <nl> static void patch_metadata_ops ( stream * s ) { <nl> int found_metadata = 0 ; <nl> <nl> / * rework the array of metadata into a linked list , making use <nl> - of the breadcrumbs we left in metadata batches during <nl> + of the breadcrumbs we left in metadata batches during <nl> add_metadata_batch * / <nl> for ( i = 0 ; i < nops ; i + + ) { <nl> grpc_stream_op * op = & ops [ i ] ; <nl> static void patch_metadata_ops ( stream * s ) { <nl> op - > data . metadata . list . head = & s - > incoming_metadata [ mdidx ] ; <nl> op - > data . metadata . list . tail = & s - > incoming_metadata [ last_mdidx - 1 ] ; <nl> for ( j = mdidx + 1 ; j < last_mdidx ; j + + ) { <nl> - s - > incoming_metadata [ j ] . prev = & s - > incoming_metadata [ j - 1 ] ; <nl> - s - > incoming_metadata [ j - 1 ] . next = & s - > incoming_metadata [ j ] ; <nl> + s - > incoming_metadata [ j ] . prev = & s - > incoming_metadata [ j - 1 ] ; <nl> + s - > incoming_metadata [ j - 1 ] . next = & s - > incoming_metadata [ j ] ; <nl> } <nl> s - > incoming_metadata [ mdidx ] . prev = NULL ; <nl> - s - > incoming_metadata [ last_mdidx - 1 ] . next = NULL ; <nl> + s - > incoming_metadata [ last_mdidx - 1 ] . next = NULL ; <nl> / * track where we ' re up to * / <nl> mdidx = last_mdidx ; <nl> } <nl> static void patch_metadata_ops ( stream * s ) { <nl> size_t copy_bytes = sizeof ( * s - > incoming_metadata ) * new_count ; <nl> GPR_ASSERT ( mdidx < s - > incoming_metadata_count ) ; <nl> s - > incoming_metadata = gpr_malloc ( copy_bytes ) ; <nl> - memcpy ( s - > old_incoming_metadata + mdidx , s - > incoming_metadata , copy_bytes ) ; <nl> + memcpy ( s - > old_incoming_metadata + mdidx , s - > incoming_metadata , <nl> + copy_bytes ) ; <nl> s - > incoming_metadata_count = s - > incoming_metadata_capacity = new_count ; <nl> } else { <nl> s - > incoming_metadata = NULL ; <nl> static void finish_reads ( transport * t ) { <nl> schedule_cb ( t , s - > recv_done_closure , 1 ) ; <nl> } <nl> } <nl> - <nl> } <nl> <nl> static void schedule_cb ( transport * t , op_closure closure , int success ) { <nl> mmm a / src / core / transport / transport . c <nl> ppp b / src / core / transport / transport . c <nl> void grpc_transport_setup_initiate ( grpc_transport_setup * setup ) { <nl> setup - > vtable - > initiate ( setup ) ; <nl> } <nl> <nl> + void grpc_transport_setup_add_interested_party ( grpc_transport_setup * setup , <nl> + grpc_pollset * pollset ) { <nl> + setup - > vtable - > add_interested_party ( setup , pollset ) ; <nl> + } <nl> + <nl> + void grpc_transport_setup_del_interested_party ( grpc_transport_setup * setup , <nl> + grpc_pollset * pollset ) { <nl> + setup - > vtable - > del_interested_party ( setup , pollset ) ; <nl> + } <nl> + <nl> void grpc_transport_op_finish_with_failure ( grpc_transport_op * op ) { <nl> if ( op - > send_ops ) { <nl> op - > on_done_send ( op - > send_user_data , 0 ) ; <nl> void grpc_transport_op_finish_with_failure ( grpc_transport_op * op ) { <nl> if ( op - > recv_ops ) { <nl> op - > on_done_recv ( op - > recv_user_data , 0 ) ; <nl> } <nl> + if ( op - > on_consumed ) { <nl> + op - > on_consumed ( op - > on_consumed_user_data , 0 ) ; <nl> + } <nl> } <nl> <nl> void grpc_transport_op_add_cancellation ( grpc_transport_op * op , <nl> mmm a / src / core / transport / transport . h <nl> ppp b / src / core / transport / transport . h <nl> <nl> # include < stddef . h > <nl> <nl> # include " src / core / iomgr / pollset . h " <nl> + # include " src / core / iomgr / pollset_set . h " <nl> # include " src / core / transport / stream_op . h " <nl> # include " src / core / channel / context . h " <nl> <nl> typedef enum grpc_stream_state { <nl> <nl> / * Transport op : a set of operations to perform on a transport * / <nl> typedef struct grpc_transport_op { <nl> + void ( * on_consumed ) ( void * user_data , int success ) ; <nl> + void * on_consumed_user_data ; <nl> + <nl> grpc_stream_op_buffer * send_ops ; <nl> int is_last_send ; <nl> void ( * on_done_send ) ( void * user_data , int success ) ; <nl> typedef struct grpc_transport_setup_vtable grpc_transport_setup_vtable ; <nl> <nl> struct grpc_transport_setup_vtable { <nl> void ( * initiate ) ( grpc_transport_setup * setup ) ; <nl> + void ( * add_interested_party ) ( grpc_transport_setup * setup , <nl> + grpc_pollset * pollset ) ; <nl> + void ( * del_interested_party ) ( grpc_transport_setup * setup , <nl> + grpc_pollset * pollset ) ; <nl> void ( * cancel ) ( grpc_transport_setup * setup ) ; <nl> } ; <nl> <nl> struct grpc_transport_setup { <nl> This * may * be implemented as a no - op if the setup process monitors something <nl> continuously . * / <nl> void grpc_transport_setup_initiate ( grpc_transport_setup * setup ) ; <nl> + <nl> + void grpc_transport_setup_add_interested_party ( grpc_transport_setup * setup , <nl> + grpc_pollset * pollset ) ; <nl> + void grpc_transport_setup_del_interested_party ( grpc_transport_setup * setup , <nl> + grpc_pollset * pollset ) ; <nl> + <nl> / * Cancel transport setup . After this returns , no new transports should be <nl> created , and all pending transport setup callbacks should be completed . <nl> After this call completes , setup should be considered invalid ( this can be <nl> mmm a / src / csharp / Grpc . Core . Tests / ClientServerTest . cs <nl> ppp b / src / csharp / Grpc . Core . Tests / ClientServerTest . cs <nl> public void UnaryCallPerformance ( ) <nl> BenchmarkUtil . RunBenchmark ( 100 , 100 , <nl> ( ) = > { Calls . BlockingUnaryCall ( call , " ABC " , default ( CancellationToken ) ) ; } ) ; <nl> } <nl> - <nl> - / / TODO ( jtattermusch ) : temporarily commented out for # 1731 <nl> - / / to be uncommented along with PR # 1577 <nl> - / / [ Test ] <nl> - / / public void UnknownMethodHandler ( ) <nl> - / / { <nl> - / / var call = new Call < string , string > ( ServiceName , NonexistentMethod , channel , Metadata . Empty ) ; <nl> - / / try <nl> - / / { <nl> - / / Calls . BlockingUnaryCall ( call , " ABC " , default ( CancellationToken ) ) ; <nl> - / / Assert . Fail ( ) ; <nl> - / / } <nl> - / / catch ( RpcException e ) <nl> - / / { <nl> - / / Assert . AreEqual ( StatusCode . Unimplemented , e . Status . StatusCode ) ; <nl> - / / } <nl> - / / } <nl> + <nl> + [ Test ] <nl> + public void UnknownMethodHandler ( ) <nl> + { <nl> + var call = new Call < string , string > ( ServiceName , NonexistentMethod , channel , Metadata . Empty ) ; <nl> + try <nl> + { <nl> + Calls . BlockingUnaryCall ( call , " ABC " , default ( CancellationToken ) ) ; <nl> + Assert . Fail ( ) ; <nl> + } <nl> + catch ( RpcException e ) <nl> + { <nl> + Assert . AreEqual ( StatusCode . Unimplemented , e . Status . StatusCode ) ; <nl> + } <nl> + } <nl> <nl> private static async Task < string > EchoHandler ( ServerCallContext context , string request ) <nl> { <nl> mmm a / src / csharp / Grpc . Core / Internal / AsyncCallServer . cs <nl> ppp b / src / csharp / Grpc . Core / Internal / AsyncCallServer . cs <nl> public void StartSendStatusFromServer ( Status status , AsyncCompletionDelegate < obj <nl> <nl> call . StartSendStatusFromServer ( status , HandleHalfclosed ) ; <nl> halfcloseRequested = true ; <nl> + readingDone = true ; <nl> sendCompletionDelegate = completionDelegate ; <nl> } <nl> } <nl> mmm a / src / csharp / Grpc . Core / Internal / ServerCallHandler . cs <nl> ppp b / src / csharp / Grpc . Core / Internal / ServerCallHandler . cs <nl> public async Task HandleCall ( string methodName , CallSafeHandle call , CompletionQ <nl> var responseStream = new ServerResponseStream < byte [ ] , byte [ ] > ( asyncCall ) ; <nl> <nl> await responseStream . WriteStatusAsync ( new Status ( StatusCode . Unimplemented , " No such method . " ) ) ; <nl> - / / TODO ( jtattermusch ) : if we don ' t read what client has sent , the server call never gets disposed . <nl> - await requestStream . ToList ( ) ; <nl> await finishedTask ; <nl> } <nl> } <nl> mmm a / src / python / src / grpc / _adapter / _c / types / server . c <nl> ppp b / src / python / src / grpc / _adapter / _c / types / server . c <nl> Server * pygrpc_Server_new ( PyTypeObject * type , PyObject * args , PyObject * kwargs ) <nl> } <nl> self = ( Server * ) type - > tp_alloc ( type , 0 ) ; <nl> self - > c_serv = grpc_server_create ( & c_args ) ; <nl> + grpc_server_register_completion_queue ( self - > c_serv , cq - > c_cq ) ; <nl> pygrpc_discard_channel_args ( c_args ) ; <nl> self - > cq = cq ; <nl> Py_INCREF ( self - > cq ) ; <nl> mmm a / src / python / src / grpc / _adapter / _intermediary_low_test . py <nl> ppp b / src / python / src / grpc / _adapter / _intermediary_low_test . py <nl> <nl> <nl> " " " Tests for the old ' _low ' . " " " <nl> <nl> + import Queue <nl> + import threading <nl> import time <nl> import unittest <nl> <nl> <nl> bytes ( bytearray ( ( row + column ) % 256 for column in range ( row ) ) ) <nl> for row in range ( _STREAM_LENGTH ) ) <nl> <nl> + <nl> class LonelyClientTest ( unittest . TestCase ) : <nl> <nl> def testLonelyClient ( self ) : <nl> def testLonelyClient ( self ) : <nl> del completion_queue <nl> <nl> <nl> + def _drive_completion_queue ( completion_queue , event_queue ) : <nl> + while True : <nl> + event = completion_queue . get ( _FUTURE ) <nl> + if event . kind is _low . Event . Kind . STOP : <nl> + break <nl> + event_queue . put ( event ) <nl> + <nl> + <nl> class EchoTest ( unittest . TestCase ) : <nl> <nl> def setUp ( self ) : <nl> def setUp ( self ) : <nl> self . server = _low . Server ( self . server_completion_queue ) <nl> port = self . server . add_http2_addr ( ' [ : : ] : 0 ' ) <nl> self . server . start ( ) <nl> + self . server_events = Queue . Queue ( ) <nl> + self . server_completion_queue_thread = threading . Thread ( <nl> + target = _drive_completion_queue , <nl> + args = ( self . server_completion_queue , self . server_events ) ) <nl> + self . server_completion_queue_thread . start ( ) <nl> <nl> self . client_completion_queue = _low . CompletionQueue ( ) <nl> self . channel = _low . Channel ( ' % s : % d ' % ( self . host , port ) , None ) <nl> + self . client_events = Queue . Queue ( ) <nl> + self . client_completion_queue_thread = threading . Thread ( <nl> + target = _drive_completion_queue , <nl> + args = ( self . client_completion_queue , self . client_events ) ) <nl> + self . client_completion_queue_thread . start ( ) <nl> <nl> def tearDown ( self ) : <nl> self . server . stop ( ) <nl> self . server_completion_queue . stop ( ) <nl> self . client_completion_queue . stop ( ) <nl> - while True : <nl> - event = self . server_completion_queue . get ( _FUTURE ) <nl> - if event is not None and event . kind is _low . Event . Kind . STOP : <nl> - break <nl> - while True : <nl> - event = self . client_completion_queue . get ( _FUTURE ) <nl> - if event is not None and event . kind is _low . Event . Kind . STOP : <nl> - break <nl> - self . server_completion_queue = None <nl> - self . client_completion_queue = None <nl> + self . server_completion_queue_thread . join ( ) <nl> + self . client_completion_queue_thread . join ( ) <nl> del self . server <nl> <nl> def _perform_echo_test ( self , test_data ) : <nl> def _perform_echo_test ( self , test_data ) : <nl> client_call . invoke ( self . client_completion_queue , metadata_tag , finish_tag ) <nl> <nl> self . server . service ( service_tag ) <nl> - service_accepted = self . server_completion_queue . get ( _FUTURE ) <nl> + service_accepted = self . server_events . get ( ) <nl> self . assertIsNotNone ( service_accepted ) <nl> self . assertIs ( service_accepted . kind , _low . Event . Kind . SERVICE_ACCEPTED ) <nl> self . assertIs ( service_accepted . tag , service_tag ) <nl> def _perform_echo_test ( self , test_data ) : <nl> server_leading_binary_metadata_value ) <nl> server_call . premetadata ( ) <nl> <nl> - metadata_accepted = self . client_completion_queue . get ( _FUTURE ) <nl> + metadata_accepted = self . client_events . get ( ) <nl> self . assertIsNotNone ( metadata_accepted ) <nl> self . assertEqual ( _low . Event . Kind . METADATA_ACCEPTED , metadata_accepted . kind ) <nl> self . assertEqual ( metadata_tag , metadata_accepted . tag ) <nl> def _perform_echo_test ( self , test_data ) : <nl> <nl> for datum in test_data : <nl> client_call . write ( datum , write_tag ) <nl> - write_accepted = self . client_completion_queue . get ( _FUTURE ) <nl> + write_accepted = self . client_events . get ( ) <nl> self . assertIsNotNone ( write_accepted ) <nl> self . assertIs ( write_accepted . kind , _low . Event . Kind . WRITE_ACCEPTED ) <nl> self . assertIs ( write_accepted . tag , write_tag ) <nl> self . assertIs ( write_accepted . write_accepted , True ) <nl> <nl> server_call . read ( read_tag ) <nl> - read_accepted = self . server_completion_queue . get ( _FUTURE ) <nl> + read_accepted = self . server_events . get ( ) <nl> self . assertIsNotNone ( read_accepted ) <nl> self . assertEqual ( _low . Event . Kind . READ_ACCEPTED , read_accepted . kind ) <nl> self . assertEqual ( read_tag , read_accepted . tag ) <nl> def _perform_echo_test ( self , test_data ) : <nl> server_data . append ( read_accepted . bytes ) <nl> <nl> server_call . write ( read_accepted . bytes , write_tag ) <nl> - write_accepted = self . server_completion_queue . get ( _FUTURE ) <nl> + write_accepted = self . server_events . get ( ) <nl> self . assertIsNotNone ( write_accepted ) <nl> self . assertEqual ( _low . Event . Kind . WRITE_ACCEPTED , write_accepted . kind ) <nl> self . assertEqual ( write_tag , write_accepted . tag ) <nl> self . assertTrue ( write_accepted . write_accepted ) <nl> <nl> client_call . read ( read_tag ) <nl> - read_accepted = self . client_completion_queue . get ( _FUTURE ) <nl> + read_accepted = self . client_events . get ( ) <nl> self . assertIsNotNone ( read_accepted ) <nl> self . assertEqual ( _low . Event . Kind . READ_ACCEPTED , read_accepted . kind ) <nl> self . assertEqual ( read_tag , read_accepted . tag ) <nl> def _perform_echo_test ( self , test_data ) : <nl> client_data . append ( read_accepted . bytes ) <nl> <nl> client_call . complete ( complete_tag ) <nl> - complete_accepted = self . client_completion_queue . get ( _FUTURE ) <nl> + complete_accepted = self . client_events . get ( ) <nl> self . assertIsNotNone ( complete_accepted ) <nl> self . assertIs ( complete_accepted . kind , _low . Event . Kind . COMPLETE_ACCEPTED ) <nl> self . assertIs ( complete_accepted . tag , complete_tag ) <nl> self . assertIs ( complete_accepted . complete_accepted , True ) <nl> <nl> server_call . read ( read_tag ) <nl> - read_accepted = self . server_completion_queue . get ( _FUTURE ) <nl> + read_accepted = self . server_events . get ( ) <nl> self . assertIsNotNone ( read_accepted ) <nl> self . assertEqual ( _low . Event . Kind . READ_ACCEPTED , read_accepted . kind ) <nl> self . assertEqual ( read_tag , read_accepted . tag ) <nl> def _perform_echo_test ( self , test_data ) : <nl> server_trailing_binary_metadata_value ) <nl> <nl> server_call . status ( _low . Status ( _low . Code . OK , details ) , status_tag ) <nl> - server_terminal_event_one = self . server_completion_queue . get ( _FUTURE ) <nl> - server_terminal_event_two = self . server_completion_queue . get ( _FUTURE ) <nl> + server_terminal_event_one = self . server_events . get ( ) <nl> + server_terminal_event_two = self . server_events . get ( ) <nl> if server_terminal_event_one . kind = = _low . Event . Kind . COMPLETE_ACCEPTED : <nl> status_accepted = server_terminal_event_one <nl> rpc_accepted = server_terminal_event_two <nl> def _perform_echo_test ( self , test_data ) : <nl> self . assertEqual ( _low . Status ( _low . Code . OK , ' ' ) , rpc_accepted . status ) <nl> <nl> client_call . read ( read_tag ) <nl> - client_terminal_event_one = self . client_completion_queue . get ( _FUTURE ) <nl> - client_terminal_event_two = self . client_completion_queue . get ( _FUTURE ) <nl> + client_terminal_event_one = self . client_events . get ( ) <nl> + client_terminal_event_two = self . client_events . get ( ) <nl> if client_terminal_event_one . kind = = _low . Event . Kind . READ_ACCEPTED : <nl> read_accepted = client_terminal_event_one <nl> finish_accepted = client_terminal_event_two <nl> def setUp ( self ) : <nl> self . server = _low . Server ( self . server_completion_queue ) <nl> port = self . server . add_http2_addr ( ' [ : : ] : 0 ' ) <nl> self . server . start ( ) <nl> + self . server_events = Queue . Queue ( ) <nl> + self . server_completion_queue_thread = threading . Thread ( <nl> + target = _drive_completion_queue , <nl> + args = ( self . server_completion_queue , self . server_events ) ) <nl> + self . server_completion_queue_thread . start ( ) <nl> <nl> self . client_completion_queue = _low . CompletionQueue ( ) <nl> self . channel = _low . Channel ( ' % s : % d ' % ( self . host , port ) , None ) <nl> + self . client_events = Queue . Queue ( ) <nl> + self . client_completion_queue_thread = threading . Thread ( <nl> + target = _drive_completion_queue , <nl> + args = ( self . client_completion_queue , self . client_events ) ) <nl> + self . client_completion_queue_thread . start ( ) <nl> <nl> def tearDown ( self ) : <nl> self . server . stop ( ) <nl> self . server_completion_queue . stop ( ) <nl> self . client_completion_queue . stop ( ) <nl> - while True : <nl> - event = self . server_completion_queue . get ( 0 ) <nl> - if event is not None and event . kind is _low . Event . Kind . STOP : <nl> - break <nl> - while True : <nl> - event = self . client_completion_queue . get ( 0 ) <nl> - if event is not None and event . kind is _low . Event . Kind . STOP : <nl> - break <nl> + self . server_completion_queue_thread . join ( ) <nl> + self . client_completion_queue_thread . join ( ) <nl> del self . server <nl> <nl> def testCancellation ( self ) : <nl> def testCancellation ( self ) : <nl> client_call . invoke ( self . client_completion_queue , metadata_tag , finish_tag ) <nl> <nl> self . server . service ( service_tag ) <nl> - service_accepted = self . server_completion_queue . get ( _FUTURE ) <nl> + service_accepted = self . server_events . get ( ) <nl> server_call = service_accepted . service_acceptance . call <nl> <nl> server_call . accept ( self . server_completion_queue , finish_tag ) <nl> server_call . premetadata ( ) <nl> <nl> - metadata_accepted = self . client_completion_queue . get ( _FUTURE ) <nl> + metadata_accepted = self . client_events . get ( ) <nl> self . assertIsNotNone ( metadata_accepted ) <nl> <nl> for datum in test_data : <nl> client_call . write ( datum , write_tag ) <nl> - write_accepted = self . client_completion_queue . get ( _FUTURE ) <nl> + write_accepted = self . client_events . get ( ) <nl> <nl> server_call . read ( read_tag ) <nl> - read_accepted = self . server_completion_queue . get ( _FUTURE ) <nl> + read_accepted = self . server_events . get ( ) <nl> server_data . append ( read_accepted . bytes ) <nl> <nl> server_call . write ( read_accepted . bytes , write_tag ) <nl> - write_accepted = self . server_completion_queue . get ( _FUTURE ) <nl> + write_accepted = self . server_events . get ( ) <nl> self . assertIsNotNone ( write_accepted ) <nl> <nl> client_call . read ( read_tag ) <nl> - read_accepted = self . client_completion_queue . get ( _FUTURE ) <nl> + read_accepted = self . client_events . get ( ) <nl> client_data . append ( read_accepted . bytes ) <nl> <nl> client_call . cancel ( ) <nl> def testCancellation ( self ) : <nl> <nl> server_call . read ( read_tag ) <nl> <nl> - server_terminal_event_one = self . server_completion_queue . get ( _FUTURE ) <nl> - server_terminal_event_two = self . server_completion_queue . get ( _FUTURE ) <nl> + server_terminal_event_one = self . server_events . get ( ) <nl> + server_terminal_event_two = self . server_events . get ( ) <nl> if server_terminal_event_one . kind = = _low . Event . Kind . READ_ACCEPTED : <nl> read_accepted = server_terminal_event_one <nl> rpc_accepted = server_terminal_event_two <nl> def testCancellation ( self ) : <nl> self . assertEqual ( _low . Event . Kind . FINISH , rpc_accepted . kind ) <nl> self . assertEqual ( _low . Status ( _low . Code . CANCELLED , ' ' ) , rpc_accepted . status ) <nl> <nl> - finish_event = self . client_completion_queue . get ( _FUTURE ) <nl> + finish_event = self . client_events . get ( ) <nl> self . assertEqual ( _low . Event . Kind . FINISH , finish_event . kind ) <nl> self . assertEqual ( _low . Status ( _low . Code . CANCELLED , ' Cancelled ' ) , <nl> finish_event . status ) <nl> mmm a / src / python / src / grpc / _adapter / _low_test . py <nl> ppp b / src / python / src / grpc / _adapter / _low_test . py <nl> <nl> # ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE <nl> # OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE . <nl> <nl> + import threading <nl> import time <nl> import unittest <nl> <nl> <nl> from grpc . _adapter import _low <nl> <nl> <nl> + def WaitForEvents ( completion_queues , deadline ) : <nl> + " " " <nl> + Args : <nl> + completion_queues : list of completion queues to wait for events on <nl> + deadline : absolute deadline to wait until <nl> + <nl> + Returns : <nl> + a sequence of events of length len ( completion_queues ) . <nl> + " " " <nl> + <nl> + results = [ None ] * len ( completion_queues ) <nl> + lock = threading . Lock ( ) <nl> + threads = [ ] <nl> + def set_ith_result ( i , completion_queue ) : <nl> + result = completion_queue . next ( deadline ) <nl> + with lock : <nl> + print i , completion_queue , result , time . time ( ) - deadline <nl> + results [ i ] = result <nl> + for i , completion_queue in enumerate ( completion_queues ) : <nl> + thread = threading . Thread ( target = set_ith_result , <nl> + args = [ i , completion_queue ] ) <nl> + thread . start ( ) <nl> + threads . append ( thread ) <nl> + for thread in threads : <nl> + thread . join ( ) <nl> + return results <nl> + <nl> class InsecureServerInsecureClient ( unittest . TestCase ) : <nl> <nl> def setUp ( self ) : <nl> def testEcho ( self ) : <nl> ] , client_call_tag ) <nl> self . assertEquals ( _types . CallError . OK , client_start_batch_result ) <nl> <nl> - request_event = self . server_completion_queue . next ( DEADLINE ) <nl> + client_no_event , request_event , = WaitForEvents ( [ self . client_completion_queue , self . server_completion_queue ] , time . time ( ) + 2 ) <nl> + self . assertEquals ( client_no_event , None ) <nl> self . assertEquals ( _types . EventType . OP_COMPLETE , request_event . type ) <nl> self . assertIsInstance ( request_event . call , _low . Call ) <nl> self . assertIs ( server_request_tag , request_event . tag ) <nl> def testEcho ( self ) : <nl> ] , server_call_tag ) <nl> self . assertEquals ( _types . CallError . OK , server_start_batch_result ) <nl> <nl> - client_event = self . client_completion_queue . next ( DEADLINE ) <nl> - server_event = self . server_completion_queue . next ( DEADLINE ) <nl> + client_event , server_event , = WaitForEvents ( [ self . client_completion_queue , self . server_completion_queue ] , time . time ( ) + 1 ) <nl> <nl> self . assertEquals ( 6 , len ( client_event . results ) ) <nl> found_client_op_types = set ( ) <nl> mmm a / src / ruby / spec / client_server_spec . rb <nl> ppp b / src / ruby / spec / client_server_spec . rb <nl> def new_client_call <nl> <nl> it ' servers receive requests from clients and can respond ' do <nl> call = new_client_call <nl> + server_call = nil <nl> + <nl> + server_thread = Thread . new do <nl> + server_call = server_allows_client_to_proceed <nl> + end <nl> + <nl> client_ops = { <nl> CallOps : : SEND_INITIAL_METADATA = > { } , <nl> CallOps : : SEND_MESSAGE = > sent_message <nl> def new_client_call <nl> expect ( batch_result . send_message ) . to be true <nl> <nl> # confirm the server can read the inbound message <nl> - server_call = server_allows_client_to_proceed <nl> + server_thread . join <nl> server_ops = { <nl> CallOps : : RECV_MESSAGE = > nil <nl> } <nl> def new_client_call <nl> <nl> it ' responses written by servers are received by the client ' do <nl> call = new_client_call <nl> + server_call = nil <nl> + <nl> + server_thread = Thread . new do <nl> + server_call = server_allows_client_to_proceed <nl> + end <nl> + <nl> client_ops = { <nl> CallOps : : SEND_INITIAL_METADATA = > { } , <nl> CallOps : : SEND_MESSAGE = > sent_message <nl> def new_client_call <nl> expect ( batch_result . send_message ) . to be true <nl> <nl> # confirm the server can read the inbound message <nl> - server_call = server_allows_client_to_proceed <nl> + server_thread . join <nl> server_ops = { <nl> CallOps : : RECV_MESSAGE = > nil , <nl> CallOps : : SEND_MESSAGE = > reply_text <nl> def new_client_call <nl> <nl> it ' servers can ignore a client write and send a status ' do <nl> call = new_client_call <nl> + server_call = nil <nl> + <nl> + server_thread = Thread . new do <nl> + server_call = server_allows_client_to_proceed <nl> + end <nl> + <nl> client_ops = { <nl> CallOps : : SEND_INITIAL_METADATA = > { } , <nl> CallOps : : SEND_MESSAGE = > sent_message <nl> def new_client_call <nl> <nl> # confirm the server can read the inbound message <nl> the_status = Struct : : Status . new ( StatusCodes : : OK , ' OK ' ) <nl> - server_call = server_allows_client_to_proceed <nl> + server_thread . join <nl> server_ops = { <nl> CallOps : : SEND_STATUS_FROM_SERVER = > the_status <nl> } <nl> def new_client_call <nl> <nl> it ' completes calls by sending status to client and server ' do <nl> call = new_client_call <nl> + server_call = nil <nl> + <nl> + server_thread = Thread . new do <nl> + server_call = server_allows_client_to_proceed <nl> + end <nl> + <nl> client_ops = { <nl> CallOps : : SEND_INITIAL_METADATA = > { } , <nl> CallOps : : SEND_MESSAGE = > sent_message <nl> def new_client_call <nl> <nl> # confirm the server can read the inbound message and respond <nl> the_status = Struct : : Status . new ( StatusCodes : : OK , ' OK ' , { } ) <nl> - server_call = server_allows_client_to_proceed <nl> + server_thread . join <nl> server_ops = { <nl> CallOps : : RECV_MESSAGE = > nil , <nl> CallOps : : SEND_MESSAGE = > reply_text , <nl> def new_client_call <nl> <nl> it ' sends all the metadata pairs when keys and values are valid ' do <nl> @ valid_metadata . each do | md | <nl> + recvd_rpc = nil <nl> + rcv_thread = Thread . new do <nl> + recvd_rpc = @ server . request_call ( @ server_queue , @ server_tag , deadline ) <nl> + end <nl> + <nl> call = new_client_call <nl> client_ops = { <nl> CallOps : : SEND_INITIAL_METADATA = > md <nl> def new_client_call <nl> expect ( batch_result . send_metadata ) . to be true <nl> <nl> # confirm the server can receive the client metadata <nl> - recvd_rpc = @ server . request_call ( @ server_queue , @ server_tag , deadline ) <nl> + rcv_thread . join <nl> expect ( recvd_rpc ) . to_not eq nil <nl> recvd_md = recvd_rpc . metadata <nl> replace_symbols = Hash [ md . each_pair . collect { | x , y | [ x . to_s , y ] } ] <nl> def new_client_call <nl> <nl> it ' raises an exception if a metadata key is invalid ' do <nl> @ bad_keys . each do | md | <nl> + recvd_rpc = nil <nl> + rcv_thread = Thread . new do <nl> + recvd_rpc = @ server . request_call ( @ server_queue , @ server_tag , deadline ) <nl> + end <nl> + <nl> call = new_client_call <nl> # client signals that it ' s done sending metadata to allow server to <nl> # respond <nl> def new_client_call <nl> call . run_batch ( @ client_queue , @ client_tag , deadline , client_ops ) <nl> <nl> # server gets the invocation <nl> - recvd_rpc = @ server . request_call ( @ server_queue , @ server_tag , deadline ) <nl> + rcv_thread . join <nl> expect ( recvd_rpc ) . to_not eq nil <nl> server_ops = { <nl> CallOps : : SEND_INITIAL_METADATA = > md <nl> def new_client_call <nl> end <nl> <nl> it ' sends an empty hash if no metadata is added ' do <nl> + recvd_rpc = nil <nl> + rcv_thread = Thread . new do <nl> + recvd_rpc = @ server . request_call ( @ server_queue , @ server_tag , deadline ) <nl> + end <nl> + <nl> call = new_client_call <nl> # client signals that it ' s done sending metadata to allow server to <nl> # respond <nl> def new_client_call <nl> call . run_batch ( @ client_queue , @ client_tag , deadline , client_ops ) <nl> <nl> # server gets the invocation but sends no metadata back <nl> - recvd_rpc = @ server . request_call ( @ server_queue , @ server_tag , deadline ) <nl> + rcv_thread . join <nl> expect ( recvd_rpc ) . to_not eq nil <nl> server_call = recvd_rpc . call <nl> server_ops = { <nl> def new_client_call <nl> <nl> it ' sends all the pairs when keys and values are valid ' do <nl> @ valid_metadata . each do | md | <nl> + recvd_rpc = nil <nl> + rcv_thread = Thread . new do <nl> + recvd_rpc = @ server . request_call ( @ server_queue , @ server_tag , deadline ) <nl> + end <nl> + <nl> call = new_client_call <nl> # client signals that it ' s done sending metadata to allow server to <nl> # respond <nl> def new_client_call <nl> call . run_batch ( @ client_queue , @ client_tag , deadline , client_ops ) <nl> <nl> # server gets the invocation but sends no metadata back <nl> - recvd_rpc = @ server . request_call ( @ server_queue , @ server_tag , deadline ) <nl> + rcv_thread . join <nl> expect ( recvd_rpc ) . to_not eq nil <nl> server_call = recvd_rpc . call <nl> server_ops = { <nl> mmm a / templates / Makefile . template <nl> ppp b / templates / Makefile . template <nl> CC_tsan = clang <nl> CXX_tsan = clang + + <nl> LD_tsan = clang <nl> LDXX_tsan = clang + + <nl> - CPPFLAGS_tsan = - O1 - fsanitize = thread - fno - omit - frame - pointer <nl> + CPPFLAGS_tsan = - O0 - fsanitize = thread - fno - omit - frame - pointer <nl> LDFLAGS_tsan = - fsanitize = thread <nl> DEFINES_tsan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR = 10 <nl> <nl> mmm a / test / core / end2end / cq_verifier . c <nl> ppp b / test / core / end2end / cq_verifier . c <nl> static void verify_matches ( expectation * e , grpc_event * ev ) { <nl> static void expectation_to_strvec ( gpr_strvec * buf , expectation * e ) { <nl> char * tmp ; <nl> <nl> + gpr_asprintf ( & tmp , " % p " , e - > tag ) ; <nl> + gpr_strvec_add ( buf , tmp ) ; <nl> + <nl> switch ( e - > type ) { <nl> case GRPC_OP_COMPLETE : <nl> gpr_asprintf ( & tmp , " GRPC_OP_COMPLETE result = % d " , e - > success ) ; <nl> mmm a / test / core / end2end / dualstack_socket_test . c <nl> ppp b / test / core / end2end / dualstack_socket_test . c <nl> void test_connect ( const char * server_host , const char * client_host , int port , <nl> char * server_hostport ; <nl> grpc_channel * client ; <nl> grpc_server * server ; <nl> - grpc_completion_queue * client_cq ; <nl> - grpc_completion_queue * server_cq ; <nl> + grpc_completion_queue * cq ; <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> - cq_verifier * v_client ; <nl> - cq_verifier * v_server ; <nl> + cq_verifier * cqv ; <nl> gpr_timespec deadline ; <nl> int got_port ; <nl> grpc_op ops [ 6 ] ; <nl> void test_connect ( const char * server_host , const char * client_host , int port , <nl> grpc_call_details_init ( & call_details ) ; <nl> <nl> / * Create server . * / <nl> - server_cq = grpc_completion_queue_create ( ) ; <nl> + cq = grpc_completion_queue_create ( ) ; <nl> server = grpc_server_create ( NULL ) ; <nl> - grpc_server_register_completion_queue ( server , server_cq ) ; <nl> + grpc_server_register_completion_queue ( server , cq ) ; <nl> GPR_ASSERT ( ( got_port = grpc_server_add_http2_port ( server , server_hostport ) ) > <nl> 0 ) ; <nl> if ( port = = 0 ) { <nl> void test_connect ( const char * server_host , const char * client_host , int port , <nl> GPR_ASSERT ( port = = got_port ) ; <nl> } <nl> grpc_server_start ( server ) ; <nl> - v_server = cq_verifier_create ( server_cq ) ; <nl> + cqv = cq_verifier_create ( cq ) ; <nl> <nl> / * Create client . * / <nl> gpr_join_host_port ( & client_hostport , client_host , port ) ; <nl> - client_cq = grpc_completion_queue_create ( ) ; <nl> client = grpc_channel_create ( client_hostport , NULL ) ; <nl> - v_client = cq_verifier_create ( client_cq ) ; <nl> <nl> gpr_log ( GPR_INFO , " Testing with server = % s client = % s ( expecting % s ) " , <nl> server_hostport , client_hostport , expect_ok ? " success " : " failure " ) ; <nl> void test_connect ( const char * server_host , const char * client_host , int port , <nl> } <nl> <nl> / * Send a trivial request . * / <nl> - c = grpc_channel_create_call ( client , client_cq , " / foo " , " foo . test . google . fr " , <nl> + c = grpc_channel_create_call ( client , cq , " / foo " , " foo . test . google . fr " , <nl> deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> void test_connect ( const char * server_host , const char * client_host , int port , <nl> <nl> if ( expect_ok ) { <nl> / * Check for a successful request . * / <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( server , & s , & call_details , <nl> - & request_metadata_recv , server_cq , <nl> - server_cq , tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + server , & s , & call_details , <nl> + & request_metadata_recv , cq , cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> void test_connect ( const char * server_host , const char * client_host , int port , <nl> GPR_ASSERT ( GRPC_CALL_OK = = <nl> grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_UNIMPLEMENTED ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , " xyz " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . method , " / foo " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . host , " foo . test . google . fr " ) ) ; <nl> - GPR_ASSERT ( was_cancelled = = 0 ) ; <nl> + GPR_ASSERT ( was_cancelled = = 1 ) ; <nl> <nl> grpc_call_destroy ( s ) ; <nl> } else { <nl> / * Check for a failed connection . * / <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_DEADLINE_EXCEEDED ) ; <nl> } <nl> <nl> grpc_call_destroy ( c ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> <nl> / * Destroy client . * / <nl> grpc_channel_destroy ( client ) ; <nl> - grpc_completion_queue_shutdown ( client_cq ) ; <nl> - drain_cq ( client_cq ) ; <nl> - grpc_completion_queue_destroy ( client_cq ) ; <nl> <nl> / * Destroy server . * / <nl> - grpc_server_shutdown_and_notify ( server , server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( server , cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( server ) ; <nl> - grpc_completion_queue_shutdown ( server_cq ) ; <nl> - drain_cq ( server_cq ) ; <nl> - grpc_completion_queue_destroy ( server_cq ) ; <nl> + grpc_completion_queue_shutdown ( cq ) ; <nl> + drain_cq ( cq ) ; <nl> + grpc_completion_queue_destroy ( cq ) ; <nl> <nl> grpc_call_details_destroy ( & call_details ) ; <nl> gpr_free ( details ) ; <nl> mmm a / test / core / end2end / end2end_tests . h <nl> ppp b / test / core / end2end / end2end_tests . h <nl> typedef struct grpc_end2end_test_config grpc_end2end_test_config ; <nl> # define FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS 4 <nl> <nl> struct grpc_end2end_test_fixture { <nl> - grpc_completion_queue * server_cq ; <nl> - grpc_completion_queue * client_cq ; <nl> + grpc_completion_queue * cq ; <nl> grpc_server * server ; <nl> grpc_channel * client ; <nl> void * fixture_data ; <nl> struct grpc_end2end_test_config { <nl> <nl> void grpc_end2end_tests ( grpc_end2end_test_config config ) ; <nl> <nl> - # endif / * GRPC_TEST_CORE_END2END_END2END_TESTS_H * / <nl> + # endif / * GRPC_TEST_CORE_END2END_END2END_TESTS_H * / <nl> mmm a / test / core / end2end / fixtures / chttp2_fake_security . c <nl> ppp b / test / core / end2end / fixtures / chttp2_fake_security . c <nl> static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack ( <nl> gpr_join_host_port ( & ffd - > localaddr , " localhost " , port ) ; <nl> <nl> f . fixture_data = ffd ; <nl> - f . client_cq = grpc_completion_queue_create ( ) ; <nl> - f . server_cq = grpc_completion_queue_create ( ) ; <nl> + f . cq = grpc_completion_queue_create ( ) ; <nl> <nl> return f ; <nl> } <nl> static void chttp2_init_server_secure_fullstack ( <nl> grpc_server_destroy ( f - > server ) ; <nl> } <nl> f - > server = grpc_server_create ( server_args ) ; <nl> - grpc_server_register_completion_queue ( f - > server , f - > server_cq ) ; <nl> - GPR_ASSERT ( grpc_server_add_secure_http2_port ( f - > server , ffd - > localaddr , server_creds ) ) ; <nl> + grpc_server_register_completion_queue ( f - > server , f - > cq ) ; <nl> + GPR_ASSERT ( grpc_server_add_secure_http2_port ( f - > server , ffd - > localaddr , <nl> + server_creds ) ) ; <nl> grpc_server_credentials_release ( server_creds ) ; <nl> grpc_server_start ( f - > server ) ; <nl> } <nl> mmm a / test / core / end2end / fixtures / chttp2_fullstack . c <nl> ppp b / test / core / end2end / fixtures / chttp2_fullstack . c <nl> static grpc_end2end_test_fixture chttp2_create_fixture_fullstack ( <nl> gpr_join_host_port ( & ffd - > localaddr , " localhost " , port ) ; <nl> <nl> f . fixture_data = ffd ; <nl> - f . client_cq = grpc_completion_queue_create ( ) ; <nl> - f . server_cq = grpc_completion_queue_create ( ) ; <nl> + f . cq = grpc_completion_queue_create ( ) ; <nl> <nl> return f ; <nl> } <nl> void chttp2_init_server_fullstack ( grpc_end2end_test_fixture * f , <nl> grpc_server_destroy ( f - > server ) ; <nl> } <nl> f - > server = grpc_server_create ( server_args ) ; <nl> - grpc_server_register_completion_queue ( f - > server , f - > server_cq ) ; <nl> + grpc_server_register_completion_queue ( f - > server , f - > cq ) ; <nl> GPR_ASSERT ( grpc_server_add_http2_port ( f - > server , ffd - > localaddr ) ) ; <nl> grpc_server_start ( f - > server ) ; <nl> } <nl> mmm a / test / core / end2end / fixtures / chttp2_fullstack_uds_posix . c <nl> ppp b / test / core / end2end / fixtures / chttp2_fullstack_uds_posix . c <nl> static grpc_end2end_test_fixture chttp2_create_fixture_fullstack ( <nl> unique + + ) ; <nl> <nl> f . fixture_data = ffd ; <nl> - f . client_cq = grpc_completion_queue_create ( ) ; <nl> - f . server_cq = grpc_completion_queue_create ( ) ; <nl> + f . cq = grpc_completion_queue_create ( ) ; <nl> <nl> return f ; <nl> } <nl> void chttp2_init_server_fullstack ( grpc_end2end_test_fixture * f , <nl> grpc_server_destroy ( f - > server ) ; <nl> } <nl> f - > server = grpc_server_create ( server_args ) ; <nl> - grpc_server_register_completion_queue ( f - > server , f - > server_cq ) ; <nl> + grpc_server_register_completion_queue ( f - > server , f - > cq ) ; <nl> GPR_ASSERT ( grpc_server_add_http2_port ( f - > server , ffd - > localaddr ) ) ; <nl> grpc_server_start ( f - > server ) ; <nl> } <nl> mmm a / test / core / end2end / fixtures / chttp2_fullstack_with_poll . c <nl> ppp b / test / core / end2end / fixtures / chttp2_fullstack_with_poll . c <nl> static grpc_end2end_test_fixture chttp2_create_fixture_fullstack ( <nl> gpr_join_host_port ( & ffd - > localaddr , " localhost " , port ) ; <nl> <nl> f . fixture_data = ffd ; <nl> - f . client_cq = grpc_completion_queue_create ( ) ; <nl> - f . server_cq = grpc_completion_queue_create ( ) ; <nl> + f . cq = grpc_completion_queue_create ( ) ; <nl> <nl> return f ; <nl> } <nl> void chttp2_init_server_fullstack ( grpc_end2end_test_fixture * f , <nl> grpc_server_destroy ( f - > server ) ; <nl> } <nl> f - > server = grpc_server_create ( server_args ) ; <nl> - grpc_server_register_completion_queue ( f - > server , f - > server_cq ) ; <nl> + grpc_server_register_completion_queue ( f - > server , f - > cq ) ; <nl> GPR_ASSERT ( grpc_server_add_http2_port ( f - > server , ffd - > localaddr ) ) ; <nl> grpc_server_start ( f - > server ) ; <nl> } <nl> static grpc_end2end_test_config configs [ ] = { <nl> int main ( int argc , char * * argv ) { <nl> size_t i ; <nl> <nl> + grpc_platform_become_multipoller = grpc_poll_become_multipoller ; <nl> + <nl> grpc_test_init ( argc , argv ) ; <nl> grpc_init ( ) ; <nl> <nl> mmm a / test / core / end2end / fixtures / chttp2_simple_ssl_fullstack . c <nl> ppp b / test / core / end2end / fixtures / chttp2_simple_ssl_fullstack . c <nl> static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack ( <nl> gpr_join_host_port ( & ffd - > localaddr , " localhost " , port ) ; <nl> <nl> f . fixture_data = ffd ; <nl> - f . client_cq = grpc_completion_queue_create ( ) ; <nl> - f . server_cq = grpc_completion_queue_create ( ) ; <nl> + f . cq = grpc_completion_queue_create ( ) ; <nl> <nl> return f ; <nl> } <nl> static void chttp2_init_server_secure_fullstack ( <nl> grpc_server_destroy ( f - > server ) ; <nl> } <nl> f - > server = grpc_server_create ( server_args ) ; <nl> - grpc_server_register_completion_queue ( f - > server , f - > server_cq ) ; <nl> - GPR_ASSERT ( grpc_server_add_secure_http2_port ( f - > server , ffd - > localaddr , server_creds ) ) ; <nl> + grpc_server_register_completion_queue ( f - > server , f - > cq ) ; <nl> + GPR_ASSERT ( grpc_server_add_secure_http2_port ( f - > server , ffd - > localaddr , <nl> + server_creds ) ) ; <nl> grpc_server_credentials_release ( server_creds ) ; <nl> grpc_server_start ( f - > server ) ; <nl> } <nl> mmm a / test / core / end2end / fixtures / chttp2_simple_ssl_fullstack_with_poll . c <nl> ppp b / test / core / end2end / fixtures / chttp2_simple_ssl_fullstack_with_poll . c <nl> static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack ( <nl> gpr_join_host_port ( & ffd - > localaddr , " localhost " , port ) ; <nl> <nl> f . fixture_data = ffd ; <nl> - f . client_cq = grpc_completion_queue_create ( ) ; <nl> - f . server_cq = grpc_completion_queue_create ( ) ; <nl> + f . cq = grpc_completion_queue_create ( ) ; <nl> <nl> return f ; <nl> } <nl> static void chttp2_init_server_secure_fullstack ( <nl> grpc_server_destroy ( f - > server ) ; <nl> } <nl> f - > server = grpc_server_create ( server_args ) ; <nl> - grpc_server_register_completion_queue ( f - > server , f - > server_cq ) ; <nl> + grpc_server_register_completion_queue ( f - > server , f - > cq ) ; <nl> GPR_ASSERT ( grpc_server_add_secure_http2_port ( f - > server , ffd - > localaddr , <nl> server_creds ) ) ; <nl> grpc_server_credentials_release ( server_creds ) ; <nl> mmm a / test / core / end2end / fixtures / chttp2_simple_ssl_with_oauth2_fullstack . c <nl> ppp b / test / core / end2end / fixtures / chttp2_simple_ssl_with_oauth2_fullstack . c <nl> static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack ( <nl> gpr_join_host_port ( & ffd - > localaddr , " localhost " , port ) ; <nl> <nl> f . fixture_data = ffd ; <nl> - f . client_cq = grpc_completion_queue_create ( ) ; <nl> - f . server_cq = grpc_completion_queue_create ( ) ; <nl> + f . cq = grpc_completion_queue_create ( ) ; <nl> <nl> return f ; <nl> } <nl> static void chttp2_init_server_secure_fullstack ( <nl> grpc_server_destroy ( f - > server ) ; <nl> } <nl> f - > server = grpc_server_create ( server_args ) ; <nl> - grpc_server_register_completion_queue ( f - > server , f - > server_cq ) ; <nl> - GPR_ASSERT ( grpc_server_add_secure_http2_port ( f - > server , ffd - > localaddr , server_creds ) ) ; <nl> + grpc_server_register_completion_queue ( f - > server , f - > cq ) ; <nl> + GPR_ASSERT ( grpc_server_add_secure_http2_port ( f - > server , ffd - > localaddr , <nl> + server_creds ) ) ; <nl> grpc_server_credentials_release ( server_creds ) ; <nl> grpc_server_start ( f - > server ) ; <nl> } <nl> mmm a / test / core / end2end / fixtures / chttp2_socket_pair . c <nl> ppp b / test / core / end2end / fixtures / chttp2_socket_pair . c <nl> static grpc_end2end_test_fixture chttp2_create_fixture_socketpair ( <nl> grpc_end2end_test_fixture f ; <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> f . fixture_data = sfd ; <nl> - f . client_cq = grpc_completion_queue_create ( ) ; <nl> - f . server_cq = grpc_completion_queue_create ( ) ; <nl> + f . cq = grpc_completion_queue_create ( ) ; <nl> <nl> * sfd = grpc_iomgr_create_endpoint_pair ( " fixture " , 65536 ) ; <nl> <nl> static void chttp2_init_server_socketpair ( grpc_end2end_test_fixture * f , <nl> grpc_endpoint_pair * sfd = f - > fixture_data ; <nl> GPR_ASSERT ( ! f - > server ) ; <nl> f - > server = grpc_server_create_from_filters ( NULL , 0 , server_args ) ; <nl> - grpc_server_register_completion_queue ( f - > server , f - > server_cq ) ; <nl> + grpc_server_register_completion_queue ( f - > server , f - > cq ) ; <nl> grpc_server_start ( f - > server ) ; <nl> grpc_create_chttp2_transport ( server_setup_transport , f , server_args , <nl> sfd - > server , NULL , 0 , grpc_mdctx_create ( ) , 0 ) ; <nl> mmm a / test / core / end2end / fixtures / chttp2_socket_pair_one_byte_at_a_time . c <nl> ppp b / test / core / end2end / fixtures / chttp2_socket_pair_one_byte_at_a_time . c <nl> static grpc_end2end_test_fixture chttp2_create_fixture_socketpair ( <nl> grpc_end2end_test_fixture f ; <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> f . fixture_data = sfd ; <nl> - f . client_cq = grpc_completion_queue_create ( ) ; <nl> - f . server_cq = grpc_completion_queue_create ( ) ; <nl> + f . cq = grpc_completion_queue_create ( ) ; <nl> <nl> * sfd = grpc_iomgr_create_endpoint_pair ( " fixture " , 1 ) ; <nl> <nl> static void chttp2_init_server_socketpair ( grpc_end2end_test_fixture * f , <nl> grpc_endpoint_pair * sfd = f - > fixture_data ; <nl> GPR_ASSERT ( ! f - > server ) ; <nl> f - > server = grpc_server_create_from_filters ( NULL , 0 , server_args ) ; <nl> - grpc_server_register_completion_queue ( f - > server , f - > server_cq ) ; <nl> + grpc_server_register_completion_queue ( f - > server , f - > cq ) ; <nl> grpc_server_start ( f - > server ) ; <nl> grpc_create_chttp2_transport ( server_setup_transport , f , server_args , <nl> sfd - > server , NULL , 0 , grpc_mdctx_create ( ) , 0 ) ; <nl> mmm a / test / core / end2end / fixtures / chttp2_socket_pair_with_grpc_trace . c <nl> ppp b / test / core / end2end / fixtures / chttp2_socket_pair_with_grpc_trace . c <nl> static grpc_end2end_test_fixture chttp2_create_fixture_socketpair ( <nl> grpc_end2end_test_fixture f ; <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> f . fixture_data = sfd ; <nl> - f . client_cq = grpc_completion_queue_create ( ) ; <nl> - f . server_cq = grpc_completion_queue_create ( ) ; <nl> + f . cq = grpc_completion_queue_create ( ) ; <nl> <nl> * sfd = grpc_iomgr_create_endpoint_pair ( " fixture " , 65536 ) ; <nl> <nl> static void chttp2_init_server_socketpair ( grpc_end2end_test_fixture * f , <nl> grpc_endpoint_pair * sfd = f - > fixture_data ; <nl> GPR_ASSERT ( ! f - > server ) ; <nl> f - > server = grpc_server_create_from_filters ( NULL , 0 , server_args ) ; <nl> - grpc_server_register_completion_queue ( f - > server , f - > server_cq ) ; <nl> + grpc_server_register_completion_queue ( f - > server , f - > cq ) ; <nl> grpc_server_start ( f - > server ) ; <nl> grpc_create_chttp2_transport ( server_setup_transport , f , server_args , <nl> sfd - > server , NULL , 0 , grpc_mdctx_create ( ) , 0 ) ; <nl> mmm a / test / core / end2end / gen_build_json . py <nl> ppp b / test / core / end2end / gen_build_json . py <nl> <nl> # maps test names to options <nl> END2END_TESTS = { <nl> ' bad_hostname ' : default_test_options , <nl> - ' cancel_after_accept ' : TestOptions ( flaky = True , secure = False ) , <nl> + ' cancel_after_accept ' : default_test_options , <nl> ' cancel_after_accept_and_writes_closed ' : default_test_options , <nl> ' cancel_after_invoke ' : default_test_options , <nl> ' cancel_before_invoke ' : default_test_options , <nl> <nl> ' early_server_shutdown_finishes_tags ' : default_test_options , <nl> ' empty_batch ' : default_test_options , <nl> ' graceful_server_shutdown ' : default_test_options , <nl> - ' invoke_large_request ' : TestOptions ( flaky = True , secure = False ) , <nl> + ' invoke_large_request ' : default_test_options , <nl> ' max_concurrent_streams ' : default_test_options , <nl> ' max_message_length ' : default_test_options , <nl> ' no_op ' : default_test_options , <nl> mmm a / test / core / end2end / tests / bad_hostname . c <nl> ppp b / test / core / end2end / tests / bad_hostname . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> grpc_call * c ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> char * details = NULL ; <nl> size_t details_capacity = 0 ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " slartibartfast . local " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " slartibartfast . local " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> grpc_metadata_array_init ( & initial_metadata_recv ) ; <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_UNAUTHENTICATED ) ; <nl> <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> <nl> grpc_call_destroy ( c ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> } <nl> <nl> static void test_invoke_simple_request ( grpc_end2end_test_config config ) { <nl> mmm a / test / core / end2end / tests / cancel_after_accept . c <nl> ppp b / test / core / end2end / tests / cancel_after_accept . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> / * Cancel after accept , no payload * / <nl> static void test_cancel_after_accept ( grpc_end2end_test_config config , <nl> grpc_op * op ; <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> - grpc_end2end_test_fixture f = begin_test ( config , " cancel_after_accept " , NULL , NULL ) ; <nl> + grpc_end2end_test_fixture f = <nl> + begin_test ( config , " cancel_after_accept " , NULL , NULL ) ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> grpc_metadata_array trailing_metadata_recv ; <nl> grpc_metadata_array request_metadata_recv ; <nl> static void test_cancel_after_accept ( grpc_end2end_test_config config , <nl> grpc_raw_byte_buffer_create ( & response_payload_slice , 1 ) ; <nl> int was_cancelled = 2 ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> grpc_metadata_array_init ( & initial_metadata_recv ) ; <nl> static void test_cancel_after_accept ( grpc_end2end_test_config config , <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 2 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 2 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 2 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 2 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_RECV_MESSAGE ; <nl> static void test_cancel_after_accept ( grpc_end2end_test_config config , <nl> <nl> GPR_ASSERT ( GRPC_CALL_OK = = mode . initiate_cancel ( c ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 3 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 3 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = mode . expect_status ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , mode . expect_details ) ) ; <nl> static void test_cancel_after_accept ( grpc_end2end_test_config config , <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> end_test ( & f ) ; <nl> config . tear_down_data ( & f ) ; <nl> } <nl> mmm a / test / core / end2end / tests / cancel_after_accept_and_writes_closed . c <nl> ppp b / test / core / end2end / tests / cancel_after_accept_and_writes_closed . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> / * Cancel after accept with a writes closed , no payload * / <nl> static void test_cancel_after_accept_and_writes_closed ( <nl> grpc_op * op ; <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> - grpc_end2end_test_fixture f = begin_test ( config , " test_cancel_after_accept_and_writes_closed " , NULL , NULL ) ; <nl> + grpc_end2end_test_fixture f = begin_test ( <nl> + config , " test_cancel_after_accept_and_writes_closed " , NULL , NULL ) ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> grpc_metadata_array trailing_metadata_recv ; <nl> grpc_metadata_array request_metadata_recv ; <nl> static void test_cancel_after_accept_and_writes_closed ( <nl> grpc_raw_byte_buffer_create ( & response_payload_slice , 1 ) ; <nl> int was_cancelled = 2 ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> grpc_metadata_array_init ( & initial_metadata_recv ) ; <nl> static void test_cancel_after_accept_and_writes_closed ( <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 2 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 2 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 2 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 2 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_RECV_MESSAGE ; <nl> static void test_cancel_after_accept_and_writes_closed ( <nl> <nl> GPR_ASSERT ( GRPC_CALL_OK = = mode . initiate_cancel ( c ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 3 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 3 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = mode . expect_status ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , mode . expect_details ) ) ; <nl> static void test_cancel_after_accept_and_writes_closed ( <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> end_test ( & f ) ; <nl> config . tear_down_data ( & f ) ; <nl> } <nl> mmm a / test / core / end2end / tests / cancel_after_invoke . c <nl> ppp b / test / core / end2end / tests / cancel_after_invoke . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> / * Cancel after invoke , no payload * / <nl> static void test_cancel_after_invoke ( grpc_end2end_test_config config , <nl> grpc_end2end_test_fixture f = <nl> begin_test ( config , " test_cancel_after_invoke " , mode , NULL , NULL ) ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> grpc_metadata_array trailing_metadata_recv ; <nl> grpc_metadata_array request_metadata_recv ; <nl> static void test_cancel_after_invoke ( grpc_end2end_test_config config , <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> grpc_metadata_array_init ( & initial_metadata_recv ) ; <nl> static void test_cancel_after_invoke ( grpc_end2end_test_config config , <nl> <nl> GPR_ASSERT ( GRPC_CALL_OK = = mode . initiate_cancel ( c ) ) ; <nl> <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = mode . expect_status ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , mode . expect_details ) ) ; <nl> static void test_cancel_after_invoke ( grpc_end2end_test_config config , <nl> <nl> grpc_call_destroy ( c ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> end_test ( & f ) ; <nl> config . tear_down_data ( & f ) ; <nl> } <nl> mmm a / test / core / end2end / tests / cancel_before_invoke . c <nl> ppp b / test / core / end2end / tests / cancel_before_invoke . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> / * Cancel before invoke * / <nl> static void test_cancel_before_invoke ( grpc_end2end_test_config config , <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_call * c ; <nl> - grpc_end2end_test_fixture f = begin_test ( config , " cancel_before_invoke " , NULL , NULL ) ; <nl> + grpc_end2end_test_fixture f = <nl> + begin_test ( config , " cancel_before_invoke " , NULL , NULL ) ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> grpc_metadata_array trailing_metadata_recv ; <nl> grpc_metadata_array request_metadata_recv ; <nl> static void test_cancel_before_invoke ( grpc_end2end_test_config config , <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_cancel ( c ) ) ; <nl> static void test_cancel_before_invoke ( grpc_end2end_test_config config , <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , test_ops , tag ( 1 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_CANCELLED ) ; <nl> <nl> static void test_cancel_before_invoke ( grpc_end2end_test_config config , <nl> <nl> grpc_call_destroy ( c ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> end_test ( & f ) ; <nl> config . tear_down_data ( & f ) ; <nl> } <nl> mmm a / test / core / end2end / tests / cancel_in_a_vacuum . c <nl> ppp b / test / core / end2end / tests / cancel_in_a_vacuum . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> / * Cancel and do nothing * / <nl> static void test_cancel_in_a_vacuum ( grpc_end2end_test_config config , <nl> cancellation_mode mode ) { <nl> grpc_call * c ; <nl> - grpc_end2end_test_fixture f = begin_test ( config , " test_cancel_in_a_vacuum " , NULL , NULL ) ; <nl> + grpc_end2end_test_fixture f = <nl> + begin_test ( config , " test_cancel_in_a_vacuum " , NULL , NULL ) ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> + cq_verifier * v_client = cq_verifier_create ( f . cq ) ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> GPR_ASSERT ( GRPC_CALL_OK = = mode . initiate_cancel ( c ) ) ; <nl> mmm a / test / core / end2end / tests / census_simple_request . c <nl> ppp b / test / core / end2end / tests / census_simple_request . c <nl> static void * tag ( gpr_intptr t ) { return ( void * ) t ; } <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static void test_body ( grpc_end2end_test_fixture f ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> gpr_timespec deadline = n_seconds_time ( 5 ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void test_body ( grpc_end2end_test_fixture f ) { <nl> size_t details_capacity = 0 ; <nl> int was_cancelled = 2 ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , <nl> " foo . test . google . fr : 1234 " , deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> static void test_body ( grpc_end2end_test_fixture f ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void test_body ( grpc_end2end_test_fixture f ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_UNIMPLEMENTED ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , " xyz " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . method , " / foo " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . host , " foo . test . google . fr : 1234 " ) ) ; <nl> - GPR_ASSERT ( was_cancelled = = 0 ) ; <nl> + GPR_ASSERT ( was_cancelled = = 1 ) ; <nl> <nl> gpr_free ( details ) ; <nl> grpc_metadata_array_destroy ( & initial_metadata_recv ) ; <nl> static void test_body ( grpc_end2end_test_fixture f ) { <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> } <nl> <nl> static void test_invoke_request_with_census ( <nl> mmm a / test / core / end2end / tests / disappearing_server . c <nl> ppp b / test / core / end2end / tests / disappearing_server . c <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static void do_request_and_shutdown_server ( grpc_end2end_test_fixture * f , <nl> - cq_verifier * v_client , <nl> - cq_verifier * v_server ) { <nl> + cq_verifier * cqv ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> static void do_request_and_shutdown_server ( grpc_end2end_test_fixture * f , <nl> size_t details_capacity = 0 ; <nl> int was_cancelled = 2 ; <nl> <nl> - c = grpc_channel_create_call ( f - > client , f - > client_cq , " / foo " , <nl> + c = grpc_channel_create_call ( f - > client , f - > cq , " / foo " , <nl> " foo . test . google . fr : 1234 " , deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> static void do_request_and_shutdown_server ( grpc_end2end_test_fixture * f , <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f - > server , & s , & call_details , <nl> - & request_metadata_recv , f - > server_cq , <nl> - f - > server_cq , tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( f - > server , & s , <nl> + & call_details , <nl> + & request_metadata_recv , <nl> + f - > cq , f - > cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> / * should be able to shut down the server early <nl> - and still complete the request * / <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void do_request_and_shutdown_server ( grpc_end2end_test_fixture * f , <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_expect_completion ( v_server , tag ( 1000 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1000 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_UNIMPLEMENTED ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , " xyz " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . method , " / foo " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . host , " foo . test . google . fr : 1234 " ) ) ; <nl> - GPR_ASSERT ( was_cancelled = = 0 ) ; <nl> + GPR_ASSERT ( was_cancelled = = 1 ) ; <nl> <nl> gpr_free ( details ) ; <nl> grpc_metadata_array_destroy ( & initial_metadata_recv ) ; <nl> static void do_request_and_shutdown_server ( grpc_end2end_test_fixture * f , <nl> <nl> static void disappearing_server_test ( grpc_end2end_test_config config ) { <nl> grpc_end2end_test_fixture f = config . create_fixture ( NULL , NULL ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> <nl> gpr_log ( GPR_INFO , " % s / % s " , " disappearing_server_test " , config . name ) ; <nl> <nl> config . init_client ( & f , NULL ) ; <nl> config . init_server ( & f , NULL ) ; <nl> <nl> - do_request_and_shutdown_server ( & f , v_client , v_server ) ; <nl> + do_request_and_shutdown_server ( & f , cqv ) ; <nl> <nl> / * now destroy and recreate the server * / <nl> config . init_server ( & f , NULL ) ; <nl> <nl> - do_request_and_shutdown_server ( & f , v_client , v_server ) ; <nl> + do_request_and_shutdown_server ( & f , cqv ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> <nl> end_test ( & f ) ; <nl> config . tear_down_data ( & f ) ; <nl> mmm a / test / core / end2end / tests / early_server_shutdown_finishes_inflight_calls . c <nl> ppp b / test / core / end2end / tests / early_server_shutdown_finishes_inflight_calls . c <nl> static void shutdown_client ( grpc_end2end_test_fixture * f ) { <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static void test_early_server_shutdown_finishes_inflight_calls ( <nl> static void test_early_server_shutdown_finishes_inflight_calls ( <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - grpc_end2end_test_fixture f = begin_test ( config , " test_early_server_shutdown_finishes_inflight_calls " , NULL , NULL ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + grpc_end2end_test_fixture f = begin_test ( <nl> + config , " test_early_server_shutdown_finishes_inflight_calls " , NULL , NULL ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void test_early_server_shutdown_finishes_inflight_calls ( <nl> size_t details_capacity = 0 ; <nl> int was_cancelled = 2 ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> grpc_metadata_array_init ( & initial_metadata_recv ) ; <nl> static void test_early_server_shutdown_finishes_inflight_calls ( <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_RECV_CLOSE_ON_SERVER ; <nl> static void test_early_server_shutdown_finishes_inflight_calls ( <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> / * shutdown and destroy the server * / <nl> - grpc_server_shutdown_and_notify ( f . server , f . server_cq , tag ( 1000 ) ) ; <nl> + grpc_server_shutdown_and_notify ( f . server , f . cq , tag ( 1000 ) ) ; <nl> grpc_server_cancel_all_calls ( f . server ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_expect_completion ( v_server , tag ( 1000 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + cq_expect_completion ( cqv , tag ( 1000 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> grpc_server_destroy ( f . server ) ; <nl> <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> - <nl> GPR_ASSERT ( status = = GRPC_STATUS_UNAVAILABLE ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . method , " / foo " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . host , " foo . test . google . fr " ) ) ; <nl> static void test_early_server_shutdown_finishes_inflight_calls ( <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> <nl> end_test ( & f ) ; <nl> config . tear_down_data ( & f ) ; <nl> mmm a / test / core / end2end / tests / early_server_shutdown_finishes_tags . c <nl> ppp b / test / core / end2end / tests / early_server_shutdown_finishes_tags . c <nl> static void shutdown_client ( grpc_end2end_test_fixture * f ) { <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static void test_early_server_shutdown_finishes_tags ( <nl> grpc_end2end_test_config config ) { <nl> - grpc_end2end_test_fixture f = begin_test ( config , " test_early_server_shutdown_finishes_tags " , NULL , NULL ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + grpc_end2end_test_fixture f = begin_test ( <nl> + config , " test_early_server_shutdown_finishes_tags " , NULL , NULL ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_call * s = ( void * ) 1 ; <nl> grpc_call_details call_details ; <nl> grpc_metadata_array request_metadata_recv ; <nl> static void test_early_server_shutdown_finishes_tags ( <nl> <nl> / * upon shutdown , the server should finish all requested calls indicating <nl> no new call * / <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 101 ) ) ) ; <nl> - grpc_server_shutdown_and_notify ( f . server , f . server_cq , tag ( 1000 ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 0 ) ; <nl> - cq_expect_completion ( v_server , tag ( 1000 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> + grpc_server_shutdown_and_notify ( f . server , f . cq , tag ( 1000 ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 0 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1000 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> GPR_ASSERT ( s = = NULL ) ; <nl> <nl> grpc_server_destroy ( f . server ) ; <nl> <nl> end_test ( & f ) ; <nl> config . tear_down_data ( & f ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> } <nl> <nl> void grpc_end2end_tests ( grpc_end2end_test_config config ) { <nl> mmm a / test / core / end2end / tests / empty_batch . c <nl> ppp b / test / core / end2end / tests / empty_batch . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static void empty_batch_body ( grpc_end2end_test_fixture f ) { <nl> grpc_call * c ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op * op = NULL ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , op , 0 , tag ( 1 ) ) ) ; <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> grpc_call_destroy ( c ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> } <nl> <nl> static void test_invoke_empty_body ( grpc_end2end_test_config config ) { <nl> mmm a / test / core / end2end / tests / graceful_server_shutdown . c <nl> ppp b / test / core / end2end / tests / graceful_server_shutdown . c <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static void test_early_server_shutdown_finishes_inflight_calls ( <nl> static void test_early_server_shutdown_finishes_inflight_calls ( <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - grpc_end2end_test_fixture f = begin_test ( config , " test_early_server_shutdown_finishes_inflight_calls " , NULL , NULL ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + grpc_end2end_test_fixture f = begin_test ( <nl> + config , " test_early_server_shutdown_finishes_inflight_calls " , NULL , NULL ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void test_early_server_shutdown_finishes_inflight_calls ( <nl> size_t details_capacity = 0 ; <nl> int was_cancelled = 2 ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> grpc_metadata_array_init ( & initial_metadata_recv ) ; <nl> static void test_early_server_shutdown_finishes_inflight_calls ( <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> / * shutdown and destroy the server * / <nl> - grpc_server_shutdown_and_notify ( f . server , f . server_cq , tag ( 0xdead ) ) ; <nl> - cq_verify_empty ( v_server ) ; <nl> + grpc_server_shutdown_and_notify ( f . server , f . cq , tag ( 0xdead ) ) ; <nl> + cq_verify_empty ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void test_early_server_shutdown_finishes_inflight_calls ( <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_expect_completion ( v_server , tag ( 0xdead ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 0xdead ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> - <nl> GPR_ASSERT ( status = = GRPC_STATUS_UNIMPLEMENTED ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . method , " / foo " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . host , " foo . test . google . fr " ) ) ; <nl> - GPR_ASSERT ( was_cancelled = = 0 ) ; <nl> + GPR_ASSERT ( was_cancelled = = 1 ) ; <nl> <nl> gpr_free ( details ) ; <nl> grpc_metadata_array_destroy ( & initial_metadata_recv ) ; <nl> static void test_early_server_shutdown_finishes_inflight_calls ( <nl> <nl> grpc_call_destroy ( c ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> <nl> end_test ( & f ) ; <nl> config . tear_down_data ( & f ) ; <nl> mmm a / test / core / end2end / tests / invoke_large_request . c <nl> ppp b / test / core / end2end / tests / invoke_large_request . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static gpr_slice large_slice ( void ) { <nl> static gpr_slice large_slice ( void ) { <nl> } <nl> <nl> static void test_invoke_large_request ( grpc_end2end_test_config config ) { <nl> - grpc_end2end_test_fixture f = begin_test ( config , " test_invoke_large_request " , NULL , NULL ) ; <nl> + grpc_end2end_test_fixture f = <nl> + begin_test ( config , " test_invoke_large_request " , NULL , NULL ) ; <nl> <nl> gpr_slice request_payload_slice = large_slice ( ) ; <nl> gpr_slice response_payload_slice = large_slice ( ) ; <nl> static void test_invoke_large_request ( grpc_end2end_test_config config ) { <nl> grpc_byte_buffer * response_payload = <nl> grpc_raw_byte_buffer_create ( & response_payload_slice , 1 ) ; <nl> gpr_timespec deadline = n_seconds_time ( 30 ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void test_invoke_large_request ( grpc_end2end_test_config config ) { <nl> size_t details_capacity = 0 ; <nl> int was_cancelled = 2 ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> grpc_metadata_array_init ( & initial_metadata_recv ) ; <nl> static void test_invoke_large_request ( grpc_end2end_test_config config ) { <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> op - > data . send_initial_metadata . count = 0 ; <nl> + op - > flags = 0 ; <nl> op + + ; <nl> op - > op = GRPC_OP_SEND_MESSAGE ; <nl> op - > data . send_message = request_payload ; <nl> + op - > flags = 0 ; <nl> op + + ; <nl> op - > op = GRPC_OP_SEND_CLOSE_FROM_CLIENT ; <nl> + op - > flags = 0 ; <nl> op + + ; <nl> op - > op = GRPC_OP_RECV_INITIAL_METADATA ; <nl> op - > data . recv_initial_metadata = & initial_metadata_recv ; <nl> + op - > flags = 0 ; <nl> op + + ; <nl> op - > op = GRPC_OP_RECV_MESSAGE ; <nl> op - > data . recv_message = & response_payload_recv ; <nl> + op - > flags = 0 ; <nl> op + + ; <nl> op - > op = GRPC_OP_RECV_STATUS_ON_CLIENT ; <nl> op - > data . recv_status_on_client . trailing_metadata = & trailing_metadata_recv ; <nl> op - > data . recv_status_on_client . status = & status ; <nl> op - > data . recv_status_on_client . status_details = & details ; <nl> op - > data . recv_status_on_client . status_details_capacity = & details_capacity ; <nl> + op - > flags = 0 ; <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> op - > data . send_initial_metadata . count = 0 ; <nl> + op - > flags = 0 ; <nl> op + + ; <nl> op - > op = GRPC_OP_RECV_MESSAGE ; <nl> op - > data . recv_message = & request_payload_recv ; <nl> + op - > flags = 0 ; <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_RECV_CLOSE_ON_SERVER ; <nl> op - > data . recv_close_on_server . cancelled = & was_cancelled ; <nl> + op - > flags = 0 ; <nl> op + + ; <nl> op - > op = GRPC_OP_SEND_MESSAGE ; <nl> op - > data . send_message = response_payload ; <nl> + op - > flags = 0 ; <nl> op + + ; <nl> - op = ops ; <nl> op - > op = GRPC_OP_SEND_STATUS_FROM_SERVER ; <nl> op - > data . send_status_from_server . trailing_metadata_count = 0 ; <nl> op - > data . send_status_from_server . status = GRPC_STATUS_UNIMPLEMENTED ; <nl> op - > data . send_status_from_server . status_details = " xyz " ; <nl> + op - > flags = 0 ; <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 103 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 103 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 103 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_UNIMPLEMENTED ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , " xyz " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . method , " / foo " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . host , " foo . test . google . fr " ) ) ; <nl> - GPR_ASSERT ( was_cancelled = = 0 ) ; <nl> + GPR_ASSERT ( was_cancelled = = 1 ) ; <nl> <nl> gpr_free ( details ) ; <nl> grpc_metadata_array_destroy ( & initial_metadata_recv ) ; <nl> static void test_invoke_large_request ( grpc_end2end_test_config config ) { <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> <nl> grpc_byte_buffer_destroy ( request_payload ) ; <nl> grpc_byte_buffer_destroy ( response_payload ) ; <nl> mmm a / test / core / end2end / tests / max_concurrent_streams . c <nl> ppp b / test / core / end2end / tests / max_concurrent_streams . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> size_t details_capacity = 0 ; <nl> int was_cancelled = 2 ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , <nl> " foo . test . google . fr : 1234 " , deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_UNIMPLEMENTED ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , " xyz " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . method , " / foo " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . host , " foo . test . google . fr : 1234 " ) ) ; <nl> - GPR_ASSERT ( was_cancelled = = 0 ) ; <nl> + GPR_ASSERT ( was_cancelled = = 1 ) ; <nl> <nl> gpr_free ( details ) ; <nl> grpc_metadata_array_destroy ( & initial_metadata_recv ) ; <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> } <nl> <nl> static void test_max_concurrent_streams ( grpc_end2end_test_config config ) { <nl> static void test_max_concurrent_streams ( grpc_end2end_test_config config ) { <nl> grpc_call * s2 ; <nl> int live_call ; <nl> gpr_timespec deadline ; <nl> - cq_verifier * v_client ; <nl> - cq_verifier * v_server ; <nl> + cq_verifier * cqv ; <nl> grpc_event ev ; <nl> grpc_call_details call_details ; <nl> grpc_metadata_array request_metadata_recv ; <nl> static void test_max_concurrent_streams ( grpc_end2end_test_config config ) { <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> int was_cancelled ; <nl> + int got_client_start ; <nl> + int got_server_start ; <nl> <nl> server_arg . key = GRPC_ARG_MAX_CONCURRENT_STREAMS ; <nl> server_arg . type = GRPC_ARG_INTEGER ; <nl> static void test_max_concurrent_streams ( grpc_end2end_test_config config ) { <nl> server_args . args = & server_arg ; <nl> <nl> f = begin_test ( config , " test_max_concurrent_streams " , NULL , & server_args ) ; <nl> - v_client = cq_verifier_create ( f . client_cq ) ; <nl> - v_server = cq_verifier_create ( f . server_cq ) ; <nl> + cqv = cq_verifier_create ( f . cq ) ; <nl> <nl> grpc_metadata_array_init ( & request_metadata_recv ) ; <nl> grpc_metadata_array_init ( & initial_metadata_recv1 ) ; <nl> static void test_max_concurrent_streams ( grpc_end2end_test_config config ) { <nl> <nl> / * start two requests - ensuring that the second is not accepted until <nl> the first completes * / <nl> - deadline = n_seconds_time ( 10 ) ; <nl> - c1 = grpc_channel_create_call ( f . client , f . client_cq , " / alpha " , <nl> + deadline = n_seconds_time ( 1000 ) ; <nl> + c1 = grpc_channel_create_call ( f . client , f . cq , " / alpha " , <nl> " foo . test . google . fr : 1234 " , deadline ) ; <nl> GPR_ASSERT ( c1 ) ; <nl> - c2 = grpc_channel_create_call ( f . client , f . client_cq , " / beta " , <nl> + c2 = grpc_channel_create_call ( f . client , f . cq , " / beta " , <nl> " foo . test . google . fr : 1234 " , deadline ) ; <nl> GPR_ASSERT ( c2 ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s1 , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 101 ) ) ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s1 , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void test_max_concurrent_streams ( grpc_end2end_test_config config ) { <nl> GPR_ASSERT ( GRPC_CALL_OK = = <nl> grpc_call_start_batch ( c2 , ops , op - ops , tag ( 402 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - ev = grpc_completion_queue_next ( f . client_cq , <nl> - GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 3 ) ) ; <nl> - GPR_ASSERT ( ev . type = = GRPC_OP_COMPLETE ) ; <nl> - GPR_ASSERT ( ev . success ) ; <nl> - GPR_ASSERT ( ev . tag = = tag ( 301 ) | | ev . tag = = tag ( 401 ) ) ; <nl> - / * The / alpha or / beta calls started above could be invoked ( but NOT both ) ; <nl> - * check this here * / <nl> - / * We ' ll get tag 303 or 403 , we want 300 , 400 * / <nl> - live_call = ( ( int ) ( gpr_intptr ) ev . tag ) - 1 ; <nl> + got_client_start = 0 ; <nl> + got_server_start = 0 ; <nl> + live_call = - 1 ; <nl> + while ( ! got_client_start | | ! got_server_start ) { <nl> + ev = grpc_completion_queue_next ( f . cq , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 3 ) ) ; <nl> + GPR_ASSERT ( ev . type = = GRPC_OP_COMPLETE ) ; <nl> + GPR_ASSERT ( ev . success ) ; <nl> + if ( ev . tag = = tag ( 101 ) ) { <nl> + GPR_ASSERT ( ! got_server_start ) ; <nl> + got_server_start = 1 ; <nl> + } else { <nl> + GPR_ASSERT ( ! got_client_start ) ; <nl> + GPR_ASSERT ( ev . tag = = tag ( 301 ) | | ev . tag = = tag ( 401 ) ) ; <nl> + / * The / alpha or / beta calls started above could be invoked ( but NOT <nl> + * both ) ; <nl> + * check this here * / <nl> + / * We ' ll get tag 303 or 403 , we want 300 , 400 * / <nl> + live_call = ( ( int ) ( gpr_intptr ) ev . tag ) - 1 ; <nl> + got_client_start = 1 ; <nl> + } <nl> + } <nl> + GPR_ASSERT ( live_call = = 300 | | live_call = = 400 ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void test_max_concurrent_streams ( grpc_end2end_test_config config ) { <nl> GPR_ASSERT ( GRPC_CALL_OK = = <nl> grpc_call_start_batch ( s1 , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( live_call + 2 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( live_call + 2 ) , 1 ) ; <nl> / * first request is finished , we should be able to start the second * / <nl> live_call = ( live_call = = 300 ) ? 400 : 300 ; <nl> - cq_expect_completion ( v_client , tag ( live_call + 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( live_call + 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s2 , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 201 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 201 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s2 , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 201 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 201 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void test_max_concurrent_streams ( grpc_end2end_test_config config ) { <nl> GPR_ASSERT ( GRPC_CALL_OK = = <nl> grpc_call_start_batch ( s2 , ops , op - ops , tag ( 202 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_client , tag ( live_call + 2 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> - <nl> - cq_expect_completion ( v_server , tag ( 202 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + cq_expect_completion ( cqv , tag ( live_call + 2 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 202 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> <nl> grpc_call_destroy ( c1 ) ; <nl> grpc_call_destroy ( s1 ) ; <nl> mmm a / test / core / end2end / tests / max_message_length . c <nl> ppp b / test / core / end2end / tests / max_message_length . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static void test_max_message_length ( grpc_end2end_test_config config ) { <nl> static void test_max_message_length ( grpc_end2end_test_config config ) { <nl> grpc_channel_args server_args ; <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> - cq_verifier * v_client ; <nl> - cq_verifier * v_server ; <nl> + cq_verifier * cqv ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> static void test_max_message_length ( grpc_end2end_test_config config ) { <nl> server_args . args = & server_arg ; <nl> <nl> f = begin_test ( config , " test_max_message_length " , NULL , & server_args ) ; <nl> - v_client = cq_verifier_create ( f . client_cq ) ; <nl> - v_server = cq_verifier_create ( f . server_cq ) ; <nl> + cqv = cq_verifier_create ( f . cq ) ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , <nl> " foo . test . google . fr : 1234 " , gpr_inf_future ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> static void test_max_message_length ( grpc_end2end_test_config config ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_RECV_CLOSE_ON_SERVER ; <nl> static void test_max_message_length ( grpc_end2end_test_config config ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status ! = GRPC_STATUS_OK ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . method , " / foo " ) ) ; <nl> static void test_max_message_length ( grpc_end2end_test_config config ) { <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> <nl> end_test ( & f ) ; <nl> config . tear_down_data ( & f ) ; <nl> mmm a / test / core / end2end / tests / no_op . c <nl> ppp b / test / core / end2end / tests / no_op . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static void test_no_op ( grpc_end2end_test_config config ) { <nl> mmm a / test / core / end2end / tests / ping_pong_streaming . c <nl> ppp b / test / core / end2end / tests / ping_pong_streaming . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> / * Client pings and server pongs . Repeat messages rounds before finishing . * / <nl> static void test_pingpong_streaming ( grpc_end2end_test_config config , <nl> int messages ) { <nl> - grpc_end2end_test_fixture f = begin_test ( config , " test_pingpong_streaming " , NULL , NULL ) ; <nl> + grpc_end2end_test_fixture f = <nl> + begin_test ( config , " test_pingpong_streaming " , NULL , NULL ) ; <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void test_pingpong_streaming ( grpc_end2end_test_config config , <nl> gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> gpr_slice response_payload_slice = gpr_slice_from_copied_string ( " hello you " ) ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , <nl> " foo . test . google . fr : 1234 " , deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> static void test_pingpong_streaming ( grpc_end2end_test_config config , <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 100 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 100 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 100 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 100 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void test_pingpong_streaming ( grpc_end2end_test_config config , <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = <nl> grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_MESSAGE ; <nl> static void test_pingpong_streaming ( grpc_end2end_test_config config , <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = <nl> grpc_call_start_batch ( s , ops , op - ops , tag ( 103 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 103 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 2 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 103 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 2 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> grpc_byte_buffer_destroy ( request_payload ) ; <nl> grpc_byte_buffer_destroy ( response_payload ) ; <nl> static void test_pingpong_streaming ( grpc_end2end_test_config config , <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 104 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_expect_completion ( v_client , tag ( 3 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> - <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_expect_completion ( v_server , tag ( 104 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 3 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 104 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> <nl> grpc_metadata_array_destroy ( & initial_metadata_recv ) ; <nl> grpc_metadata_array_destroy ( & trailing_metadata_recv ) ; <nl> mmm a / test / core / end2end / tests / registered_call . c <nl> ppp b / test / core / end2end / tests / registered_call . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static void simple_request_body ( grpc_end2end_test_fixture f , void * rc ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void simple_request_body ( grpc_end2end_test_fixture f , void * rc ) { <nl> size_t details_capacity = 0 ; <nl> int was_cancelled = 2 ; <nl> <nl> - c = grpc_channel_create_registered_call ( f . client , f . client_cq , rc , deadline ) ; <nl> + c = grpc_channel_create_registered_call ( f . client , f . cq , rc , deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> grpc_metadata_array_init ( & initial_metadata_recv ) ; <nl> static void simple_request_body ( grpc_end2end_test_fixture f , void * rc ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void simple_request_body ( grpc_end2end_test_fixture f , void * rc ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_UNIMPLEMENTED ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , " xyz " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . method , " / foo " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . host , " foo . test . google . fr : 1234 " ) ) ; <nl> - GPR_ASSERT ( was_cancelled = = 0 ) ; <nl> + GPR_ASSERT ( was_cancelled = = 1 ) ; <nl> <nl> gpr_free ( details ) ; <nl> grpc_metadata_array_destroy ( & initial_metadata_recv ) ; <nl> static void simple_request_body ( grpc_end2end_test_fixture f , void * rc ) { <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> } <nl> <nl> static void test_invoke_simple_request ( grpc_end2end_test_config config ) { <nl> - grpc_end2end_test_fixture f = begin_test ( config , " test_invoke_simple_request " , NULL , NULL ) ; <nl> + grpc_end2end_test_fixture f = <nl> + begin_test ( config , " test_invoke_simple_request " , NULL , NULL ) ; <nl> void * rc = <nl> grpc_channel_register_call ( f . client , " / foo " , " foo . test . google . fr : 1234 " ) ; <nl> <nl> static void test_invoke_simple_request ( grpc_end2end_test_config config ) { <nl> <nl> static void test_invoke_10_simple_requests ( grpc_end2end_test_config config ) { <nl> int i ; <nl> - grpc_end2end_test_fixture f = begin_test ( config , " test_invoke_10_simple_requests " , NULL , NULL ) ; <nl> + grpc_end2end_test_fixture f = <nl> + begin_test ( config , " test_invoke_10_simple_requests " , NULL , NULL ) ; <nl> void * rc = <nl> grpc_channel_register_call ( f . client , " / foo " , " foo . test . google . fr : 1234 " ) ; <nl> <nl> mmm a / test / core / end2end / tests / request_response_with_binary_metadata_and_payload . c <nl> ppp b / test / core / end2end / tests / request_response_with_binary_metadata_and_payload . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> / * Request / response with metadata and payload . * / <nl> static void test_request_response_with_metadata_and_payload ( <nl> " \ xf0 \ xf1 \ xf2 \ xf3 \ xf4 \ xf5 \ xf6 \ xf7 \ xf8 \ xf9 \ xfa \ xfb \ xfc \ xfd \ xfe \ xff " , <nl> 16 , <nl> { { NULL , NULL , NULL } } } } ; <nl> - grpc_end2end_test_fixture f = begin_test ( config , " test_request_response_with_metadata_and_payload " , NULL , NULL ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + grpc_end2end_test_fixture f = begin_test ( <nl> + config , " test_request_response_with_metadata_and_payload " , NULL , NULL ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void test_request_response_with_metadata_and_payload ( <nl> size_t details_capacity = 0 ; <nl> int was_cancelled = 2 ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> grpc_metadata_array_init ( & initial_metadata_recv ) ; <nl> static void test_request_response_with_metadata_and_payload ( <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void test_request_response_with_metadata_and_payload ( <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_RECV_CLOSE_ON_SERVER ; <nl> static void test_request_response_with_metadata_and_payload ( <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 103 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 103 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 103 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_OK ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , " xyz " ) ) ; <nl> static void test_request_response_with_metadata_and_payload ( <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> <nl> grpc_byte_buffer_destroy ( request_payload ) ; <nl> grpc_byte_buffer_destroy ( response_payload ) ; <nl> mmm a / test / core / end2end / tests / request_response_with_metadata_and_payload . c <nl> ppp b / test / core / end2end / tests / request_response_with_metadata_and_payload . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> / * Request / response with metadata and payload . * / <nl> static void test_request_response_with_metadata_and_payload ( <nl> { " key2 " , " val2 " , 4 , { { NULL , NULL , NULL } } } } ; <nl> grpc_metadata meta_s [ 2 ] = { { " key3 " , " val3 " , 4 , { { NULL , NULL , NULL } } } , <nl> { " key4 " , " val4 " , 4 , { { NULL , NULL , NULL } } } } ; <nl> - grpc_end2end_test_fixture f = begin_test ( config , " test_request_response_with_metadata_and_payload " , NULL , NULL ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + grpc_end2end_test_fixture f = begin_test ( <nl> + config , " test_request_response_with_metadata_and_payload " , NULL , NULL ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void test_request_response_with_metadata_and_payload ( <nl> size_t details_capacity = 0 ; <nl> int was_cancelled = 2 ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> grpc_metadata_array_init ( & initial_metadata_recv ) ; <nl> static void test_request_response_with_metadata_and_payload ( <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void test_request_response_with_metadata_and_payload ( <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_RECV_CLOSE_ON_SERVER ; <nl> static void test_request_response_with_metadata_and_payload ( <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 103 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 103 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 103 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_OK ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , " xyz " ) ) ; <nl> static void test_request_response_with_metadata_and_payload ( <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> <nl> grpc_byte_buffer_destroy ( request_payload ) ; <nl> grpc_byte_buffer_destroy ( response_payload ) ; <nl> mmm a / test / core / end2end / tests / request_response_with_payload . c <nl> ppp b / test / core / end2end / tests / request_response_with_payload . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static void request_response_with_payload ( grpc_end2end_test_fixture f ) { <nl> static void request_response_with_payload ( grpc_end2end_test_fixture f ) { <nl> grpc_byte_buffer * response_payload = <nl> grpc_raw_byte_buffer_create ( & response_payload_slice , 1 ) ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void request_response_with_payload ( grpc_end2end_test_fixture f ) { <nl> size_t details_capacity = 0 ; <nl> int was_cancelled = 2 ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> grpc_metadata_array_init ( & initial_metadata_recv ) ; <nl> static void request_response_with_payload ( grpc_end2end_test_fixture f ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void request_response_with_payload ( grpc_end2end_test_fixture f ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_RECV_CLOSE_ON_SERVER ; <nl> static void request_response_with_payload ( grpc_end2end_test_fixture f ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 103 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 103 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 103 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_OK ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , " xyz " ) ) ; <nl> static void request_response_with_payload ( grpc_end2end_test_fixture f ) { <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> <nl> grpc_byte_buffer_destroy ( request_payload ) ; <nl> grpc_byte_buffer_destroy ( response_payload ) ; <nl> static void request_response_with_payload ( grpc_end2end_test_fixture f ) { <nl> payload and status . * / <nl> static void test_invoke_request_response_with_payload ( <nl> grpc_end2end_test_config config ) { <nl> - grpc_end2end_test_fixture f = begin_test ( config , " test_invoke_request_response_with_payload " , NULL , NULL ) ; <nl> + grpc_end2end_test_fixture f = begin_test ( <nl> + config , " test_invoke_request_response_with_payload " , NULL , NULL ) ; <nl> request_response_with_payload ( f ) ; <nl> end_test ( & f ) ; <nl> config . tear_down_data ( & f ) ; <nl> static void test_invoke_request_response_with_payload ( <nl> static void test_invoke_10_request_response_with_payload ( <nl> grpc_end2end_test_config config ) { <nl> int i ; <nl> - grpc_end2end_test_fixture f = begin_test ( config , " test_invoke_10_request_response_with_payload " , NULL , NULL ) ; <nl> + grpc_end2end_test_fixture f = begin_test ( <nl> + config , " test_invoke_10_request_response_with_payload " , NULL , NULL ) ; <nl> for ( i = 0 ; i < 10 ; i + + ) { <nl> request_response_with_payload ( f ) ; <nl> } <nl> mmm a / test / core / end2end / tests / request_response_with_payload_and_call_creds . c <nl> ppp b / test / core / end2end / tests / request_response_with_payload_and_call_creds . c <nl> static const char iam_selector [ ] = " selector " ; <nl> static const char overridden_iam_token [ ] = " overridden_token " ; <nl> static const char overridden_iam_selector [ ] = " overridden_selector " ; <nl> <nl> - typedef enum { <nl> - NONE , <nl> - OVERRIDE , <nl> - DESTROY <nl> - } override_mode ; <nl> + typedef enum { NONE , OVERRIDE , DESTROY } override_mode ; <nl> <nl> enum { TIMEOUT = 200000 } ; <nl> <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static void print_auth_context ( int is_client , const grpc_auth_context * ctx ) { <nl> static void print_auth_context ( int is_client , const grpc_auth_context * ctx ) { <nl> static void test_call_creds_failure ( grpc_end2end_test_config config ) { <nl> grpc_call * c ; <nl> grpc_credentials * creds = NULL ; <nl> - grpc_end2end_test_fixture f = begin_test ( config , " test_call_creds_failure " , NULL , NULL ) ; <nl> + grpc_end2end_test_fixture f = <nl> + begin_test ( config , " test_call_creds_failure " , NULL , NULL ) ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> / * Try with credentials unfit to be set on a call ( channel creds ) . * / <nl> static void request_response_with_payload_and_call_creds ( <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> <nl> grpc_end2end_test_fixture f = begin_test ( config , test_name , NULL , NULL ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void request_response_with_payload_and_call_creds ( <nl> grpc_credentials * creds = NULL ; <nl> const grpc_auth_context * s_auth_context = NULL ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> creds = grpc_iam_credentials_create ( iam_token , iam_selector ) ; <nl> GPR_ASSERT ( creds ! = NULL ) ; <nl> static void request_response_with_payload_and_call_creds ( <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( f . server , & s , <nl> - & call_details , <nl> - & request_metadata_recv , <nl> - f . server_cq , f . server_cq , <nl> - tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> s_auth_context = grpc_call_auth_context ( s ) ; <nl> GPR_ASSERT ( s_auth_context ! = NULL ) ; <nl> print_auth_context ( 0 , s_auth_context ) ; <nl> static void request_response_with_payload_and_call_creds ( <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_RECV_CLOSE_ON_SERVER ; <nl> static void request_response_with_payload_and_call_creds ( <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 103 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 103 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 103 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_OK ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , " xyz " ) ) ; <nl> static void request_response_with_payload_and_call_creds ( <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> <nl> grpc_byte_buffer_destroy ( request_payload ) ; <nl> grpc_byte_buffer_destroy ( response_payload ) ; <nl> static void request_response_with_payload_and_call_creds ( <nl> <nl> void test_request_response_with_payload_and_call_creds ( <nl> grpc_end2end_test_config config ) { <nl> - request_response_with_payload_and_call_creds ( " test_request_response_with_payload_and_call_creds " , config , NONE ) ; <nl> + request_response_with_payload_and_call_creds ( <nl> + " test_request_response_with_payload_and_call_creds " , config , NONE ) ; <nl> } <nl> <nl> void test_request_response_with_payload_and_overridden_call_creds ( <nl> grpc_end2end_test_config config ) { <nl> - request_response_with_payload_and_call_creds ( " test_request_response_with_payload_and_overridden_call_creds " , config , OVERRIDE ) ; <nl> + request_response_with_payload_and_call_creds ( <nl> + " test_request_response_with_payload_and_overridden_call_creds " , config , <nl> + OVERRIDE ) ; <nl> } <nl> <nl> void test_request_response_with_payload_and_deleted_call_creds ( <nl> grpc_end2end_test_config config ) { <nl> - request_response_with_payload_and_call_creds ( " test_request_response_with_payload_and_deleted_call_creds " , config , DESTROY ) ; <nl> + request_response_with_payload_and_call_creds ( <nl> + " test_request_response_with_payload_and_deleted_call_creds " , config , <nl> + DESTROY ) ; <nl> } <nl> <nl> void grpc_end2end_tests ( grpc_end2end_test_config config ) { <nl> void grpc_end2end_tests ( grpc_end2end_test_config config ) { <nl> test_request_response_with_payload_and_deleted_call_creds ( config ) ; <nl> } <nl> } <nl> - <nl> mmm a / test / core / end2end / tests / request_response_with_trailing_metadata_and_payload . c <nl> ppp b / test / core / end2end / tests / request_response_with_trailing_metadata_and_payload . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> / * Request / response with metadata and payload . * / <nl> static void test_request_response_with_metadata_and_payload ( <nl> grpc_byte_buffer * response_payload = <nl> grpc_raw_byte_buffer_create ( & response_payload_slice , 1 ) ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - grpc_metadata meta_c [ 2 ] = { { " key1 " , " val1 " , 4 , { { NULL , NULL , NULL } } } , { " key2 " , " val2 " , 4 , { { NULL , NULL , NULL } } } } ; <nl> - grpc_metadata meta_s [ 2 ] = { { " key3 " , " val3 " , 4 , { { NULL , NULL , NULL } } } , { " key4 " , " val4 " , 4 , { { NULL , NULL , NULL } } } } ; <nl> - grpc_metadata meta_t [ 2 ] = { { " key5 " , " val5 " , 4 , { { NULL , NULL , NULL } } } , { " key6 " , " val6 " , 4 , { { NULL , NULL , NULL } } } } ; <nl> - grpc_end2end_test_fixture f = begin_test ( config , " test_request_response_with_metadata_and_payload " , NULL , NULL ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + grpc_metadata meta_c [ 2 ] = { { " key1 " , " val1 " , 4 , { { NULL , NULL , NULL } } } , <nl> + { " key2 " , " val2 " , 4 , { { NULL , NULL , NULL } } } } ; <nl> + grpc_metadata meta_s [ 2 ] = { { " key3 " , " val3 " , 4 , { { NULL , NULL , NULL } } } , <nl> + { " key4 " , " val4 " , 4 , { { NULL , NULL , NULL } } } } ; <nl> + grpc_metadata meta_t [ 2 ] = { { " key5 " , " val5 " , 4 , { { NULL , NULL , NULL } } } , <nl> + { " key6 " , " val6 " , 4 , { { NULL , NULL , NULL } } } } ; <nl> + grpc_end2end_test_fixture f = begin_test ( <nl> + config , " test_request_response_with_metadata_and_payload " , NULL , NULL ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void test_request_response_with_metadata_and_payload ( <nl> size_t details_capacity = 0 ; <nl> int was_cancelled = 2 ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> grpc_metadata_array_init ( & initial_metadata_recv ) ; <nl> static void test_request_response_with_metadata_and_payload ( <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( f . server , & s , <nl> - & call_details , <nl> - & request_metadata_recv , <nl> - f . server_cq , f . server_cq , <nl> - tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void test_request_response_with_metadata_and_payload ( <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_RECV_CLOSE_ON_SERVER ; <nl> static void test_request_response_with_metadata_and_payload ( <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 103 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 103 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 103 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_OK ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , " xyz " ) ) ; <nl> static void test_request_response_with_metadata_and_payload ( <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> <nl> grpc_byte_buffer_destroy ( request_payload ) ; <nl> grpc_byte_buffer_destroy ( response_payload ) ; <nl> mmm a / test / core / end2end / tests / request_with_flags . c <nl> ppp b / test / core / end2end / tests / request_with_flags . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static void test_invoke_request_with_flags ( <nl> static void test_invoke_request_with_flags ( <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> grpc_end2end_test_fixture f = <nl> begin_test ( config , " test_invoke_request_with_flags " , NULL , NULL ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void test_invoke_request_with_flags ( <nl> size_t details_capacity = 0 ; <nl> grpc_call_error expectation ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> grpc_metadata_array_init ( & initial_metadata_recv ) ; <nl> static void test_invoke_request_with_flags ( <nl> <nl> grpc_call_destroy ( c ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> <nl> grpc_byte_buffer_destroy ( request_payload ) ; <nl> grpc_byte_buffer_destroy ( request_payload_recv ) ; <nl> static void test_invoke_request_with_flags ( <nl> <nl> void grpc_end2end_tests ( grpc_end2end_test_config config ) { <nl> size_t i ; <nl> - gpr_uint32 flags_for_op [ GRPC_OP_RECV_CLOSE_ON_SERVER + 1 ] ; <nl> + gpr_uint32 flags_for_op [ GRPC_OP_RECV_CLOSE_ON_SERVER + 1 ] ; <nl> <nl> { <nl> / * check that all grpc_op_types fail when their flag value is set to an <nl> mmm a / test / core / end2end / tests / request_with_large_metadata . c <nl> ppp b / test / core / end2end / tests / request_with_large_metadata . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> / * Request with a large amount of metadata . * / <nl> static void test_request_with_large_metadata ( grpc_end2end_test_config config ) { <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> grpc_metadata meta ; <nl> - grpc_end2end_test_fixture f = begin_test ( config , " test_request_with_large_metadata " , NULL , NULL ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + grpc_end2end_test_fixture f = <nl> + begin_test ( config , " test_request_with_large_metadata " , NULL , NULL ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void test_request_with_large_metadata ( grpc_end2end_test_config config ) { <nl> int was_cancelled = 2 ; <nl> const int large_size = 64 * 1024 ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> meta . key = " key " ; <nl> static void test_request_with_large_metadata ( grpc_end2end_test_config config ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void test_request_with_large_metadata ( grpc_end2end_test_config config ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_RECV_CLOSE_ON_SERVER ; <nl> static void test_request_with_large_metadata ( grpc_end2end_test_config config ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 103 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 103 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 103 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_OK ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , " xyz " ) ) ; <nl> static void test_request_with_large_metadata ( grpc_end2end_test_config config ) { <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> <nl> grpc_byte_buffer_destroy ( request_payload ) ; <nl> grpc_byte_buffer_destroy ( request_payload_recv ) ; <nl> mmm a / test / core / end2end / tests / request_with_payload . c <nl> ppp b / test / core / end2end / tests / request_with_payload . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> / * Client sends a request with payload , server reads then returns status . * / <nl> static void test_invoke_request_with_payload ( grpc_end2end_test_config config ) { <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - grpc_end2end_test_fixture f = begin_test ( config , " test_invoke_request_with_payload " , NULL , NULL ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + grpc_end2end_test_fixture f = <nl> + begin_test ( config , " test_invoke_request_with_payload " , NULL , NULL ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void test_invoke_request_with_payload ( grpc_end2end_test_config config ) { <nl> size_t details_capacity = 0 ; <nl> int was_cancelled = 2 ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> grpc_metadata_array_init ( & initial_metadata_recv ) ; <nl> static void test_invoke_request_with_payload ( grpc_end2end_test_config config ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void test_invoke_request_with_payload ( grpc_end2end_test_config config ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_RECV_CLOSE_ON_SERVER ; <nl> static void test_invoke_request_with_payload ( grpc_end2end_test_config config ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 103 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 103 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 103 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_OK ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , " xyz " ) ) ; <nl> static void test_invoke_request_with_payload ( grpc_end2end_test_config config ) { <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> <nl> grpc_byte_buffer_destroy ( request_payload ) ; <nl> grpc_byte_buffer_destroy ( request_payload_recv ) ; <nl> mmm a / test / core / end2end / tests / server_finishes_request . c <nl> ppp b / test / core / end2end / tests / server_finishes_request . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> size_t details_capacity = 0 ; <nl> int was_cancelled = 2 ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , <nl> " foo . test . google . fr : 1234 " , deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_UNIMPLEMENTED ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , " xyz " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . method , " / foo " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . host , " foo . test . google . fr : 1234 " ) ) ; <nl> - GPR_ASSERT ( was_cancelled = = 0 ) ; <nl> + GPR_ASSERT ( was_cancelled = = 1 ) ; <nl> <nl> gpr_free ( details ) ; <nl> grpc_metadata_array_destroy ( & initial_metadata_recv ) ; <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> } <nl> <nl> static void test_invoke_simple_request ( grpc_end2end_test_config config ) { <nl> mmm a / test / core / end2end / tests / simple_delayed_request . c <nl> ppp b / test / core / end2end / tests / simple_delayed_request . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static void simple_delayed_request_body ( grpc_end2end_test_config config , <nl> static void simple_delayed_request_body ( grpc_end2end_test_config config , <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f - > client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f - > server_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f - > cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void simple_delayed_request_body ( grpc_end2end_test_config config , <nl> <nl> config . init_client ( f , client_args ) ; <nl> <nl> - c = grpc_channel_create_call ( f - > client , f - > client_cq , " / foo " , <nl> - " foo . test . google . fr " , deadline ) ; <nl> + c = grpc_channel_create_call ( f - > client , f - > cq , " / foo " , " foo . test . google . fr " , <nl> + deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> grpc_metadata_array_init ( & initial_metadata_recv ) ; <nl> static void simple_delayed_request_body ( grpc_end2end_test_config config , <nl> <nl> config . init_server ( f , server_args ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f - > server , & s , & call_details , <nl> - & request_metadata_recv , f - > server_cq , <nl> - f - > server_cq , tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( f - > server , & s , <nl> + & call_details , <nl> + & request_metadata_recv , <nl> + f - > cq , f - > cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void simple_delayed_request_body ( grpc_end2end_test_config config , <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_UNIMPLEMENTED ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , " xyz " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . method , " / foo " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . host , " foo . test . google . fr " ) ) ; <nl> - GPR_ASSERT ( was_cancelled = = 0 ) ; <nl> + GPR_ASSERT ( was_cancelled = = 1 ) ; <nl> <nl> gpr_free ( details ) ; <nl> grpc_metadata_array_destroy ( & initial_metadata_recv ) ; <nl> static void simple_delayed_request_body ( grpc_end2end_test_config config , <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> } <nl> <nl> static void test_simple_delayed_request_short ( grpc_end2end_test_config config ) { <nl> mmm a / test / core / end2end / tests / simple_request . c <nl> ppp b / test / core / end2end / tests / simple_request . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> size_t details_capacity = 0 ; <nl> int was_cancelled = 2 ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , <nl> " foo . test . google . fr : 1234 " , deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_UNIMPLEMENTED ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , " xyz " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . method , " / foo " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . host , " foo . test . google . fr : 1234 " ) ) ; <nl> - GPR_ASSERT ( was_cancelled = = 0 ) ; <nl> + GPR_ASSERT ( was_cancelled = = 1 ) ; <nl> <nl> gpr_free ( details ) ; <nl> grpc_metadata_array_destroy ( & initial_metadata_recv ) ; <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> } <nl> <nl> static void test_invoke_simple_request ( grpc_end2end_test_config config ) { <nl> static void test_invoke_simple_request ( grpc_end2end_test_config config ) { <nl> <nl> static void test_invoke_10_simple_requests ( grpc_end2end_test_config config ) { <nl> int i ; <nl> - grpc_end2end_test_fixture f = begin_test ( config , " test_invoke_10_simple_requests " , NULL , NULL ) ; <nl> + grpc_end2end_test_fixture f = <nl> + begin_test ( config , " test_invoke_10_simple_requests " , NULL , NULL ) ; <nl> for ( i = 0 ; i < 10 ; i + + ) { <nl> simple_request_body ( f ) ; <nl> gpr_log ( GPR_INFO , " Passed simple request % d " , i ) ; <nl> static void test_invoke_10_simple_requests ( grpc_end2end_test_config config ) { <nl> } <nl> <nl> void grpc_end2end_tests ( grpc_end2end_test_config config ) { <nl> - test_invoke_simple_request ( config ) ; <nl> + int i ; <nl> + for ( i = 0 ; i < 10 ; i + + ) { <nl> + test_invoke_simple_request ( config ) ; <nl> + } <nl> test_invoke_10_simple_requests ( config ) ; <nl> } <nl> mmm a / test / core / end2end / tests / simple_request_with_high_initial_sequence_number . c <nl> ppp b / test / core / end2end / tests / simple_request_with_high_initial_sequence_number . c <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> if ( ! f - > server ) return ; <nl> - grpc_server_shutdown_and_notify ( f - > server , f - > server_cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( f - > server_cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > cq , tag ( 1000 ) , <nl> + GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( f - > server ) ; <nl> f - > server = NULL ; <nl> } <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> shutdown_server ( f ) ; <nl> shutdown_client ( f ) ; <nl> <nl> - grpc_completion_queue_shutdown ( f - > server_cq ) ; <nl> - drain_cq ( f - > server_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > server_cq ) ; <nl> - grpc_completion_queue_shutdown ( f - > client_cq ) ; <nl> - drain_cq ( f - > client_cq ) ; <nl> - grpc_completion_queue_destroy ( f - > client_cq ) ; <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> - cq_verifier * v_client = cq_verifier_create ( f . client_cq ) ; <nl> - cq_verifier * v_server = cq_verifier_create ( f . server_cq ) ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> grpc_metadata_array initial_metadata_recv ; <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> size_t details_capacity = 0 ; <nl> int was_cancelled = 2 ; <nl> <nl> - c = grpc_channel_create_call ( f . client , f . client_cq , " / foo " , <nl> + c = grpc_channel_create_call ( f . client , f . cq , " / foo " , <nl> " foo . test . google . fr : 1234 " , deadline ) ; <nl> GPR_ASSERT ( c ) ; <nl> <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( c , ops , op - ops , tag ( 1 ) ) ) ; <nl> <nl> - GPR_ASSERT ( GRPC_CALL_OK = = <nl> - grpc_server_request_call ( f . server , & s , & call_details , <nl> - & request_metadata_recv , f . server_cq , <nl> - f . server_cq , tag ( 101 ) ) ) ; <nl> - cq_expect_completion ( v_server , tag ( 101 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = grpc_server_request_call ( <nl> + f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 101 ) ) ) ; <nl> + cq_expect_completion ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> op + + ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = grpc_call_start_batch ( s , ops , op - ops , tag ( 102 ) ) ) ; <nl> <nl> - cq_expect_completion ( v_server , tag ( 102 ) , 1 ) ; <nl> - cq_verify ( v_server ) ; <nl> - <nl> - cq_expect_completion ( v_client , tag ( 1 ) , 1 ) ; <nl> - cq_verify ( v_client ) ; <nl> + cq_expect_completion ( cqv , tag ( 102 ) , 1 ) ; <nl> + cq_expect_completion ( cqv , tag ( 1 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> <nl> GPR_ASSERT ( status = = GRPC_STATUS_UNIMPLEMENTED ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( details , " xyz " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . method , " / foo " ) ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( call_details . host , " foo . test . google . fr : 1234 " ) ) ; <nl> - GPR_ASSERT ( was_cancelled = = 0 ) ; <nl> + GPR_ASSERT ( was_cancelled = = 1 ) ; <nl> <nl> gpr_free ( details ) ; <nl> grpc_metadata_array_destroy ( & initial_metadata_recv ) ; <nl> static void simple_request_body ( grpc_end2end_test_fixture f ) { <nl> grpc_call_destroy ( c ) ; <nl> grpc_call_destroy ( s ) ; <nl> <nl> - cq_verifier_destroy ( v_client ) ; <nl> - cq_verifier_destroy ( v_server ) ; <nl> + cq_verifier_destroy ( cqv ) ; <nl> } <nl> <nl> - static void test_invoke_10_simple_requests ( grpc_end2end_test_config config , int initial_sequence_number ) { <nl> + static void test_invoke_10_simple_requests ( grpc_end2end_test_config config , <nl> + int initial_sequence_number ) { <nl> int i ; <nl> grpc_end2end_test_fixture f ; <nl> grpc_arg client_arg ; <nl> mmm a / test / core / fling / server . c <nl> ppp b / test / core / fling / server . c <nl> int main ( int argc , char * * argv ) { <nl> if ( got_sigint & & ! shutdown_started ) { <nl> gpr_log ( GPR_INFO , " Shutting down due to SIGINT " ) ; <nl> grpc_server_shutdown_and_notify ( server , cq , tag ( 1000 ) ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_pluck ( cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) . type = = GRPC_OP_COMPLETE ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( <nl> + cq , tag ( 1000 ) , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_completion_queue_shutdown ( cq ) ; <nl> shutdown_started = 1 ; <nl> } <nl> mmm a / test / core / httpcli / httpcli_test . c <nl> ppp b / test / core / httpcli / httpcli_test . c <nl> <nl> <nl> # include < string . h > <nl> <nl> + # include < grpc / grpc . h > <nl> # include " src / core / iomgr / iomgr . h " <nl> # include < grpc / support / alloc . h > <nl> # include < grpc / support / log . h > <nl> <nl> # include " test / core / util / port . h " <nl> # include " test / core / util / test_config . h " <nl> <nl> - static gpr_event g_done ; <nl> + static int g_done = 0 ; <nl> + static grpc_httpcli_context g_context ; <nl> + static grpc_pollset g_pollset ; <nl> <nl> static gpr_timespec n_seconds_time ( int seconds ) { <nl> return GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( seconds ) ; <nl> } <nl> <nl> static void on_finish ( void * arg , const grpc_httpcli_response * response ) { <nl> - const char * expect = <nl> + const char * expect = <nl> " < html > < head > < title > Hello world ! < / title > < / head > " <nl> " < body > < p > This is a test < / p > < / body > < / html > " ; <nl> GPR_ASSERT ( arg = = ( void * ) 42 ) ; <nl> static void on_finish ( void * arg , const grpc_httpcli_response * response ) { <nl> GPR_ASSERT ( response - > status = = 200 ) ; <nl> GPR_ASSERT ( response - > body_length = = strlen ( expect ) ) ; <nl> GPR_ASSERT ( 0 = = memcmp ( expect , response - > body , response - > body_length ) ) ; <nl> - gpr_event_set ( & g_done , ( void * ) 1 ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + g_done = 1 ; <nl> + grpc_pollset_kick ( & g_pollset ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> } <nl> <nl> static void test_get ( int use_ssl , int port ) { <nl> grpc_httpcli_request req ; <nl> - char * host ; <nl> + char * host ; <nl> <nl> + g_done = 0 ; <nl> gpr_log ( GPR_INFO , " running % s with use_ssl = % d . " , " test_get " , use_ssl ) ; <nl> <nl> gpr_asprintf ( & host , " localhost : % d " , port ) ; <nl> gpr_log ( GPR_INFO , " requesting from % s " , host ) ; <nl> <nl> - gpr_event_init ( & g_done ) ; <nl> memset ( & req , 0 , sizeof ( req ) ) ; <nl> req . host = host ; <nl> req . path = " / get " ; <nl> req . use_ssl = use_ssl ; <nl> <nl> - grpc_httpcli_get ( & req , n_seconds_time ( 15 ) , on_finish , ( void * ) 42 ) ; <nl> + grpc_httpcli_get ( & g_context , & g_pollset , & req , n_seconds_time ( 15 ) , on_finish , <nl> + ( void * ) 42 ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + while ( ! g_done ) { <nl> + grpc_pollset_work ( & g_pollset , n_seconds_time ( 20 ) ) ; <nl> + } <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> gpr_free ( host ) ; <nl> - GPR_ASSERT ( gpr_event_wait ( & g_done , n_seconds_time ( 20 ) ) ) ; <nl> } <nl> <nl> static void test_post ( int use_ssl , int port ) { <nl> grpc_httpcli_request req ; <nl> - char * host ; <nl> + char * host ; <nl> <nl> + g_done = 0 ; <nl> gpr_log ( GPR_INFO , " running % s with use_ssl = % d . " , " test_post " , ( int ) use_ssl ) ; <nl> <nl> gpr_asprintf ( & host , " localhost : % d " , port ) ; <nl> gpr_log ( GPR_INFO , " posting to % s " , host ) ; <nl> <nl> - gpr_event_init ( & g_done ) ; <nl> memset ( & req , 0 , sizeof ( req ) ) ; <nl> req . host = host ; <nl> req . path = " / post " ; <nl> req . use_ssl = use_ssl ; <nl> <nl> - grpc_httpcli_post ( & req , " hello " , 5 , n_seconds_time ( 15 ) , on_finish , <nl> - ( void * ) 42 ) ; <nl> - GPR_ASSERT ( gpr_event_wait ( & g_done , n_seconds_time ( 20 ) ) ) ; <nl> + grpc_httpcli_post ( & g_context , & g_pollset , & req , " hello " , 5 , <nl> + n_seconds_time ( 15 ) , on_finish , ( void * ) 42 ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + while ( ! g_done ) { <nl> + grpc_pollset_work ( & g_pollset , n_seconds_time ( 20 ) ) ; <nl> + } <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + gpr_free ( host ) ; <nl> } <nl> <nl> + static void destroy_pollset ( void * ignored ) { grpc_pollset_destroy ( & g_pollset ) ; } <nl> + <nl> int main ( int argc , char * * argv ) { <nl> - gpr_subprocess * server ; <nl> + gpr_subprocess * server ; <nl> char * me = argv [ 0 ] ; <nl> char * lslash = strrchr ( me , ' / ' ) ; <nl> - char * args [ 4 ] ; <nl> + char * args [ 4 ] ; <nl> char root [ 1024 ] ; <nl> int port = grpc_pick_unused_port_or_die ( ) ; <nl> <nl> int main ( int argc , char * * argv ) { <nl> gpr_asprintf ( & args [ 0 ] , " % s / . . / . . / test / core / httpcli / test_server . py " , root ) ; <nl> args [ 1 ] = " - - port " ; <nl> gpr_asprintf ( & args [ 2 ] , " % d " , port ) ; <nl> - server = gpr_subprocess_create ( 3 , ( const char * * ) args ) ; <nl> + server = gpr_subprocess_create ( 3 , ( const char * * ) args ) ; <nl> GPR_ASSERT ( server ) ; <nl> gpr_free ( args [ 0 ] ) ; <nl> gpr_free ( args [ 2 ] ) ; <nl> int main ( int argc , char * * argv ) { <nl> gpr_sleep_until ( gpr_time_add ( gpr_now ( ) , gpr_time_from_seconds ( 5 ) ) ) ; <nl> <nl> grpc_test_init ( argc , argv ) ; <nl> - grpc_iomgr_init ( ) ; <nl> + grpc_init ( ) ; <nl> + grpc_httpcli_context_init ( & g_context ) ; <nl> + grpc_pollset_init ( & g_pollset ) ; <nl> <nl> test_get ( 0 , port ) ; <nl> test_post ( 0 , port ) ; <nl> <nl> - grpc_iomgr_shutdown ( ) ; <nl> + grpc_httpcli_context_destroy ( & g_context ) ; <nl> + grpc_pollset_shutdown ( & g_pollset , destroy_pollset , NULL ) ; <nl> + grpc_shutdown ( ) ; <nl> <nl> gpr_subprocess_destroy ( server ) ; <nl> <nl> mmm a / test / core / iomgr / endpoint_tests . c <nl> ppp b / test / core / iomgr / endpoint_tests . c <nl> <nl> <nl> * / <nl> <nl> + static grpc_pollset * g_pollset ; <nl> + <nl> size_t count_and_unref_slices ( gpr_slice * slices , size_t nslices , <nl> int * current_data ) { <nl> size_t num_bytes = 0 ; <nl> static gpr_slice * allocate_blocks ( size_t num_bytes , size_t slice_size , <nl> struct read_and_write_test_state { <nl> grpc_endpoint * read_ep ; <nl> grpc_endpoint * write_ep ; <nl> - gpr_mu mu ; <nl> - gpr_cv cv ; <nl> size_t target_bytes ; <nl> size_t bytes_read ; <nl> size_t current_write_size ; <nl> static void read_and_write_test_read_handler ( void * data , gpr_slice * slices , <nl> GPR_ASSERT ( error ! = GRPC_ENDPOINT_CB_ERROR ) ; <nl> if ( error = = GRPC_ENDPOINT_CB_SHUTDOWN ) { <nl> gpr_log ( GPR_INFO , " Read handler shutdown " ) ; <nl> - gpr_mu_lock ( & state - > mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( g_pollset ) ) ; <nl> state - > read_done = 1 ; <nl> - gpr_cv_signal ( & state - > cv ) ; <nl> - gpr_mu_unlock ( & state - > mu ) ; <nl> + grpc_pollset_kick ( g_pollset ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( g_pollset ) ) ; <nl> return ; <nl> } <nl> <nl> static void read_and_write_test_read_handler ( void * data , gpr_slice * slices , <nl> count_and_unref_slices ( slices , nslices , & state - > current_read_data ) ; <nl> if ( state - > bytes_read = = state - > target_bytes ) { <nl> gpr_log ( GPR_INFO , " Read handler done " ) ; <nl> - gpr_mu_lock ( & state - > mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( g_pollset ) ) ; <nl> state - > read_done = 1 ; <nl> - gpr_cv_signal ( & state - > cv ) ; <nl> - gpr_mu_unlock ( & state - > mu ) ; <nl> + grpc_pollset_kick ( g_pollset ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( g_pollset ) ) ; <nl> } else { <nl> grpc_endpoint_notify_on_read ( state - > read_ep , <nl> read_and_write_test_read_handler , data ) ; <nl> static void read_and_write_test_write_handler ( void * data , <nl> <nl> GPR_ASSERT ( error ! = GRPC_ENDPOINT_CB_ERROR ) ; <nl> <nl> - gpr_log ( GPR_DEBUG , " % s : error = % d " , " read_and_write_test_write_handler " , error ) ; <nl> + gpr_log ( GPR_DEBUG , " % s : error = % d " , " read_and_write_test_write_handler " , <nl> + error ) ; <nl> <nl> if ( error = = GRPC_ENDPOINT_CB_SHUTDOWN ) { <nl> gpr_log ( GPR_INFO , " Write handler shutdown " ) ; <nl> - gpr_mu_lock ( & state - > mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( g_pollset ) ) ; <nl> state - > write_done = 1 ; <nl> - gpr_cv_signal ( & state - > cv ) ; <nl> - gpr_mu_unlock ( & state - > mu ) ; <nl> + grpc_pollset_kick ( g_pollset ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( g_pollset ) ) ; <nl> return ; <nl> } <nl> <nl> static void read_and_write_test_write_handler ( void * data , <nl> GPR_ASSERT ( state - > bytes_written = = state - > target_bytes ) ; <nl> <nl> gpr_log ( GPR_INFO , " Write handler done " ) ; <nl> - gpr_mu_lock ( & state - > mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( g_pollset ) ) ; <nl> state - > write_done = 1 ; <nl> - gpr_cv_signal ( & state - > cv ) ; <nl> - gpr_mu_unlock ( & state - > mu ) ; <nl> + grpc_pollset_kick ( g_pollset ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( g_pollset ) ) ; <nl> } <nl> <nl> / * Do both reading and writing using the grpc_endpoint API . <nl> static void read_and_write_test ( grpc_endpoint_test_config config , <nl> size_t slice_size , int shutdown ) { <nl> struct read_and_write_test_state state ; <nl> gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 20 ) ; <nl> - grpc_endpoint_test_fixture f = begin_test ( config , " read_and_write_test " , slice_size ) ; <nl> + grpc_endpoint_test_fixture f = <nl> + begin_test ( config , " read_and_write_test " , slice_size ) ; <nl> <nl> if ( shutdown ) { <nl> gpr_log ( GPR_INFO , " Start read and write shutdown test " ) ; <nl> static void read_and_write_test ( grpc_endpoint_test_config config , <nl> num_bytes , slice_size ) ; <nl> } <nl> <nl> - gpr_mu_init ( & state . mu ) ; <nl> - gpr_cv_init ( & state . cv ) ; <nl> - <nl> state . read_ep = f . client_ep ; <nl> state . write_ep = f . server_ep ; <nl> state . target_bytes = num_bytes ; <nl> static void read_and_write_test ( grpc_endpoint_test_config config , <nl> grpc_endpoint_shutdown ( state . write_ep ) ; <nl> } <nl> <nl> - gpr_mu_lock ( & state . mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( g_pollset ) ) ; <nl> while ( ! state . read_done | | ! state . write_done ) { <nl> - if ( gpr_cv_wait ( & state . cv , & state . mu , deadline ) ) { <nl> - gpr_log ( GPR_ERROR , " timeout : read_done = % d , write_done = % d " , <nl> - state . read_done , state . write_done ) ; <nl> - abort ( ) ; <nl> - } <nl> + GPR_ASSERT ( gpr_time_cmp ( gpr_now ( ) , deadline ) < 0 ) ; <nl> + grpc_pollset_work ( g_pollset , deadline ) ; <nl> } <nl> - gpr_mu_unlock ( & state . mu ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( g_pollset ) ) ; <nl> <nl> grpc_endpoint_destroy ( state . read_ep ) ; <nl> grpc_endpoint_destroy ( state . write_ep ) ; <nl> - gpr_mu_destroy ( & state . mu ) ; <nl> - gpr_cv_destroy ( & state . cv ) ; <nl> end_test ( config ) ; <nl> } <nl> <nl> struct timeout_test_state { <nl> - gpr_event io_done ; <nl> + int io_done ; <nl> } ; <nl> <nl> typedef struct { <nl> - gpr_event ev ; <nl> + int done ; <nl> grpc_endpoint * ep ; <nl> } shutdown_during_write_test_state ; <nl> <nl> static void shutdown_during_write_test_read_handler ( <nl> <nl> if ( error ! = GRPC_ENDPOINT_CB_OK ) { <nl> grpc_endpoint_destroy ( st - > ep ) ; <nl> - gpr_event_set ( & st - > ev , ( void * ) ( gpr_intptr ) error ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( g_pollset ) ) ; <nl> + st - > done = error ; <nl> + grpc_pollset_kick ( g_pollset ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( g_pollset ) ) ; <nl> } else { <nl> grpc_endpoint_notify_on_read ( <nl> st - > ep , shutdown_during_write_test_read_handler , user_data ) ; <nl> static void shutdown_during_write_test_write_handler ( <nl> gpr_log ( GPR_ERROR , <nl> " shutdown_during_write_test_write_handler completed unexpectedly " ) ; <nl> } <nl> - gpr_event_set ( & st - > ev , ( void * ) ( gpr_intptr ) 1 ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( g_pollset ) ) ; <nl> + st - > done = 1 ; <nl> + grpc_pollset_kick ( g_pollset ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( g_pollset ) ) ; <nl> } <nl> <nl> static void shutdown_during_write_test ( grpc_endpoint_test_config config , <nl> static void shutdown_during_write_test ( grpc_endpoint_test_config config , <nl> shutdown_during_write_test_state read_st ; <nl> shutdown_during_write_test_state write_st ; <nl> gpr_slice * slices ; <nl> - grpc_endpoint_test_fixture f = begin_test ( config , " shutdown_during_write_test " , slice_size ) ; <nl> + grpc_endpoint_test_fixture f = <nl> + begin_test ( config , " shutdown_during_write_test " , slice_size ) ; <nl> <nl> gpr_log ( GPR_INFO , " testing shutdown during a write " ) ; <nl> <nl> read_st . ep = f . client_ep ; <nl> write_st . ep = f . server_ep ; <nl> - gpr_event_init ( & read_st . ev ) ; <nl> - gpr_event_init ( & write_st . ev ) ; <nl> + read_st . done = 0 ; <nl> + write_st . done = 0 ; <nl> <nl> grpc_endpoint_notify_on_read ( <nl> read_st . ep , shutdown_during_write_test_read_handler , & read_st ) ; <nl> static void shutdown_during_write_test ( grpc_endpoint_test_config config , <nl> case GRPC_ENDPOINT_WRITE_PENDING : <nl> grpc_endpoint_shutdown ( write_st . ep ) ; <nl> deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 10 ) ; <nl> - GPR_ASSERT ( gpr_event_wait ( & write_st . ev , deadline ) ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( g_pollset ) ) ; <nl> + while ( ! write_st . done ) { <nl> + GPR_ASSERT ( gpr_time_cmp ( gpr_now ( ) , deadline ) < 0 ) ; <nl> + grpc_pollset_work ( g_pollset , deadline ) ; <nl> + } <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( g_pollset ) ) ; <nl> grpc_endpoint_destroy ( write_st . ep ) ; <nl> - GPR_ASSERT ( gpr_event_wait ( & read_st . ev , deadline ) ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( g_pollset ) ) ; <nl> + while ( ! read_st . done ) { <nl> + GPR_ASSERT ( gpr_time_cmp ( gpr_now ( ) , deadline ) < 0 ) ; <nl> + grpc_pollset_work ( g_pollset , deadline ) ; <nl> + } <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( g_pollset ) ) ; <nl> gpr_free ( slices ) ; <nl> end_test ( config ) ; <nl> return ; <nl> static void shutdown_during_write_test ( grpc_endpoint_test_config config , <nl> abort ( ) ; <nl> } <nl> <nl> - void grpc_endpoint_tests ( grpc_endpoint_test_config config ) { <nl> + void grpc_endpoint_tests ( grpc_endpoint_test_config config , <nl> + grpc_pollset * pollset ) { <nl> + g_pollset = pollset ; <nl> read_and_write_test ( config , 10000000 , 100000 , 8192 , 0 ) ; <nl> read_and_write_test ( config , 1000000 , 100000 , 1 , 0 ) ; <nl> read_and_write_test ( config , 100000000 , 100000 , 1 , 1 ) ; <nl> shutdown_during_write_test ( config , 1000 ) ; <nl> + g_pollset = NULL ; <nl> } <nl> mmm a / test / core / iomgr / endpoint_tests . h <nl> ppp b / test / core / iomgr / endpoint_tests . h <nl> struct grpc_endpoint_test_config { <nl> void ( * clean_up ) ( ) ; <nl> } ; <nl> <nl> - void grpc_endpoint_tests ( grpc_endpoint_test_config config ) ; <nl> + void grpc_endpoint_tests ( grpc_endpoint_test_config config , <nl> + grpc_pollset * pollset ) ; <nl> <nl> - # endif / * GRPC_TEST_CORE_IOMGR_ENDPOINT_TESTS_H * / <nl> + # endif / * GRPC_TEST_CORE_IOMGR_ENDPOINT_TESTS_H * / <nl> mmm a / test / core / iomgr / fd_posix_test . c <nl> ppp b / test / core / iomgr / fd_posix_test . c <nl> <nl> # include < grpc / support / time . h > <nl> # include " test / core / util / test_config . h " <nl> <nl> + static grpc_pollset g_pollset ; <nl> + <nl> / * buffer size used to send and receive data . <nl> 1024 is the minimal value to set TCP send and receive buffer . * / <nl> # define BUF_SIZE 1024 <nl> void no_op_cb ( void * arg , int success ) { } <nl> typedef struct { <nl> grpc_fd * em_fd ; / * listening fd * / <nl> ssize_t read_bytes_total ; / * total number of received bytes * / <nl> - gpr_mu mu ; / * protect done and done_cv * / <nl> - gpr_cv done_cv ; / * signaled when a server finishes serving * / <nl> int done ; / * set to 1 when a server finishes serving * / <nl> grpc_iomgr_closure listen_closure ; <nl> } server ; <nl> <nl> static void server_init ( server * sv ) { <nl> sv - > read_bytes_total = 0 ; <nl> - gpr_mu_init ( & sv - > mu ) ; <nl> - gpr_cv_init ( & sv - > done_cv ) ; <nl> sv - > done = 0 ; <nl> } <nl> <nl> static void session_shutdown_cb ( void * arg , / * session * / <nl> int success ) { <nl> session * se = arg ; <nl> server * sv = se - > sv ; <nl> - grpc_fd_orphan ( se - > em_fd , NULL , NULL ) ; <nl> + grpc_fd_orphan ( se - > em_fd , NULL , " a " ) ; <nl> gpr_free ( se ) ; <nl> / * Start to shutdown listen fd . * / <nl> grpc_fd_shutdown ( sv - > em_fd ) ; <nl> static void session_read_cb ( void * arg , / * session * / <nl> static void listen_shutdown_cb ( void * arg / * server * / , int success ) { <nl> server * sv = arg ; <nl> <nl> - grpc_fd_orphan ( sv - > em_fd , NULL , NULL ) ; <nl> + grpc_fd_orphan ( sv - > em_fd , NULL , " b " ) ; <nl> <nl> - gpr_mu_lock ( & sv - > mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> sv - > done = 1 ; <nl> - gpr_cv_signal ( & sv - > done_cv ) ; <nl> - gpr_mu_unlock ( & sv - > mu ) ; <nl> + grpc_pollset_kick ( & g_pollset ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> } <nl> <nl> / * Called when a new TCP connection request arrives in the listening port . * / <nl> static void listen_cb ( void * arg , / * = sv_arg * / <nl> se = gpr_malloc ( sizeof ( * se ) ) ; <nl> se - > sv = sv ; <nl> se - > em_fd = grpc_fd_create ( fd , " listener " ) ; <nl> + grpc_pollset_add_fd ( & g_pollset , se - > em_fd ) ; <nl> se - > session_read_closure . cb = session_read_cb ; <nl> se - > session_read_closure . cb_arg = se ; <nl> grpc_fd_notify_on_read ( se - > em_fd , & se - > session_read_closure ) ; <nl> static int server_start ( server * sv ) { <nl> GPR_ASSERT ( listen ( fd , MAX_NUM_FD ) = = 0 ) ; <nl> <nl> sv - > em_fd = grpc_fd_create ( fd , " server " ) ; <nl> + grpc_pollset_add_fd ( & g_pollset , sv - > em_fd ) ; <nl> / * Register to be interested in reading from listen_fd . * / <nl> sv - > listen_closure . cb = listen_cb ; <nl> sv - > listen_closure . cb_arg = sv ; <nl> static int server_start ( server * sv ) { <nl> <nl> / * Wait and shutdown a sever . * / <nl> static void server_wait_and_shutdown ( server * sv ) { <nl> - gpr_mu_lock ( & sv - > mu ) ; <nl> - while ( ! sv - > done ) gpr_cv_wait ( & sv - > done_cv , & sv - > mu , gpr_inf_future ) ; <nl> - gpr_mu_unlock ( & sv - > mu ) ; <nl> - <nl> - gpr_mu_destroy ( & sv - > mu ) ; <nl> - gpr_cv_destroy ( & sv - > done_cv ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + while ( ! sv - > done ) { <nl> + grpc_pollset_work ( & g_pollset , gpr_inf_future ) ; <nl> + } <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> } <nl> <nl> / * = = = An upload client to test notify_on_write = = = * / <nl> typedef struct { <nl> notify_on_write to schedule another write . * / <nl> int client_write_cnt ; <nl> <nl> - gpr_mu mu ; / * protect done and done_cv * / <nl> - gpr_cv done_cv ; / * signaled when a client finishes sending * / <nl> - int done ; / * set to 1 when a client finishes sending * / <nl> + int done ; / * set to 1 when a client finishes sending * / <nl> grpc_iomgr_closure write_closure ; <nl> } client ; <nl> <nl> static void client_init ( client * cl ) { <nl> memset ( cl - > write_buf , 0 , sizeof ( cl - > write_buf ) ) ; <nl> cl - > write_bytes_total = 0 ; <nl> cl - > client_write_cnt = 0 ; <nl> - gpr_mu_init ( & cl - > mu ) ; <nl> - gpr_cv_init ( & cl - > done_cv ) ; <nl> cl - > done = 0 ; <nl> } <nl> <nl> / * Called when a client upload session is ready to shutdown . * / <nl> static void client_session_shutdown_cb ( void * arg / * client * / , int success ) { <nl> client * cl = arg ; <nl> - grpc_fd_orphan ( cl - > em_fd , NULL , NULL ) ; <nl> + grpc_fd_orphan ( cl - > em_fd , NULL , " c " ) ; <nl> cl - > done = 1 ; <nl> - gpr_cv_signal ( & cl - > done_cv ) ; <nl> + grpc_pollset_kick ( & g_pollset ) ; <nl> } <nl> <nl> / * Write as much as possible , then register notify_on_write . * / <nl> static void client_session_write ( void * arg , / * client * / <nl> ssize_t write_once = 0 ; <nl> <nl> if ( ! success ) { <nl> - gpr_mu_lock ( & cl - > mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> client_session_shutdown_cb ( arg , 1 ) ; <nl> - gpr_mu_unlock ( & cl - > mu ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> return ; <nl> } <nl> <nl> static void client_session_write ( void * arg , / * client * / <nl> } while ( write_once > 0 ) ; <nl> <nl> if ( errno = = EAGAIN ) { <nl> - gpr_mu_lock ( & cl - > mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> if ( cl - > client_write_cnt < CLIENT_TOTAL_WRITE_CNT ) { <nl> cl - > write_closure . cb = client_session_write ; <nl> cl - > write_closure . cb_arg = cl ; <nl> static void client_session_write ( void * arg , / * client * / <nl> } else { <nl> client_session_shutdown_cb ( arg , 1 ) ; <nl> } <nl> - gpr_mu_unlock ( & cl - > mu ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> } else { <nl> gpr_log ( GPR_ERROR , " unknown errno % s " , strerror ( errno ) ) ; <nl> abort ( ) ; <nl> static void client_start ( client * cl , int port ) { <nl> } <nl> <nl> cl - > em_fd = grpc_fd_create ( fd , " client " ) ; <nl> + grpc_pollset_add_fd ( & g_pollset , cl - > em_fd ) ; <nl> <nl> client_session_write ( cl , 1 ) ; <nl> } <nl> <nl> / * Wait for the signal to shutdown a client . * / <nl> static void client_wait_and_shutdown ( client * cl ) { <nl> - gpr_mu_lock ( & cl - > mu ) ; <nl> - while ( ! cl - > done ) gpr_cv_wait ( & cl - > done_cv , & cl - > mu , gpr_inf_future ) ; <nl> - gpr_mu_unlock ( & cl - > mu ) ; <nl> - <nl> - gpr_mu_destroy ( & cl - > mu ) ; <nl> - gpr_cv_destroy ( & cl - > done_cv ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + while ( ! cl - > done ) { <nl> + grpc_pollset_work ( & g_pollset , gpr_inf_future ) ; <nl> + } <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> } <nl> <nl> / * Test grpc_fd . Start an upload server and client , upload a stream of <nl> static void test_grpc_fd ( void ) { <nl> } <nl> <nl> typedef struct fd_change_data { <nl> - gpr_mu mu ; <nl> - gpr_cv cv ; <nl> void ( * cb_that_ran ) ( void * , int success ) ; <nl> } fd_change_data ; <nl> <nl> - void init_change_data ( fd_change_data * fdc ) { <nl> - gpr_mu_init ( & fdc - > mu ) ; <nl> - gpr_cv_init ( & fdc - > cv ) ; <nl> - fdc - > cb_that_ran = NULL ; <nl> - } <nl> + void init_change_data ( fd_change_data * fdc ) { fdc - > cb_that_ran = NULL ; } <nl> <nl> - void destroy_change_data ( fd_change_data * fdc ) { <nl> - gpr_mu_destroy ( & fdc - > mu ) ; <nl> - gpr_cv_destroy ( & fdc - > cv ) ; <nl> - } <nl> + void destroy_change_data ( fd_change_data * fdc ) { } <nl> <nl> static void first_read_callback ( void * arg / * fd_change_data * / , int success ) { <nl> fd_change_data * fdc = arg ; <nl> <nl> - gpr_mu_lock ( & fdc - > mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> fdc - > cb_that_ran = first_read_callback ; <nl> - gpr_cv_signal ( & fdc - > cv ) ; <nl> - gpr_mu_unlock ( & fdc - > mu ) ; <nl> + grpc_pollset_kick ( & g_pollset ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> } <nl> <nl> static void second_read_callback ( void * arg / * fd_change_data * / , int success ) { <nl> fd_change_data * fdc = arg ; <nl> <nl> - gpr_mu_lock ( & fdc - > mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> fdc - > cb_that_ran = second_read_callback ; <nl> - gpr_cv_signal ( & fdc - > cv ) ; <nl> - gpr_mu_unlock ( & fdc - > mu ) ; <nl> + grpc_pollset_kick ( & g_pollset ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> } <nl> <nl> / * Test that changing the callback we use for notify_on_read actually works . <nl> static void test_grpc_fd_change ( void ) { <nl> GPR_ASSERT ( fcntl ( sv [ 1 ] , F_SETFL , flags | O_NONBLOCK ) = = 0 ) ; <nl> <nl> em_fd = grpc_fd_create ( sv [ 0 ] , " test_grpc_fd_change " ) ; <nl> + grpc_pollset_add_fd ( & g_pollset , em_fd ) ; <nl> <nl> / * Register the first callback , then make its FD readable * / <nl> grpc_fd_notify_on_read ( em_fd , & first_closure ) ; <nl> static void test_grpc_fd_change ( void ) { <nl> GPR_ASSERT ( result = = 1 ) ; <nl> <nl> / * And now wait for it to run . * / <nl> - gpr_mu_lock ( & a . mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> while ( a . cb_that_ran = = NULL ) { <nl> - gpr_cv_wait ( & a . cv , & a . mu , gpr_inf_future ) ; <nl> + grpc_pollset_work ( & g_pollset , gpr_inf_future ) ; <nl> } <nl> GPR_ASSERT ( a . cb_that_ran = = first_read_callback ) ; <nl> - gpr_mu_unlock ( & a . mu ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> <nl> / * And drain the socket so we can generate a new read edge * / <nl> result = read ( sv [ 0 ] , & data , 1 ) ; <nl> static void test_grpc_fd_change ( void ) { <nl> result = write ( sv [ 1 ] , & data , 1 ) ; <nl> GPR_ASSERT ( result = = 1 ) ; <nl> <nl> - gpr_mu_lock ( & b . mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> while ( b . cb_that_ran = = NULL ) { <nl> - gpr_cv_wait ( & b . cv , & b . mu , gpr_inf_future ) ; <nl> + grpc_pollset_work ( & g_pollset , gpr_inf_future ) ; <nl> } <nl> / * Except now we verify that second_read_callback ran instead * / <nl> GPR_ASSERT ( b . cb_that_ran = = second_read_callback ) ; <nl> - gpr_mu_unlock ( & b . mu ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> <nl> - grpc_fd_orphan ( em_fd , NULL , NULL ) ; <nl> + grpc_fd_orphan ( em_fd , NULL , " d " ) ; <nl> destroy_change_data ( & a ) ; <nl> destroy_change_data ( & b ) ; <nl> close ( sv [ 1 ] ) ; <nl> } <nl> <nl> + static void destroy_pollset ( void * p ) { grpc_pollset_destroy ( p ) ; } <nl> + <nl> int main ( int argc , char * * argv ) { <nl> grpc_test_init ( argc , argv ) ; <nl> grpc_iomgr_init ( ) ; <nl> + grpc_pollset_init ( & g_pollset ) ; <nl> test_grpc_fd ( ) ; <nl> test_grpc_fd_change ( ) ; <nl> + grpc_pollset_shutdown ( & g_pollset , destroy_pollset , & g_pollset ) ; <nl> grpc_iomgr_shutdown ( ) ; <nl> return 0 ; <nl> } <nl> mmm a / test / core / iomgr / poll_kick_posix_test . c <nl> ppp b / test / core / iomgr / poll_kick_posix_test . c <nl> <nl> * <nl> * / <nl> <nl> - # include " src / core / iomgr / pollset_kick . h " <nl> + # include " src / core / iomgr / pollset_kick_posix . h " <nl> <nl> # include < grpc / support / alloc . h > <nl> # include < grpc / support / log . h > <nl> static void test_allocation ( void ) { <nl> <nl> static void test_non_kick ( void ) { <nl> grpc_pollset_kick_state state ; <nl> - int fd ; <nl> + grpc_kick_fd_info * kfd ; <nl> <nl> grpc_pollset_kick_init ( & state ) ; <nl> - fd = grpc_pollset_kick_pre_poll ( & state ) ; <nl> - GPR_ASSERT ( fd > = 0 ) ; <nl> + kfd = grpc_pollset_kick_pre_poll ( & state ) ; <nl> + GPR_ASSERT ( kfd ! = NULL ) ; <nl> <nl> - grpc_pollset_kick_post_poll ( & state ) ; <nl> + grpc_pollset_kick_post_poll ( & state , kfd ) ; <nl> grpc_pollset_kick_destroy ( & state ) ; <nl> } <nl> <nl> static void test_basic_kick ( void ) { <nl> / * Kicked during poll * / <nl> grpc_pollset_kick_state state ; <nl> - int fd ; <nl> + grpc_kick_fd_info * kfd ; <nl> grpc_pollset_kick_init ( & state ) ; <nl> <nl> - fd = grpc_pollset_kick_pre_poll ( & state ) ; <nl> - GPR_ASSERT ( fd > = 0 ) ; <nl> + kfd = grpc_pollset_kick_pre_poll ( & state ) ; <nl> + GPR_ASSERT ( kfd ! = NULL ) ; <nl> <nl> grpc_pollset_kick_kick ( & state ) ; <nl> <nl> / * Now hypothetically we polled and found that we were kicked * / <nl> - grpc_pollset_kick_consume ( & state ) ; <nl> + grpc_pollset_kick_consume ( & state , kfd ) ; <nl> <nl> - grpc_pollset_kick_post_poll ( & state ) ; <nl> + grpc_pollset_kick_post_poll ( & state , kfd ) ; <nl> <nl> grpc_pollset_kick_destroy ( & state ) ; <nl> } <nl> static void test_basic_kick ( void ) { <nl> static void test_non_poll_kick ( void ) { <nl> / * Kick before entering poll * / <nl> grpc_pollset_kick_state state ; <nl> - int fd ; <nl> + grpc_kick_fd_info * kfd ; <nl> <nl> grpc_pollset_kick_init ( & state ) ; <nl> <nl> grpc_pollset_kick_kick ( & state ) ; <nl> - fd = grpc_pollset_kick_pre_poll ( & state ) ; <nl> - GPR_ASSERT ( fd < 0 ) ; <nl> + kfd = grpc_pollset_kick_pre_poll ( & state ) ; <nl> + GPR_ASSERT ( kfd = = NULL ) ; <nl> grpc_pollset_kick_destroy ( & state ) ; <nl> } <nl> <nl> static void test_non_poll_kick ( void ) { <nl> static void test_over_free ( void ) { <nl> / * Check high watermark pipe free logic * / <nl> int i ; <nl> - struct grpc_pollset_kick_state * kick_state = <nl> - gpr_malloc ( sizeof ( grpc_pollset_kick_state ) * GRPC_MAX_CACHED_PIPES ) ; <nl> + grpc_kick_fd_info * * kfds = <nl> + gpr_malloc ( sizeof ( grpc_kick_fd_info * ) * GRPC_MAX_CACHED_PIPES ) ; <nl> + grpc_pollset_kick_state state ; <nl> + grpc_pollset_kick_init ( & state ) ; <nl> for ( i = 0 ; i < GRPC_MAX_CACHED_PIPES ; + + i ) { <nl> - int fd ; <nl> - grpc_pollset_kick_init ( & kick_state [ i ] ) ; <nl> - fd = grpc_pollset_kick_pre_poll ( & kick_state [ i ] ) ; <nl> - GPR_ASSERT ( fd > = 0 ) ; <nl> + kfds [ i ] = grpc_pollset_kick_pre_poll ( & state ) ; <nl> + GPR_ASSERT ( kfds [ i ] ! = NULL ) ; <nl> } <nl> <nl> for ( i = 0 ; i < GRPC_MAX_CACHED_PIPES ; + + i ) { <nl> - grpc_pollset_kick_post_poll ( & kick_state [ i ] ) ; <nl> - grpc_pollset_kick_destroy ( & kick_state [ i ] ) ; <nl> + grpc_pollset_kick_post_poll ( & state , kfds [ i ] ) ; <nl> } <nl> - gpr_free ( kick_state ) ; <nl> + grpc_pollset_kick_destroy ( & state ) ; <nl> + gpr_free ( kfds ) ; <nl> } <nl> <nl> static void run_tests ( void ) { <nl> mmm a / test / core / iomgr / tcp_client_posix_test . c <nl> ppp b / test / core / iomgr / tcp_client_posix_test . c <nl> <nl> # include < grpc / support / time . h > <nl> # include " test / core / util / test_config . h " <nl> <nl> + static grpc_pollset_set g_pollset_set ; <nl> + static grpc_pollset g_pollset ; <nl> + static int g_connections_complete = 0 ; <nl> + <nl> static gpr_timespec test_deadline ( void ) { <nl> return GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 10 ) ; <nl> } <nl> <nl> + static void finish_connection ( ) { <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + g_connections_complete + + ; <nl> + grpc_pollset_kick ( & g_pollset ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + } <nl> + <nl> static void must_succeed ( void * arg , grpc_endpoint * tcp ) { <nl> GPR_ASSERT ( tcp ) ; <nl> grpc_endpoint_shutdown ( tcp ) ; <nl> grpc_endpoint_destroy ( tcp ) ; <nl> - gpr_event_set ( arg , ( void * ) 1 ) ; <nl> + finish_connection ( ) ; <nl> } <nl> <nl> static void must_fail ( void * arg , grpc_endpoint * tcp ) { <nl> GPR_ASSERT ( ! tcp ) ; <nl> - gpr_event_set ( arg , ( void * ) 1 ) ; <nl> + finish_connection ( ) ; <nl> } <nl> <nl> void test_succeeds ( void ) { <nl> void test_succeeds ( void ) { <nl> socklen_t addr_len = sizeof ( addr ) ; <nl> int svr_fd ; <nl> int r ; <nl> - gpr_event ev ; <nl> - <nl> - gpr_event_init ( & ev ) ; <nl> + int connections_complete_before ; <nl> <nl> memset ( & addr , 0 , sizeof ( addr ) ) ; <nl> addr . sin_family = AF_INET ; <nl> void test_succeeds ( void ) { <nl> GPR_ASSERT ( 0 = = bind ( svr_fd , ( struct sockaddr * ) & addr , addr_len ) ) ; <nl> GPR_ASSERT ( 0 = = listen ( svr_fd , 1 ) ) ; <nl> <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + connections_complete_before = g_connections_complete ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + <nl> / * connect to it * / <nl> GPR_ASSERT ( getsockname ( svr_fd , ( struct sockaddr * ) & addr , & addr_len ) = = 0 ) ; <nl> - grpc_tcp_client_connect ( must_succeed , & ev , ( struct sockaddr * ) & addr , addr_len , <nl> - gpr_inf_future ) ; <nl> + grpc_tcp_client_connect ( must_succeed , NULL , & g_pollset_set , <nl> + ( struct sockaddr * ) & addr , addr_len , gpr_inf_future ) ; <nl> <nl> / * await the connection * / <nl> do { <nl> void test_succeeds ( void ) { <nl> GPR_ASSERT ( r > = 0 ) ; <nl> close ( r ) ; <nl> <nl> - / * wait for the connection callback to finish * / <nl> - GPR_ASSERT ( gpr_event_wait ( & ev , test_deadline ( ) ) ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + <nl> + while ( g_connections_complete = = connections_complete_before ) { <nl> + grpc_pollset_work ( & g_pollset , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) ; <nl> + } <nl> + <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> } <nl> <nl> void test_fails ( void ) { <nl> struct sockaddr_in addr ; <nl> socklen_t addr_len = sizeof ( addr ) ; <nl> - gpr_event ev ; <nl> - <nl> - gpr_event_init ( & ev ) ; <nl> + int connections_complete_before ; <nl> <nl> memset ( & addr , 0 , sizeof ( addr ) ) ; <nl> addr . sin_family = AF_INET ; <nl> <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + connections_complete_before = g_connections_complete ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + <nl> / * connect to a broken address * / <nl> - grpc_tcp_client_connect ( must_fail , & ev , ( struct sockaddr * ) & addr , addr_len , <nl> - gpr_inf_future ) ; <nl> + grpc_tcp_client_connect ( must_fail , NULL , & g_pollset_set , <nl> + ( struct sockaddr * ) & addr , addr_len , gpr_inf_future ) ; <nl> + <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> <nl> / * wait for the connection callback to finish * / <nl> - GPR_ASSERT ( gpr_event_wait ( & ev , test_deadline ( ) ) ) ; <nl> + while ( g_connections_complete = = connections_complete_before ) { <nl> + grpc_pollset_work ( & g_pollset , test_deadline ( ) ) ; <nl> + } <nl> + <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> } <nl> <nl> void test_times_out ( void ) { <nl> void test_times_out ( void ) { <nl> int client_fd [ NUM_CLIENT_CONNECTS ] ; <nl> int i ; <nl> int r ; <nl> - gpr_event ev ; <nl> + int connections_complete_before ; <nl> gpr_timespec connect_deadline ; <nl> <nl> - gpr_event_init ( & ev ) ; <nl> - <nl> memset ( & addr , 0 , sizeof ( addr ) ) ; <nl> addr . sin_family = AF_INET ; <nl> <nl> void test_times_out ( void ) { <nl> <nl> connect_deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 1 ) ; <nl> <nl> - grpc_tcp_client_connect ( must_fail , & ev , ( struct sockaddr * ) & addr , addr_len , <nl> - connect_deadline ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + connections_complete_before = g_connections_complete ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + <nl> + grpc_tcp_client_connect ( must_fail , NULL , & g_pollset_set , <nl> + ( struct sockaddr * ) & addr , addr_len , connect_deadline ) ; <nl> + <nl> / * Make sure the event doesn ' t trigger early * / <nl> - GPR_ASSERT ( ! gpr_event_wait ( & ev , GRPC_TIMEOUT_MILLIS_TO_DEADLINE ( 500 ) ) ) ; <nl> - / * Now wait until it should have triggered * / <nl> - sleep ( 1 ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + while ( gpr_time_cmp ( gpr_time_add ( connect_deadline , gpr_time_from_seconds ( 2 ) ) , <nl> + gpr_now ( ) ) > 0 ) { <nl> + int is_after_deadline = gpr_time_cmp ( connect_deadline , gpr_now ( ) ) < = 0 ; <nl> + if ( is_after_deadline & & <nl> + gpr_time_cmp ( gpr_time_add ( connect_deadline , gpr_time_from_seconds ( 1 ) ) , <nl> + gpr_now ( ) ) > 0 ) { <nl> + / * allow some slack before insisting that things be done * / <nl> + } else { <nl> + GPR_ASSERT ( g_connections_complete = = <nl> + connections_complete_before + is_after_deadline ) ; <nl> + } <nl> + grpc_pollset_work ( & g_pollset , GRPC_TIMEOUT_MILLIS_TO_DEADLINE ( 10 ) ) ; <nl> + } <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> <nl> - / * wait for the connection callback to finish * / <nl> - GPR_ASSERT ( gpr_event_wait ( & ev , test_deadline ( ) ) ) ; <nl> close ( svr_fd ) ; <nl> for ( i = 0 ; i < NUM_CLIENT_CONNECTS ; + + i ) { <nl> close ( client_fd [ i ] ) ; <nl> } <nl> } <nl> <nl> + static void destroy_pollset ( void * p ) { grpc_pollset_destroy ( p ) ; } <nl> + <nl> int main ( int argc , char * * argv ) { <nl> grpc_test_init ( argc , argv ) ; <nl> grpc_iomgr_init ( ) ; <nl> + grpc_pollset_set_init ( & g_pollset_set ) ; <nl> + grpc_pollset_init ( & g_pollset ) ; <nl> + grpc_pollset_set_add_pollset ( & g_pollset_set , & g_pollset ) ; <nl> test_succeeds ( ) ; <nl> gpr_log ( GPR_ERROR , " End of first test " ) ; <nl> test_fails ( ) ; <nl> test_times_out ( ) ; <nl> + grpc_pollset_set_destroy ( & g_pollset_set ) ; <nl> + grpc_pollset_shutdown ( & g_pollset , destroy_pollset , & g_pollset ) ; <nl> grpc_iomgr_shutdown ( ) ; <nl> return 0 ; <nl> } <nl> mmm a / test / core / iomgr / tcp_posix_test . c <nl> ppp b / test / core / iomgr / tcp_posix_test . c <nl> <nl> # include " test / core / util / test_config . h " <nl> # include " test / core / iomgr / endpoint_tests . h " <nl> <nl> + static grpc_pollset g_pollset ; <nl> + <nl> / * <nl> General test notes : <nl> <nl> static size_t fill_socket_partial ( int fd , size_t bytes ) { <nl> <nl> struct read_socket_state { <nl> grpc_endpoint * ep ; <nl> - gpr_mu mu ; <nl> - gpr_cv cv ; <nl> ssize_t read_bytes ; <nl> ssize_t target_read_bytes ; <nl> } ; <nl> static void read_cb ( void * user_data , gpr_slice * slices , size_t nslices , <nl> <nl> GPR_ASSERT ( error = = GRPC_ENDPOINT_CB_OK ) ; <nl> <nl> - gpr_mu_lock ( & state - > mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> current_data = state - > read_bytes % 256 ; <nl> read_bytes = count_and_unref_slices ( slices , nslices , & current_data ) ; <nl> state - > read_bytes + = read_bytes ; <nl> gpr_log ( GPR_INFO , " Read % d bytes of % d " , read_bytes , <nl> state - > target_read_bytes ) ; <nl> if ( state - > read_bytes > = state - > target_read_bytes ) { <nl> - gpr_cv_signal ( & state - > cv ) ; <nl> + / * empty * / <nl> } else { <nl> grpc_endpoint_notify_on_read ( state - > ep , read_cb , state ) ; <nl> } <nl> - gpr_mu_unlock ( & state - > mu ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> } <nl> <nl> / * Write to a socket , then read from it using the grpc_tcp API . * / <nl> static void read_test ( ssize_t num_bytes , ssize_t slice_size ) { <nl> create_sockets ( sv ) ; <nl> <nl> ep = grpc_tcp_create ( grpc_fd_create ( sv [ 1 ] , " read_test " ) , slice_size ) ; <nl> + grpc_endpoint_add_to_pollset ( ep , & g_pollset ) ; <nl> + <nl> written_bytes = fill_socket_partial ( sv [ 0 ] , num_bytes ) ; <nl> gpr_log ( GPR_INFO , " Wrote % d bytes " , written_bytes ) ; <nl> <nl> - gpr_mu_init ( & state . mu ) ; <nl> - gpr_cv_init ( & state . cv ) ; <nl> state . ep = ep ; <nl> state . read_bytes = 0 ; <nl> state . target_read_bytes = written_bytes ; <nl> <nl> grpc_endpoint_notify_on_read ( ep , read_cb , & state ) ; <nl> <nl> - gpr_mu_lock ( & state . mu ) ; <nl> - for ( ; ; ) { <nl> - GPR_ASSERT ( gpr_cv_wait ( & state . cv , & state . mu , deadline ) = = 0 ) ; <nl> - if ( state . read_bytes > = state . target_read_bytes ) { <nl> - break ; <nl> - } <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + while ( state . read_bytes < state . target_read_bytes ) { <nl> + grpc_pollset_work ( & g_pollset , deadline ) ; <nl> } <nl> GPR_ASSERT ( state . read_bytes = = state . target_read_bytes ) ; <nl> - gpr_mu_unlock ( & state . mu ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> <nl> grpc_endpoint_destroy ( ep ) ; <nl> - <nl> - gpr_mu_destroy ( & state . mu ) ; <nl> - gpr_cv_destroy ( & state . cv ) ; <nl> } <nl> <nl> / * Write to a socket until it fills up , then read from it using the grpc_tcp <nl> static void large_read_test ( ssize_t slice_size ) { <nl> create_sockets ( sv ) ; <nl> <nl> ep = grpc_tcp_create ( grpc_fd_create ( sv [ 1 ] , " large_read_test " ) , slice_size ) ; <nl> + grpc_endpoint_add_to_pollset ( ep , & g_pollset ) ; <nl> + <nl> written_bytes = fill_socket ( sv [ 0 ] ) ; <nl> gpr_log ( GPR_INFO , " Wrote % d bytes " , written_bytes ) ; <nl> <nl> - gpr_mu_init ( & state . mu ) ; <nl> - gpr_cv_init ( & state . cv ) ; <nl> state . ep = ep ; <nl> state . read_bytes = 0 ; <nl> state . target_read_bytes = written_bytes ; <nl> <nl> grpc_endpoint_notify_on_read ( ep , read_cb , & state ) ; <nl> <nl> - gpr_mu_lock ( & state . mu ) ; <nl> - for ( ; ; ) { <nl> - GPR_ASSERT ( gpr_cv_wait ( & state . cv , & state . mu , deadline ) = = 0 ) ; <nl> - if ( state . read_bytes > = state . target_read_bytes ) { <nl> - break ; <nl> - } <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + while ( state . read_bytes < state . target_read_bytes ) { <nl> + grpc_pollset_work ( & g_pollset , deadline ) ; <nl> } <nl> GPR_ASSERT ( state . read_bytes = = state . target_read_bytes ) ; <nl> - gpr_mu_unlock ( & state . mu ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> <nl> grpc_endpoint_destroy ( ep ) ; <nl> - <nl> - gpr_mu_destroy ( & state . mu ) ; <nl> - gpr_cv_destroy ( & state . cv ) ; <nl> } <nl> <nl> struct write_socket_state { <nl> grpc_endpoint * ep ; <nl> - gpr_mu mu ; <nl> - gpr_cv cv ; <nl> int write_done ; <nl> } ; <nl> <nl> static void write_done ( void * user_data / * write_socket_state * / , <nl> grpc_endpoint_cb_status error ) { <nl> struct write_socket_state * state = ( struct write_socket_state * ) user_data ; <nl> gpr_log ( GPR_INFO , " Write done callback called " ) ; <nl> - gpr_mu_lock ( & state - > mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> gpr_log ( GPR_INFO , " Signalling write done " ) ; <nl> state - > write_done = 1 ; <nl> - gpr_cv_signal ( & state - > cv ) ; <nl> - gpr_mu_unlock ( & state - > mu ) ; <nl> + grpc_pollset_kick ( & g_pollset ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> } <nl> <nl> void drain_socket_blocking ( int fd , size_t num_bytes , size_t read_size ) { <nl> void drain_socket_blocking ( int fd , size_t num_bytes , size_t read_size ) { <nl> GPR_ASSERT ( fcntl ( fd , F_SETFL , flags & ~ O_NONBLOCK ) = = 0 ) ; <nl> <nl> for ( ; ; ) { <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + grpc_pollset_work ( & g_pollset , GRPC_TIMEOUT_MILLIS_TO_DEADLINE ( 10 ) ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> do { <nl> bytes_read = <nl> read ( fd , buf , bytes_left > read_size ? read_size : bytes_left ) ; <nl> static void write_test ( ssize_t num_bytes , ssize_t slice_size ) { <nl> <nl> ep = grpc_tcp_create ( grpc_fd_create ( sv [ 1 ] , " write_test " ) , <nl> GRPC_TCP_DEFAULT_READ_SLICE_SIZE ) ; <nl> + grpc_endpoint_add_to_pollset ( ep , & g_pollset ) ; <nl> <nl> - gpr_mu_init ( & state . mu ) ; <nl> - gpr_cv_init ( & state . cv ) ; <nl> state . ep = ep ; <nl> state . write_done = 0 ; <nl> <nl> static void write_test ( ssize_t num_bytes , ssize_t slice_size ) { <nl> GPR_ASSERT ( read_bytes = = num_bytes ) ; <nl> } else { <nl> drain_socket_blocking ( sv [ 0 ] , num_bytes , num_bytes ) ; <nl> - gpr_mu_lock ( & state . mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> for ( ; ; ) { <nl> if ( state . write_done ) { <nl> break ; <nl> } <nl> - GPR_ASSERT ( gpr_cv_wait ( & state . cv , & state . mu , deadline ) = = 0 ) ; <nl> + grpc_pollset_work ( & g_pollset , deadline ) ; <nl> } <nl> - gpr_mu_unlock ( & state . mu ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> } <nl> <nl> grpc_endpoint_destroy ( ep ) ; <nl> - gpr_mu_destroy ( & state . mu ) ; <nl> - gpr_cv_destroy ( & state . cv ) ; <nl> gpr_free ( slices ) ; <nl> } <nl> <nl> static void write_error_test ( ssize_t num_bytes , ssize_t slice_size ) { <nl> <nl> ep = grpc_tcp_create ( grpc_fd_create ( sv [ 1 ] , " write_error_test " ) , <nl> GRPC_TCP_DEFAULT_READ_SLICE_SIZE ) ; <nl> + grpc_endpoint_add_to_pollset ( ep , & g_pollset ) ; <nl> + <nl> close ( sv [ 0 ] ) ; <nl> <nl> - gpr_mu_init ( & state . mu ) ; <nl> - gpr_cv_init ( & state . cv ) ; <nl> state . ep = ep ; <nl> state . write_done = 0 ; <nl> <nl> static void write_error_test ( ssize_t num_bytes , ssize_t slice_size ) { <nl> break ; <nl> case GRPC_ENDPOINT_WRITE_PENDING : <nl> grpc_endpoint_notify_on_read ( ep , read_done_for_write_error , NULL ) ; <nl> - gpr_mu_lock ( & state . mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> for ( ; ; ) { <nl> if ( state . write_done ) { <nl> break ; <nl> } <nl> - GPR_ASSERT ( gpr_cv_wait ( & state . cv , & state . mu , deadline ) = = 0 ) ; <nl> + grpc_pollset_work ( & g_pollset , deadline ) ; <nl> } <nl> - gpr_mu_unlock ( & state . mu ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> break ; <nl> } <nl> <nl> grpc_endpoint_destroy ( ep ) ; <nl> - gpr_mu_destroy ( & state . mu ) ; <nl> - gpr_cv_destroy ( & state . cv ) ; <nl> free ( slices ) ; <nl> } <nl> <nl> static grpc_endpoint_test_fixture create_fixture_tcp_socketpair ( <nl> grpc_tcp_create ( grpc_fd_create ( sv [ 0 ] , " fixture : client " ) , slice_size ) ; <nl> f . server_ep = <nl> grpc_tcp_create ( grpc_fd_create ( sv [ 1 ] , " fixture : server " ) , slice_size ) ; <nl> + grpc_endpoint_add_to_pollset ( f . client_ep , & g_pollset ) ; <nl> + grpc_endpoint_add_to_pollset ( f . server_ep , & g_pollset ) ; <nl> <nl> return f ; <nl> } <nl> static grpc_endpoint_test_config configs [ ] = { <nl> { " tcp / tcp_socketpair " , create_fixture_tcp_socketpair , clean_up } , <nl> } ; <nl> <nl> + static void destroy_pollset ( void * p ) { grpc_pollset_destroy ( p ) ; } <nl> + <nl> int main ( int argc , char * * argv ) { <nl> grpc_test_init ( argc , argv ) ; <nl> grpc_init ( ) ; <nl> + grpc_pollset_init ( & g_pollset ) ; <nl> run_tests ( ) ; <nl> - grpc_endpoint_tests ( configs [ 0 ] ) ; <nl> + grpc_endpoint_tests ( configs [ 0 ] , & g_pollset ) ; <nl> + grpc_pollset_shutdown ( & g_pollset , destroy_pollset , & g_pollset ) ; <nl> grpc_shutdown ( ) ; <nl> <nl> return 0 ; <nl> mmm a / test / core / iomgr / tcp_server_posix_test . c <nl> ppp b / test / core / iomgr / tcp_server_posix_test . c <nl> <nl> <nl> # define LOG_TEST ( x ) gpr_log ( GPR_INFO , " % s " , # x ) <nl> <nl> - static gpr_mu mu ; <nl> - static gpr_cv cv ; <nl> - static int nconnects = 0 ; <nl> + static grpc_pollset g_pollset ; <nl> + static int g_nconnects = 0 ; <nl> <nl> static void on_connect ( void * arg , grpc_endpoint * tcp ) { <nl> grpc_endpoint_shutdown ( tcp ) ; <nl> grpc_endpoint_destroy ( tcp ) ; <nl> <nl> - gpr_mu_lock ( & mu ) ; <nl> - nconnects + + ; <nl> - gpr_cv_broadcast ( & cv ) ; <nl> - gpr_mu_unlock ( & mu ) ; <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> + g_nconnects + + ; <nl> + grpc_pollset_kick ( & g_pollset ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> } <nl> <nl> static void test_no_op ( void ) { <nl> static void test_connect ( int n ) { <nl> grpc_tcp_server * s = grpc_tcp_server_create ( ) ; <nl> int nconnects_before ; <nl> gpr_timespec deadline ; <nl> + grpc_pollset * pollsets [ 1 ] ; <nl> int i ; <nl> LOG_TEST ( " test_connect " ) ; <nl> gpr_log ( GPR_INFO , " clients = % d " , n ) ; <nl> <nl> - gpr_mu_lock ( & mu ) ; <nl> - <nl> memset ( & addr , 0 , sizeof ( addr ) ) ; <nl> addr . ss_family = AF_INET ; <nl> GPR_ASSERT ( grpc_tcp_server_add_port ( s , ( struct sockaddr * ) & addr , addr_len ) ) ; <nl> static void test_connect ( int n ) { <nl> GPR_ASSERT ( getsockname ( svrfd , ( struct sockaddr * ) & addr , & addr_len ) = = 0 ) ; <nl> GPR_ASSERT ( addr_len < = sizeof ( addr ) ) ; <nl> <nl> - grpc_tcp_server_start ( s , NULL , 0 , on_connect , NULL ) ; <nl> + pollsets [ 0 ] = & g_pollset ; <nl> + grpc_tcp_server_start ( s , pollsets , 1 , on_connect , NULL ) ; <nl> + <nl> + gpr_mu_lock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> <nl> for ( i = 0 ; i < n ; i + + ) { <nl> - deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 1 ) ; <nl> + deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 4000 ) ; <nl> <nl> - nconnects_before = nconnects ; <nl> + nconnects_before = g_nconnects ; <nl> clifd = socket ( addr . ss_family , SOCK_STREAM , 0 ) ; <nl> GPR_ASSERT ( clifd > = 0 ) ; <nl> + gpr_log ( GPR_DEBUG , " start connect " ) ; <nl> GPR_ASSERT ( connect ( clifd , ( struct sockaddr * ) & addr , addr_len ) = = 0 ) ; <nl> <nl> - while ( nconnects = = nconnects_before ) { <nl> - GPR_ASSERT ( gpr_cv_wait ( & cv , & mu , deadline ) = = 0 ) ; <nl> + gpr_log ( GPR_DEBUG , " wait " ) ; <nl> + while ( g_nconnects = = nconnects_before & & <nl> + gpr_time_cmp ( deadline , gpr_now ( ) ) > 0 ) { <nl> + grpc_pollset_work ( & g_pollset , deadline ) ; <nl> } <nl> + gpr_log ( GPR_DEBUG , " wait done " ) ; <nl> <nl> - GPR_ASSERT ( nconnects = = nconnects_before + 1 ) ; <nl> + GPR_ASSERT ( g_nconnects = = nconnects_before + 1 ) ; <nl> close ( clifd ) ; <nl> - <nl> - if ( i ! = n - 1 ) { <nl> - sleep ( 1 ) ; <nl> - } <nl> } <nl> <nl> - gpr_mu_unlock ( & mu ) ; <nl> + gpr_mu_unlock ( GRPC_POLLSET_MU ( & g_pollset ) ) ; <nl> <nl> grpc_tcp_server_destroy ( s , NULL , NULL ) ; <nl> } <nl> <nl> + static void destroy_pollset ( void * p ) { grpc_pollset_destroy ( p ) ; } <nl> + <nl> int main ( int argc , char * * argv ) { <nl> grpc_test_init ( argc , argv ) ; <nl> grpc_iomgr_init ( ) ; <nl> - gpr_mu_init ( & mu ) ; <nl> - gpr_cv_init ( & cv ) ; <nl> + grpc_pollset_init ( & g_pollset ) ; <nl> <nl> test_no_op ( ) ; <nl> test_no_op_with_start ( ) ; <nl> int main ( int argc , char * * argv ) { <nl> test_connect ( 1 ) ; <nl> test_connect ( 10 ) ; <nl> <nl> + grpc_pollset_shutdown ( & g_pollset , destroy_pollset , & g_pollset ) ; <nl> grpc_iomgr_shutdown ( ) ; <nl> - gpr_mu_destroy ( & mu ) ; <nl> - gpr_cv_destroy ( & cv ) ; <nl> return 0 ; <nl> } <nl> mmm a / test / core / security / credentials_test . c <nl> ppp b / test / core / security / credentials_test . c <nl> static void test_oauth2_token_fetcher_creds_parsing_ok ( void ) { <nl> grpc_httpcli_response response = <nl> http_response ( 200 , valid_oauth2_json_response ) ; <nl> GPR_ASSERT ( grpc_oauth2_token_fetcher_credentials_parse_server_response ( <nl> - & response , & token_md , & token_lifetime ) = = <nl> - GRPC_CREDENTIALS_OK ) ; <nl> + & response , & token_md , & token_lifetime ) = = GRPC_CREDENTIALS_OK ) ; <nl> GPR_ASSERT ( token_lifetime . tv_sec = = 3599 ) ; <nl> GPR_ASSERT ( token_lifetime . tv_nsec = = 0 ) ; <nl> GPR_ASSERT ( token_md - > num_entries = = 1 ) ; <nl> static void test_iam_creds ( void ) { <nl> test_iam_authorization_token , test_iam_authority_selector ) ; <nl> GPR_ASSERT ( grpc_credentials_has_request_metadata ( creds ) ) ; <nl> GPR_ASSERT ( grpc_credentials_has_request_metadata_only ( creds ) ) ; <nl> - grpc_credentials_get_request_metadata ( creds , test_service_url , <nl> + grpc_credentials_get_request_metadata ( creds , NULL , test_service_url , <nl> check_iam_metadata , creds ) ; <nl> } <nl> <nl> static void test_ssl_oauth2_composite_creds ( void ) { <nl> grpc_composite_credentials_create ( ssl_creds , oauth2_creds ) ; <nl> grpc_credentials_unref ( ssl_creds ) ; <nl> grpc_credentials_unref ( oauth2_creds ) ; <nl> - GPR_ASSERT ( strcmp ( composite_creds - > type , <nl> - GRPC_CREDENTIALS_TYPE_COMPOSITE ) = = 0 ) ; <nl> + GPR_ASSERT ( strcmp ( composite_creds - > type , GRPC_CREDENTIALS_TYPE_COMPOSITE ) = = <nl> + 0 ) ; <nl> GPR_ASSERT ( grpc_credentials_has_request_metadata ( composite_creds ) ) ; <nl> GPR_ASSERT ( ! grpc_credentials_has_request_metadata_only ( composite_creds ) ) ; <nl> creds_array = grpc_composite_credentials_get_credentials ( composite_creds ) ; <nl> static void test_ssl_oauth2_composite_creds ( void ) { <nl> GRPC_CREDENTIALS_TYPE_SSL ) = = 0 ) ; <nl> GPR_ASSERT ( strcmp ( creds_array - > creds_array [ 1 ] - > type , <nl> GRPC_CREDENTIALS_TYPE_OAUTH2 ) = = 0 ) ; <nl> - grpc_credentials_get_request_metadata ( composite_creds , test_service_url , <nl> + grpc_credentials_get_request_metadata ( composite_creds , NULL , test_service_url , <nl> check_ssl_oauth2_composite_metadata , <nl> composite_creds ) ; <nl> } <nl> <nl> void test_ssl_fake_transport_security_composite_creds_failure ( void ) { <nl> - grpc_credentials * ssl_creds = <nl> - grpc_ssl_credentials_create ( NULL , NULL ) ; <nl> + grpc_credentials * ssl_creds = grpc_ssl_credentials_create ( NULL , NULL ) ; <nl> grpc_credentials * fake_transport_security_creds = <nl> grpc_fake_transport_security_credentials_create ( ) ; <nl> <nl> static void test_ssl_oauth2_iam_composite_creds ( void ) { <nl> grpc_credentials_unref ( oauth2_creds ) ; <nl> grpc_credentials_unref ( aux_creds ) ; <nl> grpc_credentials_unref ( iam_creds ) ; <nl> - GPR_ASSERT ( strcmp ( composite_creds - > type , <nl> - GRPC_CREDENTIALS_TYPE_COMPOSITE ) = = 0 ) ; <nl> + GPR_ASSERT ( strcmp ( composite_creds - > type , GRPC_CREDENTIALS_TYPE_COMPOSITE ) = = <nl> + 0 ) ; <nl> GPR_ASSERT ( grpc_credentials_has_request_metadata ( composite_creds ) ) ; <nl> GPR_ASSERT ( ! grpc_credentials_has_request_metadata_only ( composite_creds ) ) ; <nl> creds_array = grpc_composite_credentials_get_credentials ( composite_creds ) ; <nl> static void test_ssl_oauth2_iam_composite_creds ( void ) { <nl> GRPC_CREDENTIALS_TYPE_OAUTH2 ) = = 0 ) ; <nl> GPR_ASSERT ( strcmp ( creds_array - > creds_array [ 2 ] - > type , <nl> GRPC_CREDENTIALS_TYPE_IAM ) = = 0 ) ; <nl> - grpc_credentials_get_request_metadata ( composite_creds , test_service_url , <nl> + grpc_credentials_get_request_metadata ( composite_creds , NULL , test_service_url , <nl> check_ssl_oauth2_iam_composite_metadata , <nl> composite_creds ) ; <nl> } <nl> static void validate_compute_engine_http_request ( <nl> const grpc_httpcli_request * request ) { <nl> GPR_ASSERT ( ! request - > use_ssl ) ; <nl> GPR_ASSERT ( strcmp ( request - > host , " metadata " ) = = 0 ) ; <nl> - GPR_ASSERT ( strcmp ( request - > path , <nl> - " / computeMetadata / v1 / instance / service - accounts / default / token " ) <nl> - = = 0 ) ; <nl> + GPR_ASSERT ( <nl> + strcmp ( request - > path , <nl> + " / computeMetadata / v1 / instance / service - accounts / default / token " ) = = <nl> + 0 ) ; <nl> GPR_ASSERT ( request - > hdr_count = = 1 ) ; <nl> GPR_ASSERT ( strcmp ( request - > hdrs [ 0 ] . key , " Metadata - Flavor " ) = = 0 ) ; <nl> GPR_ASSERT ( strcmp ( request - > hdrs [ 0 ] . value , " Google " ) = = 0 ) ; <nl> static void test_compute_engine_creds_success ( void ) { <nl> / * First request : http get should be called . * / <nl> grpc_httpcli_set_override ( compute_engine_httpcli_get_success_override , <nl> httpcli_post_should_not_be_called ) ; <nl> - grpc_credentials_get_request_metadata ( compute_engine_creds , test_service_url , <nl> - on_oauth2_creds_get_metadata_success , <nl> - ( void * ) test_user_data ) ; <nl> + grpc_credentials_get_request_metadata ( <nl> + compute_engine_creds , NULL , test_service_url , <nl> + on_oauth2_creds_get_metadata_success , ( void * ) test_user_data ) ; <nl> <nl> / * Second request : the cached token should be served directly . * / <nl> grpc_httpcli_set_override ( httpcli_get_should_not_be_called , <nl> httpcli_post_should_not_be_called ) ; <nl> - grpc_credentials_get_request_metadata ( compute_engine_creds , test_service_url , <nl> - on_oauth2_creds_get_metadata_success , <nl> - ( void * ) test_user_data ) ; <nl> + grpc_credentials_get_request_metadata ( <nl> + compute_engine_creds , NULL , test_service_url , <nl> + on_oauth2_creds_get_metadata_success , ( void * ) test_user_data ) ; <nl> <nl> grpc_credentials_unref ( compute_engine_creds ) ; <nl> grpc_httpcli_set_override ( NULL , NULL ) ; <nl> static void test_compute_engine_creds_failure ( void ) { <nl> httpcli_post_should_not_be_called ) ; <nl> GPR_ASSERT ( grpc_credentials_has_request_metadata ( compute_engine_creds ) ) ; <nl> GPR_ASSERT ( grpc_credentials_has_request_metadata_only ( compute_engine_creds ) ) ; <nl> - grpc_credentials_get_request_metadata ( compute_engine_creds , test_service_url , <nl> - on_oauth2_creds_get_metadata_failure , <nl> - ( void * ) test_user_data ) ; <nl> + grpc_credentials_get_request_metadata ( <nl> + compute_engine_creds , NULL , test_service_url , <nl> + on_oauth2_creds_get_metadata_failure , ( void * ) test_user_data ) ; <nl> grpc_credentials_unref ( compute_engine_creds ) ; <nl> grpc_httpcli_set_override ( NULL , NULL ) ; <nl> } <nl> static void validate_refresh_token_http_request ( <nl> GPR_ASSERT ( strcmp ( request - > path , GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH ) = = 0 ) ; <nl> GPR_ASSERT ( request - > hdr_count = = 1 ) ; <nl> GPR_ASSERT ( strcmp ( request - > hdrs [ 0 ] . key , " Content - Type " ) = = 0 ) ; <nl> - GPR_ASSERT ( strcmp ( request - > hdrs [ 0 ] . value , <nl> - " application / x - www - form - urlencoded " ) = = 0 ) ; <nl> + GPR_ASSERT ( <nl> + strcmp ( request - > hdrs [ 0 ] . value , " application / x - www - form - urlencoded " ) = = 0 ) ; <nl> } <nl> <nl> static int refresh_token_httpcli_post_success ( <nl> static void test_refresh_token_creds_success ( void ) { <nl> / * First request : http get should be called . * / <nl> grpc_httpcli_set_override ( httpcli_get_should_not_be_called , <nl> refresh_token_httpcli_post_success ) ; <nl> - grpc_credentials_get_request_metadata ( refresh_token_creds , test_service_url , <nl> - on_oauth2_creds_get_metadata_success , <nl> - ( void * ) test_user_data ) ; <nl> + grpc_credentials_get_request_metadata ( <nl> + refresh_token_creds , NULL , test_service_url , <nl> + on_oauth2_creds_get_metadata_success , ( void * ) test_user_data ) ; <nl> <nl> / * Second request : the cached token should be served directly . * / <nl> grpc_httpcli_set_override ( httpcli_get_should_not_be_called , <nl> httpcli_post_should_not_be_called ) ; <nl> - grpc_credentials_get_request_metadata ( refresh_token_creds , test_service_url , <nl> - on_oauth2_creds_get_metadata_success , <nl> - ( void * ) test_user_data ) ; <nl> + grpc_credentials_get_request_metadata ( <nl> + refresh_token_creds , NULL , test_service_url , <nl> + on_oauth2_creds_get_metadata_success , ( void * ) test_user_data ) ; <nl> <nl> grpc_credentials_unref ( refresh_token_creds ) ; <nl> grpc_httpcli_set_override ( NULL , NULL ) ; <nl> static void test_refresh_token_creds_failure ( void ) { <nl> refresh_token_httpcli_post_failure ) ; <nl> GPR_ASSERT ( grpc_credentials_has_request_metadata ( refresh_token_creds ) ) ; <nl> GPR_ASSERT ( grpc_credentials_has_request_metadata_only ( refresh_token_creds ) ) ; <nl> - grpc_credentials_get_request_metadata ( refresh_token_creds , test_service_url , <nl> - on_oauth2_creds_get_metadata_failure , <nl> - ( void * ) test_user_data ) ; <nl> + grpc_credentials_get_request_metadata ( <nl> + refresh_token_creds , NULL , test_service_url , <nl> + on_oauth2_creds_get_metadata_failure , ( void * ) test_user_data ) ; <nl> grpc_credentials_unref ( refresh_token_creds ) ; <nl> grpc_httpcli_set_override ( NULL , NULL ) ; <nl> } <nl> static void validate_service_account_http_request ( <nl> char * expected_body = NULL ; <nl> GPR_ASSERT ( body ! = NULL ) ; <nl> GPR_ASSERT ( body_size ! = 0 ) ; <nl> - gpr_asprintf ( & expected_body , " % s % s " , <nl> - GRPC_SERVICE_ACCOUNT_POST_BODY_PREFIX , test_signed_jwt ) ; <nl> + gpr_asprintf ( & expected_body , " % s % s " , GRPC_SERVICE_ACCOUNT_POST_BODY_PREFIX , <nl> + test_signed_jwt ) ; <nl> GPR_ASSERT ( strlen ( expected_body ) = = body_size ) ; <nl> GPR_ASSERT ( memcmp ( expected_body , body , body_size ) = = 0 ) ; <nl> gpr_free ( expected_body ) ; <nl> static void validate_service_account_http_request ( <nl> GPR_ASSERT ( strcmp ( request - > path , GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH ) = = 0 ) ; <nl> GPR_ASSERT ( request - > hdr_count = = 1 ) ; <nl> GPR_ASSERT ( strcmp ( request - > hdrs [ 0 ] . key , " Content - Type " ) = = 0 ) ; <nl> - GPR_ASSERT ( strcmp ( request - > hdrs [ 0 ] . value , <nl> - " application / x - www - form - urlencoded " ) = = 0 ) ; <nl> + GPR_ASSERT ( <nl> + strcmp ( request - > hdrs [ 0 ] . value , " application / x - www - form - urlencoded " ) = = 0 ) ; <nl> } <nl> <nl> static int service_account_httpcli_post_success ( <nl> static void test_service_account_creds_success ( void ) { <nl> grpc_jwt_encode_and_sign_set_override ( encode_and_sign_jwt_success ) ; <nl> grpc_httpcli_set_override ( httpcli_get_should_not_be_called , <nl> service_account_httpcli_post_success ) ; <nl> - grpc_credentials_get_request_metadata ( service_account_creds , test_service_url , <nl> - on_oauth2_creds_get_metadata_success , <nl> - ( void * ) test_user_data ) ; <nl> + grpc_credentials_get_request_metadata ( <nl> + service_account_creds , NULL , test_service_url , <nl> + on_oauth2_creds_get_metadata_success , ( void * ) test_user_data ) ; <nl> <nl> / * Second request : the cached token should be served directly . * / <nl> grpc_jwt_encode_and_sign_set_override ( <nl> encode_and_sign_jwt_should_not_be_called ) ; <nl> grpc_httpcli_set_override ( httpcli_get_should_not_be_called , <nl> httpcli_post_should_not_be_called ) ; <nl> - grpc_credentials_get_request_metadata ( service_account_creds , test_service_url , <nl> - on_oauth2_creds_get_metadata_success , <nl> - ( void * ) test_user_data ) ; <nl> + grpc_credentials_get_request_metadata ( <nl> + service_account_creds , NULL , test_service_url , <nl> + on_oauth2_creds_get_metadata_success , ( void * ) test_user_data ) ; <nl> <nl> gpr_free ( json_key_string ) ; <nl> grpc_credentials_unref ( service_account_creds ) ; <nl> static void test_service_account_creds_http_failure ( void ) { <nl> grpc_jwt_encode_and_sign_set_override ( encode_and_sign_jwt_success ) ; <nl> grpc_httpcli_set_override ( httpcli_get_should_not_be_called , <nl> service_account_httpcli_post_failure ) ; <nl> - grpc_credentials_get_request_metadata ( service_account_creds , test_service_url , <nl> - on_oauth2_creds_get_metadata_failure , <nl> - ( void * ) test_user_data ) ; <nl> + grpc_credentials_get_request_metadata ( <nl> + service_account_creds , NULL , test_service_url , <nl> + on_oauth2_creds_get_metadata_failure , ( void * ) test_user_data ) ; <nl> <nl> gpr_free ( json_key_string ) ; <nl> grpc_credentials_unref ( service_account_creds ) ; <nl> static void test_service_account_creds_signing_failure ( void ) { <nl> grpc_jwt_encode_and_sign_set_override ( encode_and_sign_jwt_failure ) ; <nl> grpc_httpcli_set_override ( httpcli_get_should_not_be_called , <nl> httpcli_post_should_not_be_called ) ; <nl> - grpc_credentials_get_request_metadata ( service_account_creds , test_service_url , <nl> - on_oauth2_creds_get_metadata_failure , <nl> - ( void * ) test_user_data ) ; <nl> + grpc_credentials_get_request_metadata ( <nl> + service_account_creds , NULL , test_service_url , <nl> + on_oauth2_creds_get_metadata_failure , ( void * ) test_user_data ) ; <nl> <nl> gpr_free ( json_key_string ) ; <nl> grpc_credentials_unref ( service_account_creds ) ; <nl> static void test_jwt_creds_success ( void ) { <nl> <nl> / * First request : jwt_encode_and_sign should be called . * / <nl> grpc_jwt_encode_and_sign_set_override ( encode_and_sign_jwt_success ) ; <nl> - grpc_credentials_get_request_metadata ( jwt_creds , test_service_url , <nl> + grpc_credentials_get_request_metadata ( jwt_creds , NULL , test_service_url , <nl> on_jwt_creds_get_metadata_success , <nl> ( void * ) test_user_data ) ; <nl> <nl> / * Second request : the cached token should be served directly . * / <nl> grpc_jwt_encode_and_sign_set_override ( <nl> encode_and_sign_jwt_should_not_be_called ) ; <nl> - grpc_credentials_get_request_metadata ( jwt_creds , test_service_url , <nl> + grpc_credentials_get_request_metadata ( jwt_creds , NULL , test_service_url , <nl> on_jwt_creds_get_metadata_success , <nl> ( void * ) test_user_data ) ; <nl> <nl> / * Third request : Different service url so jwt_encode_and_sign should be <nl> called again ( no caching ) . * / <nl> grpc_jwt_encode_and_sign_set_override ( encode_and_sign_jwt_success ) ; <nl> - grpc_credentials_get_request_metadata ( jwt_creds , other_test_service_url , <nl> + grpc_credentials_get_request_metadata ( jwt_creds , NULL , other_test_service_url , <nl> on_jwt_creds_get_metadata_success , <nl> ( void * ) test_user_data ) ; <nl> <nl> static void test_jwt_creds_signing_failure ( void ) { <nl> GPR_ASSERT ( grpc_credentials_has_request_metadata_only ( jwt_creds ) ) ; <nl> <nl> grpc_jwt_encode_and_sign_set_override ( encode_and_sign_jwt_failure ) ; <nl> - grpc_credentials_get_request_metadata ( jwt_creds , test_service_url , <nl> + grpc_credentials_get_request_metadata ( jwt_creds , NULL , test_service_url , <nl> on_jwt_creds_get_metadata_failure , <nl> ( void * ) test_user_data ) ; <nl> <nl> mmm a / test / core / security / secure_endpoint_test . c <nl> ppp b / test / core / security / secure_endpoint_test . c <nl> <nl> # include " test / core / util / test_config . h " <nl> # include " src / core / tsi / fake_transport_security . h " <nl> <nl> + static grpc_pollset g_pollset ; <nl> + <nl> static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair ( <nl> size_t slice_size , gpr_slice * leftover_slices , size_t leftover_nslices ) { <nl> tsi_frame_protector * fake_read_protector = tsi_create_fake_protector ( NULL ) ; <nl> static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair ( <nl> grpc_endpoint_pair tcp ; <nl> <nl> tcp = grpc_iomgr_create_endpoint_pair ( " fixture " , slice_size ) ; <nl> + grpc_endpoint_add_to_pollset ( tcp . client , & g_pollset ) ; <nl> + grpc_endpoint_add_to_pollset ( tcp . server , & g_pollset ) ; <nl> <nl> if ( leftover_nslices = = 0 ) { <nl> f . client_ep = <nl> static void test_destroy_ep_early ( grpc_endpoint_test_config config , <nl> clean_up ( ) ; <nl> } <nl> <nl> + static void destroy_pollset ( void * p ) { grpc_pollset_destroy ( p ) ; } <nl> + <nl> int main ( int argc , char * * argv ) { <nl> grpc_test_init ( argc , argv ) ; <nl> <nl> grpc_iomgr_init ( ) ; <nl> - grpc_endpoint_tests ( configs [ 0 ] ) ; <nl> + grpc_pollset_init ( & g_pollset ) ; <nl> + grpc_endpoint_tests ( configs [ 0 ] , & g_pollset ) ; <nl> test_leftover ( configs [ 1 ] , 1 ) ; <nl> test_destroy_ep_early ( configs [ 1 ] , 1 ) ; <nl> + grpc_pollset_shutdown ( & g_pollset , destroy_pollset , & g_pollset ) ; <nl> grpc_iomgr_shutdown ( ) ; <nl> <nl> return 0 ; <nl> mmm a / test / core / surface / byte_buffer_reader_test . c <nl> ppp b / test / core / surface / byte_buffer_reader_test . c <nl> static void read_compressed_slice ( grpc_compression_algorithm algorithm , <nl> <nl> input_slice = gpr_slice_malloc ( input_size ) ; <nl> memset ( GPR_SLICE_START_PTR ( input_slice ) , ' a ' , input_size ) ; <nl> - gpr_slice_buffer_add ( & sliceb_in , input_slice ) ; / * takes ownership * / <nl> + gpr_slice_buffer_add ( & sliceb_in , input_slice ) ; / * takes ownership * / <nl> GPR_ASSERT ( grpc_msg_compress ( algorithm , & sliceb_in , & sliceb_out ) ) ; <nl> <nl> - buffer = grpc_raw_compressed_byte_buffer_create ( <nl> - sliceb_out . slices , sliceb_out . count , algorithm ) ; <nl> + buffer = grpc_raw_compressed_byte_buffer_create ( sliceb_out . slices , <nl> + sliceb_out . count , algorithm ) ; <nl> grpc_byte_buffer_reader_init ( & reader , buffer ) ; <nl> <nl> while ( grpc_byte_buffer_reader_next ( & reader , & read_slice ) ) { <nl> mmm a / test / core / surface / completion_queue_test . c <nl> ppp b / test / core / surface / completion_queue_test . c <nl> static void test_shutdown_then_next_polling ( void ) { <nl> <nl> cc = grpc_completion_queue_create ( ) ; <nl> grpc_completion_queue_shutdown ( cc ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_next ( cc , gpr_inf_past ) . type = = GRPC_QUEUE_SHUTDOWN ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_next ( cc , gpr_inf_past ) . type = = <nl> + GRPC_QUEUE_SHUTDOWN ) ; <nl> grpc_completion_queue_destroy ( cc ) ; <nl> } <nl> <nl> static void test_shutdown_then_next_with_timeout ( void ) { <nl> <nl> cc = grpc_completion_queue_create ( ) ; <nl> grpc_completion_queue_shutdown ( cc ) ; <nl> - GPR_ASSERT ( grpc_completion_queue_next ( cc , gpr_inf_future ) . type = = GRPC_QUEUE_SHUTDOWN ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_next ( cc , gpr_inf_future ) . type = = <nl> + GRPC_QUEUE_SHUTDOWN ) ; <nl> grpc_completion_queue_destroy ( cc ) ; <nl> } <nl> <nl> static void producer_thread ( void * arg ) { <nl> int i ; <nl> <nl> gpr_log ( GPR_INFO , " producer % d started " , opt - > id ) ; <nl> - gpr_event_set ( & opt - > on_started , ( void * ) ( gpr_intptr ) 1 ) ; <nl> + gpr_event_set ( & opt - > on_started , ( void * ) ( gpr_intptr ) 1 ) ; <nl> GPR_ASSERT ( gpr_event_wait ( opt - > phase1 , ten_seconds_time ( ) ) ) ; <nl> <nl> gpr_log ( GPR_INFO , " producer % d phase 1 " , opt - > id ) ; <nl> static void producer_thread ( void * arg ) { <nl> } <nl> <nl> gpr_log ( GPR_INFO , " producer % d phase 1 done " , opt - > id ) ; <nl> - gpr_event_set ( & opt - > on_phase1_done , ( void * ) ( gpr_intptr ) 1 ) ; <nl> + gpr_event_set ( & opt - > on_phase1_done , ( void * ) ( gpr_intptr ) 1 ) ; <nl> GPR_ASSERT ( gpr_event_wait ( opt - > phase2 , ten_seconds_time ( ) ) ) ; <nl> <nl> gpr_log ( GPR_INFO , " producer % d phase 2 " , opt - > id ) ; <nl> static void producer_thread ( void * arg ) { <nl> } <nl> <nl> gpr_log ( GPR_INFO , " producer % d phase 2 done " , opt - > id ) ; <nl> - gpr_event_set ( & opt - > on_finished , ( void * ) ( gpr_intptr ) 1 ) ; <nl> + gpr_event_set ( & opt - > on_finished , ( void * ) ( gpr_intptr ) 1 ) ; <nl> } <nl> <nl> static void consumer_thread ( void * arg ) { <nl> static void consumer_thread ( void * arg ) { <nl> grpc_event ev ; <nl> <nl> gpr_log ( GPR_INFO , " consumer % d started " , opt - > id ) ; <nl> - gpr_event_set ( & opt - > on_started , ( void * ) ( gpr_intptr ) 1 ) ; <nl> + gpr_event_set ( & opt - > on_started , ( void * ) ( gpr_intptr ) 1 ) ; <nl> GPR_ASSERT ( gpr_event_wait ( opt - > phase1 , ten_seconds_time ( ) ) ) ; <nl> <nl> gpr_log ( GPR_INFO , " consumer % d phase 1 " , opt - > id ) ; <nl> <nl> gpr_log ( GPR_INFO , " consumer % d phase 1 done " , opt - > id ) ; <nl> - gpr_event_set ( & opt - > on_phase1_done , ( void * ) ( gpr_intptr ) 1 ) ; <nl> + gpr_event_set ( & opt - > on_phase1_done , ( void * ) ( gpr_intptr ) 1 ) ; <nl> GPR_ASSERT ( gpr_event_wait ( opt - > phase2 , ten_seconds_time ( ) ) ) ; <nl> <nl> gpr_log ( GPR_INFO , " consumer % d phase 2 " , opt - > id ) ; <nl> static void consumer_thread ( void * arg ) { <nl> break ; <nl> case GRPC_QUEUE_SHUTDOWN : <nl> gpr_log ( GPR_INFO , " consumer % d phase 2 done " , opt - > id ) ; <nl> - gpr_event_set ( & opt - > on_finished , ( void * ) ( gpr_intptr ) 1 ) ; <nl> + gpr_event_set ( & opt - > on_finished , ( void * ) ( gpr_intptr ) 1 ) ; <nl> return ; <nl> case GRPC_QUEUE_TIMEOUT : <nl> gpr_log ( GPR_ERROR , " Invalid timeout received " ) ; <nl> static void test_threading ( int producers , int consumers ) { <nl> int total_consumed = 0 ; <nl> static int optid = 101 ; <nl> <nl> - gpr_log ( GPR_INFO , " % s : % d producers , % d consumers " , " test_threading " , producers , <nl> - consumers ) ; <nl> - <nl> - grpc_completion_queue_dont_poll_test_only ( cc ) ; <nl> + gpr_log ( GPR_INFO , " % s : % d producers , % d consumers " , " test_threading " , <nl> + producers , consumers ) ; <nl> <nl> / * start all threads : they will wait for phase1 * / <nl> for ( i = 0 ; i < producers + consumers ; i + + ) { <nl> static void test_threading ( int producers , int consumers ) { <nl> / * start phase1 : producers will pre - declare all operations they will <nl> complete * / <nl> gpr_log ( GPR_INFO , " start phase 1 " ) ; <nl> - gpr_event_set ( & phase1 , ( void * ) ( gpr_intptr ) 1 ) ; <nl> + gpr_event_set ( & phase1 , ( void * ) ( gpr_intptr ) 1 ) ; <nl> <nl> gpr_log ( GPR_INFO , " wait phase 1 " ) ; <nl> for ( i = 0 ; i < producers + consumers ; i + + ) { <nl> static void test_threading ( int producers , int consumers ) { <nl> <nl> / * start phase2 : operations will complete , and consumers will consume them * / <nl> gpr_log ( GPR_INFO , " start phase 2 " ) ; <nl> - gpr_event_set ( & phase2 , ( void * ) ( gpr_intptr ) 1 ) ; <nl> + gpr_event_set ( & phase2 , ( void * ) ( gpr_intptr ) 1 ) ; <nl> <nl> / * in parallel , we shutdown the completion channel - all events should still <nl> be consumed * / <nl> mmm a / test / cpp / end2end / async_end2end_test . cc <nl> ppp b / test / cpp / end2end / async_end2end_test . cc <nl> namespace { <nl> <nl> void * tag ( int i ) { return ( void * ) ( gpr_intptr ) i ; } <nl> <nl> - void verify_ok ( CompletionQueue * cq , int i , bool expect_ok ) { <nl> - bool ok ; <nl> - void * got_tag ; <nl> - EXPECT_TRUE ( cq - > Next ( & got_tag , & ok ) ) ; <nl> - EXPECT_EQ ( expect_ok , ok ) ; <nl> - EXPECT_EQ ( tag ( i ) , got_tag ) ; <nl> - } <nl> - <nl> - void verify_timed_ok ( <nl> - CompletionQueue * cq , int i , bool expect_ok , <nl> - std : : chrono : : system_clock : : time_point deadline = <nl> - std : : chrono : : system_clock : : time_point : : max ( ) , <nl> - CompletionQueue : : NextStatus expected_outcome = CompletionQueue : : GOT_EVENT ) { <nl> - bool ok ; <nl> - void * got_tag ; <nl> - EXPECT_EQ ( cq - > AsyncNext ( & got_tag , & ok , deadline ) , expected_outcome ) ; <nl> - if ( expected_outcome = = CompletionQueue : : GOT_EVENT ) { <nl> - EXPECT_EQ ( expect_ok , ok ) ; <nl> - EXPECT_EQ ( tag ( i ) , got_tag ) ; <nl> + class Verifier { <nl> + public : <nl> + Verifier & Expect ( int i , bool expect_ok ) { <nl> + expectations_ [ tag ( i ) ] = expect_ok ; <nl> + return * this ; <nl> } <nl> - } <nl> + void Verify ( CompletionQueue * cq ) { <nl> + GPR_ASSERT ( ! expectations_ . empty ( ) ) ; <nl> + while ( ! expectations_ . empty ( ) ) { <nl> + bool ok ; <nl> + void * got_tag ; <nl> + EXPECT_TRUE ( cq - > Next ( & got_tag , & ok ) ) ; <nl> + auto it = expectations_ . find ( got_tag ) ; <nl> + EXPECT_TRUE ( it ! = expectations_ . end ( ) ) ; <nl> + EXPECT_EQ ( it - > second , ok ) ; <nl> + expectations_ . erase ( it ) ; <nl> + } <nl> + } <nl> + void Verify ( CompletionQueue * cq , std : : chrono : : system_clock : : time_point deadline ) { <nl> + if ( expectations_ . empty ( ) ) { <nl> + bool ok ; <nl> + void * got_tag ; <nl> + EXPECT_EQ ( cq - > AsyncNext ( & got_tag , & ok , deadline ) , CompletionQueue : : TIMEOUT ) ; <nl> + } else { <nl> + while ( ! expectations_ . empty ( ) ) { <nl> + bool ok ; <nl> + void * got_tag ; <nl> + EXPECT_EQ ( cq - > AsyncNext ( & got_tag , & ok , deadline ) , CompletionQueue : : GOT_EVENT ) ; <nl> + auto it = expectations_ . find ( got_tag ) ; <nl> + EXPECT_TRUE ( it ! = expectations_ . end ( ) ) ; <nl> + EXPECT_EQ ( it - > second , ok ) ; <nl> + expectations_ . erase ( it ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + private : <nl> + std : : map < void * , bool > expectations_ ; <nl> + } ; <nl> <nl> class AsyncEnd2endTest : public : : testing : : Test { <nl> protected : <nl> class AsyncEnd2endTest : public : : testing : : Test { <nl> ServerBuilder builder ; <nl> builder . AddListeningPort ( server_address_ . str ( ) , grpc : : InsecureServerCredentials ( ) ) ; <nl> builder . RegisterAsyncService ( & service_ ) ; <nl> - srv_cq_ = builder . AddCompletionQueue ( ) ; <nl> + cq_ = builder . AddCompletionQueue ( ) ; <nl> server_ = builder . BuildAndStart ( ) ; <nl> } <nl> <nl> class AsyncEnd2endTest : public : : testing : : Test { <nl> server_ - > Shutdown ( ) ; <nl> void * ignored_tag ; <nl> bool ignored_ok ; <nl> - cli_cq_ . Shutdown ( ) ; <nl> - srv_cq_ - > Shutdown ( ) ; <nl> - while ( cli_cq_ . Next ( & ignored_tag , & ignored_ok ) ) <nl> - ; <nl> - while ( srv_cq_ - > Next ( & ignored_tag , & ignored_ok ) ) <nl> + cq_ - > Shutdown ( ) ; <nl> + while ( cq_ - > Next ( & ignored_tag , & ignored_ok ) ) <nl> ; <nl> } <nl> <nl> class AsyncEnd2endTest : public : : testing : : Test { <nl> stub_ = std : : move ( grpc : : cpp : : test : : util : : TestService : : NewStub ( channel ) ) ; <nl> } <nl> <nl> - void server_ok ( int i ) { verify_ok ( srv_cq_ . get ( ) , i , true ) ; } <nl> - void client_ok ( int i ) { verify_ok ( & cli_cq_ , i , true ) ; } <nl> - void server_fail ( int i ) { verify_ok ( srv_cq_ . get ( ) , i , false ) ; } <nl> - void client_fail ( int i ) { verify_ok ( & cli_cq_ , i , false ) ; } <nl> - <nl> void SendRpc ( int num_rpcs ) { <nl> for ( int i = 0 ; i < num_rpcs ; i + + ) { <nl> EchoRequest send_request ; <nl> class AsyncEnd2endTest : public : : testing : : Test { <nl> <nl> send_request . set_message ( " Hello " ) ; <nl> std : : unique_ptr < ClientAsyncResponseReader < EchoResponse > > response_reader ( <nl> - stub_ - > AsyncEcho ( & cli_ctx , send_request , & cli_cq_ ) ) ; <nl> + stub_ - > AsyncEcho ( & cli_ctx , send_request , cq_ . get ( ) ) ) ; <nl> <nl> service_ . RequestEcho ( & srv_ctx , & recv_request , & response_writer , <nl> - srv_cq_ . get ( ) , srv_cq_ . get ( ) , tag ( 2 ) ) ; <nl> + cq_ . get ( ) , cq_ . get ( ) , tag ( 2 ) ) ; <nl> <nl> - server_ok ( 2 ) ; <nl> + Verifier ( ) . Expect ( 2 , true ) . Verify ( cq_ . get ( ) ) ; <nl> EXPECT_EQ ( send_request . message ( ) , recv_request . message ( ) ) ; <nl> <nl> send_response . set_message ( recv_request . message ( ) ) ; <nl> response_writer . Finish ( send_response , Status : : OK , tag ( 3 ) ) ; <nl> - server_ok ( 3 ) ; <nl> + Verifier ( ) . Expect ( 3 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> response_reader - > Finish ( & recv_response , & recv_status , tag ( 4 ) ) ; <nl> - client_ok ( 4 ) ; <nl> + Verifier ( ) . Expect ( 4 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> EXPECT_EQ ( send_response . message ( ) , recv_response . message ( ) ) ; <nl> EXPECT_TRUE ( recv_status . ok ( ) ) ; <nl> } <nl> } <nl> <nl> - CompletionQueue cli_cq_ ; <nl> - std : : unique_ptr < ServerCompletionQueue > srv_cq_ ; <nl> + std : : unique_ptr < ServerCompletionQueue > cq_ ; <nl> std : : unique_ptr < grpc : : cpp : : test : : util : : TestService : : Stub > stub_ ; <nl> std : : unique_ptr < Server > server_ ; <nl> grpc : : cpp : : test : : util : : TestService : : AsyncService service_ ; <nl> TEST_F ( AsyncEnd2endTest , AsyncNextRpc ) { <nl> <nl> send_request . set_message ( " Hello " ) ; <nl> std : : unique_ptr < ClientAsyncResponseReader < EchoResponse > > response_reader ( <nl> - stub_ - > AsyncEcho ( & cli_ctx , send_request , & cli_cq_ ) ) ; <nl> + stub_ - > AsyncEcho ( & cli_ctx , send_request , cq_ . get ( ) ) ) ; <nl> <nl> std : : chrono : : system_clock : : time_point time_now ( <nl> std : : chrono : : system_clock : : now ( ) ) ; <nl> std : : chrono : : system_clock : : time_point time_limit ( <nl> std : : chrono : : system_clock : : now ( ) + std : : chrono : : seconds ( 10 ) ) ; <nl> - verify_timed_ok ( srv_cq_ . get ( ) , - 1 , true , time_now , CompletionQueue : : TIMEOUT ) ; <nl> - verify_timed_ok ( & cli_cq_ , - 1 , true , time_now , CompletionQueue : : TIMEOUT ) ; <nl> + Verifier ( ) . Verify ( cq_ . get ( ) , time_now ) ; <nl> + Verifier ( ) . Verify ( cq_ . get ( ) , time_now ) ; <nl> <nl> - service_ . RequestEcho ( & srv_ctx , & recv_request , & response_writer , srv_cq_ . get ( ) , <nl> - srv_cq_ . get ( ) , tag ( 2 ) ) ; <nl> + service_ . RequestEcho ( & srv_ctx , & recv_request , & response_writer , cq_ . get ( ) , <nl> + cq_ . get ( ) , tag ( 2 ) ) ; <nl> <nl> - verify_timed_ok ( srv_cq_ . get ( ) , 2 , true , time_limit ) ; <nl> + Verifier ( ) . Expect ( 2 , true ) . Verify ( cq_ . get ( ) , time_limit ) ; <nl> EXPECT_EQ ( send_request . message ( ) , recv_request . message ( ) ) ; <nl> <nl> send_response . set_message ( recv_request . message ( ) ) ; <nl> response_writer . Finish ( send_response , Status : : OK , tag ( 3 ) ) ; <nl> - verify_timed_ok ( srv_cq_ . get ( ) , 3 , true ) ; <nl> + Verifier ( ) . Expect ( 3 , true ) . Verify ( cq_ . get ( ) , std : : chrono : : system_clock : : time_point : : max ( ) ) ; <nl> <nl> response_reader - > Finish ( & recv_response , & recv_status , tag ( 4 ) ) ; <nl> - verify_timed_ok ( & cli_cq_ , 4 , true ) ; <nl> + Verifier ( ) . Expect ( 4 , true ) . Verify ( cq_ . get ( ) , std : : chrono : : system_clock : : time_point : : max ( ) ) ; <nl> <nl> EXPECT_EQ ( send_response . message ( ) , recv_response . message ( ) ) ; <nl> EXPECT_TRUE ( recv_status . ok ( ) ) ; <nl> TEST_F ( AsyncEnd2endTest , SimpleClientStreaming ) { <nl> <nl> send_request . set_message ( " Hello " ) ; <nl> std : : unique_ptr < ClientAsyncWriter < EchoRequest > > cli_stream ( <nl> - stub_ - > AsyncRequestStream ( & cli_ctx , & recv_response , & cli_cq_ , tag ( 1 ) ) ) ; <nl> + stub_ - > AsyncRequestStream ( & cli_ctx , & recv_response , cq_ . get ( ) , tag ( 1 ) ) ) ; <nl> <nl> - service_ . RequestRequestStream ( & srv_ctx , & srv_stream , srv_cq_ . get ( ) , <nl> - srv_cq_ . get ( ) , tag ( 2 ) ) ; <nl> + service_ . RequestRequestStream ( & srv_ctx , & srv_stream , cq_ . get ( ) , <nl> + cq_ . get ( ) , tag ( 2 ) ) ; <nl> <nl> - server_ok ( 2 ) ; <nl> - client_ok ( 1 ) ; <nl> + Verifier ( ) . Expect ( 2 , true ) . Expect ( 1 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> cli_stream - > Write ( send_request , tag ( 3 ) ) ; <nl> - client_ok ( 3 ) ; <nl> + Verifier ( ) . Expect ( 3 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> srv_stream . Read ( & recv_request , tag ( 4 ) ) ; <nl> - server_ok ( 4 ) ; <nl> + Verifier ( ) . Expect ( 4 , true ) . Verify ( cq_ . get ( ) ) ; <nl> EXPECT_EQ ( send_request . message ( ) , recv_request . message ( ) ) ; <nl> <nl> cli_stream - > Write ( send_request , tag ( 5 ) ) ; <nl> - client_ok ( 5 ) ; <nl> + Verifier ( ) . Expect ( 5 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> srv_stream . Read ( & recv_request , tag ( 6 ) ) ; <nl> - server_ok ( 6 ) ; <nl> + Verifier ( ) . Expect ( 6 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> EXPECT_EQ ( send_request . message ( ) , recv_request . message ( ) ) ; <nl> cli_stream - > WritesDone ( tag ( 7 ) ) ; <nl> - client_ok ( 7 ) ; <nl> + Verifier ( ) . Expect ( 7 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> srv_stream . Read ( & recv_request , tag ( 8 ) ) ; <nl> - server_fail ( 8 ) ; <nl> + Verifier ( ) . Expect ( 8 , false ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> send_response . set_message ( recv_request . message ( ) ) ; <nl> srv_stream . Finish ( send_response , Status : : OK , tag ( 9 ) ) ; <nl> - server_ok ( 9 ) ; <nl> + Verifier ( ) . Expect ( 9 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> cli_stream - > Finish ( & recv_status , tag ( 10 ) ) ; <nl> - client_ok ( 10 ) ; <nl> + Verifier ( ) . Expect ( 10 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> EXPECT_EQ ( send_response . message ( ) , recv_response . message ( ) ) ; <nl> EXPECT_TRUE ( recv_status . ok ( ) ) ; <nl> TEST_F ( AsyncEnd2endTest , SimpleServerStreaming ) { <nl> <nl> send_request . set_message ( " Hello " ) ; <nl> std : : unique_ptr < ClientAsyncReader < EchoResponse > > cli_stream ( <nl> - stub_ - > AsyncResponseStream ( & cli_ctx , send_request , & cli_cq_ , tag ( 1 ) ) ) ; <nl> + stub_ - > AsyncResponseStream ( & cli_ctx , send_request , cq_ . get ( ) , tag ( 1 ) ) ) ; <nl> <nl> service_ . RequestResponseStream ( & srv_ctx , & recv_request , & srv_stream , <nl> - srv_cq_ . get ( ) , srv_cq_ . get ( ) , tag ( 2 ) ) ; <nl> + cq_ . get ( ) , cq_ . get ( ) , tag ( 2 ) ) ; <nl> <nl> - server_ok ( 2 ) ; <nl> - client_ok ( 1 ) ; <nl> + Verifier ( ) . Expect ( 1 , true ) . Expect ( 2 , true ) . Verify ( cq_ . get ( ) ) ; <nl> EXPECT_EQ ( send_request . message ( ) , recv_request . message ( ) ) ; <nl> <nl> send_response . set_message ( recv_request . message ( ) ) ; <nl> srv_stream . Write ( send_response , tag ( 3 ) ) ; <nl> - server_ok ( 3 ) ; <nl> + Verifier ( ) . Expect ( 3 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> cli_stream - > Read ( & recv_response , tag ( 4 ) ) ; <nl> - client_ok ( 4 ) ; <nl> + Verifier ( ) . Expect ( 4 , true ) . Verify ( cq_ . get ( ) ) ; <nl> EXPECT_EQ ( send_response . message ( ) , recv_response . message ( ) ) ; <nl> <nl> srv_stream . Write ( send_response , tag ( 5 ) ) ; <nl> - server_ok ( 5 ) ; <nl> + Verifier ( ) . Expect ( 5 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> cli_stream - > Read ( & recv_response , tag ( 6 ) ) ; <nl> - client_ok ( 6 ) ; <nl> + Verifier ( ) . Expect ( 6 , true ) . Verify ( cq_ . get ( ) ) ; <nl> EXPECT_EQ ( send_response . message ( ) , recv_response . message ( ) ) ; <nl> <nl> srv_stream . Finish ( Status : : OK , tag ( 7 ) ) ; <nl> - server_ok ( 7 ) ; <nl> + Verifier ( ) . Expect ( 7 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> cli_stream - > Read ( & recv_response , tag ( 8 ) ) ; <nl> - client_fail ( 8 ) ; <nl> + Verifier ( ) . Expect ( 8 , false ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> cli_stream - > Finish ( & recv_status , tag ( 9 ) ) ; <nl> - client_ok ( 9 ) ; <nl> + Verifier ( ) . Expect ( 9 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> EXPECT_TRUE ( recv_status . ok ( ) ) ; <nl> } <nl> TEST_F ( AsyncEnd2endTest , SimpleBidiStreaming ) { <nl> <nl> send_request . set_message ( " Hello " ) ; <nl> std : : unique_ptr < ClientAsyncReaderWriter < EchoRequest , EchoResponse > > <nl> - cli_stream ( stub_ - > AsyncBidiStream ( & cli_ctx , & cli_cq_ , tag ( 1 ) ) ) ; <nl> + cli_stream ( stub_ - > AsyncBidiStream ( & cli_ctx , cq_ . get ( ) , tag ( 1 ) ) ) ; <nl> <nl> - service_ . RequestBidiStream ( & srv_ctx , & srv_stream , srv_cq_ . get ( ) , <nl> - srv_cq_ . get ( ) , tag ( 2 ) ) ; <nl> + service_ . RequestBidiStream ( & srv_ctx , & srv_stream , cq_ . get ( ) , <nl> + cq_ . get ( ) , tag ( 2 ) ) ; <nl> <nl> - server_ok ( 2 ) ; <nl> - client_ok ( 1 ) ; <nl> + Verifier ( ) . Expect ( 1 , true ) . Expect ( 2 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> cli_stream - > Write ( send_request , tag ( 3 ) ) ; <nl> - client_ok ( 3 ) ; <nl> + Verifier ( ) . Expect ( 3 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> srv_stream . Read ( & recv_request , tag ( 4 ) ) ; <nl> - server_ok ( 4 ) ; <nl> + Verifier ( ) . Expect ( 4 , true ) . Verify ( cq_ . get ( ) ) ; <nl> EXPECT_EQ ( send_request . message ( ) , recv_request . message ( ) ) ; <nl> <nl> send_response . set_message ( recv_request . message ( ) ) ; <nl> srv_stream . Write ( send_response , tag ( 5 ) ) ; <nl> - server_ok ( 5 ) ; <nl> + Verifier ( ) . Expect ( 5 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> cli_stream - > Read ( & recv_response , tag ( 6 ) ) ; <nl> - client_ok ( 6 ) ; <nl> + Verifier ( ) . Expect ( 6 , true ) . Verify ( cq_ . get ( ) ) ; <nl> EXPECT_EQ ( send_response . message ( ) , recv_response . message ( ) ) ; <nl> <nl> cli_stream - > WritesDone ( tag ( 7 ) ) ; <nl> - client_ok ( 7 ) ; <nl> + Verifier ( ) . Expect ( 7 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> srv_stream . Read ( & recv_request , tag ( 8 ) ) ; <nl> - server_fail ( 8 ) ; <nl> + Verifier ( ) . Expect ( 8 , false ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> srv_stream . Finish ( Status : : OK , tag ( 9 ) ) ; <nl> - server_ok ( 9 ) ; <nl> + Verifier ( ) . Expect ( 9 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> cli_stream - > Finish ( & recv_status , tag ( 10 ) ) ; <nl> - client_ok ( 10 ) ; <nl> + Verifier ( ) . Expect ( 10 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> EXPECT_TRUE ( recv_status . ok ( ) ) ; <nl> } <nl> TEST_F ( AsyncEnd2endTest , ClientInitialMetadataRpc ) { <nl> cli_ctx . AddMetadata ( meta2 . first , meta2 . second ) ; <nl> <nl> std : : unique_ptr < ClientAsyncResponseReader < EchoResponse > > response_reader ( <nl> - stub_ - > AsyncEcho ( & cli_ctx , send_request , & cli_cq_ ) ) ; <nl> + stub_ - > AsyncEcho ( & cli_ctx , send_request , cq_ . get ( ) ) ) ; <nl> <nl> - service_ . RequestEcho ( & srv_ctx , & recv_request , & response_writer , srv_cq_ . get ( ) , <nl> - srv_cq_ . get ( ) , tag ( 2 ) ) ; <nl> - server_ok ( 2 ) ; <nl> + service_ . RequestEcho ( & srv_ctx , & recv_request , & response_writer , cq_ . get ( ) , <nl> + cq_ . get ( ) , tag ( 2 ) ) ; <nl> + Verifier ( ) . Expect ( 2 , true ) . Verify ( cq_ . get ( ) ) ; <nl> EXPECT_EQ ( send_request . message ( ) , recv_request . message ( ) ) ; <nl> auto client_initial_metadata = srv_ctx . client_metadata ( ) ; <nl> EXPECT_EQ ( meta1 . second , client_initial_metadata . find ( meta1 . first ) - > second ) ; <nl> TEST_F ( AsyncEnd2endTest , ClientInitialMetadataRpc ) { <nl> send_response . set_message ( recv_request . message ( ) ) ; <nl> response_writer . Finish ( send_response , Status : : OK , tag ( 3 ) ) ; <nl> <nl> - server_ok ( 3 ) ; <nl> + Verifier ( ) . Expect ( 3 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> response_reader - > Finish ( & recv_response , & recv_status , tag ( 4 ) ) ; <nl> - client_ok ( 4 ) ; <nl> + Verifier ( ) . Expect ( 4 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> EXPECT_EQ ( send_response . message ( ) , recv_response . message ( ) ) ; <nl> EXPECT_TRUE ( recv_status . ok ( ) ) ; <nl> TEST_F ( AsyncEnd2endTest , ServerInitialMetadataRpc ) { <nl> std : : pair < grpc : : string , grpc : : string > meta2 ( " key2 " , " val2 " ) ; <nl> <nl> std : : unique_ptr < ClientAsyncResponseReader < EchoResponse > > response_reader ( <nl> - stub_ - > AsyncEcho ( & cli_ctx , send_request , & cli_cq_ ) ) ; <nl> + stub_ - > AsyncEcho ( & cli_ctx , send_request , cq_ . get ( ) ) ) ; <nl> <nl> - service_ . RequestEcho ( & srv_ctx , & recv_request , & response_writer , srv_cq_ . get ( ) , <nl> - srv_cq_ . get ( ) , tag ( 2 ) ) ; <nl> - server_ok ( 2 ) ; <nl> + service_ . RequestEcho ( & srv_ctx , & recv_request , & response_writer , cq_ . get ( ) , <nl> + cq_ . get ( ) , tag ( 2 ) ) ; <nl> + Verifier ( ) . Expect ( 2 , true ) . Verify ( cq_ . get ( ) ) ; <nl> EXPECT_EQ ( send_request . message ( ) , recv_request . message ( ) ) ; <nl> srv_ctx . AddInitialMetadata ( meta1 . first , meta1 . second ) ; <nl> srv_ctx . AddInitialMetadata ( meta2 . first , meta2 . second ) ; <nl> response_writer . SendInitialMetadata ( tag ( 3 ) ) ; <nl> - server_ok ( 3 ) ; <nl> + Verifier ( ) . Expect ( 3 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> response_reader - > ReadInitialMetadata ( tag ( 4 ) ) ; <nl> - client_ok ( 4 ) ; <nl> + Verifier ( ) . Expect ( 4 , true ) . Verify ( cq_ . get ( ) ) ; <nl> auto server_initial_metadata = cli_ctx . GetServerInitialMetadata ( ) ; <nl> EXPECT_EQ ( meta1 . second , server_initial_metadata . find ( meta1 . first ) - > second ) ; <nl> EXPECT_EQ ( meta2 . second , server_initial_metadata . find ( meta2 . first ) - > second ) ; <nl> TEST_F ( AsyncEnd2endTest , ServerInitialMetadataRpc ) { <nl> <nl> send_response . set_message ( recv_request . message ( ) ) ; <nl> response_writer . Finish ( send_response , Status : : OK , tag ( 5 ) ) ; <nl> - server_ok ( 5 ) ; <nl> + Verifier ( ) . Expect ( 5 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> response_reader - > Finish ( & recv_response , & recv_status , tag ( 6 ) ) ; <nl> - client_ok ( 6 ) ; <nl> + Verifier ( ) . Expect ( 6 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> EXPECT_EQ ( send_response . message ( ) , recv_response . message ( ) ) ; <nl> EXPECT_TRUE ( recv_status . ok ( ) ) ; <nl> TEST_F ( AsyncEnd2endTest , ServerTrailingMetadataRpc ) { <nl> std : : pair < grpc : : string , grpc : : string > meta2 ( " key2 " , " val2 " ) ; <nl> <nl> std : : unique_ptr < ClientAsyncResponseReader < EchoResponse > > response_reader ( <nl> - stub_ - > AsyncEcho ( & cli_ctx , send_request , & cli_cq_ ) ) ; <nl> + stub_ - > AsyncEcho ( & cli_ctx , send_request , cq_ . get ( ) ) ) ; <nl> <nl> - service_ . RequestEcho ( & srv_ctx , & recv_request , & response_writer , srv_cq_ . get ( ) , <nl> - srv_cq_ . get ( ) , tag ( 2 ) ) ; <nl> - server_ok ( 2 ) ; <nl> + service_ . RequestEcho ( & srv_ctx , & recv_request , & response_writer , cq_ . get ( ) , <nl> + cq_ . get ( ) , tag ( 2 ) ) ; <nl> + Verifier ( ) . Expect ( 2 , true ) . Verify ( cq_ . get ( ) ) ; <nl> EXPECT_EQ ( send_request . message ( ) , recv_request . message ( ) ) ; <nl> response_writer . SendInitialMetadata ( tag ( 3 ) ) ; <nl> - server_ok ( 3 ) ; <nl> + Verifier ( ) . Expect ( 3 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> send_response . set_message ( recv_request . message ( ) ) ; <nl> srv_ctx . AddTrailingMetadata ( meta1 . first , meta1 . second ) ; <nl> srv_ctx . AddTrailingMetadata ( meta2 . first , meta2 . second ) ; <nl> response_writer . Finish ( send_response , Status : : OK , tag ( 4 ) ) ; <nl> <nl> - server_ok ( 4 ) ; <nl> + Verifier ( ) . Expect ( 4 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> response_reader - > Finish ( & recv_response , & recv_status , tag ( 5 ) ) ; <nl> - client_ok ( 5 ) ; <nl> + Verifier ( ) . Expect ( 5 , true ) . Verify ( cq_ . get ( ) ) ; <nl> EXPECT_EQ ( send_response . message ( ) , recv_response . message ( ) ) ; <nl> EXPECT_TRUE ( recv_status . ok ( ) ) ; <nl> auto server_trailing_metadata = cli_ctx . GetServerTrailingMetadata ( ) ; <nl> TEST_F ( AsyncEnd2endTest , MetadataRpc ) { <nl> cli_ctx . AddMetadata ( meta2 . first , meta2 . second ) ; <nl> <nl> std : : unique_ptr < ClientAsyncResponseReader < EchoResponse > > response_reader ( <nl> - stub_ - > AsyncEcho ( & cli_ctx , send_request , & cli_cq_ ) ) ; <nl> + stub_ - > AsyncEcho ( & cli_ctx , send_request , cq_ . get ( ) ) ) ; <nl> <nl> - service_ . RequestEcho ( & srv_ctx , & recv_request , & response_writer , srv_cq_ . get ( ) , <nl> - srv_cq_ . get ( ) , tag ( 2 ) ) ; <nl> - server_ok ( 2 ) ; <nl> + service_ . RequestEcho ( & srv_ctx , & recv_request , & response_writer , cq_ . get ( ) , <nl> + cq_ . get ( ) , tag ( 2 ) ) ; <nl> + Verifier ( ) . Expect ( 2 , true ) . Verify ( cq_ . get ( ) ) ; <nl> EXPECT_EQ ( send_request . message ( ) , recv_request . message ( ) ) ; <nl> auto client_initial_metadata = srv_ctx . client_metadata ( ) ; <nl> EXPECT_EQ ( meta1 . second , client_initial_metadata . find ( meta1 . first ) - > second ) ; <nl> TEST_F ( AsyncEnd2endTest , MetadataRpc ) { <nl> srv_ctx . AddInitialMetadata ( meta3 . first , meta3 . second ) ; <nl> srv_ctx . AddInitialMetadata ( meta4 . first , meta4 . second ) ; <nl> response_writer . SendInitialMetadata ( tag ( 3 ) ) ; <nl> - server_ok ( 3 ) ; <nl> + Verifier ( ) . Expect ( 3 , true ) . Verify ( cq_ . get ( ) ) ; <nl> response_reader - > ReadInitialMetadata ( tag ( 4 ) ) ; <nl> - client_ok ( 4 ) ; <nl> + Verifier ( ) . Expect ( 4 , true ) . Verify ( cq_ . get ( ) ) ; <nl> auto server_initial_metadata = cli_ctx . GetServerInitialMetadata ( ) ; <nl> EXPECT_EQ ( meta3 . second , server_initial_metadata . find ( meta3 . first ) - > second ) ; <nl> EXPECT_EQ ( meta4 . second , server_initial_metadata . find ( meta4 . first ) - > second ) ; <nl> TEST_F ( AsyncEnd2endTest , MetadataRpc ) { <nl> srv_ctx . AddTrailingMetadata ( meta6 . first , meta6 . second ) ; <nl> response_writer . Finish ( send_response , Status : : OK , tag ( 5 ) ) ; <nl> <nl> - server_ok ( 5 ) ; <nl> + Verifier ( ) . Expect ( 5 , true ) . Verify ( cq_ . get ( ) ) ; <nl> <nl> response_reader - > Finish ( & recv_response , & recv_status , tag ( 6 ) ) ; <nl> - client_ok ( 6 ) ; <nl> + Verifier ( ) . Expect ( 6 , true ) . Verify ( cq_ . get ( ) ) ; <nl> EXPECT_EQ ( send_response . message ( ) , recv_response . message ( ) ) ; <nl> EXPECT_TRUE ( recv_status . ok ( ) ) ; <nl> auto server_trailing_metadata = cli_ctx . GetServerTrailingMetadata ( ) ; <nl> mmm a / test / cpp / end2end / client_crash_test . cc <nl> ppp b / test / cpp / end2end / client_crash_test . cc <nl> class CrashTest : public : : testing : : Test { <nl> <nl> void KillServer ( ) { <nl> server_ . reset ( ) ; <nl> - / / give some time for the TCP connection to drop <nl> - gpr_sleep_until ( gpr_time_add ( gpr_now ( ) , gpr_time_from_seconds ( 1 ) ) ) ; <nl> } <nl> <nl> private : <nl> std : : unique_ptr < SubProcess > server_ ; <nl> } ; <nl> <nl> - TEST_F ( CrashTest , KillAfterWrite ) { <nl> + TEST_F ( CrashTest , KillBeforeWrite ) { <nl> auto stub = CreateServerAndStub ( ) ; <nl> <nl> EchoRequest request ; <nl> TEST_F ( CrashTest , KillAfterWrite ) { <nl> EXPECT_TRUE ( stream - > Read ( & response ) ) ; <nl> EXPECT_EQ ( response . message ( ) , request . message ( ) ) ; <nl> <nl> - request . set_message ( " I ' m going to kill you " ) ; <nl> - EXPECT_TRUE ( stream - > Write ( request ) ) ; <nl> - <nl> KillServer ( ) ; <nl> <nl> + request . set_message ( " You should be dead " ) ; <nl> + / / This may succeed or fail depending on the state of the TCP connection <nl> + stream - > Write ( request ) ; <nl> + / / But the read will definitely fail <nl> EXPECT_FALSE ( stream - > Read ( & response ) ) ; <nl> <nl> EXPECT_FALSE ( stream - > Finish ( ) . ok ( ) ) ; <nl> } <nl> <nl> - TEST_F ( CrashTest , KillBeforeWrite ) { <nl> + TEST_F ( CrashTest , KillAfterWrite ) { <nl> auto stub = CreateServerAndStub ( ) ; <nl> <nl> EchoRequest request ; <nl> TEST_F ( CrashTest , KillBeforeWrite ) { <nl> EXPECT_TRUE ( stream - > Read ( & response ) ) ; <nl> EXPECT_EQ ( response . message ( ) , request . message ( ) ) ; <nl> <nl> + request . set_message ( " I ' m going to kill you " ) ; <nl> + EXPECT_TRUE ( stream - > Write ( request ) ) ; <nl> + <nl> KillServer ( ) ; <nl> <nl> - request . set_message ( " You should be dead " ) ; <nl> - EXPECT_FALSE ( stream - > Write ( request ) ) ; <nl> EXPECT_FALSE ( stream - > Read ( & response ) ) ; <nl> <nl> EXPECT_FALSE ( stream - > Finish ( ) . ok ( ) ) ; <nl> int main ( int argc , char * * argv ) { <nl> <nl> grpc_test_init ( argc , argv ) ; <nl> : : testing : : InitGoogleTest ( & argc , argv ) ; <nl> - return RUN_ALL_TESTS ( ) ; <nl> + / / Order seems to matter on these tests : run three times to eliminate that <nl> + for ( int i = 0 ; i < 3 ; i + + ) { <nl> + if ( RUN_ALL_TESTS ( ) ! = 0 ) { <nl> + return 1 ; <nl> + } <nl> + } <nl> + return 0 ; <nl> } <nl> new file mode 100644 <nl> index 00000000000 . . 90a8da8d110 <nl> mmm / dev / null <nl> ppp b / test / cpp / qps / qps_test_with_poll . cc <nl> <nl> + / * <nl> + * <nl> + * Copyright 2015 , Google Inc . <nl> + * All rights reserved . <nl> + * <nl> + * Redistribution and use in source and binary forms , with or without <nl> + * modification , are permitted provided that the following conditions are <nl> + * met : <nl> + * <nl> + * * Redistributions of source code must retain the above copyright <nl> + * notice , this list of conditions and the following disclaimer . <nl> + * * Redistributions in binary form must reproduce the above <nl> + * copyright notice , this list of conditions and the following disclaimer <nl> + * in the documentation and / or other materials provided with the <nl> + * distribution . <nl> + * * Neither the name of Google Inc . nor the names of its <nl> + * contributors may be used to endorse or promote products derived from <nl> + * this software without specific prior written permission . <nl> + * <nl> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS <nl> + * " AS IS " AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT <nl> + * LIMITED TO , THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR <nl> + * A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT <nl> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT <nl> + * LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , <nl> + * DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY <nl> + * THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT <nl> + * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE <nl> + * OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE . <nl> + * <nl> + * / <nl> + <nl> + # include < set > <nl> + <nl> + # include < grpc / support / log . h > <nl> + <nl> + # include < signal . h > <nl> + <nl> + # include " test / cpp / qps / driver . h " <nl> + # include " test / cpp / qps / report . h " <nl> + # include " test / cpp / util / benchmark_config . h " <nl> + <nl> + extern " C " { <nl> + # include " src / core / iomgr / pollset_posix . h " <nl> + } <nl> + <nl> + namespace grpc { <nl> + namespace testing { <nl> + <nl> + static const int WARMUP = 5 ; <nl> + static const int BENCHMARK = 5 ; <nl> + <nl> + static void RunQPS ( ) { <nl> + gpr_log ( GPR_INFO , " Running QPS test " ) ; <nl> + <nl> + ClientConfig client_config ; <nl> + client_config . set_client_type ( ASYNC_CLIENT ) ; <nl> + client_config . set_enable_ssl ( false ) ; <nl> + client_config . set_outstanding_rpcs_per_channel ( 1000 ) ; <nl> + client_config . set_client_channels ( 8 ) ; <nl> + client_config . set_payload_size ( 1 ) ; <nl> + client_config . set_async_client_threads ( 8 ) ; <nl> + client_config . set_rpc_type ( UNARY ) ; <nl> + <nl> + ServerConfig server_config ; <nl> + server_config . set_server_type ( ASYNC_SERVER ) ; <nl> + server_config . set_enable_ssl ( false ) ; <nl> + server_config . set_threads ( 4 ) ; <nl> + <nl> + const auto result = <nl> + RunScenario ( client_config , 1 , server_config , 1 , WARMUP , BENCHMARK , - 2 ) ; <nl> + <nl> + GetReporter ( ) - > ReportQPSPerCore ( * result ) ; <nl> + GetReporter ( ) - > ReportLatency ( * result ) ; <nl> + } <nl> + <nl> + } / / namespace testing <nl> + } / / namespace grpc <nl> + <nl> + int main ( int argc , char * * argv ) { <nl> + grpc : : testing : : InitBenchmark ( & argc , & argv , true ) ; <nl> + <nl> + grpc_platform_become_multipoller = grpc_poll_become_multipoller ; <nl> + <nl> + signal ( SIGPIPE , SIG_IGN ) ; <nl> + grpc : : testing : : RunQPS ( ) ; <nl> + <nl> + return 0 ; <nl> + } <nl> mmm a / tools / doxygen / Doxyfile . core . internal <nl> ppp b / tools / doxygen / Doxyfile . core . internal <nl> WARN_LOGFILE = <nl> # spaces . <nl> # Note : If this tag is empty the current directory is searched . <nl> <nl> - INPUT = include / grpc / grpc_security . h include / grpc / byte_buffer . h include / grpc / byte_buffer_reader . h include / grpc / compression . h include / grpc / grpc . h include / grpc / status . h include / grpc / census . h src / core / httpcli / format_request . h src / core / httpcli / httpcli . h src / core / httpcli / httpcli_security_connector . h src / core / httpcli / parser . h src / core / security / auth_filters . h src / core / security / base64 . h src / core / security / credentials . h src / core / security / json_token . h src / core / security / secure_endpoint . h src / core / security / secure_transport_setup . h src / core / security / security_connector . h src / core / security / security_context . h src / core / tsi / fake_transport_security . h src / core / tsi / ssl_transport_security . h src / core / tsi / transport_security . h src / core / tsi / transport_security_interface . h src / core / census / grpc_context . h src / core / channel / census_filter . h src / core / channel / channel_args . h src / core / channel / channel_stack . h src / core / channel / child_channel . h src / core / channel / client_channel . h src / core / channel / client_setup . h src / core / channel / connected_channel . h src / core / channel / context . h src / core / channel / http_client_filter . h src / core / channel / http_server_filter . h src / core / channel / noop_filter . h src / core / compression / message_compress . h src / core / debug / trace . h src / core / iomgr / alarm . h src / core / iomgr / alarm_heap . h src / core / iomgr / alarm_internal . h src / core / iomgr / endpoint . h src / core / iomgr / endpoint_pair . h src / core / iomgr / fd_posix . h src / core / iomgr / iocp_windows . h src / core / iomgr / iomgr . h src / core / iomgr / iomgr_internal . h src / core / iomgr / iomgr_posix . h src / core / iomgr / pollset . h src / core / iomgr / pollset_kick . h src / core / iomgr / pollset_kick_posix . h src / core / iomgr / pollset_kick_windows . h src / core / iomgr / pollset_posix . h src / core / iomgr / pollset_windows . h src / core / iomgr / resolve_address . h src / core / iomgr / sockaddr . h src / core / iomgr / sockaddr_posix . h src / core / iomgr / sockaddr_utils . h src / core / iomgr / sockaddr_win32 . h src / core / iomgr / socket_utils_posix . h src / core / iomgr / socket_windows . h src / core / iomgr / tcp_client . h src / core / iomgr / tcp_posix . h src / core / iomgr / tcp_server . h src / core / iomgr / tcp_windows . h src / core / iomgr / time_averaged_stats . h src / core / iomgr / wakeup_fd_pipe . h src / core / iomgr / wakeup_fd_posix . h src / core / json / json . h src / core / json / json_common . h src / core / json / json_reader . h src / core / json / json_writer . h src / core / profiling / timers . h src / core / profiling / timers_preciseclock . h src / core / surface / byte_buffer_queue . h src / core / surface / call . h src / core / surface / channel . h src / core / surface / client . h src / core / surface / completion_queue . h src / core / surface / event_string . h src / core / surface / init . h src / core / surface / server . h src / core / surface / surface_trace . h src / core / transport / chttp2 / alpn . h src / core / transport / chttp2 / bin_encoder . h src / core / transport / chttp2 / frame . h src / core / transport / chttp2 / frame_data . h src / core / transport / chttp2 / frame_goaway . h src / core / transport / chttp2 / frame_ping . h src / core / transport / chttp2 / frame_rst_stream . h src / core / transport / chttp2 / frame_settings . h src / core / transport / chttp2 / frame_window_update . h src / core / transport / chttp2 / hpack_parser . h src / core / transport / chttp2 / hpack_table . h src / core / transport / chttp2 / http2_errors . h src / core / transport / chttp2 / huffsyms . h src / core / transport / chttp2 / status_conversion . h src / core / transport / chttp2 / stream_encoder . h src / core / transport / chttp2 / stream_map . h src / core / transport / chttp2 / timeout_encoding . h src / core / transport / chttp2 / varint . h src / core / transport / chttp2_transport . h src / core / transport / metadata . h src / core / transport / stream_op . h src / core / transport / transport . h src / core / transport / transport_impl . h src / core / census / context . h src / core / httpcli / format_request . c src / core / httpcli / httpcli . c src / core / httpcli / httpcli_security_connector . c src / core / httpcli / parser . c src / core / security / base64 . c src / core / security / client_auth_filter . c src / core / security / credentials . c src / core / security / credentials_metadata . c src / core / security / credentials_posix . c src / core / security / credentials_win32 . c src / core / security / google_default_credentials . c src / core / security / json_token . c src / core / security / secure_endpoint . c src / core / security / secure_transport_setup . c src / core / security / security_connector . c src / core / security / security_context . c src / core / security / server_auth_filter . c src / core / security / server_secure_chttp2 . c src / core / surface / init_secure . c src / core / surface / secure_channel_create . c src / core / tsi / fake_transport_security . c src / core / tsi / ssl_transport_security . c src / core / tsi / transport_security . c src / core / census / grpc_context . c src / core / channel / channel_args . c src / core / channel / channel_stack . c src / core / channel / child_channel . c src / core / channel / client_channel . c src / core / channel / client_setup . c src / core / channel / connected_channel . c src / core / channel / http_client_filter . c src / core / channel / http_server_filter . c src / core / channel / noop_filter . c src / core / compression / algorithm . c src / core / compression / message_compress . c src / core / debug / trace . c src / core / iomgr / alarm . c src / core / iomgr / alarm_heap . c src / core / iomgr / endpoint . c src / core / iomgr / endpoint_pair_posix . c src / core / iomgr / endpoint_pair_windows . c src / core / iomgr / fd_posix . c src / core / iomgr / iocp_windows . c src / core / iomgr / iomgr . c src / core / iomgr / iomgr_posix . c src / core / iomgr / iomgr_windows . c src / core / iomgr / pollset_kick . c src / core / iomgr / pollset_multipoller_with_epoll . c src / core / iomgr / pollset_multipoller_with_poll_posix . c src / core / iomgr / pollset_posix . c src / core / iomgr / pollset_windows . c src / core / iomgr / resolve_address_posix . c src / core / iomgr / resolve_address_windows . c src / core / iomgr / sockaddr_utils . c src / core / iomgr / socket_utils_common_posix . c src / core / iomgr / socket_utils_linux . c src / core / iomgr / socket_utils_posix . c src / core / iomgr / socket_windows . c src / core / iomgr / tcp_client_posix . c src / core / iomgr / tcp_client_windows . c src / core / iomgr / tcp_posix . c src / core / iomgr / tcp_server_posix . c src / core / iomgr / tcp_server_windows . c src / core / iomgr / tcp_windows . c src / core / iomgr / time_averaged_stats . c src / core / iomgr / wakeup_fd_eventfd . c src / core / iomgr / wakeup_fd_nospecial . c src / core / iomgr / wakeup_fd_pipe . c src / core / iomgr / wakeup_fd_posix . c src / core / json / json . c src / core / json / json_reader . c src / core / json / json_string . c src / core / json / json_writer . c src / core / profiling / basic_timers . c src / core / profiling / stap_timers . c src / core / surface / byte_buffer . c src / core / surface / byte_buffer_queue . c src / core / surface / byte_buffer_reader . c src / core / surface / call . c src / core / surface / call_details . c src / core / surface / call_log_batch . c src / core / surface / channel . c src / core / surface / channel_create . c src / core / surface / client . c src / core / surface / completion_queue . c src / core / surface / event_string . c src / core / surface / init . c src / core / surface / lame_client . c src / core / surface / metadata_array . c src / core / surface / server . c src / core / surface / server_chttp2 . c src / core / surface / server_create . c src / core / surface / surface_trace . c src / core / transport / chttp2 / alpn . c src / core / transport / chttp2 / bin_encoder . c src / core / transport / chttp2 / frame_data . c src / core / transport / chttp2 / frame_goaway . c src / core / transport / chttp2 / frame_ping . c src / core / transport / chttp2 / frame_rst_stream . c src / core / transport / chttp2 / frame_settings . c src / core / transport / chttp2 / frame_window_update . c src / core / transport / chttp2 / hpack_parser . c src / core / transport / chttp2 / hpack_table . c src / core / transport / chttp2 / huffsyms . c src / core / transport / chttp2 / status_conversion . c src / core / transport / chttp2 / stream_encoder . c src / core / transport / chttp2 / stream_map . c src / core / transport / chttp2 / timeout_encoding . c src / core / transport / chttp2 / varint . c src / core / transport / chttp2_transport . c src / core / transport / metadata . c src / core / transport / stream_op . c src / core / transport / transport . c src / core / transport / transport_op_string . c src / core / census / context . c src / core / census / initialize . c include / grpc / support / alloc . h include / grpc / support / atm . h include / grpc / support / atm_gcc_atomic . h include / grpc / support / atm_gcc_sync . h include / grpc / support / atm_win32 . h include / grpc / support / cancellable_platform . h include / grpc / support / cmdline . h include / grpc / support / cpu . h include / grpc / support / histogram . h include / grpc / support / host_port . h include / grpc / support / log . h include / grpc / support / log_win32 . h include / grpc / support / port_platform . h include / grpc / support / slice . h include / grpc / support / slice_buffer . h include / grpc / support / string_util . h include / grpc / support / subprocess . h include / grpc / support / sync . h include / grpc / support / sync_generic . h include / grpc / support / sync_posix . h include / grpc / support / sync_win32 . h include / grpc / support / thd . h include / grpc / support / time . h include / grpc / support / tls . h include / grpc / support / tls_gcc . h include / grpc / support / tls_msvc . h include / grpc / support / tls_pthread . h include / grpc / support / useful . h src / core / support / env . h src / core / support / file . h src / core / support / murmur_hash . h src / core / support / string . h src / core / support / string_win32 . h src / core / support / thd_internal . h src / core / support / alloc . c src / core / support / cancellable . c src / core / support / cmdline . c src / core / support / cpu_iphone . c src / core / support / cpu_linux . c src / core / support / cpu_posix . c src / core / support / cpu_windows . c src / core / support / env_linux . c src / core / support / env_posix . c src / core / support / env_win32 . c src / core / support / file . c src / core / support / file_posix . c src / core / support / file_win32 . c src / core / support / histogram . c src / core / support / host_port . c src / core / support / log . c src / core / support / log_android . c src / core / support / log_linux . c src / core / support / log_posix . c src / core / support / log_win32 . c src / core / support / murmur_hash . c src / core / support / slice . c src / core / support / slice_buffer . c src / core / support / string . c src / core / support / string_posix . c src / core / support / string_win32 . c src / core / support / subprocess_posix . c src / core / support / sync . c src / core / support / sync_posix . c src / core / support / sync_win32 . c src / core / support / thd . c src / core / support / thd_posix . c src / core / support / thd_win32 . c src / core / support / time . c src / core / support / time_posix . c src / core / support / time_win32 . c src / core / support / tls_pthread . c <nl> + INPUT = include / grpc / grpc_security . h include / grpc / byte_buffer . h include / grpc / byte_buffer_reader . h include / grpc / compression . h include / grpc / grpc . h include / grpc / status . h include / grpc / census . h src / core / httpcli / format_request . h src / core / httpcli / httpcli . h src / core / httpcli / httpcli_security_connector . h src / core / httpcli / parser . h src / core / security / auth_filters . h src / core / security / base64 . h src / core / security / credentials . h src / core / security / json_token . h src / core / security / secure_endpoint . h src / core / security / secure_transport_setup . h src / core / security / security_connector . h src / core / security / security_context . h src / core / tsi / fake_transport_security . h src / core / tsi / ssl_transport_security . h src / core / tsi / transport_security . h src / core / tsi / transport_security_interface . h src / core / census / grpc_context . h src / core / channel / census_filter . h src / core / channel / channel_args . h src / core / channel / channel_stack . h src / core / channel / child_channel . h src / core / channel / client_channel . h src / core / channel / client_setup . h src / core / channel / connected_channel . h src / core / channel / context . h src / core / channel / http_client_filter . h src / core / channel / http_server_filter . h src / core / channel / noop_filter . h src / core / compression / message_compress . h src / core / debug / trace . h src / core / iomgr / alarm . h src / core / iomgr / alarm_heap . h src / core / iomgr / alarm_internal . h src / core / iomgr / endpoint . h src / core / iomgr / endpoint_pair . h src / core / iomgr / fd_posix . h src / core / iomgr / iocp_windows . h src / core / iomgr / iomgr . h src / core / iomgr / iomgr_internal . h src / core / iomgr / iomgr_posix . h src / core / iomgr / pollset . h src / core / iomgr / pollset_kick_posix . h src / core / iomgr / pollset_posix . h src / core / iomgr / pollset_set_posix . h src / core / iomgr / pollset_set_windows . h src / core / iomgr / pollset_windows . h src / core / iomgr / resolve_address . h src / core / iomgr / sockaddr . h src / core / iomgr / sockaddr_posix . h src / core / iomgr / sockaddr_utils . h src / core / iomgr / sockaddr_win32 . h src / core / iomgr / socket_utils_posix . h src / core / iomgr / socket_windows . h src / core / iomgr / tcp_client . h src / core / iomgr / tcp_posix . h src / core / iomgr / tcp_server . h src / core / iomgr / tcp_windows . h src / core / iomgr / time_averaged_stats . h src / core / iomgr / wakeup_fd_pipe . h src / core / iomgr / wakeup_fd_posix . h src / core / json / json . h src / core / json / json_common . h src / core / json / json_reader . h src / core / json / json_writer . h src / core / profiling / timers . h src / core / profiling / timers_preciseclock . h src / core / surface / byte_buffer_queue . h src / core / surface / call . h src / core / surface / channel . h src / core / surface / client . h src / core / surface / completion_queue . h src / core / surface / event_string . h src / core / surface / init . h src / core / surface / server . h src / core / surface / surface_trace . h src / core / transport / chttp2 / alpn . h src / core / transport / chttp2 / bin_encoder . h src / core / transport / chttp2 / frame . h src / core / transport / chttp2 / frame_data . h src / core / transport / chttp2 / frame_goaway . h src / core / transport / chttp2 / frame_ping . h src / core / transport / chttp2 / frame_rst_stream . h src / core / transport / chttp2 / frame_settings . h src / core / transport / chttp2 / frame_window_update . h src / core / transport / chttp2 / hpack_parser . h src / core / transport / chttp2 / hpack_table . h src / core / transport / chttp2 / http2_errors . h src / core / transport / chttp2 / huffsyms . h src / core / transport / chttp2 / status_conversion . h src / core / transport / chttp2 / stream_encoder . h src / core / transport / chttp2 / stream_map . h src / core / transport / chttp2 / timeout_encoding . h src / core / transport / chttp2 / varint . h src / core / transport / chttp2_transport . h src / core / transport / metadata . h src / core / transport / stream_op . h src / core / transport / transport . h src / core / transport / transport_impl . h src / core / census / context . h src / core / httpcli / format_request . c src / core / httpcli / httpcli . c src / core / httpcli / httpcli_security_connector . c src / core / httpcli / parser . c src / core / security / base64 . c src / core / security / client_auth_filter . c src / core / security / credentials . c src / core / security / credentials_metadata . c src / core / security / credentials_posix . c src / core / security / credentials_win32 . c src / core / security / google_default_credentials . c src / core / security / json_token . c src / core / security / secure_endpoint . c src / core / security / secure_transport_setup . c src / core / security / security_connector . c src / core / security / security_context . c src / core / security / server_auth_filter . c src / core / security / server_secure_chttp2 . c src / core / surface / init_secure . c src / core / surface / secure_channel_create . c src / core / tsi / fake_transport_security . c src / core / tsi / ssl_transport_security . c src / core / tsi / transport_security . c src / core / census / grpc_context . c src / core / channel / channel_args . c src / core / channel / channel_stack . c src / core / channel / child_channel . c src / core / channel / client_channel . c src / core / channel / client_setup . c src / core / channel / connected_channel . c src / core / channel / http_client_filter . c src / core / channel / http_server_filter . c src / core / channel / noop_filter . c src / core / compression / algorithm . c src / core / compression / message_compress . c src / core / debug / trace . c src / core / iomgr / alarm . c src / core / iomgr / alarm_heap . c src / core / iomgr / endpoint . c src / core / iomgr / endpoint_pair_posix . c src / core / iomgr / endpoint_pair_windows . c src / core / iomgr / fd_posix . c src / core / iomgr / iocp_windows . c src / core / iomgr / iomgr . c src / core / iomgr / iomgr_posix . c src / core / iomgr / iomgr_windows . c src / core / iomgr / pollset_kick_posix . c src / core / iomgr / pollset_multipoller_with_epoll . c src / core / iomgr / pollset_multipoller_with_poll_posix . c src / core / iomgr / pollset_posix . c src / core / iomgr / pollset_set_posix . c src / core / iomgr / pollset_set_windows . c src / core / iomgr / pollset_windows . c src / core / iomgr / resolve_address_posix . c src / core / iomgr / resolve_address_windows . c src / core / iomgr / sockaddr_utils . c src / core / iomgr / socket_utils_common_posix . c src / core / iomgr / socket_utils_linux . c src / core / iomgr / socket_utils_posix . c src / core / iomgr / socket_windows . c src / core / iomgr / tcp_client_posix . c src / core / iomgr / tcp_client_windows . c src / core / iomgr / tcp_posix . c src / core / iomgr / tcp_server_posix . c src / core / iomgr / tcp_server_windows . c src / core / iomgr / tcp_windows . c src / core / iomgr / time_averaged_stats . c src / core / iomgr / wakeup_fd_eventfd . c src / core / iomgr / wakeup_fd_nospecial . c src / core / iomgr / wakeup_fd_pipe . c src / core / iomgr / wakeup_fd_posix . c src / core / json / json . c src / core / json / json_reader . c src / core / json / json_string . c src / core / json / json_writer . c src / core / profiling / basic_timers . c src / core / profiling / stap_timers . c src / core / surface / byte_buffer . c src / core / surface / byte_buffer_queue . c src / core / surface / byte_buffer_reader . c src / core / surface / call . c src / core / surface / call_details . c src / core / surface / call_log_batch . c src / core / surface / channel . c src / core / surface / channel_create . c src / core / surface / client . c src / core / surface / completion_queue . c src / core / surface / event_string . c src / core / surface / init . c src / core / surface / lame_client . c src / core / surface / metadata_array . c src / core / surface / server . c src / core / surface / server_chttp2 . c src / core / surface / server_create . c src / core / surface / surface_trace . c src / core / transport / chttp2 / alpn . c src / core / transport / chttp2 / bin_encoder . c src / core / transport / chttp2 / frame_data . c src / core / transport / chttp2 / frame_goaway . c src / core / transport / chttp2 / frame_ping . c src / core / transport / chttp2 / frame_rst_stream . c src / core / transport / chttp2 / frame_settings . c src / core / transport / chttp2 / frame_window_update . c src / core / transport / chttp2 / hpack_parser . c src / core / transport / chttp2 / hpack_table . c src / core / transport / chttp2 / huffsyms . c src / core / transport / chttp2 / status_conversion . c src / core / transport / chttp2 / stream_encoder . c src / core / transport / chttp2 / stream_map . c src / core / transport / chttp2 / timeout_encoding . c src / core / transport / chttp2 / varint . c src / core / transport / chttp2_transport . c src / core / transport / metadata . c src / core / transport / stream_op . c src / core / transport / transport . c src / core / transport / transport_op_string . c src / core / census / context . c src / core / census / initialize . c include / grpc / support / alloc . h include / grpc / support / atm . h include / grpc / support / atm_gcc_atomic . h include / grpc / support / atm_gcc_sync . h include / grpc / support / atm_win32 . h include / grpc / support / cancellable_platform . h include / grpc / support / cmdline . h include / grpc / support / cpu . h include / grpc / support / histogram . h include / grpc / support / host_port . h include / grpc / support / log . h include / grpc / support / log_win32 . h include / grpc / support / port_platform . h include / grpc / support / slice . h include / grpc / support / slice_buffer . h include / grpc / support / string_util . h include / grpc / support / subprocess . h include / grpc / support / sync . h include / grpc / support / sync_generic . h include / grpc / support / sync_posix . h include / grpc / support / sync_win32 . h include / grpc / support / thd . h include / grpc / support / time . h include / grpc / support / tls . h include / grpc / support / tls_gcc . h include / grpc / support / tls_msvc . h include / grpc / support / tls_pthread . h include / grpc / support / useful . h src / core / support / env . h src / core / support / file . h src / core / support / murmur_hash . h src / core / support / string . h src / core / support / string_win32 . h src / core / support / thd_internal . h src / core / support / alloc . c src / core / support / cancellable . c src / core / support / cmdline . c src / core / support / cpu_iphone . c src / core / support / cpu_linux . c src / core / support / cpu_posix . c src / core / support / cpu_windows . c src / core / support / env_linux . c src / core / support / env_posix . c src / core / support / env_win32 . c src / core / support / file . c src / core / support / file_posix . c src / core / support / file_win32 . c src / core / support / histogram . c src / core / support / host_port . c src / core / support / log . c src / core / support / log_android . c src / core / support / log_linux . c src / core / support / log_posix . c src / core / support / log_win32 . c src / core / support / murmur_hash . c src / core / support / slice . c src / core / support / slice_buffer . c src / core / support / string . c src / core / support / string_posix . c src / core / support / string_win32 . c src / core / support / subprocess_posix . c src / core / support / sync . c src / core / support / sync_posix . c src / core / support / sync_win32 . c src / core / support / thd . c src / core / support / thd_posix . c src / core / support / thd_win32 . c src / core / support / time . c src / core / support / time_posix . c src / core / support / time_win32 . c src / core / support / tls_pthread . c <nl> <nl> # This tag can be used to specify the character encoding of the source files <nl> # that doxygen parses . Internally doxygen uses the UTF - 8 encoding . Doxygen uses <nl> mmm a / tools / run_tests / run_tests . py <nl> ppp b / tools / run_tests / run_tests . py <nl> <nl> os . chdir ( ROOT ) <nl> <nl> <nl> + _FORCE_ENVIRON_FOR_WRAPPERS = { } <nl> + <nl> + <nl> # SimpleConfig : just compile with CONFIG = config , and run the binary to test <nl> class SimpleConfig ( object ) : <nl> <nl> def __init__ ( self , config , tool , args = None ) : <nl> def job_spec ( self , cmdline , hash_targets ) : <nl> return jobset . JobSpec ( cmdline = [ ' valgrind ' , ' - - tool = % s ' % self . tool ] + <nl> self . args + cmdline , <nl> - shortname = ' valgrind % s ' % binary , <nl> + shortname = ' valgrind % s ' % cmdline [ 0 ] , <nl> hash_targets = None ) <nl> <nl> <nl> class NodeLanguage ( object ) : <nl> <nl> def test_specs ( self , config , travis ) : <nl> return [ config . job_spec ( [ ' tools / run_tests / run_node . sh ' ] , None , <nl> - environ = { ' GRPC_TRACE ' : ' surface , batch ' } ) ] <nl> + environ = _FORCE_ENVIRON_FOR_WRAPPERS ) ] <nl> <nl> def make_targets ( self ) : <nl> return [ ' static_c ' , ' shared_c ' ] <nl> class PhpLanguage ( object ) : <nl> <nl> def test_specs ( self , config , travis ) : <nl> return [ config . job_spec ( [ ' src / php / bin / run_tests . sh ' ] , None , <nl> - environ = { ' GRPC_TRACE ' : ' surface , batch ' } ) ] <nl> + environ = _FORCE_ENVIRON_FOR_WRAPPERS ) ] <nl> <nl> def make_targets ( self ) : <nl> return [ ' static_c ' , ' shared_c ' ] <nl> def test_specs ( self , config , travis ) : <nl> modules = [ config . job_spec ( [ ' tools / run_tests / run_python . sh ' , ' - m ' , <nl> test [ ' module ' ] ] , <nl> None , <nl> - environ = { ' GRPC_TRACE ' : ' surface , batch ' } , <nl> + environ = _FORCE_ENVIRON_FOR_WRAPPERS , <nl> shortname = test [ ' module ' ] ) <nl> for test in self . _tests if ' module ' in test ] <nl> files = [ config . job_spec ( [ ' tools / run_tests / run_python . sh ' , <nl> test [ ' file ' ] ] , <nl> None , <nl> - environ = { ' GRPC_TRACE ' : ' surface , batch ' } , <nl> + environ = _FORCE_ENVIRON_FOR_WRAPPERS , <nl> shortname = test [ ' file ' ] ) <nl> for test in self . _tests if ' file ' in test ] <nl> return files + modules <nl> class RubyLanguage ( object ) : <nl> <nl> def test_specs ( self , config , travis ) : <nl> return [ config . job_spec ( [ ' tools / run_tests / run_ruby . sh ' ] , None , <nl> - environ = { ' GRPC_TRACE ' : ' surface , batch ' } ) ] <nl> + environ = _FORCE_ENVIRON_FOR_WRAPPERS ) ] <nl> <nl> def make_targets ( self ) : <nl> return [ ' run_dep_checks ' ] <nl> def test_specs ( self , config , travis ) : <nl> cmd = ' tools / run_tests / run_csharp . sh ' <nl> return [ config . job_spec ( [ cmd , assembly ] , <nl> None , shortname = assembly , <nl> - environ = { ' GRPC_TRACE ' : ' surface , batch ' } ) <nl> + environ = _FORCE_ENVIRON_FOR_WRAPPERS ) <nl> for assembly in assemblies ] <nl> <nl> def make_targets ( self ) : <nl> def runs_per_test_type ( arg_str ) : <nl> action = ' store_const ' , <nl> const = True ) <nl> argp . add_argument ( ' - l ' , ' - - language ' , <nl> - choices = sorted ( _LANGUAGES . keys ( ) ) , <nl> + choices = [ ' all ' ] + sorted ( _LANGUAGES . keys ( ) ) , <nl> nargs = ' + ' , <nl> - default = sorted ( _LANGUAGES . keys ( ) ) ) <nl> + default = [ ' all ' ] ) <nl> argp . add_argument ( ' - S ' , ' - - stop_on_failure ' , <nl> default = False , <nl> action = ' store_const ' , <nl> def runs_per_test_type ( arg_str ) : <nl> for x in args . config ) ) <nl> build_configs = set ( cfg . build_config for cfg in run_configs ) <nl> <nl> + if args . travis : <nl> + _FORCE_ENVIRON_FOR_WRAPPERS = { ' GRPC_TRACE ' : ' surface , batch ' } <nl> + <nl> make_targets = [ ] <nl> - languages = set ( _LANGUAGES [ l ] for l in args . language ) <nl> + languages = set ( _LANGUAGES [ l ] <nl> + for l in itertools . chain . from_iterable ( <nl> + _LANGUAGES . iterkeys ( ) if x = = ' all ' else [ x ] <nl> + for x in args . language ) ) <nl> <nl> if len ( build_configs ) > 1 : <nl> for language in languages : <nl> def make_jobspec ( cfg , targets ) : <nl> one_run = set ( <nl> spec <nl> for config in run_configs <nl> - for language in args . language <nl> - for spec in _LANGUAGES [ language ] . test_specs ( config , args . travis ) <nl> + for language in languages <nl> + for spec in language . test_specs ( config , args . travis ) <nl> if re . search ( args . regex , spec . shortname ) ) <nl> <nl> runs_per_test = args . runs_per_test <nl> mmm a / tools / run_tests / tests . json <nl> ppp b / tools / run_tests / tests . json <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_fake_security_cancel_after_accept_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_fake_security_invoke_large_request_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_fullstack_cancel_after_accept_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_fullstack_invoke_large_request_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_fullstack_uds_posix_cancel_after_accept_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_fullstack_uds_posix_invoke_large_request_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_fullstack_with_poll_cancel_after_accept_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_fullstack_with_poll_invoke_large_request_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_simple_ssl_fullstack_cancel_after_accept_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_simple_ssl_fullstack_invoke_large_request_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_simple_ssl_fullstack_with_poll_cancel_after_accept_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_simple_ssl_fullstack_with_poll_invoke_large_request_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_socket_pair_cancel_after_accept_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_socket_pair_invoke_large_request_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_socket_pair_with_grpc_trace_cancel_after_accept_test " , <nl> " platforms " : [ <nl> <nl> ] <nl> } , <nl> { <nl> - " flaky " : true , <nl> + " flaky " : false , <nl> " language " : " c " , <nl> " name " : " chttp2_socket_pair_with_grpc_trace_invoke_large_request_test " , <nl> " platforms " : [ <nl> mmm a / vsprojects / grpc / grpc . vcxproj <nl> ppp b / vsprojects / grpc / grpc . vcxproj <nl> <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ iomgr_internal . h " / > <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ iomgr_posix . h " / > <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset . h " / > <nl> - < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick . h " / > <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick_posix . h " / > <nl> - < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick_windows . h " / > <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_posix . h " / > <nl> + < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_set_posix . h " / > <nl> + < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_set_windows . h " / > <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_windows . h " / > <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ resolve_address . h " / > <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ sockaddr . h " / > <nl> <nl> < / ClCompile > <nl> < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ iomgr_windows . c " > <nl> < / ClCompile > <nl> - < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick . c " > <nl> + < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick_posix . c " > <nl> < / ClCompile > <nl> < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_multipoller_with_epoll . c " > <nl> < / ClCompile > <nl> <nl> < / ClCompile > <nl> < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_posix . c " > <nl> < / ClCompile > <nl> + < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_set_posix . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_set_windows . c " > <nl> + < / ClCompile > <nl> < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_windows . c " > <nl> < / ClCompile > <nl> < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ resolve_address_posix . c " > <nl> mmm a / vsprojects / grpc / grpc . vcxproj . filters <nl> ppp b / vsprojects / grpc / grpc . vcxproj . filters <nl> <nl> < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ iomgr_windows . c " > <nl> < Filter > src \ core \ iomgr < / Filter > <nl> < / ClCompile > <nl> - < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick . c " > <nl> + < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick_posix . c " > <nl> < Filter > src \ core \ iomgr < / Filter > <nl> < / ClCompile > <nl> < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_multipoller_with_epoll . c " > <nl> <nl> < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_posix . c " > <nl> < Filter > src \ core \ iomgr < / Filter > <nl> < / ClCompile > <nl> + < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_set_posix . c " > <nl> + < Filter > src \ core \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_set_windows . c " > <nl> + < Filter > src \ core \ iomgr < / Filter > <nl> + < / ClCompile > <nl> < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_windows . c " > <nl> < Filter > src \ core \ iomgr < / Filter > <nl> < / ClCompile > <nl> <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset . h " > <nl> < Filter > src \ core \ iomgr < / Filter > <nl> < / ClInclude > <nl> - < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick . h " > <nl> + < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick_posix . h " > <nl> < Filter > src \ core \ iomgr < / Filter > <nl> < / ClInclude > <nl> - < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick_posix . h " > <nl> + < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_posix . h " > <nl> < Filter > src \ core \ iomgr < / Filter > <nl> < / ClInclude > <nl> - < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick_windows . h " > <nl> + < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_set_posix . h " > <nl> < Filter > src \ core \ iomgr < / Filter > <nl> < / ClInclude > <nl> - < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_posix . h " > <nl> + < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_set_windows . h " > <nl> < Filter > src \ core \ iomgr < / Filter > <nl> < / ClInclude > <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_windows . h " > <nl> mmm a / vsprojects / grpc_unsecure / grpc_unsecure . vcxproj <nl> ppp b / vsprojects / grpc_unsecure / grpc_unsecure . vcxproj <nl> <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ iomgr_internal . h " / > <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ iomgr_posix . h " / > <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset . h " / > <nl> - < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick . h " / > <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick_posix . h " / > <nl> - < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick_windows . h " / > <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_posix . h " / > <nl> + < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_set_posix . h " / > <nl> + < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_set_windows . h " / > <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_windows . h " / > <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ resolve_address . h " / > <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ sockaddr . h " / > <nl> <nl> < / ClCompile > <nl> < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ iomgr_windows . c " > <nl> < / ClCompile > <nl> - < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick . c " > <nl> + < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick_posix . c " > <nl> < / ClCompile > <nl> < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_multipoller_with_epoll . c " > <nl> < / ClCompile > <nl> <nl> < / ClCompile > <nl> < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_posix . c " > <nl> < / ClCompile > <nl> + < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_set_posix . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_set_windows . c " > <nl> + < / ClCompile > <nl> < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_windows . c " > <nl> < / ClCompile > <nl> < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ resolve_address_posix . c " > <nl> mmm a / vsprojects / grpc_unsecure / grpc_unsecure . vcxproj . filters <nl> ppp b / vsprojects / grpc_unsecure / grpc_unsecure . vcxproj . filters <nl> <nl> < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ iomgr_windows . c " > <nl> < Filter > src \ core \ iomgr < / Filter > <nl> < / ClCompile > <nl> - < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick . c " > <nl> + < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick_posix . c " > <nl> < Filter > src \ core \ iomgr < / Filter > <nl> < / ClCompile > <nl> < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_multipoller_with_epoll . c " > <nl> <nl> < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_posix . c " > <nl> < Filter > src \ core \ iomgr < / Filter > <nl> < / ClCompile > <nl> + < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_set_posix . c " > <nl> + < Filter > src \ core \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_set_windows . c " > <nl> + < Filter > src \ core \ iomgr < / Filter > <nl> + < / ClCompile > <nl> < ClCompile Include = " . . \ . . \ src \ core \ iomgr \ pollset_windows . c " > <nl> < Filter > src \ core \ iomgr < / Filter > <nl> < / ClCompile > <nl> <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset . h " > <nl> < Filter > src \ core \ iomgr < / Filter > <nl> < / ClInclude > <nl> - < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick . h " > <nl> + < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick_posix . h " > <nl> < Filter > src \ core \ iomgr < / Filter > <nl> < / ClInclude > <nl> - < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick_posix . h " > <nl> + < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_posix . h " > <nl> < Filter > src \ core \ iomgr < / Filter > <nl> < / ClInclude > <nl> - < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_kick_windows . h " > <nl> + < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_set_posix . h " > <nl> < Filter > src \ core \ iomgr < / Filter > <nl> < / ClInclude > <nl> - < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_posix . h " > <nl> + < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_set_windows . h " > <nl> < Filter > src \ core \ iomgr < / Filter > <nl> < / ClInclude > <nl> < ClInclude Include = " . . \ . . \ src \ core \ iomgr \ pollset_windows . h " > <nl>
|
Merge pull request from ctiller / we - dont - need - no - backup
|
grpc/grpc
|
f3fac562e8994631484f77ad8b0c6c17582699a8
|
2015-06-19T20:08:00Z
|
mmm a / src / core / hle / service / filesystem / fsp_srv . cpp <nl> ppp b / src / core / hle / service / filesystem / fsp_srv . cpp <nl> class IFile final : public ServiceFramework < IFile > { <nl> : ServiceFramework ( " IFile " ) , backend ( std : : move ( backend ) ) { <nl> static const FunctionInfo functions [ ] = { <nl> { 0 , & IFile : : Read , " Read " } , { 1 , & IFile : : Write , " Write " } , <nl> - { 2 , nullptr , " Flush " } , { 3 , & IFile : : SetSize , " SetSize " } , <nl> + { 2 , & IFile : : Flush , " Flush " } , { 3 , & IFile : : SetSize , " SetSize " } , <nl> { 4 , & IFile : : GetSize , " GetSize " } , { 5 , nullptr , " OperateRange " } , <nl> } ; <nl> RegisterHandlers ( functions ) ; <nl> class IFile final : public ServiceFramework < IFile > { <nl> rb . Push ( RESULT_SUCCESS ) ; <nl> } <nl> <nl> + void Flush ( Kernel : : HLERequestContext & ctx ) { <nl> + LOG_DEBUG ( Service_FS , " called " ) ; <nl> + backend - > Flush ( ) ; <nl> + <nl> + IPC : : ResponseBuilder rb { ctx , 2 } ; <nl> + rb . Push ( RESULT_SUCCESS ) ; <nl> + } <nl> + <nl> void SetSize ( Kernel : : HLERequestContext & ctx ) { <nl> IPC : : RequestParser rp { ctx } ; <nl> const u64 size = rp . Pop < u64 > ( ) ; <nl>
|
Merge pull request from bunnei / fsp - flush
|
yuzu-emu/yuzu
|
778be45103b43d3f08018201461c05aba442db3d
|
2018-04-15T01:21:34Z
|
mmm a / contracts / libc + + / upstream <nl> ppp b / contracts / libc + + / upstream <nl> @ @ - 1 + 1 @ @ <nl> - Subproject commit 959b01fb8b617851e260bd2218ac8ba74269fec9 <nl> + Subproject commit 2880ac42909d4bb29687ed079f8bb4405c3b0869 <nl> mmm a / contracts / musl / upstream <nl> ppp b / contracts / musl / upstream <nl> @ @ - 1 + 1 @ @ <nl> - Subproject commit ee49ba896db1de3c3e4f4285eb4e285b641a6cd9 <nl> + Subproject commit c3607eac7ca8a1420aa4c09919ae762468585c42 <nl>
|
switch to next version of our libc and libc + + ( with floating point support )
|
EOSIO/eos
|
f4a6290effa02b9de26703b09d1b0faf0cec05e2
|
2018-03-08T22:20:58Z
|
mmm a / modules / ml / src / em . cpp <nl> ppp b / modules / ml / src / em . cpp <nl> Vec2d EM : : predict ( InputArray _sample , OutputArray _probs ) const <nl> sample . convertTo ( tmp , CV_64FC1 ) ; <nl> sample = tmp ; <nl> } <nl> - sample . reshape ( 1 , 1 ) ; <nl> + sample = sample . reshape ( 1 , 1 ) ; <nl> <nl> Mat probs ; <nl> if ( _probs . needed ( ) ) <nl> void EM : : setTrainData ( int startStep , const Mat & samples , <nl> if ( weights0 & & ( startStep = = EM : : START_E_STEP & & covs0 ) ) <nl> { <nl> weights0 - > convertTo ( weights , CV_64FC1 ) ; <nl> - weights . reshape ( 1 , 1 ) ; <nl> + weights = weights . reshape ( 1 , 1 ) ; <nl> preprocessProbability ( weights ) ; <nl> } <nl> <nl>
|
2 fixed unassigned reshapes in em ( )
|
opencv/opencv
|
2bacd8b702bbefee1bbe415b9bdcb484881071fc
|
2014-05-28T08:37:16Z
|
mmm a / atom / browser / api / atom_api_app . cc <nl> ppp b / atom / browser / api / atom_api_app . cc <nl> int GetPathConstant ( const std : : string & name ) { <nl> return brightray : : DIR_CACHE ; <nl> else if ( name = = " userCache " ) <nl> return brightray : : DIR_USER_CACHE ; <nl> + else if ( name = = " logs " ) <nl> + return brightray : : DIR_APP_LOGS ; <nl> else if ( name = = " home " ) <nl> return base : : DIR_HOME ; <nl> else if ( name = = " temp " ) <nl> mmm a / brightray / browser / brightray_paths . h <nl> ppp b / brightray / browser / brightray_paths . h <nl> enum { <nl> <nl> DIR_USER_DATA = PATH_START , / / Directory where user data can be written . <nl> DIR_USER_CACHE , / / Directory where user cache can be written . <nl> + DIR_APP_LOGS , / / Directory where app logs live <nl> <nl> # if defined ( OS_LINUX ) <nl> DIR_APP_DATA , / / Application Data directory under the user profile . <nl> mmm a / brightray / browser / browser_main_parts . cc <nl> ppp b / brightray / browser / browser_main_parts . cc <nl> <nl> <nl> # include " brightray / browser / browser_main_parts . h " <nl> <nl> + # if defined ( OSX_POSIX ) <nl> + # include < stdlib . h > <nl> + # endif <nl> + <nl> + # include < sys / stat . h > <nl> + # include < string > <nl> + <nl> # include " base / command_line . h " <nl> # include " base / feature_list . h " <nl> # include " base / strings / string_number_conversions . h " <nl> <nl> # include " brightray / browser / browser_context . h " <nl> # include " brightray / browser / devtools_manager_delegate . h " <nl> # include " brightray / browser / web_ui_controller_factory . h " <nl> + # include " brightray / common / application_info . h " <nl> # include " brightray / common / main_delegate . h " <nl> # include " content / public / browser / browser_thread . h " <nl> # include " content / public / common / content_switches . h " <nl> BrowserMainParts : : BrowserMainParts ( ) { <nl> BrowserMainParts : : ~ BrowserMainParts ( ) { <nl> } <nl> <nl> + # if defined ( OS_WIN ) | | defined ( OS_LINUX ) <nl> + void OverrideAppLogsPath ( ) { <nl> + # if defined ( OS_WIN ) <nl> + std : : wstring app_name = base : : UTF8ToWide ( GetApplicationName ( ) ) ; <nl> + std : : wstring log_path = L " % HOMEDRIVE % % HOMEPATH % \ \ AppData \ \ Roaming \ \ " ; <nl> + std : : wstring app_log_path = log_path + app_name + L " \ \ logs " ; <nl> + # else <nl> + std : : string app_name = GetApplicationName ( ) ; <nl> + std : : string home_path = std : : string ( getenv ( " HOME " ) ) ; <nl> + std : : string app_log_path = home_path + " / . config / " + app_name + " / logs " ; <nl> + # endif <nl> + PathService : : Override ( DIR_APP_LOGS , base : : FilePath ( app_log_path ) ) ; <nl> + } <nl> + # endif <nl> + <nl> void BrowserMainParts : : PreEarlyInitialization ( ) { <nl> std : : unique_ptr < base : : FeatureList > feature_list ( new base : : FeatureList ) ; <nl> feature_list - > InitializeFromCommandLine ( " " , " " ) ; <nl> base : : FeatureList : : SetInstance ( std : : move ( feature_list ) ) ; <nl> - <nl> + OverrideAppLogsPath ( ) ; <nl> # if defined ( USE_X11 ) <nl> views : : LinuxUI : : SetInstance ( BuildGtkUi ( ) ) ; <nl> OverrideLinuxAppDataPath ( ) ; <nl> mmm a / brightray / browser / browser_main_parts . h <nl> ppp b / brightray / browser / browser_main_parts . h <nl> <nl> <nl> # include " base / compiler_specific . h " <nl> # include " base / macros . h " <nl> + # include " base / path_service . h " <nl> + # include " brightray / browser / brightray_paths . h " <nl> # include " content / public / browser / browser_main_parts . h " <nl> # include " ui / views / layout / layout_provider . h " <nl> <nl> class BrowserMainParts : public content : : BrowserMainParts { <nl> private : <nl> # if defined ( OS_MACOSX ) <nl> void InitializeMainNib ( ) ; <nl> + void OverrideAppLogsPath ( ) ; <nl> # endif <nl> <nl> # if defined ( TOOLKIT_VIEWS ) <nl> mmm a / brightray / browser / browser_main_parts_mac . mm <nl> ppp b / brightray / browser / browser_main_parts_mac . mm <nl> <nl> <nl> namespace brightray { <nl> <nl> + void BrowserMainParts : : OverrideAppLogsPath ( ) { <nl> + base : : FilePath path ; <nl> + NSString * bundleName = [ [ [ NSBundle mainBundle ] infoDictionary ] <nl> + objectForKey : @ " CFBundleName " ] ; <nl> + NSString * logsPath = [ NSString stringWithFormat : @ " Library / Logs / % @ " , bundleName ] ; <nl> + NSString * libraryPath = [ NSHomeDirectory ( ) stringByAppendingPathComponent : logsPath ] ; <nl> + <nl> + PathService : : Override ( DIR_APP_LOGS , base : : FilePath ( [ libraryPath UTF8String ] ) ) ; <nl> + } <nl> + <nl> / / Replicates NSApplicationMain , but doesn ' t start a run loop . <nl> void BrowserMainParts : : InitializeMainNib ( ) { <nl> auto infoDictionary = base : : mac : : OuterBundle ( ) . infoDictionary ; <nl> mmm a / docs / api / app . md <nl> ppp b / docs / api / app . md <nl> You can request the following paths by the name : <nl> * ` music ` Directory for a user ' s music . <nl> * ` pictures ` Directory for a user ' s pictures . <nl> * ` videos ` Directory for a user ' s videos . <nl> + * ` logs ` Directory for your app ' s log folder . <nl> * ` pepperFlashSystemPlugin ` Full path to the system version of the Pepper Flash plugin . <nl> <nl> # # # ` app . getFileIcon ( path [ , options ] , callback ) ` <nl>
|
Merge pull request from electron / add_log_path_support
|
electron/electron
|
9f895879bfe11418369724f991f3fb334490a421
|
2017-09-29T18:11:29Z
|
mmm a / xbmc / dbwrappers / Database . cpp <nl> ppp b / xbmc / dbwrappers / Database . cpp <nl> CStdString CDatabase : : PrepareSQL ( CStdString strStmt , . . . ) const <nl> return strResult ; <nl> } <nl> <nl> - CStdString CDatabase : : GetSingleValue ( const CStdString & strTable , const CStdString & strColumn , const CStdString & strWhereClause / * = CStdString ( ) * / , const CStdString & strOrderBy / * = CStdString ( ) * / ) <nl> + std : : string CDatabase : : GetSingleValue ( const std : : string & query , std : : auto_ptr < Dataset > & ds ) <nl> { <nl> - CStdString strReturn ; <nl> - <nl> + std : : string ret ; <nl> try <nl> { <nl> - if ( NULL = = m_pDB . get ( ) ) return strReturn ; <nl> - if ( NULL = = m_pDS . get ( ) ) return strReturn ; <nl> - <nl> - CStdString strQueryBase = " SELECT % s FROM % s " ; <nl> - if ( ! strWhereClause . IsEmpty ( ) ) <nl> - strQueryBase . AppendFormat ( " WHERE % s " , strWhereClause . c_str ( ) ) ; <nl> - if ( ! strOrderBy . IsEmpty ( ) ) <nl> - strQueryBase . AppendFormat ( " ORDER BY % s " , strOrderBy . c_str ( ) ) ; <nl> - strQueryBase . append ( " LIMIT 1 " ) ; <nl> - <nl> - CStdString strQuery = PrepareSQL ( strQueryBase , <nl> - strColumn . c_str ( ) , strTable . c_str ( ) ) ; <nl> - <nl> - if ( ! m_pDS - > query ( strQuery . c_str ( ) ) ) return strReturn ; <nl> + if ( ! m_pDB . get ( ) | | ! ds . get ( ) ) <nl> + return ret ; <nl> <nl> - if ( m_pDS - > num_rows ( ) > 0 ) <nl> - { <nl> - strReturn = m_pDS - > fv ( 0 ) . get_asString ( ) ; <nl> - } <nl> + if ( ds - > query ( query . c_str ( ) ) & & ds - > num_rows ( ) > 0 ) <nl> + ret = ds - > fv ( 0 ) . get_asString ( ) ; <nl> <nl> - m_pDS - > close ( ) ; <nl> + ds - > close ( ) ; <nl> } <nl> catch ( . . . ) <nl> { <nl> - CLog : : Log ( LOGERROR , " % s - failed to get value ' % s ' from table ' % s ' " , <nl> - __FUNCTION__ , strColumn . c_str ( ) , strTable . c_str ( ) ) ; <nl> + CLog : : Log ( LOGERROR , " % s - failed on query ' % s ' " , __FUNCTION__ , query . c_str ( ) ) ; <nl> } <nl> + return ret ; <nl> + } <nl> <nl> - return strReturn ; <nl> + CStdString CDatabase : : GetSingleValue ( const CStdString & strTable , const CStdString & strColumn , const CStdString & strWhereClause / * = CStdString ( ) * / , const CStdString & strOrderBy / * = CStdString ( ) * / ) <nl> + { <nl> + CStdString query = PrepareSQL ( " SELECT % s FROM % s " , strColumn . c_str ( ) , strTable . c_str ( ) ) ; <nl> + if ( ! strWhereClause . empty ( ) ) <nl> + query + = " WHERE % s " + strWhereClause ; <nl> + if ( ! strOrderBy . empty ( ) ) <nl> + query + = " ORDER BY % s " + strOrderBy ; <nl> + query + = " LIMIT 1 " ; <nl> + return GetSingleValue ( query , m_pDS ) ; <nl> } <nl> <nl> bool CDatabase : : DeleteValues ( const CStdString & strTable , const CStdString & strWhereClause / * = CStdString ( ) * / ) <nl> mmm a / xbmc / dbwrappers / Database . h <nl> ppp b / xbmc / dbwrappers / Database . h <nl> class CDatabase <nl> * / <nl> CStdString GetSingleValue ( const CStdString & strTable , const CStdString & strColumn , const CStdString & strWhereClause = CStdString ( ) , const CStdString & strOrderBy = CStdString ( ) ) ; <nl> <nl> + / * ! \ brief Get a single value from a query on a dataset . <nl> + \ param query the query in question . <nl> + \ param ds the dataset to use for the query . <nl> + \ return the value from the query , empty on failure . <nl> + * / <nl> + std : : string GetSingleValue ( const std : : string & query , std : : auto_ptr < dbiplus : : Dataset > & ds ) ; <nl> + <nl> / * ! <nl> * @ brief Delete values from a table . <nl> * @ remarks The value of the strWhereClause parameter has to be FormatSQL ' ed when used . <nl>
|
adds dataset - specific version of GetSingleValue , allowing different datasets to be used for the query
|
xbmc/xbmc
|
9916f1e5f3d5bff54ba1e38878d1ce82cb199fc8
|
2012-05-25T03:40:18Z
|
mmm a / include / swift / Basic / LangOptions . h <nl> ppp b / include / swift / Basic / LangOptions . h <nl> namespace swift { <nl> bool EnableDynamic = true ; <nl> <nl> / / / Enables lvalue propagation through optional operations . <nl> - bool EnableOptionalLValues = false ; <nl> + bool EnableOptionalLValues = true ; <nl> <nl> / / / Should access control be respected ? <nl> bool EnableAccessControl = true ; <nl> mmm a / test / SILGen / force_cast_chained_optional . swift <nl> ppp b / test / SILGen / force_cast_chained_optional . swift <nl> class D : C { } <nl> / / CHECK : [ [ TRAP : bb [ 0 - 9 ] + ] ] : <nl> / / CHECK : unreachable <nl> / / CHECK : [ [ NO_BAR ] ] : <nl> - / / CHECK : br [ [ NO_BAR_2 : bb [ 0 - 9 ] + ] ] <nl> - / / CHECK : [ [ SOME_BAR ] ] : <nl> - / / CHECK : function_ref @ _TFSs24_injectValueIntoOptionalU__FQ_GSqQ__ <nl> - / / CHECK : br [ [ BAR_CONT : bb [ 0 - 9 ] + ] ] <nl> - / / CHECK : [ [ NO_BAR_2 ] ] : <nl> - / / CHECK : function_ref @ _TFSs26_injectNothingIntoOptionalU__FT_GSqQ__ <nl> - / / CHECK : br [ [ BAR_CONT ] ] <nl> - / / CHECK : [ [ BAR_CONT ] ] : <nl> - / / CHECK : function_ref @ _TFSs22_doesOptionalHaveValueU__FRGSqQ__Bi1_ <nl> - / / CHECK : cond_br { { % . * } } , [ [ SOME_BAR_3 : bb [ 0 - 9 ] + ] ] , [ [ NO_BAR_3 : bb [ 0 - 9 ] + ] ] <nl> - / / CHECK : [ [ NO_BAR_3 ] ] : <nl> / / CHECK : br [ [ TRAP ] ] <nl> - / / CHECK : [ [ SOME_BAR_3 ] ] : <nl> - / / CHECK : function_ref @ _TFC27force_cast_chained_optional3Barg3basGSQCS_1C_ <nl> + / / CHECK : [ [ SOME_BAR ] ] : <nl> + / / CHECK : [ [ PAYLOAD_ADDR : % . * ] ] = unchecked_take_enum_data_addr { { % . * } } : $ * ImplicitlyUnwrappedOptional < Bar > <nl> + / / CHECK : [ [ BAR : % . * ] ] = load [ [ PAYLOAD_ADDR ] ] <nl> + / / CHECK : [ [ GET_BAS : % . * ] ] = function_ref @ _TFC27force_cast_chained_optional3Barg3basGSQCS_1C_ <nl> + / / CHECK : apply [ transparent ] [ [ GET_BAS ] ] ( [ [ BAR ] ] ) <nl> / / CHECK : function_ref @ _TFSs36_getImplicitlyUnwrappedOptionalValueU__FGSQQ__Q_ <nl> / / CHECK : unconditional_checked_cast { { % . * } } : $ C to $ D <nl> func test ( x : Foo ) - > D { <nl> mmm a / test / SILGen / implicitly_unwrapped_optional . swift <nl> ppp b / test / SILGen / implicitly_unwrapped_optional . swift <nl> func foo ( var # f : ( ( ) - > ( ) ) ! ) { <nl> / / CHECK - NEXT : store [ [ T0 ] ] to [ [ F ] ] # 1 <nl> / / CHECK - NEXT : [ [ RESULT : % . * ] ] = alloc_stack $ Optional < ( ) > <nl> / / CHECK - NEXT : [ [ TEMP_RESULT : % . * ] ] = alloc_stack $ ( ) <nl> - / / Copy ' f ' into a temporary . <nl> - / / CHECK - NEXT : [ [ TEMP_OPTFN : % . * ] ] = alloc_stack $ Optional < ( ) - > ( ) > <nl> - / / CHECK - NEXT : [ [ TEMP_FN : % . * ] ] = alloc_stack $ @ callee_owned ( @ out ( ) , @ in ( ) ) - > ( ) <nl> - / / CHECK - NEXT : [ [ TEMP_UOPTFN : % . * ] ] = alloc_stack $ ImplicitlyUnwrappedOptional < ( ) - > ( ) > <nl> - / / CHECK - NEXT : copy_addr [ [ F ] ] # 1 to [ initialization ] [ [ TEMP_UOPTFN ] ] # 1 <nl> - / / Switch out on the copied ( ( ) - > ( ) ) ! : <nl> - / / CHECK - NEXT : function_ref <nl> - / / CHECK - NEXT : [ [ T0 : % . * ] ] = function_ref @ _TFSs41_doesImplicitlyUnwrappedOptionalHaveValueU__FRGSQQ__Bi1_ : $ @ thin < τ_0_0 > ( @ inout ImplicitlyUnwrappedOptional < τ_0_0 > ) - > Builtin . Int1 <nl> - / / CHECK - NEXT : [ [ T1 : % . * ] ] = apply [ transparent ] [ [ T0 ] ] < ( ) - > ( ) > ( [ [ TEMP_UOPTFN ] ] # 1 ) <nl> + / / Switch out on the lvalue ( ( ) - > ( ) ) ! : <nl> + / / CHECK : [ [ T0 : % . * ] ] = function_ref @ _TFSs41_doesImplicitlyUnwrappedOptionalHaveValueU__FRGSQQ__Bi1_ : $ @ thin < τ_0_0 > ( @ inout ImplicitlyUnwrappedOptional < τ_0_0 > ) - > Builtin . Int1 <nl> + / / CHECK - NEXT : [ [ T1 : % . * ] ] = apply [ transparent ] [ [ T0 ] ] < ( ) - > ( ) > ( [ [ F ] ] # 1 ) <nl> / / CHECK - NEXT : cond_br [ [ T1 ] ] , bb2 , bb1 <nl> / / If it doesn ' t have a value , kill all the temporaries and jump to <nl> / / the first nothing block . <nl> / / CHECK : bb1 : <nl> - / / CHECK - NEXT : destroy_addr [ [ TEMP_UOPTFN ] ] # 1 <nl> - / / CHECK - NEXT : dealloc_stack [ [ TEMP_UOPTFN ] ] # 0 <nl> - / / CHECK - NEXT : dealloc_stack [ [ TEMP_FN ] ] # 0 <nl> + / / CHECK - NEXT : dealloc_stack [ [ TEMP_RESULT ] ] # 0 <nl> / / CHECK - NEXT : br bb3 <nl> - / / If it does , pull the value out of the implicitly unwrapped optional . . . <nl> + / / If it does , project and load the value out of the implicitly unwrapped <nl> + / / optional . . . <nl> / / CHECK : bb2 : <nl> - / / CHECK - NEXT : function_ref <nl> - / / CHECK - NEXT : [ [ T0 : % . * ] ] = function_ref @ _TFSs36_getImplicitlyUnwrappedOptionalValueU__FGSQQ__Q_ : $ @ thin < τ_0_0 > ( @ out τ_0_0 , @ in ImplicitlyUnwrappedOptional < τ_0_0 > ) - > ( ) <nl> - / / CHECK - NEXT : [ [ TEMP_FN2 : % . * ] ] = alloc_stack $ @ callee_owned ( @ out ( ) , @ in ( ) ) - > ( ) <nl> - / / CHECK - NEXT : apply [ transparent ] [ [ T0 ] ] < ( ) - > ( ) > ( [ [ TEMP_FN2 ] ] # 1 , [ [ TEMP_UOPTFN ] ] # 1 ) <nl> - / / CHECK - NEXT : [ [ FN0 : % . * ] ] = load [ [ TEMP_FN2 ] ] # 1 <nl> + / / CHECK - NEXT : [ [ FN0_ADDR : % . * ] ] = unchecked_take_enum_data_addr [ [ F ] ] <nl> + / / CHECK - NEXT : [ [ FN0 : % . * ] ] = load [ [ FN0_ADDR ] ] <nl> / / . . . unnecessarily reabstract back to ( ) - > ( ) . . . <nl> - / / CHECK - NEXT : function_ref reabstraction thunk <nl> - / / CHECK - NEXT : [ [ T0 : % . * ] ] = function_ref @ _TTRXFo_iT__iT__XFo__dT__ : $ @ thin ( @ owned @ callee_owned ( @ out ( ) , @ in ( ) ) - > ( ) ) - > ( ) <nl> + / / CHECK : [ [ T0 : % . * ] ] = function_ref @ _TTRXFo_iT__iT__XFo__dT__ : $ @ thin ( @ owned @ callee_owned ( @ out ( ) , @ in ( ) ) - > ( ) ) - > ( ) <nl> / / CHECK - NEXT : [ [ FN1 : % . * ] ] = partial_apply [ [ T0 ] ] ( [ [ FN0 ] ] ) <nl> - / / . . . and then back to ( @ out ( ) , @ in ( ) ) - > ( ) . . . <nl> - / / CHECK - NEXT : function_ref reabstraction thunk <nl> - / / CHECK - NEXT : [ [ T0 : % . * ] ] = function_ref @ _TTRXFo__dT__XFo_iT__iT__ : $ @ thin ( @ out ( ) , @ in ( ) , @ owned @ callee_owned ( ) - > ( ) ) - > ( ) <nl> - / / CHECK - NEXT : [ [ FN2 : % . * ] ] = partial_apply [ [ T0 ] ] ( [ [ FN1 ] ] ) <nl> - / / . . . inject into an optional . . . <nl> - / / CHECK - NEXT : store [ [ FN2 ] ] to [ [ TEMP_FN ] ] <nl> - / / CHECK - NEXT : / / function_ref Swift . _injectValueIntoOptional <nl> - / / CHECK - NEXT : [ [ T0 : % . * ] ] = function_ref @ _TFSs24_injectValueIntoOptionalU__FQ_GSqQ__ <nl> - / / CHECK - NEXT : apply [ transparent ] [ [ T0 ] ] < ( ) - > ( ) > ( [ [ TEMP_OPTFN ] ] # 1 , [ [ TEMP_FN ] ] # 1 ) <nl> - / / CHECK - NEXT : dealloc_stack [ [ TEMP_FN2 ] ] # 0 <nl> - / / CHECK - NEXT : dealloc_stack [ [ TEMP_UOPTFN ] ] # 0 <nl> - / / CHECK - NEXT : dealloc_stack [ [ TEMP_FN ] ] # 0 <nl> - / / CHECK - NEXT : br bb4 <nl> + / / . . . . then call it <nl> + / / CHECK - NEXT : apply [ [ FN1 ] ] ( ) <nl> + / / CHECK : br bb4 <nl> / / ( first nothing block ) <nl> / / CHECK : bb3 : <nl> / / CHECK - NEXT : / / function_ref Swift . _injectNothingIntoOptional <nl> / / CHECK - NEXT : [ [ T0 : % . * ] ] = function_ref @ _TFSs26_injectNothingIntoOptionalU__FT_GSqQ__ <nl> - / / CHECK - NEXT : apply [ transparent ] [ [ T0 ] ] < ( ) - > ( ) > ( [ [ TEMP_OPTFN ] ] # 1 ) <nl> + / / CHECK - NEXT : apply [ transparent ] [ [ T0 ] ] < ( ) > ( [ [ RESULT ] ] # 1 ) <nl> / / CHECK - NEXT : br bb4 <nl> / / The rest of this is tested in optional . swift <nl> <nl> mmm a / test / SILGen / optional . swift <nl> ppp b / test / SILGen / optional . swift <nl> func foo ( var f : ( ( ) - > ( ) ) ? ) { <nl> / / CHECK - NEXT : store [ [ T0 ] ] to [ [ F ] ] # 1 <nl> / / CHECK - NEXT : [ [ RESULT : % . * ] ] = alloc_stack $ Optional < ( ) > <nl> / / CHECK - NEXT : [ [ TEMP_RESULT : % . * ] ] = alloc_stack $ ( ) <nl> - / / Copy ' f ' into a temporary . <nl> - / / CHECK - NEXT : [ [ TEMP_OPTFN : % . * ] ] = alloc_stack $ Optional < ( ) - > ( ) > <nl> - / / CHECK - NEXT : copy_addr [ [ F ] ] # 1 to [ initialization ] [ [ TEMP_OPTFN ] ] # 1 <nl> - / / Check whether that temporary holds a value . <nl> - / / CHECK - NEXT : function_ref <nl> - / / CHECK - NEXT : [ [ T0 : % . * ] ] = function_ref @ _TFSs22_doesOptionalHaveValueU__FRGSqQ__Bi1_ : $ @ thin < τ_0_0 > ( @ inout Optional < τ_0_0 > ) - > Builtin . Int1 <nl> - / / CHECK - NEXT : [ [ T1 : % . * ] ] = apply [ transparent ] [ [ T0 ] ] < ( ) - > ( ) > ( [ [ TEMP_OPTFN ] ] # 1 ) <nl> + / / Switch out on the lvalue ( ( ) - > ( ) ) ! : <nl> + / / CHECK : [ [ T0 : % . * ] ] = function_ref @ _TFSs22_doesOptionalHaveValueU__FRGSqQ__Bi1_ : $ @ thin < τ_0_0 > ( @ inout Optional < τ_0_0 > ) - > Builtin . Int1 <nl> + / / CHECK - NEXT : [ [ T1 : % . * ] ] = apply [ transparent ] [ [ T0 ] ] < ( ) - > ( ) > ( [ [ F ] ] # 1 ) <nl> / / CHECK - NEXT : cond_br [ [ T1 ] ] , bb2 , bb1 <nl> - / / If not , leave all the cleanups we needed and jump to the nothing block . <nl> + / / If it doesn ' t have a value , kill all the temporaries and jump to <nl> + / / the first nothing block . <nl> / / CHECK : bb1 : <nl> - / / CHECK - NEXT : destroy_addr [ [ TEMP_OPTFN ] ] # 1 <nl> - / / CHECK - NEXT : dealloc_stack [ [ TEMP_OPTFN ] ] # 0 <nl> / / CHECK - NEXT : dealloc_stack [ [ TEMP_RESULT ] ] # 0 <nl> / / CHECK - NEXT : br bb3 <nl> - / / If so , pull out the value . . . <nl> + / / If it does , project and load the value out of the implicitly unwrapped <nl> + / / optional . . . <nl> / / CHECK : bb2 : <nl> - / / CHECK - NEXT : function_ref <nl> - / / CHECK - NEXT : [ [ T0 : % . * ] ] = function_ref @ _TFSs17_getOptionalValueU__FGSqQ__Q_ : $ @ thin < τ_0_0 > ( @ out τ_0_0 , @ in Optional < τ_0_0 > ) - > ( ) <nl> - / / CHECK - NEXT : [ [ TEMP_FN : % . * ] ] = alloc_stack $ @ callee_owned ( @ out ( ) , @ in ( ) ) - > ( ) <nl> - / / CHECK - NEXT : apply [ transparent ] [ [ T0 ] ] < ( ) - > ( ) > ( [ [ TEMP_FN ] ] # 1 , [ [ TEMP_OPTFN ] ] # 1 ) <nl> - / / CHECK - NEXT : [ [ T0 : % . * ] ] = load [ [ TEMP_FN ] ] # 1 <nl> - / / . . . evaluate the rest of the suffix . . . <nl> - / / CHECK - NEXT : function_ref <nl> - / / CHECK - NEXT : [ [ T1 : % . * ] ] = function_ref @ { { . * } } : $ @ thin ( @ owned @ callee_owned ( @ out ( ) , @ in ( ) ) - > ( ) ) - > ( ) <nl> - / / CHECK - NEXT : [ [ T2 : % . * ] ] = partial_apply [ [ T1 ] ] ( [ [ T0 ] ] ) <nl> - / / CHECK - NEXT : [ [ T3 : % . * ] ] = apply [ [ T2 ] ] ( ) <nl> - / / . . . and coerce to ( ) ? <nl> - / / CHECK - NEXT : function_ref <nl> - / / CHECK - NEXT : [ [ T0 : % . * ] ] = function_ref @ _TFSs24_injectValueIntoOptionalU__FQ_GSqQ__ : $ @ thin < τ_0_0 > ( @ out Optional < τ_0_0 > , @ in τ_0_0 ) - > ( ) <nl> - / / CHECK - NEXT : [ [ T1 : % . * ] ] = apply [ transparent ] [ [ T0 ] ] < ( ) > ( [ [ RESULT ] ] # 1 , [ [ TEMP_RESULT ] ] # 1 ) <nl> - / / CHECK - NEXT : dealloc_stack [ [ TEMP_FN ] ] # 0 <nl> - / / CHECK - NEXT : dealloc_stack [ [ TEMP_OPTFN ] ] # 0 <nl> - / / CHECK - NEXT : dealloc_stack [ [ TEMP_RESULT ] ] # 0 <nl> - / / CHECK - NEXT : br bb4 <nl> - / / Nothing block . <nl> + / / CHECK - NEXT : [ [ FN0_ADDR : % . * ] ] = unchecked_take_enum_data_addr [ [ F ] ] <nl> + / / CHECK - NEXT : [ [ FN0 : % . * ] ] = load [ [ FN0_ADDR ] ] <nl> + / / . . . unnecessarily reabstract back to ( ) - > ( ) . . . <nl> + / / CHECK : [ [ T0 : % . * ] ] = function_ref @ _TTRXFo_iT__iT__XFo__dT__ : $ @ thin ( @ owned @ callee_owned ( @ out ( ) , @ in ( ) ) - > ( ) ) - > ( ) <nl> + / / CHECK - NEXT : [ [ FN1 : % . * ] ] = partial_apply [ [ T0 ] ] ( [ [ FN0 ] ] ) <nl> + / / . . . . then call it <nl> + / / CHECK - NEXT : apply [ [ FN1 ] ] ( ) <nl> + / / CHECK : br bb4 <nl> + / / ( first nothing block ) <nl> / / CHECK : bb3 : <nl> - / / CHECK - NEXT : function_ref <nl> - / / CHECK - NEXT : [ [ T0 : % . * ] ] = function_ref @ _TFSs26_injectNothingIntoOptionalU__FT_GSqQ__ : $ @ thin < τ_0_0 > ( @ out Optional < τ_0_0 > ) - > ( ) <nl> + / / CHECK - NEXT : / / function_ref Swift . _injectNothingIntoOptional <nl> + / / CHECK - NEXT : [ [ T0 : % . * ] ] = function_ref @ _TFSs26_injectNothingIntoOptionalU__FT_GSqQ__ <nl> / / CHECK - NEXT : apply [ transparent ] [ [ T0 ] ] < ( ) > ( [ [ RESULT ] ] # 1 ) <nl> / / CHECK - NEXT : br bb4 <nl> - / / Continuation block . <nl> - / / CHECK : bb4 : <nl> - / / CHECK - NEXT : [ [ T0 : % . * ] ] = load [ [ RESULT ] ] # 1 <nl> - / / CHECK - NEXT : dealloc_stack [ [ RESULT ] ] # 0 <nl> - / / CHECK - NEXT : strong_release [ [ F ] ] # 0 <nl> - / / CHECK - NEXT : [ [ T0 : % . * ] ] = tuple ( ) <nl> - / / CHECK - NEXT : return [ [ T0 ] ] : $ ( ) <nl> <nl> func foo2 < T > ( var f : ( ( ) - > T ) ? ) { <nl> var x = f ? ( ) <nl> func foo2 < T > ( var f : ( ( ) - > T ) ? ) { <nl> / / CHECK - NEXT : [ [ F : % . * ] ] = alloc_box $ Optional < ( ) - > T > <nl> / / CHECK - NEXT : store [ [ T0 ] ] to [ [ F ] ] # 1 <nl> / / CHECK - NEXT : [ [ X : % . * ] ] = alloc_box $ Optional < T > <nl> - / / Copy ' f ' into a temporary . <nl> - / / CHECK - NEXT : [ [ TEMP_RESULT : % . * ] ] = alloc_stack $ T <nl> - / / CHECK - NEXT : [ [ TEMP_OPTFN : % . * ] ] = alloc_stack $ Optional < ( ) - > T > <nl> - / / CHECK - NEXT : copy_addr [ [ F ] ] # 1 to [ initialization ] [ [ TEMP_OPTFN ] ] # 1 <nl> - / / Check whether that temporary holds a value . <nl> + / / CHECK - NEXT : [ [ TEMP : % . * ] ] = alloc_stack $ T <nl> + / / Check whether ' f ' holds a value . <nl> / / CHECK - NEXT : function_ref <nl> / / CHECK - NEXT : [ [ T0 : % . * ] ] = function_ref @ _TFSs22_doesOptionalHaveValueU__FRGSqQ__Bi1_ : $ @ thin < τ_0_0 > ( @ inout Optional < τ_0_0 > ) - > Builtin . Int1 <nl> - / / CHECK - NEXT : [ [ T1 : % . * ] ] = apply [ transparent ] [ [ T0 ] ] < ( ) - > T > ( [ [ TEMP_OPTFN ] ] # 1 ) <nl> + / / CHECK - NEXT : [ [ T1 : % . * ] ] = apply [ transparent ] [ [ T0 ] ] < ( ) - > T > ( [ [ F ] ] # 1 ) <nl> / / CHECK - NEXT : cond_br [ [ T1 ] ] , bb2 , bb1 <nl> / / If not , leave all the cleanups we needed and jump to the nothing block . <nl> / / CHECK : bb1 : <nl> - / / CHECK - NEXT : destroy_addr [ [ TEMP_OPTFN ] ] # 1 <nl> - / / CHECK - NEXT : dealloc_stack [ [ TEMP_OPTFN ] ] # 0 <nl> - / / CHECK - NEXT : dealloc_stack [ [ TEMP_RESULT ] ] # 0 <nl> + / / CHECK - NEXT : dealloc_stack [ [ TEMP ] ] # 0 <nl> / / CHECK - NEXT : br bb3 <nl> / / If so , pull out the value . . . <nl> / / CHECK : bb2 : <nl> - / / CHECK - NEXT : function_ref <nl> - / / CHECK - NEXT : [ [ T0 : % . * ] ] = function_ref @ _TFSs17_getOptionalValueU__FGSqQ__Q_ : $ @ thin < τ_0_0 > ( @ out τ_0_0 , @ in Optional < τ_0_0 > ) - > ( ) <nl> - / / CHECK - NEXT : [ [ TEMP_FN : % . * ] ] = alloc_stack $ @ callee_owned ( @ out T , @ in ( ) ) - > ( ) <nl> - / / CHECK - NEXT : apply [ transparent ] [ [ T0 ] ] < ( ) - > T > ( [ [ TEMP_FN ] ] # 1 , [ [ TEMP_OPTFN ] ] # 1 ) <nl> - / / CHECK - NEXT : [ [ T0 : % . * ] ] = load [ [ TEMP_FN ] ] # 1 <nl> + / / CHECK - NEXT : [ [ T1 : % . * ] ] = unchecked_take_enum_data_addr [ [ F ] ] # 1 <nl> + / / CHECK - NEXT : [ [ T0 : % . * ] ] = load [ [ T1 ] ] <nl> + / / CHECK - NEXT : strong_retain <nl> / / . . . evaluate the rest of the suffix . . . <nl> / / CHECK - NEXT : function_ref <nl> / / CHECK - NEXT : [ [ THUNK : % . * ] ] = function_ref @ { { . * } } : $ @ thin < τ_0_0 > ( @ out τ_0_0 , @ owned @ callee_owned ( @ out τ_0_0 , @ in ( ) ) - > ( ) ) - > ( ) <nl> func foo2 < T > ( var f : ( ( ) - > T ) ? ) { <nl> / / . . . and coerce to T ? <nl> / / CHECK - NEXT : function_ref <nl> / / CHECK - NEXT : [ [ T0 : % . * ] ] = function_ref @ _TFSs24_injectValueIntoOptionalU__FQ_GSqQ__ : $ @ thin < τ_0_0 > ( @ out Optional < τ_0_0 > , @ in τ_0_0 ) - > ( ) <nl> - / / CHECK - NEXT : apply [ transparent ] [ [ T0 ] ] < T > ( [ [ X ] ] # 1 , [ [ TEMP_RESULT ] ] # 1 ) <nl> - / / CHECK - NEXT : dealloc_stack [ [ TEMP_FN ] ] # 0 <nl> - / / CHECK - NEXT : dealloc_stack [ [ TEMP_OPTFN ] ] # 0 <nl> - / / CHECK - NEXT : dealloc_stack [ [ TEMP_RESULT ] ] # 0 <nl> + / / CHECK - NEXT : apply [ transparent ] [ [ T0 ] ] < T > ( [ [ X ] ] # 1 , [ [ TEMP ] ] # 1 ) <nl> + / / CHECK - NEXT : dealloc_stack [ [ TEMP ] ] # 0 <nl> / / CHECK - NEXT : br bb4 <nl> / / Nothing block . <nl> / / CHECK : bb3 : <nl>
|
Enable lvalue ' ? ' chaining .
|
apple/swift
|
7ff5de5f34add5cf8acacc25ec3ae504d485bb3f
|
2014-07-28T22:24:18Z
|
mmm a / torch / random . py <nl> ppp b / torch / random . py <nl> def fork_rng ( devices = None , enabled = True , _caller = " fork_rng " , _devices_kw = " device <nl> the RNG . CPU RNG state is always forked . By default , : meth : ` fork_rng ` operates <nl> on all devices , but will emit a warning if your machine has a lot <nl> of devices , since this function will run very slowly in that case . <nl> - If you explicitly specify devices , this warning will be supressed <nl> + If you explicitly specify devices , this warning will be suppressed <nl> enabled ( bool ) : if ` ` False ` ` , the RNG is not forked . This is a convenience <nl> argument for easily disabling the context manager without having <nl> - to reindent your Python code . <nl> + to delete it and unindent your Python code under it . <nl> " " " <nl> <nl> import torch . cuda <nl>
|
Improve the docstring of nn . random . fork_rng ( )
|
pytorch/pytorch
|
6ec753f2f9f950e4a7ac3e2468cb073500b1d930
|
2019-01-14T10:41:18Z
|
mmm a / folly / experimental / fibers / Fiber . cpp <nl> ppp b / folly / experimental / fibers / Fiber . cpp <nl> pid_t localThreadId ( ) { <nl> return threadId ; <nl> } <nl> <nl> - static void fillMagic ( const FContext & context ) { <nl> - uint64_t * begin = static_cast < uint64_t * > ( context . stackLimit ( ) ) ; <nl> - uint64_t * end = static_cast < uint64_t * > ( context . stackBase ( ) ) ; <nl> - <nl> - std : : fill ( begin , end , kMagic8Bytes ) ; <nl> - } <nl> - <nl> / * Size of the region from p + nBytes down to the last non - magic value * / <nl> static size_t nonMagicInBytes ( const FContext & context ) { <nl> uint64_t * begin = static_cast < uint64_t * > ( context . stackLimit ( ) ) ; <nl> Fiber : : Fiber ( FiberManager & fiberManager ) : <nl> auto limit = fiberManager_ . stackAllocator_ . allocate ( size ) ; <nl> <nl> fcontext_ = makeContext ( limit , size , & Fiber : : fiberFuncHelper ) ; <nl> + } <nl> + <nl> + void Fiber : : init ( bool recordStackUsed ) { <nl> + recordStackUsed_ = recordStackUsed ; <nl> + if ( UNLIKELY ( recordStackUsed_ & & ! stackFilledWithMagic_ ) ) { <nl> + auto limit = fcontext_ . stackLimit ( ) ; <nl> + auto base = fcontext_ . stackBase ( ) ; <nl> + <nl> + std : : fill ( static_cast < uint64_t * > ( limit ) , <nl> + static_cast < uint64_t * > ( base ) , <nl> + kMagic8Bytes ) ; <nl> + <nl> + / / newer versions of boost allocate context on fiber stack , <nl> + / / need to create a new one <nl> + auto size = fiberManager_ . options_ . stackSize ; <nl> + fcontext_ = makeContext ( limit , size , & Fiber : : fiberFuncHelper ) ; <nl> <nl> - if ( UNLIKELY ( fiberManager_ . options_ . debugRecordStackUsed ) ) { <nl> - fillMagic ( fcontext_ ) ; <nl> + stackFilledWithMagic_ = true ; <nl> } <nl> } <nl> <nl> Fiber : : ~ Fiber ( ) { <nl> <nl> void Fiber : : recordStackPosition ( ) { <nl> int stackDummy ; <nl> + auto currentPosition = static_cast < size_t > ( <nl> + static_cast < unsigned char * > ( fcontext_ . stackBase ( ) ) - <nl> + static_cast < unsigned char * > ( static_cast < void * > ( & stackDummy ) ) ) ; <nl> fiberManager_ . stackHighWatermark_ = <nl> - std : : max ( fiberManager_ . stackHighWatermark_ , <nl> - static_cast < size_t > ( <nl> - static_cast < unsigned char * > ( fcontext_ . stackBase ( ) ) - <nl> - static_cast < unsigned char * > ( <nl> - static_cast < void * > ( & stackDummy ) ) ) ) ; <nl> + std : : max ( fiberManager_ . stackHighWatermark_ , currentPosition ) ; <nl> + VLOG ( 4 ) < < " Stack usage : " < < currentPosition ; <nl> } <nl> <nl> void Fiber : : fiberFuncHelper ( intptr_t fiber ) { <nl> void Fiber : : fiberFunc ( ) { <nl> " running Fiber func_ / resultFunc_ " ) ; <nl> } <nl> <nl> - if ( UNLIKELY ( fiberManager_ . options_ . debugRecordStackUsed ) ) { <nl> + if ( UNLIKELY ( recordStackUsed_ ) ) { <nl> fiberManager_ . stackHighWatermark_ = <nl> std : : max ( fiberManager_ . stackHighWatermark_ , <nl> nonMagicInBytes ( fcontext_ ) ) ; <nl> + VLOG ( 3 ) < < " Max stack usage : " < < fiberManager_ . stackHighWatermark_ ; <nl> + CHECK ( fiberManager_ . stackHighWatermark_ < <nl> + fiberManager_ . options_ . stackSize - 64 ) < < " Fiber stack overflow " ; <nl> } <nl> <nl> state_ = INVALID ; <nl> mmm a / folly / experimental / fibers / Fiber . h <nl> ppp b / folly / experimental / fibers / Fiber . h <nl> class Fiber { <nl> friend class FiberManager ; <nl> <nl> explicit Fiber ( FiberManager & fiberManager ) ; <nl> + void init ( bool recordStackUsed ) ; <nl> <nl> template < typename F > <nl> void setFunction ( F & & func ) ; <nl> class Fiber { <nl> FContext fcontext_ ; / * * < current task execution context * / <nl> intptr_t data_ ; / * * < Used to keep some data with the Fiber * / <nl> std : : function < void ( ) > func_ ; / * * < task function * / <nl> + bool recordStackUsed_ { false } ; <nl> + bool stackFilledWithMagic_ { false } ; <nl> <nl> / * * <nl> * Points to next fiber in remote ready list <nl> mmm a / folly / experimental / fibers / FiberManager - inl . h <nl> ppp b / folly / experimental / fibers / FiberManager - inl . h <nl> inline FiberManager * FiberManager : : getFiberManagerUnsafe ( ) { <nl> return currentFiberManager_ ; <nl> } <nl> <nl> - inline bool FiberManager : : hasActiveFiber ( ) { <nl> + inline bool FiberManager : : hasActiveFiber ( ) const { <nl> return activeFiber_ ! = nullptr ; <nl> } <nl> <nl> mmm a / folly / experimental / fibers / FiberManager . cpp <nl> ppp b / folly / experimental / fibers / FiberManager . cpp <nl> Fiber * FiberManager : : getFiber ( ) { <nl> assert ( fibersPoolSize_ > 0 ) ; <nl> - - fibersPoolSize_ ; <nl> } <nl> - + + fibersActive_ ; <nl> assert ( fiber ) ; <nl> + + + fibersActive_ ; <nl> + + + fiberId_ ; <nl> + bool recordStack = ( options_ . recordStackEvery ! = 0 ) & & <nl> + ( fiberId_ % options_ . recordStackEvery = = 0 ) ; <nl> + fiber - > init ( recordStack ) ; <nl> return fiber ; <nl> } <nl> <nl> mmm a / folly / experimental / fibers / FiberManager . h <nl> ppp b / folly / experimental / fibers / FiberManager . h <nl> class FiberManager { <nl> * This is fairly expensive : we fill each newly allocated stack <nl> * with some known value and find the boundary of unused stack <nl> * with linear search every time we surrender the stack back to fibersPool . <nl> + * 0 disables stack recording . <nl> * / <nl> - bool debugRecordStackUsed { false } ; <nl> + size_t recordStackEvery { 0 } ; <nl> <nl> / * * <nl> * Keep at most this many free fibers in the pool . <nl> class FiberManager { <nl> / * * <nl> * return true if running activeFiber_ is not nullptr . <nl> * / <nl> - bool hasActiveFiber ( ) ; <nl> + bool hasActiveFiber ( ) const ; <nl> <nl> / * * <nl> * @ return What was the most observed fiber stack usage ( in bytes ) . <nl> class FiberManager { <nl> size_t fibersAllocated_ { 0 } ; / * * < total number of fibers allocated * / <nl> size_t fibersPoolSize_ { 0 } ; / * * < total number of fibers in the free pool * / <nl> size_t fibersActive_ { 0 } ; / * * < number of running or blocked fibers * / <nl> + size_t fiberId_ { 0 } ; / * * < id of last fiber used * / <nl> <nl> FContext : : ContextStruct mainContext_ ; / * * < stores loop function context * / <nl> <nl>
|
Option to record precise stack on every N fiber
|
facebook/folly
|
42caa0b1a3890bcf6b63de9c981bd1c88e02ace5
|
2015-04-10T03:34:08Z
|
mmm a / xbmc / music / infoscanner / MusicInfoScanner . cpp <nl> ppp b / xbmc / music / infoscanner / MusicInfoScanner . cpp <nl> void MUSIC_INFO : : CMusicInfoScanner : : ScrapeInfoAddedAlbums ( ) <nl> return ; <nl> <nl> std : : set < int > artists ; <nl> - for ( auto i = 0 ; i < m_albumsAdded . size ( ) ; + + i ) <nl> + for ( auto i = 0u ; i < m_albumsAdded . size ( ) ; + + i ) <nl> { <nl> if ( m_bStop ) <nl> break ; <nl>
|
fixed : auto takes type from rvalue , rvalue is an integer - > signed / unsigned comparison
|
xbmc/xbmc
|
eff275c15cb8683f2ed996be0faf9a858b18cd50
|
2017-07-10T14:33:25Z
|
new file mode 100644 <nl> index 000000000 . . 82f1599fa <nl> mmm / dev / null <nl> ppp b / . github / PULL_REQUEST_TEMPLATE / pull_request_template . md <nl> <nl> + # Fixes # . <nl> + <nl> + # # Description of the changes in this pull request : <nl> + - <nl> + - <nl> + - <nl> + <nl> + # # How this pull request was validated : <nl> + # # # Review [ Contributing . md ] ( . . / Contributing . md ) and ensure all contributing requirements are met . <nl> + # # # Specify how you tested your changes ( i . e . manual / ad - hoc testing , automated testing , new automated tests added ) <nl> + - <nl> + - <nl> + - <nl> + <nl> + @ Microsoft / calculator - team <nl>
|
Merge pull request from Microsoft / sanderl - pr - template
|
microsoft/calculator
|
098563f3d1a0afbcd2be857f62da87af89b1064a
|
2019-02-13T21:52:46Z
|
mmm a / cyber / doxy - docs / source / api / cppapi_index . rst <nl> ppp b / cyber / doxy - docs / source / api / cppapi_index . rst <nl> <nl> C + + API <nl> = = = = = = = = = = = = = = = = = = = = <nl> <nl> - Topological communication is the base mmmmmmmmm . <nl> Topological communication APIs is actually implemented in ` ` node ` ` and ` ` reader / writer ` ` and ` ` client / service ` ` . <nl> <nl> . . toctree : : <nl>
|
cyber : delete useless words
|
ApolloAuto/apollo
|
19dd1b6abeb406b977a807496aaa1468bfd98819
|
2019-05-24T18:32:04Z
|
mmm a / test / CMakeLists . txt <nl> ppp b / test / CMakeLists . txt <nl> foreach ( SDK $ { SWIFT_SDKS } ) <nl> COMMENT " Running $ { test_subset } Swift tests for $ { VARIANT_TRIPLE } " <nl> USES_TERMINAL ) <nl> <nl> + set ( test_dependencies_target_name <nl> + " swift $ { test_subset_target_suffix } $ { test_mode_target_suffix } $ { VARIANT_SUFFIX } - test - depends " ) <nl> + add_custom_target ( " $ { test_dependencies_target_name } " <nl> + DEPENDS $ { dependencies } ) <nl> + <nl> add_custom_target ( " $ { test_target_name } - custom " <nl> $ { command_upload_stdlib } <nl> $ { command_upload_swift_reflection_test } <nl> foreach ( test_mode $ { TEST_MODES } ) <nl> DEPENDS " $ { test_target_name } $ { SWIFT_PRIMARY_VARIANT_SUFFIX } " ) <nl> set_property ( TARGET " $ { test_target_name } " <nl> PROPERTY FOLDER " Tests / check - swift " ) <nl> + <nl> + add_custom_target ( " swift $ { test_subset_target_suffix } $ { test_mode_target_suffix } - test - depends " <nl> + DEPENDS " swift $ { test_subset_target_suffix } $ { test_mode_target_suffix } $ { SWIFT_PRIMARY_VARIANT_SUFFIX } - test - depends " ) <nl> endforeach ( ) <nl> endforeach ( ) <nl>
|
Merge remote - tracking branch ' origin / master ' into master - next
|
apple/swift
|
e106cf874227c5defc9b7be48b7acea21d84a3dc
|
2018-10-16T18:09:06Z
|
mmm a / WORKSPACE <nl> ppp b / WORKSPACE <nl> new_http_archive ( <nl> <nl> new_http_archive ( <nl> name = " eigen_archive " , <nl> - url = " https : / / bitbucket . org / eigen / eigen / get / 726c779 . tar . gz " , <nl> - sha256 = " 30e0c5d84cfefc6a0bf7ae1e682b22788b5b2e408e7db7d9ea2d2aa9f70a72a9 " , <nl> + url = " https : / / bitbucket . org / eigen / eigen / get / c5e90d9 . tar . gz " , <nl> + sha256 = " 3a66f9bfce85aff39bc255d5a341f87336ec6f5911e8d816dd4a3fdc500f8acf " , <nl> build_file = " eigen . BUILD " , <nl> ) <nl> <nl> mmm a / eigen . BUILD <nl> ppp b / eigen . BUILD <nl> <nl> package ( default_visibility = [ " / / visibility : public " ] ) <nl> <nl> - archive_dir = " eigen - eigen - 726c779797e8 " <nl> + archive_dir = " eigen - eigen - c5e90d9e764e " <nl> <nl> cc_library ( <nl> name = " eigen " , <nl> mmm a / third_party / eigen3 / Eigen / Cholesky <nl> ppp b / third_party / eigen3 / Eigen / Cholesky <nl> @ @ - 1 + 1 @ @ <nl> - # include " eigen - eigen - 726c779797e8 / Eigen / Cholesky " <nl> + # include " eigen - eigen - c5e90d9e764e / Eigen / Cholesky " <nl> mmm a / third_party / eigen3 / Eigen / Core <nl> ppp b / third_party / eigen3 / Eigen / Core <nl> @ @ - 1 + 1 @ @ <nl> - # include " eigen - eigen - 726c779797e8 / Eigen / Core " <nl> + # include " eigen - eigen - c5e90d9e764e / Eigen / Core " <nl> mmm a / third_party / eigen3 / Eigen / Eigenvalues <nl> ppp b / third_party / eigen3 / Eigen / Eigenvalues <nl> <nl> - # include " eigen - eigen - 726c779797e8 / Eigen / Eigenvalues " <nl> + # include " eigen - eigen - c5e90d9e764e / Eigen / Eigenvalues " <nl> <nl> mmm a / third_party / eigen3 / Eigen / LU <nl> ppp b / third_party / eigen3 / Eigen / LU <nl> @ @ - 1 + 1 @ @ <nl> - # include " eigen - eigen - 726c779797e8 / Eigen / LU " <nl> + # include " eigen - eigen - c5e90d9e764e / Eigen / LU " <nl> mmm a / third_party / eigen3 / Eigen / QR <nl> ppp b / third_party / eigen3 / Eigen / QR <nl> @ @ - 1 + 1 @ @ <nl> - # include " eigen - eigen - 726c779797e8 / Eigen / QR " <nl> + # include " eigen - eigen - c5e90d9e764e / Eigen / QR " <nl> mmm a / third_party / eigen3 / unsupported / Eigen / CXX11 / Tensor <nl> ppp b / third_party / eigen3 / unsupported / Eigen / CXX11 / Tensor <nl> @ @ - 1 + 1 @ @ <nl> - # include " eigen - eigen - 726c779797e8 / unsupported / Eigen / CXX11 / Tensor " <nl> + # include " eigen - eigen - c5e90d9e764e / unsupported / Eigen / CXX11 / Tensor " <nl>
|
Merge pull request from benoitsteiner / master .
|
tensorflow/tensorflow
|
efb860cf11ff814b695ab64b20b206944f0287d8
|
2016-02-11T18:40:43Z
|
mmm a / include / gmock / gmock - matchers . h <nl> ppp b / include / gmock / gmock - matchers . h <nl> class PolymorphicMatcher { <nl> template < typename T > <nl> inline Matcher < T > MakeMatcher ( const MatcherInterface < T > * impl ) { <nl> return Matcher < T > ( impl ) ; <nl> - } ; <nl> + } <nl> <nl> / / Creates a polymorphic matcher from its implementation . This is <nl> / / easier to use than the PolymorphicMatcher < Impl > constructor as it <nl>
|
Removes an unnecessary semi - colon , which causes a warning in GCC ' s pedantic mode .
|
google/googletest
|
2eab17b76d350dac1b1c85879ec8e1135da615ce
|
2013-03-08T17:53:24Z
|
mmm a / CMakeModules / eosio - config . cmake . in <nl> ppp b / CMakeModules / eosio - config . cmake . in <nl> if ( EOSIO_ROOT STREQUAL " " OR NOT EOSIO_ROOT ) <nl> set ( EOSIO_ROOT " @ EOS_ROOT_DIR @ " ) <nl> endif ( ) <nl> list ( APPEND CMAKE_MODULE_PATH $ { EOSIO_ROOT } / lib / cmake / eosio ) <nl> + list ( APPEND CMAKE_MODULE_PATH $ { EOSIO_ROOT } / lib64 / cmake / eosio ) <nl> include ( EosioTester ) <nl> <nl> function ( EXTRACT_MAJOR_MINOR_FROM_VERSION version success major minor ) <nl>
|
Added lib64 to CMake search space because of CentOS
|
EOSIO/eos
|
8f9bfc9c5072076473a8295d820b268794a0b170
|
2019-04-16T23:21:02Z
|
mmm a / Admin / RestAdminFeConfigurationHandler . cpp <nl> ppp b / Admin / RestAdminFeConfigurationHandler . cpp <nl> HttpHandler : : status_e RestAdminFeConfigurationHandler : : execute ( ) { <nl> <nl> default : <nl> generateError ( HttpResponse : : METHOD_NOT_ALLOWED , <nl> - TRI_REST_ERROR_METHOD_NOT_ALLOWED , <nl> + TRI_ERROR_HTTP_METHOD_NOT_ALLOWED , <nl> " expecting GET or POST " ) ; <nl> return HANDLER_DONE ; <nl> } <nl> mmm a / Admin / RestAdminLogHandler . cpp <nl> ppp b / Admin / RestAdminLogHandler . cpp <nl> HttpHandler : : status_e RestAdminLogHandler : : execute ( ) { <nl> } <nl> else { <nl> generateError ( HttpResponse : : BAD , <nl> - TRI_REST_ERROR_BAD_PARAMETER , <nl> + TRI_ERROR_HTTP_BAD_PARAMETER , <nl> " unknown ' upto ' log level : ' " + upto + " ' " ) ; <nl> return HANDLER_DONE ; <nl> } <nl> mmm a / Admin / RestBaseHandler . cpp <nl> ppp b / Admin / RestBaseHandler . cpp <nl> bool RestBaseHandler : : parseBody ( InputParser : : ObjectDescription & desc ) { <nl> <nl> if ( ! ok ) { <nl> generateError ( HttpResponse : : BAD , <nl> - TRI_REST_ERROR_CORRUPTED_JSON , <nl> + TRI_ERROR_HTTP_CORRUPTED_JSON , <nl> desc . lastError ( ) ) ; <nl> } <nl> <nl> mmm a / BasicsC / files . c <nl> ppp b / BasicsC / files . c <nl> bool TRI_CreateLockFile ( char const * filename ) { <nl> fd = TRI_CREATE ( filename , O_CREAT | O_EXCL | O_RDWR , S_IRUSR | S_IWUSR ) ; <nl> <nl> if ( fd = = - 1 ) { <nl> - TRI_set_errno ( TRI_ERROR_OPEN_ERROR ) ; <nl> + TRI_set_errno ( TRI_ERROR_SYS_ERROR ) ; <nl> return false ; <nl> } <nl> <nl> bool TRI_CreateLockFile ( char const * filename ) { <nl> <nl> rv = TRI_WRITE ( fd , buf , strlen ( buf ) ) ; <nl> <nl> - TRI_CLOSE ( fd ) ; <nl> - TRI_FreeString ( buf ) ; <nl> - <nl> if ( rv = = - 1 ) { <nl> + TRI_set_errno ( TRI_ERROR_SYS_ERROR ) ; <nl> + <nl> + TRI_FreeString ( buf ) ; <nl> + <nl> + TRI_CLOSE ( fd ) ; <nl> TRI_UNLINK ( filename ) ; <nl> - TRI_set_errno ( TRI_ERROR_WRITE_ERROR ) ; <nl> return false ; <nl> } <nl> <nl> + TRI_FreeString ( buf ) ; <nl> + TRI_CLOSE ( fd ) ; <nl> + <nl> fd = TRI_OPEN ( filename , O_RDONLY ) ; <nl> rv = flock ( fd , LOCK_EX ) ; <nl> <nl> if ( rv = = - 1 ) { / / file may be locked already <nl> + TRI_set_errno ( TRI_ERROR_SYS_ERROR ) ; <nl> + <nl> TRI_CLOSE ( fd ) ; <nl> TRI_UNLINK ( filename ) ; <nl> - TRI_set_errno ( TRI_ERROR_LOCK_ERROR ) ; <nl> return false ; <nl> } <nl> <nl> bool TRI_VerifyLockFile ( char const * filename ) { <nl> TRI_set_errno ( TRI_ERROR_NO_ERROR ) ; <nl> <nl> if ( ! TRI_ExistsFile ( filename ) ) { <nl> + TRI_set_errno ( TRI_ERROR_SYS_ERROR ) ; <nl> return false ; <nl> } <nl> <nl> bool TRI_VerifyLockFile ( char const * filename ) { <nl> can_lock = flock ( fd , LOCK_EX | LOCK_NB ) ; <nl> <nl> if ( can_lock = = 0 ) { / / file was not yet be locked <nl> - TRI_set_errno ( TRI_ERROR_UNLOCKED_FILE ) ; <nl> + TRI_set_errno ( TRI_ERROR_SYS_ERROR ) ; <nl> + <nl> flock ( fd , LOCK_UN ) ; <nl> TRI_CLOSE ( fd ) ; <nl> <nl> mmm a / BasicsC / voc - errors . c <nl> ppp b / BasicsC / voc - errors . c <nl> void TRI_InitialiseErrorMessages ( void ) { <nl> REG_ERROR ( ERROR_NUMERIC_OVERFLOW , " numeric overflow " ) ; <nl> REG_ERROR ( ERROR_ILLEGAL_OPTION , " illegal option " ) ; <nl> REG_ERROR ( ERROR_DEAD_PID , " dead process identifier " ) ; <nl> - REG_ERROR ( ERROR_OPEN_ERROR , " open / create file failed " ) ; <nl> - REG_ERROR ( ERROR_WRITE_ERROR , " write failed " ) ; <nl> - REG_ERROR ( ERROR_LOCK_ERROR , " lock failed " ) ; <nl> - REG_ERROR ( ERROR_UNLOCKED_FILE , " unlock failed " ) ; <nl> - REG_ERROR ( VOC_ERROR_ILLEGAL_STATE , " illegal state " ) ; <nl> - REG_ERROR ( VOC_ERROR_SHAPER_FAILED , " illegal shaper " ) ; <nl> - REG_ERROR ( VOC_ERROR_CORRUPTED_DATAFILE , " corrupted datafile " ) ; <nl> - REG_ERROR ( VOC_ERROR_MMAP_FAILED , " mmap failed " ) ; <nl> - REG_ERROR ( VOC_ERROR_MSYNC_FAILED , " msync failed " ) ; <nl> - REG_ERROR ( VOC_ERROR_NO_JOURNAL , " no journal " ) ; <nl> - REG_ERROR ( VOC_ERROR_DATAFILE_SEALED , " datafile sealed " ) ; <nl> - REG_ERROR ( VOC_ERROR_CORRUPTED_COLLECTION , " corrupted collection " ) ; <nl> - REG_ERROR ( VOC_ERROR_UNKNOWN_TYPE , " unknown type " ) ; <nl> - REG_ERROR ( VOC_ERROR_ILLEGAL_PARAMETER , " illegal parameter " ) ; <nl> - REG_ERROR ( VOC_ERROR_INDEX_EXISTS , " index exists " ) ; <nl> - REG_ERROR ( VOC_ERROR_CONFLICT , " conflict " ) ; <nl> - REG_ERROR ( VOC_ERROR_WRONG_PATH , " wrong path " ) ; <nl> - REG_ERROR ( VOC_ERROR_CANNOT_RENAME , " cannot rename " ) ; <nl> - REG_ERROR ( VOC_ERROR_WRITE_FAILED , " write failed " ) ; <nl> - REG_ERROR ( VOC_ERROR_READ_ONLY , " ready only " ) ; <nl> - REG_ERROR ( VOC_ERROR_DATAFILE_FULL , " datafile full " ) ; <nl> - REG_ERROR ( VOC_ERROR_FILESYSTEM_FULL , " filesystem full " ) ; <nl> - REG_ERROR ( VOC_ERROR_READ_FAILED , " read failed " ) ; <nl> - REG_ERROR ( VOC_ERROR_FILE_NOT_FOUND , " file not found " ) ; <nl> - REG_ERROR ( VOC_ERROR_FILE_NOT_ACCESSIBLE , " file not accessible " ) ; <nl> - REG_ERROR ( VOC_ERROR_DOCUMENT_NOT_FOUND , " document not found " ) ; <nl> - REG_ERROR ( VOC_ERROR_COLLECTION_NOT_FOUND , " collection not found " ) ; <nl> - REG_ERROR ( VOC_ERROR_COLLECTION_PARAMETER_MISSING , " parameter collection not found " ) ; <nl> - REG_ERROR ( VOC_ERROR_DOCUMENT_ALTERED , " document altered " ) ; <nl> - REG_ERROR ( VOC_ERROR_DOCUMENT_HANDLE_BAD , " illegal document handle " ) ; <nl> - REG_ERROR ( VOC_ERROR_COLLECTION_EXISTS , " collection already exists " ) ; <nl> - REG_ERROR ( ERROR_QUERY_OOM , " out of memory " ) ; <nl> + REG_ERROR ( ERROR_NOT_IMPLEMENTED , " not implemented " ) ; <nl> + REG_ERROR ( ERROR_HTTP_BAD_PARAMETER , " bad parameter " ) ; <nl> + REG_ERROR ( ERROR_HTTP_METHOD_NOT_ALLOWED , " method not supported " ) ; <nl> + REG_ERROR ( ERROR_HTTP_CORRUPTED_JSON , " invalid JSON object " ) ; <nl> + REG_ERROR ( ERROR_HTTP_SUPERFLUOUS_SUFFICES , " superfluous URL suffices " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_ILLEGAL_STATE , " illegal state " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_SHAPER_FAILED , " illegal shaper " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_DATAFILE_SEALED , " datafile sealed " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_UNKNOWN_COLLECTION_TYPE , " unknown type " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_READ_ONLY , " ready only " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_CORRUPTED_DATAFILE , " corrupted datafile " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_ILLEGAL_PARAMETER_FILE , " illegal parameter file " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_CORRUPTED_COLLECTION , " corrupted collection " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_MMAP_FAILED , " mmap failed " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_MSYNC_FAILED , " msync failed " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_NO_JOURNAL , " no journal " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_DATAFILE_ALREADY_EXISTS , " cannot rename , file ready exists " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_FILESYSTEM_FULL , " filesystem full " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_CONFLICT , " conflict " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_WRONG_VOCBASE_PATH , " wrong path for database " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_DOCUMENT_NOT_FOUND , " document not found " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_COLLECTION_NOT_FOUND , " collection not found " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_COLLECTION_PARAMETER_MISSING , " parameter ' collection ' not found " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_DOCUMENT_HANDLE_BAD , " illegal document handle " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_MAXIMAL_SIZE_TOO_SMALL , " maixaml size of journal too small " ) ; <nl> + REG_ERROR ( ERROR_AVOCADO_DATAFILE_FULL , " datafile full " ) ; <nl> REG_ERROR ( ERROR_QUERY_KILLED , " query killed " ) ; <nl> REG_ERROR ( ERROR_QUERY_PARSE , " parse error : % s " ) ; <nl> REG_ERROR ( ERROR_QUERY_EMPTY , " query is empty " ) ; <nl> void TRI_InitialiseErrorMessages ( void ) { <nl> REG_ERROR ( SIMPLE_CLIENT_COULD_NOT_CONNECT , " could not connect to server " ) ; <nl> REG_ERROR ( SIMPLE_CLIENT_COULD_NOT_WRITE , " could not write to server " ) ; <nl> REG_ERROR ( SIMPLE_CLIENT_COULD_NOT_READ , " could not read from server " ) ; <nl> - REG_ERROR ( ERROR_PROTOCOL_UNSUPPORTED_METHOD , " method not supported " ) ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / BasicsC / voc - errors . h <nl> ppp b / BasicsC / voc - errors . h <nl> extern " C " { <nl> / / / The following errors might be raised when running AvocadoDB : <nl> / / / <nl> / / / - 0 : @ CODE { no error } <nl> - / / / TODO <nl> + / / / No error has occurred . <nl> / / / - 1 : @ CODE { failed } <nl> - / / / TODO <nl> + / / / Will be raised when a general error occurred . <nl> / / / - 2 : @ CODE { system error } <nl> - / / / TODO <nl> + / / / Will be raised when operating system error occurred . <nl> / / / - 3 : @ CODE { out of memory } <nl> - / / / TODO <nl> + / / / Will be raised when there is a memory shortage . <nl> / / / - 4 : @ CODE { internal error } <nl> - / / / TODO <nl> + / / / Will be raised when an internal error occurred . <nl> / / / - 5 : @ CODE { illegal number } <nl> - / / / TODO <nl> + / / / Will be raised when an illegal representation of a number was given . <nl> / / / - 6 : @ CODE { numeric overflow } <nl> - / / / TODO <nl> + / / / Will be raised when a numeric overflow occurred . <nl> / / / - 7 : @ CODE { illegal option } <nl> - / / / TODO <nl> + / / / Will be raised when an unknown option was supplied by the user . <nl> / / / - 8 : @ CODE { dead process identifier } <nl> - / / / TODO <nl> - / / / - 9 : @ CODE { open / create file failed } <nl> - / / / TODO <nl> - / / / - 10 : @ CODE { write failed } <nl> - / / / TODO <nl> - / / / - 11 : @ CODE { lock failed } <nl> - / / / TODO <nl> - / / / - 12 : @ CODE { unlock failed } <nl> - / / / TODO <nl> + / / / Will be raised when a PID without a living process was found . <nl> + / / / - 9 : @ CODE { not implemented } <nl> + / / / Will be raised when hitting an unimplemented feature . <nl> + / / / - 400 : @ CODE { bad parameter } <nl> + / / / Will be raised when the a bad does not fulfill the requirements . <nl> + / / / - 405 : @ CODE { method not supported } <nl> + / / / Will be raised when an unsupported HTTP method is used for an operation . <nl> + / / / - 600 : @ CODE { invalid JSON object } <nl> + / / / Will be raised when a string representation an JSON object is corrupt . " <nl> + / / / - 601 : @ CODE { superfluous URL suffices } <nl> + / / / Will be raised when the URL contains superfluous suffices . <nl> / / / - 1000 : @ CODE { illegal state } <nl> - / / / TODO <nl> + / / / Internal error that will be raised when the datafile is not in the <nl> + / / / required state . <nl> / / / - 1001 : @ CODE { illegal shaper } <nl> - / / / TODO <nl> - / / / - 1002 : @ CODE { corrupted datafile } <nl> - / / / TODO <nl> - / / / - 1003 : @ CODE { mmap failed } <nl> - / / / TODO <nl> - / / / - 1004 : @ CODE { msync failed } <nl> - / / / TODO <nl> - / / / - 1005 : @ CODE { no journal } <nl> - / / / TODO <nl> - / / / - 1006 : @ CODE { datafile sealed } <nl> - / / / TODO <nl> - / / / - 1007 : @ CODE { corrupted collection } <nl> - / / / TODO <nl> - / / / - 1008 : @ CODE { unknown type } <nl> - / / / TODO <nl> - / / / - 1009 : @ CODE { illegal parameter } <nl> - / / / TODO <nl> - / / / - 1010 : @ CODE { index exists } <nl> - / / / TODO <nl> - / / / - 1011 : @ CODE { conflict } <nl> - / / / TODO <nl> - / / / - 1100 : @ CODE { wrong path } <nl> - / / / TODO <nl> - / / / - 1101 : @ CODE { cannot rename } <nl> - / / / TODO <nl> - / / / - 1102 : @ CODE { write failed } <nl> - / / / TODO <nl> - / / / - 1103 : @ CODE { ready only } <nl> - / / / TODO <nl> - / / / - 1104 : @ CODE { datafile full } <nl> - / / / TODO <nl> - / / / - 1105 : @ CODE { filesystem full } <nl> - / / / TODO <nl> - / / / - 1106 : @ CODE { read failed } <nl> - / / / TODO <nl> - / / / - 1107 : @ CODE { file not found } <nl> - / / / TODO <nl> - / / / - 1108 : @ CODE { file not accessible } <nl> - / / / TODO <nl> - / / / - 1200 : @ CODE { document not found } <nl> - / / / Will be raised when a doucment with a given identifier or handle is <nl> + / / / Internal error that will be raised when the shaper encountered a porblem . <nl> + / / / - 1002 : @ CODE { datafile sealed } <nl> + / / / Internal error that will be raised when trying to write to a datafile . <nl> + / / / - 1003 : @ CODE { unknown type } <nl> + / / / Internal error that will be raised when an unknown collection type is <nl> + / / / encountered . <nl> + / / / - 1004 : @ CODE { ready only } <nl> + / / / Internal error that will be raised when trying to write to a read - only <nl> + / / / datafile or collection . <nl> + / / / - 1100 : @ CODE { corrupted datafile } <nl> + / / / Will be raised when a corruption is detected in a datafile . <nl> + / / / - 1101 : @ CODE { illegal parameter file } <nl> + / / / Will be raised if a parameter file is corrupted . <nl> + / / / - 1102 : @ CODE { corrupted collection } <nl> + / / / Will be raised when a collection contains one or more corrupted datafiles . <nl> + / / / - 1103 : @ CODE { mmap failed } <nl> + / / / Will be raised when the system call mmap failed . <nl> + / / / - 1104 : @ CODE { msync failed } <nl> + / / / Will be raised when the system call msync failed <nl> + / / / - 1105 : @ CODE { no journal } <nl> + / / / Will be raised when a journal cannot be created . <nl> + / / / - 1106 : @ CODE { cannot rename , file ready exists } <nl> + / / / Will be raised when the datafile cannot be renamed because a file of the <nl> + / / / same name already exists . <nl> + / / / - 1107 : @ CODE { filesystem full } <nl> + / / / Will be raised when the filesystem is full . <nl> + / / / - 1200 : @ CODE { conflict } <nl> + / / / Will be raised when updating or deleting a document and a conflict has <nl> + / / / been detected . <nl> + / / / - 1201 : @ CODE { wrong path for database } <nl> + / / / Will be raised when a non - existing directory was specified as path for <nl> + / / / the database . <nl> + / / / - 1202 : @ CODE { document not found } <nl> + / / / Will be raised when a document with a given identifier or handle is <nl> / / / unknown . <nl> - / / / - 1201 : @ CODE { collection not found } <nl> + / / / - 1203 : @ CODE { collection not found } <nl> / / / Will be raised when a collection with a given identifier or name is <nl> / / / unknown . <nl> - / / / - 1202 : @ CODE { parameter collection not found } <nl> + / / / - 1204 : @ CODE { parameter ' collection ' not found } <nl> / / / Will be raised when the collection parameter is missing . <nl> - / / / - 1203 : @ CODE { document altered } <nl> - / / / Will be raised when a document has been altered and a change would result <nl> - / / / in a conflict . <nl> - / / / - 1204 : @ CODE { illegal document handle } <nl> + / / / - 1205 : @ CODE { illegal document handle } <nl> / / / Will be raised when a document handle is corrupt . <nl> - / / / - 1205 : @ CODE { collection already exists } <nl> - / / / Will be raised when a collection with a given identifier or name already <nl> - / / / exists . <nl> - / / / - 1500 : @ CODE { out of memory } <nl> - / / / Will be raised during query execution when a memory allocation request <nl> - / / / can not be satisfied . <nl> - / / / - 1501 : @ CODE { query killed } <nl> + / / / - 1206 : @ CODE { maixaml size of journal too small } <nl> + / / / Will be raised when the maximal size of the journal is too small . <nl> + / / / - 1300 : @ CODE { datafile full } <nl> + / / / Will be raised when the datafile reaches its limit . <nl> + / / / - 1500 : @ CODE { query killed } <nl> / / / Will be raised when a running query is killed by an explicit admin <nl> / / / command . <nl> - / / / - 1510 : @ CODE { parse error : \ % s } <nl> + / / / - 1501 : @ CODE { parse error : \ % s } <nl> / / / Will be raised when query is parsed and is found to be syntactially <nl> / / / invalid . <nl> - / / / - 1511 : @ CODE { query is empty } <nl> + / / / - 1502 : @ CODE { query is empty } <nl> / / / Will be raised when an empty query is specified . <nl> - / / / - 1512 : @ CODE { query specification invalid } <nl> + / / / - 1503 : @ CODE { query specification invalid } <nl> / / / Will be raised when a query is sent to the server with an incomplete or <nl> / / / invalid query specification structure . <nl> - / / / - 1520 : @ CODE { number ' \ % s ' is out of range } <nl> + / / / - 1504 : @ CODE { number ' \ % s ' is out of range } <nl> / / / Will be raised when a numeric value inside a query is out of the allowed <nl> / / / value range . <nl> / / / - 1521 : @ CODE { limit value ' \ % s ' is out of range } <nl> / / / Will be raised when a limit value in the query is outside the allowed <nl> / / / range ( e . g . when passing a negative skip value ) . <nl> - / / / - 1540 : @ CODE { too many joins . } <nl> + / / / - 1505 : @ CODE { too many joins . } <nl> / / / Will be raised when the number of joins in a query is beyond the allowed <nl> / / / value . <nl> - / / / - 1550 : @ CODE { collection name ' \ % s ' is invalid } <nl> + / / / - 1506 : @ CODE { collection name ' \ % s ' is invalid } <nl> / / / Will be raised when an invalid collection name is used in the from clause <nl> / / / of a query . <nl> - / / / - 1551 : @ CODE { collection alias ' \ % s ' is invalid } <nl> + / / / - 1507 : @ CODE { collection alias ' \ % s ' is invalid } <nl> / / / Will be raised when an invalid alias name is used for a collection . <nl> - / / / - 1552 : @ CODE { collection alias ' \ % s ' is declared multiple times in the same query } <nl> + / / / - 1508 : @ CODE { collection alias ' \ % s ' is declared multiple times in the same query } <nl> / / / Will be raised when the same alias name is declared multiple times in the <nl> / / / same query ' s from clause . <nl> - / / / - 1553 : @ CODE { collection alias ' \ % s ' is used but was not declared in the from clause } <nl> + / / / - 1509 : @ CODE { collection alias ' \ % s ' is used but was not declared in the from clause } <nl> / / / Will be raised when an alias not declared in the from clause is used in <nl> / / / the query . <nl> - / / / - 1560 : @ CODE { unable to open collection ' \ % s ' } <nl> + / / / - 1510 : @ CODE { unable to open collection ' \ % s ' } <nl> / / / Will be raised when one of the collections referenced in the query was <nl> / / / not found . <nl> - / / / - 1570 : @ CODE { geo restriction for alias ' \ % s ' is invalid } <nl> + / / / - 1511 : @ CODE { geo restriction for alias ' \ % s ' is invalid } <nl> / / / Will be raised when a specified geo restriction is invalid . <nl> - / / / - 1571 : @ CODE { no suitable geo index found for geo restriction on ' \ % s ' } <nl> + / / / - 1512 : @ CODE { no suitable geo index found for geo restriction on ' \ % s ' } <nl> / / / Will be raised when a geo restriction was specified but no suitable geo <nl> / / / index is found to resolve it . <nl> - / / / - 1590 : @ CODE { no value specified for declared bind parameter ' \ % s ' } <nl> + / / / - 1513 : @ CODE { no value specified for declared bind parameter ' \ % s ' } <nl> / / / Will be raised when a bind parameter was declared in the query but the <nl> / / / query is being executed with no value for that parameter . <nl> - / / / - 1591 : @ CODE { value for bind parameter ' \ % s ' is declared multiple times } <nl> + / / / - 1514 : @ CODE { value for bind parameter ' \ % s ' is declared multiple times } <nl> / / / Will be raised when a value gets specified multiple times for the same <nl> / / / bind parameter . <nl> - / / / - 1592 : @ CODE { bind parameter ' \ % s ' was not declared in the query } <nl> + / / / - 1515 : @ CODE { bind parameter ' \ % s ' was not declared in the query } <nl> / / / Will be raised when a value gets specified for an undeclared bind <nl> / / / parameter . <nl> - / / / - 1593 : @ CODE { invalid value for bind parameter ' \ % s ' } <nl> + / / / - 1516 : @ CODE { invalid value for bind parameter ' \ % s ' } <nl> / / / Will be raised when an invalid value is specified for one of the bind <nl> / / / parameters . <nl> - / / / - 1594 : @ CODE { bind parameter number ' \ % s ' out of range } <nl> + / / / - 1517 : @ CODE { bind parameter number ' \ % s ' out of range } <nl> / / / Will be specified when the numeric index for a bind parameter of type @ n <nl> / / / is out of the allowed range . <nl> / / / - 1600 : @ CODE { cursor not found } <nl> extern " C " { <nl> / / / Will be raised when the client could not write data . <nl> / / / - 2003 : @ CODE { could not read from server } <nl> / / / Will be raised when the client could not read data . <nl> - / / / - 3000 : @ CODE { method not supported } <nl> - / / / Will be raised when an unsupported HTTP method is used for an operation . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / <nl> / / / no error <nl> / / / <nl> - / / / TODO <nl> + / / / No error has occurred . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> # define TRI_ERROR_NO_ERROR ( 0 ) <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / <nl> / / / failed <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when a general error occurred . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> # define TRI_ERROR_FAILED ( 1 ) <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / <nl> / / / system error <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when operating system error occurred . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> # define TRI_ERROR_SYS_ERROR ( 2 ) <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / <nl> / / / out of memory <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when there is a memory shortage . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> # define TRI_ERROR_OUT_OF_MEMORY ( 3 ) <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / <nl> / / / internal error <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when an internal error occurred . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> # define TRI_ERROR_INTERNAL ( 4 ) <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / <nl> / / / illegal number <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when an illegal representation of a number was given . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> # define TRI_ERROR_ILLEGAL_NUMBER ( 5 ) <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / <nl> / / / numeric overflow <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when a numeric overflow occurred . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> # define TRI_ERROR_NUMERIC_OVERFLOW ( 6 ) <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / <nl> / / / illegal option <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when an unknown option was supplied by the user . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> # define TRI_ERROR_ILLEGAL_OPTION ( 7 ) <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / <nl> / / / dead process identifier <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when a PID without a living process was found . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> # define TRI_ERROR_DEAD_PID ( 8 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 9 : ERROR_OPEN_ERROR <nl> - / / / <nl> - / / / open / create file failed <nl> - / / / <nl> - / / / TODO <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - # define TRI_ERROR_OPEN_ERROR ( 9 ) <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 10 : ERROR_WRITE_ERROR <nl> + / / / @ brief 9 : ERROR_NOT_IMPLEMENTED <nl> / / / <nl> - / / / write failed <nl> + / / / not implemented <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when hitting an unimplemented feature . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_WRITE_ERROR ( 10 ) <nl> + # define TRI_ERROR_NOT_IMPLEMENTED ( 9 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 11 : ERROR_LOCK_ERROR <nl> + / / / @ brief 400 : ERROR_HTTP_BAD_PARAMETER <nl> / / / <nl> - / / / lock failed <nl> + / / / bad parameter <nl> / / / <nl> - / / / TODO <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - # define TRI_ERROR_LOCK_ERROR ( 11 ) <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 12 : ERROR_UNLOCKED_FILE <nl> - / / / <nl> - / / / unlock failed <nl> - / / / <nl> - / / / TODO <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - # define TRI_ERROR_UNLOCKED_FILE ( 12 ) <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1000 : VOC_ERROR_ILLEGAL_STATE <nl> - / / / <nl> - / / / illegal state <nl> - / / / <nl> - / / / TODO <nl> + / / / Will be raised when the a bad does not fulfill the requirements . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_ILLEGAL_STATE ( 1000 ) <nl> + # define TRI_ERROR_HTTP_BAD_PARAMETER ( 400 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1001 : VOC_ERROR_SHAPER_FAILED <nl> + / / / @ brief 405 : ERROR_HTTP_METHOD_NOT_ALLOWED <nl> / / / <nl> - / / / illegal shaper <nl> + / / / method not supported <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when an unsupported HTTP method is used for an operation . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_SHAPER_FAILED ( 1001 ) <nl> + # define TRI_ERROR_HTTP_METHOD_NOT_ALLOWED ( 405 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1002 : VOC_ERROR_CORRUPTED_DATAFILE <nl> + / / / @ brief 600 : ERROR_HTTP_CORRUPTED_JSON <nl> / / / <nl> - / / / corrupted datafile <nl> + / / / invalid JSON object <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when a string representation an JSON object is corrupt . " <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_CORRUPTED_DATAFILE ( 1002 ) <nl> + # define TRI_ERROR_HTTP_CORRUPTED_JSON ( 600 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1003 : VOC_ERROR_MMAP_FAILED <nl> + / / / @ brief 601 : ERROR_HTTP_SUPERFLUOUS_SUFFICES <nl> / / / <nl> - / / / mmap failed <nl> + / / / superfluous URL suffices <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when the URL contains superfluous suffices . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_MMAP_FAILED ( 1003 ) <nl> + # define TRI_ERROR_HTTP_SUPERFLUOUS_SUFFICES ( 601 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1004 : VOC_ERROR_MSYNC_FAILED <nl> + / / / @ brief 1000 : ERROR_AVOCADO_ILLEGAL_STATE <nl> / / / <nl> - / / / msync failed <nl> + / / / illegal state <nl> / / / <nl> - / / / TODO <nl> + / / / Internal error that will be raised when the datafile is not in the required <nl> + / / / state . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_MSYNC_FAILED ( 1004 ) <nl> + # define TRI_ERROR_AVOCADO_ILLEGAL_STATE ( 1000 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1005 : VOC_ERROR_NO_JOURNAL <nl> + / / / @ brief 1001 : ERROR_AVOCADO_SHAPER_FAILED <nl> / / / <nl> - / / / no journal <nl> + / / / illegal shaper <nl> / / / <nl> - / / / TODO <nl> + / / / Internal error that will be raised when the shaper encountered a porblem . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_NO_JOURNAL ( 1005 ) <nl> + # define TRI_ERROR_AVOCADO_SHAPER_FAILED ( 1001 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1006 : VOC_ERROR_DATAFILE_SEALED <nl> + / / / @ brief 1002 : ERROR_AVOCADO_DATAFILE_SEALED <nl> / / / <nl> / / / datafile sealed <nl> / / / <nl> - / / / TODO <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - # define TRI_VOC_ERROR_DATAFILE_SEALED ( 1006 ) <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1007 : VOC_ERROR_CORRUPTED_COLLECTION <nl> - / / / <nl> - / / / corrupted collection <nl> - / / / <nl> - / / / TODO <nl> + / / / Internal error that will be raised when trying to write to a datafile . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_CORRUPTED_COLLECTION ( 1007 ) <nl> + # define TRI_ERROR_AVOCADO_DATAFILE_SEALED ( 1002 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1008 : VOC_ERROR_UNKNOWN_TYPE <nl> + / / / @ brief 1003 : ERROR_AVOCADO_UNKNOWN_COLLECTION_TYPE <nl> / / / <nl> / / / unknown type <nl> / / / <nl> - / / / TODO <nl> + / / / Internal error that will be raised when an unknown collection type is <nl> + / / / encountered . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_UNKNOWN_TYPE ( 1008 ) <nl> + # define TRI_ERROR_AVOCADO_UNKNOWN_COLLECTION_TYPE ( 1003 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1009 : VOC_ERROR_ILLEGAL_PARAMETER <nl> + / / / @ brief 1004 : ERROR_AVOCADO_READ_ONLY <nl> / / / <nl> - / / / illegal parameter <nl> + / / / ready only <nl> / / / <nl> - / / / TODO <nl> + / / / Internal error that will be raised when trying to write to a read - only <nl> + / / / datafile or collection . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_ILLEGAL_PARAMETER ( 1009 ) <nl> + # define TRI_ERROR_AVOCADO_READ_ONLY ( 1004 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1010 : VOC_ERROR_INDEX_EXISTS <nl> + / / / @ brief 1100 : ERROR_AVOCADO_CORRUPTED_DATAFILE <nl> / / / <nl> - / / / index exists <nl> + / / / corrupted datafile <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when a corruption is detected in a datafile . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_INDEX_EXISTS ( 1010 ) <nl> + # define TRI_ERROR_AVOCADO_CORRUPTED_DATAFILE ( 1100 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1011 : VOC_ERROR_CONFLICT <nl> + / / / @ brief 1101 : ERROR_AVOCADO_ILLEGAL_PARAMETER_FILE <nl> / / / <nl> - / / / conflict <nl> + / / / illegal parameter file <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised if a parameter file is corrupted . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_CONFLICT ( 1011 ) <nl> + # define TRI_ERROR_AVOCADO_ILLEGAL_PARAMETER_FILE ( 1101 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1100 : VOC_ERROR_WRONG_PATH <nl> + / / / @ brief 1102 : ERROR_AVOCADO_CORRUPTED_COLLECTION <nl> / / / <nl> - / / / wrong path <nl> + / / / corrupted collection <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when a collection contains one or more corrupted datafiles . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_WRONG_PATH ( 1100 ) <nl> + # define TRI_ERROR_AVOCADO_CORRUPTED_COLLECTION ( 1102 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1101 : VOC_ERROR_CANNOT_RENAME <nl> + / / / @ brief 1103 : ERROR_AVOCADO_MMAP_FAILED <nl> / / / <nl> - / / / cannot rename <nl> + / / / mmap failed <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when the system call mmap failed . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_CANNOT_RENAME ( 1101 ) <nl> + # define TRI_ERROR_AVOCADO_MMAP_FAILED ( 1103 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1102 : VOC_ERROR_WRITE_FAILED <nl> + / / / @ brief 1104 : ERROR_AVOCADO_MSYNC_FAILED <nl> / / / <nl> - / / / write failed <nl> + / / / msync failed <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when the system call msync failed <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_WRITE_FAILED ( 1102 ) <nl> + # define TRI_ERROR_AVOCADO_MSYNC_FAILED ( 1104 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1103 : VOC_ERROR_READ_ONLY <nl> + / / / @ brief 1105 : ERROR_AVOCADO_NO_JOURNAL <nl> / / / <nl> - / / / ready only <nl> + / / / no journal <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when a journal cannot be created . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_READ_ONLY ( 1103 ) <nl> + # define TRI_ERROR_AVOCADO_NO_JOURNAL ( 1105 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1104 : VOC_ERROR_DATAFILE_FULL <nl> + / / / @ brief 1106 : ERROR_AVOCADO_DATAFILE_ALREADY_EXISTS <nl> / / / <nl> - / / / datafile full <nl> + / / / cannot rename , file ready exists <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when the datafile cannot be renamed because a file of the <nl> + / / / same name already exists . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_DATAFILE_FULL ( 1104 ) <nl> + # define TRI_ERROR_AVOCADO_DATAFILE_ALREADY_EXISTS ( 1106 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1105 : VOC_ERROR_FILESYSTEM_FULL <nl> + / / / @ brief 1107 : ERROR_AVOCADO_FILESYSTEM_FULL <nl> / / / <nl> / / / filesystem full <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when the filesystem is full . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_FILESYSTEM_FULL ( 1105 ) <nl> + # define TRI_ERROR_AVOCADO_FILESYSTEM_FULL ( 1107 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1106 : VOC_ERROR_READ_FAILED <nl> - / / / <nl> - / / / read failed <nl> + / / / @ brief 1200 : ERROR_AVOCADO_CONFLICT <nl> / / / <nl> - / / / TODO <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - # define TRI_VOC_ERROR_READ_FAILED ( 1106 ) <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1107 : VOC_ERROR_FILE_NOT_FOUND <nl> - / / / <nl> - / / / file not found <nl> + / / / conflict <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when updating or deleting a document and a conflict has been <nl> + / / / detected . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_FILE_NOT_FOUND ( 1107 ) <nl> + # define TRI_ERROR_AVOCADO_CONFLICT ( 1200 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1108 : VOC_ERROR_FILE_NOT_ACCESSIBLE <nl> + / / / @ brief 1201 : ERROR_AVOCADO_WRONG_VOCBASE_PATH <nl> / / / <nl> - / / / file not accessible <nl> + / / / wrong path for database <nl> / / / <nl> - / / / TODO <nl> + / / / Will be raised when a non - existing directory was specified as path for the <nl> + / / / database . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_FILE_NOT_ACCESSIBLE ( 1108 ) <nl> + # define TRI_ERROR_AVOCADO_WRONG_VOCBASE_PATH ( 1201 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1200 : VOC_ERROR_DOCUMENT_NOT_FOUND <nl> + / / / @ brief 1202 : ERROR_AVOCADO_DOCUMENT_NOT_FOUND <nl> / / / <nl> / / / document not found <nl> / / / <nl> - / / / Will be raised when a doucment with a given identifier or handle is unknown . <nl> + / / / Will be raised when a document with a given identifier or handle is unknown . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_DOCUMENT_NOT_FOUND ( 1200 ) <nl> + # define TRI_ERROR_AVOCADO_DOCUMENT_NOT_FOUND ( 1202 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1201 : VOC_ERROR_COLLECTION_NOT_FOUND <nl> + / / / @ brief 1203 : ERROR_AVOCADO_COLLECTION_NOT_FOUND <nl> / / / <nl> / / / collection not found <nl> / / / <nl> / / / Will be raised when a collection with a given identifier or name is unknown . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_COLLECTION_NOT_FOUND ( 1201 ) <nl> + # define TRI_ERROR_AVOCADO_COLLECTION_NOT_FOUND ( 1203 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1202 : VOC_ERROR_COLLECTION_PARAMETER_MISSING <nl> + / / / @ brief 1204 : ERROR_AVOCADO_COLLECTION_PARAMETER_MISSING <nl> / / / <nl> - / / / parameter collection not found <nl> + / / / parameter ' collection ' not found <nl> / / / <nl> / / / Will be raised when the collection parameter is missing . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_COLLECTION_PARAMETER_MISSING ( 1202 ) <nl> + # define TRI_ERROR_AVOCADO_COLLECTION_PARAMETER_MISSING ( 1204 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1203 : VOC_ERROR_DOCUMENT_ALTERED <nl> - / / / <nl> - / / / document altered <nl> - / / / <nl> - / / / Will be raised when a document has been altered and a change would result <nl> - / / / in a conflict . <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - # define TRI_VOC_ERROR_DOCUMENT_ALTERED ( 1203 ) <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1204 : VOC_ERROR_DOCUMENT_HANDLE_BAD <nl> + / / / @ brief 1205 : ERROR_AVOCADO_DOCUMENT_HANDLE_BAD <nl> / / / <nl> / / / illegal document handle <nl> / / / <nl> / / / Will be raised when a document handle is corrupt . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_DOCUMENT_HANDLE_BAD ( 1204 ) <nl> + # define TRI_ERROR_AVOCADO_DOCUMENT_HANDLE_BAD ( 1205 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1205 : VOC_ERROR_COLLECTION_EXISTS <nl> + / / / @ brief 1206 : ERROR_AVOCADO_MAXIMAL_SIZE_TOO_SMALL <nl> / / / <nl> - / / / collection already exists <nl> + / / / maixaml size of journal too small <nl> / / / <nl> - / / / Will be raised when a collection with a given identifier or name already <nl> - / / / exists . <nl> + / / / Will be raised when the maximal size of the journal is too small . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_VOC_ERROR_COLLECTION_EXISTS ( 1205 ) <nl> + # define TRI_ERROR_AVOCADO_MAXIMAL_SIZE_TOO_SMALL ( 1206 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1500 : ERROR_QUERY_OOM <nl> + / / / @ brief 1300 : ERROR_AVOCADO_DATAFILE_FULL <nl> / / / <nl> - / / / out of memory <nl> + / / / datafile full <nl> / / / <nl> - / / / Will be raised during query execution when a memory allocation request can <nl> - / / / not be satisfied . <nl> + / / / Will be raised when the datafile reaches its limit . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_OOM ( 1500 ) <nl> + # define TRI_ERROR_AVOCADO_DATAFILE_FULL ( 1300 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1501 : ERROR_QUERY_KILLED <nl> + / / / @ brief 1500 : ERROR_QUERY_KILLED <nl> / / / <nl> / / / query killed <nl> / / / <nl> / / / Will be raised when a running query is killed by an explicit admin command . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_KILLED ( 1501 ) <nl> + # define TRI_ERROR_QUERY_KILLED ( 1500 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1510 : ERROR_QUERY_PARSE <nl> + / / / @ brief 1501 : ERROR_QUERY_PARSE <nl> / / / <nl> / / / parse error : % s <nl> / / / <nl> / / / Will be raised when query is parsed and is found to be syntactially invalid . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_PARSE ( 1510 ) <nl> + # define TRI_ERROR_QUERY_PARSE ( 1501 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1511 : ERROR_QUERY_EMPTY <nl> + / / / @ brief 1502 : ERROR_QUERY_EMPTY <nl> / / / <nl> / / / query is empty <nl> / / / <nl> / / / Will be raised when an empty query is specified . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_EMPTY ( 1511 ) <nl> + # define TRI_ERROR_QUERY_EMPTY ( 1502 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1512 : ERROR_QUERY_SPECIFICATION_INVALID <nl> + / / / @ brief 1503 : ERROR_QUERY_SPECIFICATION_INVALID <nl> / / / <nl> / / / query specification invalid <nl> / / / <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / invalid query specification structure . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_SPECIFICATION_INVALID ( 1512 ) <nl> + # define TRI_ERROR_QUERY_SPECIFICATION_INVALID ( 1503 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1520 : ERROR_QUERY_NUMBER_OUT_OF_RANGE <nl> + / / / @ brief 1504 : ERROR_QUERY_NUMBER_OUT_OF_RANGE <nl> / / / <nl> / / / number ' % s ' is out of range <nl> / / / <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / value range . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE ( 1520 ) <nl> + # define TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE ( 1504 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief 1521 : ERROR_QUERY_LIMIT_VALUE_OUT_OF_RANGE <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> # define TRI_ERROR_QUERY_LIMIT_VALUE_OUT_OF_RANGE ( 1521 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1540 : ERROR_QUERY_TOO_MANY_JOINS <nl> + / / / @ brief 1505 : ERROR_QUERY_TOO_MANY_JOINS <nl> / / / <nl> / / / too many joins . <nl> / / / <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / value . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_TOO_MANY_JOINS ( 1540 ) <nl> + # define TRI_ERROR_QUERY_TOO_MANY_JOINS ( 1505 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1550 : ERROR_QUERY_COLLECTION_NAME_INVALID <nl> + / / / @ brief 1506 : ERROR_QUERY_COLLECTION_NAME_INVALID <nl> / / / <nl> / / / collection name ' % s ' is invalid <nl> / / / <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / of a query . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_COLLECTION_NAME_INVALID ( 1550 ) <nl> + # define TRI_ERROR_QUERY_COLLECTION_NAME_INVALID ( 1506 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1551 : ERROR_QUERY_COLLECTION_ALIAS_INVALID <nl> + / / / @ brief 1507 : ERROR_QUERY_COLLECTION_ALIAS_INVALID <nl> / / / <nl> / / / collection alias ' % s ' is invalid <nl> / / / <nl> / / / Will be raised when an invalid alias name is used for a collection . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_COLLECTION_ALIAS_INVALID ( 1551 ) <nl> + # define TRI_ERROR_QUERY_COLLECTION_ALIAS_INVALID ( 1507 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1552 : ERROR_QUERY_COLLECTION_ALIAS_REDECLARED <nl> + / / / @ brief 1508 : ERROR_QUERY_COLLECTION_ALIAS_REDECLARED <nl> / / / <nl> / / / collection alias ' % s ' is declared multiple times in the same query <nl> / / / <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / same query ' s from clause . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_COLLECTION_ALIAS_REDECLARED ( 1552 ) <nl> + # define TRI_ERROR_QUERY_COLLECTION_ALIAS_REDECLARED ( 1508 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1553 : ERROR_QUERY_COLLECTION_ALIAS_UNDECLARED <nl> + / / / @ brief 1509 : ERROR_QUERY_COLLECTION_ALIAS_UNDECLARED <nl> / / / <nl> / / / collection alias ' % s ' is used but was not declared in the from clause <nl> / / / <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / query . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_COLLECTION_ALIAS_UNDECLARED ( 1553 ) <nl> + # define TRI_ERROR_QUERY_COLLECTION_ALIAS_UNDECLARED ( 1509 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1560 : ERROR_QUERY_COLLECTION_NOT_FOUND <nl> + / / / @ brief 1510 : ERROR_QUERY_COLLECTION_NOT_FOUND <nl> / / / <nl> / / / unable to open collection ' % s ' <nl> / / / <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / found . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_COLLECTION_NOT_FOUND ( 1560 ) <nl> + # define TRI_ERROR_QUERY_COLLECTION_NOT_FOUND ( 1510 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1570 : ERROR_QUERY_GEO_RESTRICTION_INVALID <nl> + / / / @ brief 1511 : ERROR_QUERY_GEO_RESTRICTION_INVALID <nl> / / / <nl> / / / geo restriction for alias ' % s ' is invalid <nl> / / / <nl> / / / Will be raised when a specified geo restriction is invalid . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_GEO_RESTRICTION_INVALID ( 1570 ) <nl> + # define TRI_ERROR_QUERY_GEO_RESTRICTION_INVALID ( 1511 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1571 : ERROR_QUERY_GEO_INDEX_MISSING <nl> + / / / @ brief 1512 : ERROR_QUERY_GEO_INDEX_MISSING <nl> / / / <nl> / / / no suitable geo index found for geo restriction on ' % s ' <nl> / / / <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / index is found to resolve it . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_GEO_INDEX_MISSING ( 1571 ) <nl> + # define TRI_ERROR_QUERY_GEO_INDEX_MISSING ( 1512 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1590 : ERROR_QUERY_BIND_PARAMETER_MISSING <nl> + / / / @ brief 1513 : ERROR_QUERY_BIND_PARAMETER_MISSING <nl> / / / <nl> / / / no value specified for declared bind parameter ' % s ' <nl> / / / <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / query is being executed with no value for that parameter . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_BIND_PARAMETER_MISSING ( 1590 ) <nl> + # define TRI_ERROR_QUERY_BIND_PARAMETER_MISSING ( 1513 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1591 : ERROR_QUERY_BIND_PARAMETER_REDECLARED <nl> + / / / @ brief 1514 : ERROR_QUERY_BIND_PARAMETER_REDECLARED <nl> / / / <nl> / / / value for bind parameter ' % s ' is declared multiple times <nl> / / / <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / parameter . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_BIND_PARAMETER_REDECLARED ( 1591 ) <nl> + # define TRI_ERROR_QUERY_BIND_PARAMETER_REDECLARED ( 1514 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1592 : ERROR_QUERY_BIND_PARAMETER_UNDECLARED <nl> + / / / @ brief 1515 : ERROR_QUERY_BIND_PARAMETER_UNDECLARED <nl> / / / <nl> / / / bind parameter ' % s ' was not declared in the query <nl> / / / <nl> / / / Will be raised when a value gets specified for an undeclared bind parameter . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_BIND_PARAMETER_UNDECLARED ( 1592 ) <nl> + # define TRI_ERROR_QUERY_BIND_PARAMETER_UNDECLARED ( 1515 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1593 : ERROR_QUERY_BIND_PARAMETER_VALUE_INVALID <nl> + / / / @ brief 1516 : ERROR_QUERY_BIND_PARAMETER_VALUE_INVALID <nl> / / / <nl> / / / invalid value for bind parameter ' % s ' <nl> / / / <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / parameters . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_BIND_PARAMETER_VALUE_INVALID ( 1593 ) <nl> + # define TRI_ERROR_QUERY_BIND_PARAMETER_VALUE_INVALID ( 1516 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 1594 : ERROR_QUERY_BIND_PARAMETER_NUMBER_OUT_OF_RANGE <nl> + / / / @ brief 1517 : ERROR_QUERY_BIND_PARAMETER_NUMBER_OUT_OF_RANGE <nl> / / / <nl> / / / bind parameter number ' % s ' out of range <nl> / / / <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> / / / out of the allowed range . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # define TRI_ERROR_QUERY_BIND_PARAMETER_NUMBER_OUT_OF_RANGE ( 1594 ) <nl> + # define TRI_ERROR_QUERY_BIND_PARAMETER_NUMBER_OUT_OF_RANGE ( 1517 ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief 1600 : ERROR_CURSOR_NOT_FOUND <nl> void TRI_InitialiseErrorMessages ( void ) ; <nl> <nl> # define TRI_SIMPLE_CLIENT_COULD_NOT_READ ( 2003 ) <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 3000 : ERROR_PROTOCOL_UNSUPPORTED_METHOD <nl> - / / / <nl> - / / / method not supported <nl> - / / / <nl> - / / / Will be raised when an unsupported HTTP method is used for an operation . <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - # define TRI_ERROR_PROTOCOL_UNSUPPORTED_METHOD ( 3000 ) <nl> - <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ } <nl> mmm a / QL / parser . y <nl> ppp b / QL / parser . y <nl> <nl> <nl> # define ABORT_IF_OOM ( ptr ) \ <nl> if ( ! ptr ) { \ <nl> - TRI_SetQueryError ( & template_ - > _error , TRI_ERROR_QUERY_OOM , NULL ) ; \ <nl> + TRI_SetQueryError ( & template_ - > _error , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; \ <nl> YYABORT ; \ <nl> } <nl> <nl> select_clause : <nl> $ $ = $ 1 ; <nl> ABORT_IF_OOM ( $ $ ) ; <nl> } <nl> - ; <nl> + ; <nl> <nl> from_clause : <nl> FROM { <nl> from_clause : <nl> $ $ = TRI_ParseQueryContextPop ( template_ ) ; <nl> ABORT_IF_OOM ( $ $ ) ; <nl> } <nl> - ; <nl> + ; <nl> <nl> from_list : <nl> collection_reference geo_restriction { <nl> collection_alias : <nl> $ $ - > _value . _stringValue = TRI_ParseQueryRegisterString ( template_ , TRI_UnescapeUtf8String ( $ 1 + 1 , strlen ( $ 1 ) - 2 , & outLength ) ) ; <nl> ABORT_IF_OOM ( $ $ - > _value . _stringValue ) ; <nl> } <nl> - ; <nl> + ; <nl> <nl> join_type : <nl> list_join { <nl> mmm a / Rest / HttpResponse . h <nl> ppp b / Rest / HttpResponse . h <nl> <nl> # include < Basics / Dictionary . h > <nl> # include < Basics / StringBuffer . h > <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 500 : Method ( GET / PUT / POST / DELETE ) not allowed . <nl> - / / / <nl> - / / / Will be raised when the request method is not allowed . <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - # define TRI_REST_ERROR_METHOD_NOT_ALLOWED ( 500 ) <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 501 : Bad parameter . <nl> - / / / <nl> - / / / Will be raised when the a bad does not fulfill the requirements . <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - # define TRI_REST_ERROR_BAD_PARAMETER ( 501 ) <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 502 : Invalid JSON object . <nl> - / / / <nl> - / / / Will be raised when a string representation an JSON object is corrupt . <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - # define TRI_REST_ERROR_CORRUPTED_JSON ( 502 ) <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 503 : Tailing URL parts . <nl> - / / / <nl> - / / / Will be raised when the URL contains superfluous suffices . <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - # define TRI_REST_ERROR_SUPERFLUOUS_SUFFICES ( 503 ) <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief 503 : Not implemented . <nl> - / / / <nl> - / / / Will be raised when the URL exists , but has not yet been implemented . <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - # define TRI_REST_ERROR_NOT_IMPLEMENTED ( 504 ) <nl> - <nl> namespace triagens { <nl> namespace rest { <nl> <nl> mmm a / Rest / Initialise . cpp <nl> ppp b / Rest / Initialise . cpp <nl> namespace triagens { <nl> # ifdef TRI_HAVE_POSIX_THREADS <nl> opensslSetup ( ) ; <nl> # endif <nl> - <nl> - / / rest errors <nl> - TRI_set_errno_string ( TRI_REST_ERROR_BAD_PARAMETER , " bad parameter " ) ; <nl> - TRI_set_errno_string ( TRI_REST_ERROR_CORRUPTED_JSON , " corrupted JSON " ) ; <nl> - TRI_set_errno_string ( TRI_REST_ERROR_METHOD_NOT_ALLOWED , " method not allowed " ) ; <nl> - TRI_set_errno_string ( TRI_REST_ERROR_NOT_IMPLEMENTED , " not implemented " ) ; <nl> - TRI_set_errno_string ( TRI_REST_ERROR_SUPERFLUOUS_SUFFICES , " superfluous suffices " ) ; <nl> } <nl> <nl> <nl> mmm a / RestHandler / RestDocumentHandler . cpp <nl> ppp b / RestHandler / RestDocumentHandler . cpp <nl> bool RestDocumentHandler : : createDocument ( ) { <nl> <nl> if ( suffix . size ( ) ! = 0 ) { <nl> generateError ( HttpResponse : : BAD , <nl> - TRI_REST_ERROR_SUPERFLUOUS_SUFFICES , <nl> + TRI_ERROR_HTTP_SUPERFLUOUS_SUFFICES , <nl> " superfluous suffix , expecting " + DOCUMENT_PATH + " ? collection = < identifier > " ) ; <nl> return false ; <nl> } <nl> bool RestDocumentHandler : : createDocument ( ) { <nl> <nl> if ( ! found | | cid . empty ( ) ) { <nl> generateError ( HttpResponse : : BAD , <nl> - TRI_VOC_ERROR_COLLECTION_PARAMETER_MISSING , <nl> + TRI_ERROR_AVOCADO_COLLECTION_PARAMETER_MISSING , <nl> " ' collection ' is missing , expecting " + DOCUMENT_PATH + " ? collection = < identifier > " ) ; <nl> return false ; <nl> } <nl> bool RestDocumentHandler : : createDocument ( ) { <nl> return true ; <nl> } <nl> else { <nl> - if ( TRI_errno ( ) = = TRI_VOC_ERROR_READ_ONLY ) { <nl> + if ( TRI_errno ( ) = = TRI_ERROR_AVOCADO_READ_ONLY ) { <nl> generateError ( HttpResponse : : FORBIDDEN , <nl> - TRI_VOC_ERROR_READ_ONLY , <nl> + TRI_ERROR_AVOCADO_READ_ONLY , <nl> " collection is read - only " ) ; <nl> return false ; <nl> } <nl> bool RestDocumentHandler : : readDocument ( ) { <nl> <nl> default : <nl> generateError ( HttpResponse : : BAD , <nl> - TRI_REST_ERROR_SUPERFLUOUS_SUFFICES , <nl> + TRI_ERROR_HTTP_SUPERFLUOUS_SUFFICES , <nl> " expecting GET / document / < document - handle > or GET / document ? collection = < collection - identifier > " ) ; <nl> return false ; <nl> } <nl> bool RestDocumentHandler : : checkDocument ( ) { <nl> <nl> if ( suffix . size ( ) ! = 2 ) { <nl> generateError ( HttpResponse : : BAD , <nl> - TRI_REST_ERROR_BAD_PARAMETER , <nl> + TRI_ERROR_HTTP_BAD_PARAMETER , <nl> " expecting URI / document / < document - handle > " ) ; <nl> return false ; <nl> } <nl> bool RestDocumentHandler : : updateDocument ( ) { <nl> <nl> if ( suffix . size ( ) ! = 2 ) { <nl> generateError ( HttpResponse : : BAD , <nl> - TRI_REST_ERROR_BAD_PARAMETER , <nl> + TRI_ERROR_HTTP_BAD_PARAMETER , <nl> " expecting UPDATE / document / < document - handle > " ) ; <nl> return false ; <nl> } <nl> bool RestDocumentHandler : : updateDocument ( ) { <nl> return true ; <nl> } <nl> else { <nl> - if ( TRI_errno ( ) = = TRI_VOC_ERROR_READ_ONLY ) { <nl> + if ( TRI_errno ( ) = = TRI_ERROR_AVOCADO_READ_ONLY ) { <nl> generateError ( HttpResponse : : FORBIDDEN , <nl> - TRI_VOC_ERROR_READ_ONLY , <nl> + TRI_ERROR_AVOCADO_READ_ONLY , <nl> " collection is read - only " ) ; <nl> return false ; <nl> } <nl> - else if ( TRI_errno ( ) = = TRI_VOC_ERROR_DOCUMENT_NOT_FOUND ) { <nl> + else if ( TRI_errno ( ) = = TRI_ERROR_AVOCADO_DOCUMENT_NOT_FOUND ) { <nl> generateDocumentNotFound ( cid + TRI_DOCUMENT_HANDLE_SEPARATOR_STR + didStr ) ; <nl> return false ; <nl> } <nl> - else if ( TRI_errno ( ) = = TRI_VOC_ERROR_CONFLICT ) { <nl> + else if ( TRI_errno ( ) = = TRI_ERROR_AVOCADO_CONFLICT ) { <nl> generatePreconditionFailed ( _documentCollection - > base . _cid , did , rid ) ; <nl> return false ; <nl> } <nl> bool RestDocumentHandler : : deleteDocument ( ) { <nl> <nl> if ( suffix . size ( ) ! = 2 ) { <nl> generateError ( HttpResponse : : BAD , <nl> - TRI_REST_ERROR_BAD_PARAMETER , <nl> + TRI_ERROR_HTTP_BAD_PARAMETER , <nl> " expecting DELETE / document / < document - handle > " ) ; <nl> return false ; <nl> } <nl> bool RestDocumentHandler : : deleteDocument ( ) { <nl> <nl> if ( policy = = TRI_DOC_UPDATE_ILLEGAL ) { <nl> generateError ( HttpResponse : : BAD , <nl> - TRI_REST_ERROR_BAD_PARAMETER , <nl> + TRI_ERROR_HTTP_BAD_PARAMETER , <nl> " policy must be ' error ' or ' last ' " ) ; <nl> return false ; <nl> } <nl> bool RestDocumentHandler : : deleteDocument ( ) { <nl> return true ; <nl> } <nl> else { <nl> - if ( TRI_errno ( ) = = TRI_VOC_ERROR_READ_ONLY ) { <nl> + if ( TRI_errno ( ) = = TRI_ERROR_AVOCADO_READ_ONLY ) { <nl> generateError ( HttpResponse : : FORBIDDEN , <nl> - TRI_VOC_ERROR_READ_ONLY , <nl> + TRI_ERROR_AVOCADO_READ_ONLY , <nl> " collection is read - only " ) ; <nl> return false ; <nl> } <nl> - else if ( TRI_errno ( ) = = TRI_VOC_ERROR_DOCUMENT_NOT_FOUND ) { <nl> + else if ( TRI_errno ( ) = = TRI_ERROR_AVOCADO_DOCUMENT_NOT_FOUND ) { <nl> generateDocumentNotFound ( cid + TRI_DOCUMENT_HANDLE_SEPARATOR_STR + didStr ) ; <nl> return false ; <nl> } <nl> - else if ( TRI_errno ( ) = = TRI_VOC_ERROR_CONFLICT ) { <nl> + else if ( TRI_errno ( ) = = TRI_ERROR_AVOCADO_CONFLICT ) { <nl> generatePreconditionFailed ( _documentCollection - > base . _cid , did , rid ) ; <nl> return false ; <nl> } <nl> mmm a / RestHandler / RestVocbaseBaseHandler . cpp <nl> ppp b / RestHandler / RestVocbaseBaseHandler . cpp <nl> void RestVocbaseBaseHandler : : generateUpdated ( TRI_voc_cid_t cid , TRI_voc_did_t d <nl> <nl> void RestVocbaseBaseHandler : : generateCollectionNotFound ( string const & cid ) { <nl> generateError ( HttpResponse : : NOT_FOUND , <nl> - TRI_VOC_ERROR_COLLECTION_NOT_FOUND , <nl> + TRI_ERROR_AVOCADO_COLLECTION_NOT_FOUND , <nl> " collection " + COLLECTION_PATH + " / " + cid + " not found " ) ; <nl> } <nl> <nl> void RestVocbaseBaseHandler : : generateCollectionNotFound ( string const & cid ) { <nl> <nl> void RestVocbaseBaseHandler : : generateDocumentNotFound ( string const & handle ) { <nl> generateError ( HttpResponse : : NOT_FOUND , <nl> - TRI_VOC_ERROR_DOCUMENT_NOT_FOUND , <nl> + TRI_ERROR_AVOCADO_DOCUMENT_NOT_FOUND , <nl> " document " + DOCUMENT_PATH + " / " + handle + " not found " ) ; <nl> } <nl> <nl> void RestVocbaseBaseHandler : : generateDocumentNotFound ( string const & handle ) { <nl> <nl> void RestVocbaseBaseHandler : : generateConflict ( string const & cid , string const & did ) { <nl> generateError ( HttpResponse : : CONFLICT , <nl> - TRI_VOC_ERROR_DOCUMENT_ALTERED , <nl> + TRI_ERROR_AVOCADO_CONFLICT , <nl> " document " + DOCUMENT_PATH + " / " + cid + " / " + did + " has been altered " ) ; <nl> } <nl> <nl> void RestVocbaseBaseHandler : : generateConflict ( string const & cid , string const & <nl> <nl> void RestVocbaseBaseHandler : : generateNotImplemented ( string const & path ) { <nl> generateError ( HttpResponse : : NOT_IMPLEMENTED , <nl> - TRI_REST_ERROR_NOT_IMPLEMENTED , <nl> + TRI_ERROR_NOT_IMPLEMENTED , <nl> " ' " + path + " ' not implemented " ) ; <nl> } <nl> <nl> bool RestVocbaseBaseHandler : : findCollection ( string const & name , bool create ) { <nl> <nl> if ( name . empty ( ) ) { <nl> generateError ( HttpResponse : : BAD , <nl> - TRI_REST_ERROR_CORRUPTED_JSON , <nl> + TRI_ERROR_HTTP_CORRUPTED_JSON , <nl> " collection identifier is empty " ) ; <nl> return false ; <nl> } <nl> bool RestVocbaseBaseHandler : : loadCollection ( ) { <nl> / / check for corrupted collections <nl> if ( _collection - > _corrupted ) { <nl> generateError ( HttpResponse : : SERVER_ERROR , <nl> - TRI_VOC_ERROR_CORRUPTED_COLLECTION , <nl> + TRI_ERROR_AVOCADO_CORRUPTED_COLLECTION , <nl> " collection is corrupted , please run collection check " ) ; <nl> return false ; <nl> } <nl> bool RestVocbaseBaseHandler : : loadCollection ( ) { <nl> if ( _collection - > _loaded ) { <nl> if ( _collection - > _collection = = 0 ) { <nl> generateError ( HttpResponse : : SERVER_ERROR , <nl> - TRI_VOC_ERROR_CORRUPTED_COLLECTION , <nl> + TRI_ERROR_AVOCADO_CORRUPTED_COLLECTION , <nl> " cannot load collection , check log " ) ; <nl> return false ; <nl> } <nl> bool RestVocbaseBaseHandler : : loadCollection ( ) { <nl> <nl> if ( _collection - > _corrupted ) { <nl> generateError ( HttpResponse : : SERVER_ERROR , <nl> - TRI_VOC_ERROR_CORRUPTED_COLLECTION , <nl> + TRI_ERROR_AVOCADO_CORRUPTED_COLLECTION , <nl> " collection is corrupted , please run collection check " ) ; <nl> return false ; <nl> } <nl> TRI_json_t * RestVocbaseBaseHandler : : parseJsonBody ( ) { <nl> if ( json = = 0 ) { <nl> if ( errmsg = = 0 ) { <nl> generateError ( HttpResponse : : BAD , <nl> - TRI_REST_ERROR_CORRUPTED_JSON , <nl> + TRI_ERROR_HTTP_CORRUPTED_JSON , <nl> " cannot parse json object " ) ; <nl> } <nl> else { <nl> generateError ( HttpResponse : : BAD , <nl> - TRI_REST_ERROR_CORRUPTED_JSON , <nl> + TRI_ERROR_HTTP_CORRUPTED_JSON , <nl> errmsg ) ; <nl> <nl> TRI_FreeString ( errmsg ) ; <nl> mmm a / V8 / v8 - vocbase . cpp <nl> ppp b / V8 / v8 - vocbase . cpp <nl> static v8 : : Handle < v8 : : Value > JS_DeleteVocbaseCol ( v8 : : Arguments const & argv ) { <nl> / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> <nl> if ( ! ok ) { <nl> - if ( TRI_errno ( ) = = TRI_VOC_ERROR_DOCUMENT_NOT_FOUND ) { <nl> + if ( TRI_errno ( ) = = TRI_ERROR_AVOCADO_DOCUMENT_NOT_FOUND ) { <nl> return scope . Close ( v8 : : False ( ) ) ; <nl> } <nl> else { <nl> mmm a / VocBase / blob - collection . c <nl> ppp b / VocBase / blob - collection . c <nl> static bool CreateJournal ( TRI_blob_collection_t * collection ) { <nl> <nl> / / check that a journal was created <nl> if ( journal = = NULL ) { <nl> - collection - > base . _lastError = TRI_set_errno ( TRI_VOC_ERROR_NO_JOURNAL ) ; <nl> + collection - > base . _lastError = TRI_set_errno ( TRI_ERROR_AVOCADO_NO_JOURNAL ) ; <nl> collection - > base . _state = TRI_COL_STATE_WRITE_ERROR ; <nl> <nl> LOG_ERROR ( " cannot create new journal ' % s ' : % s " , filename , TRI_last_error ( ) ) ; <nl> static bool CloseJournal ( TRI_blob_collection_t * collection , TRI_datafile_t * jou <nl> } <nl> <nl> if ( i = = n ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_NO_JOURNAL ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_NO_JOURNAL ) ; <nl> return false ; <nl> } <nl> <nl> static TRI_datafile_t * SelectJournal ( TRI_blob_collection_t * collection , <nl> / / try to reserve space <nl> ok = TRI_ReserveElementDatafile ( datafile , size , result ) ; <nl> <nl> - while ( ! ok & & TRI_errno ( ) = = TRI_VOC_ERROR_DATAFILE_FULL ) { <nl> + while ( ! ok & & TRI_errno ( ) = = TRI_ERROR_AVOCADO_DATAFILE_FULL ) { <nl> ok = CloseJournal ( collection , datafile ) ; <nl> <nl> if ( ! ok ) { <nl> bool TRI_WriteBlobCollection ( TRI_blob_collection_t * collection , <nl> if ( collection - > base . _state ! = TRI_COL_STATE_WRITE ) { <nl> if ( collection - > base . _state = = TRI_COL_STATE_READ ) { <nl> TRI_UnlockMutex ( & collection - > _lock ) ; <nl> - return TRI_VOC_ERROR_READ_ONLY ; <nl> + return TRI_ERROR_AVOCADO_READ_ONLY ; <nl> } <nl> <nl> TRI_UnlockMutex ( & collection - > _lock ) ; <nl> - return TRI_VOC_ERROR_ILLEGAL_STATE ; <nl> + return TRI_ERROR_AVOCADO_ILLEGAL_STATE ; <nl> } <nl> <nl> / / find and select a journal <nl> bool TRI_WriteBlobCollection ( TRI_blob_collection_t * collection , <nl> <nl> if ( journal = = NULL ) { <nl> TRI_UnlockMutex ( & collection - > _lock ) ; <nl> - return TRI_VOC_ERROR_NO_JOURNAL ; <nl> + return TRI_ERROR_AVOCADO_NO_JOURNAL ; <nl> } <nl> <nl> / / and write marker and blob <nl> mmm a / VocBase / collection . c <nl> ppp b / VocBase / collection . c <nl> static bool CheckCollection ( TRI_collection_t * collection ) { <nl> else if ( TRI_EqualString2 ( " datafile " , first , firstLen ) ) { <nl> if ( ! datafile - > _isSealed ) { <nl> LOG_ERROR ( " datafile ' % s ' is not sealed , this should never happen " , filename ) ; <nl> - collection - > _lastError = TRI_set_errno ( TRI_VOC_ERROR_CORRUPTED_DATAFILE ) ; <nl> + collection - > _lastError = TRI_set_errno ( TRI_ERROR_AVOCADO_CORRUPTED_DATAFILE ) ; <nl> stop = true ; <nl> break ; <nl> } <nl> TRI_collection_t * TRI_CreateCollection ( TRI_collection_t * collection , <nl> <nl> / / sanity check <nl> if ( sizeof ( TRI_df_header_marker_t ) + sizeof ( TRI_df_footer_marker_t ) > parameter - > _maximalSize ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_DATAFILE_FULL ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_DATAFILE_FULL ) ; <nl> <nl> LOG_ERROR ( " cannot create datafile ' % s ' in ' % s ' , maximal size ' % u ' is too small " , <nl> parameter - > _name , <nl> TRI_collection_t * TRI_CreateCollection ( TRI_collection_t * collection , <nl> } <nl> <nl> if ( ! TRI_IsDirectory ( path ) ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_WRONG_PATH ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_WRONG_VOCBASE_PATH ) ; <nl> <nl> LOG_ERROR ( " cannot create collection ' % s ' , path is not a directory " , path ) ; <nl> <nl> TRI_collection_t * TRI_CreateCollection ( TRI_collection_t * collection , <nl> filename = TRI_Concatenate2File ( path , parameter - > _name ) ; <nl> <nl> if ( TRI_ExistsFile ( filename ) ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_WRONG_PATH ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_WRONG_VOCBASE_PATH ) ; <nl> TRI_FreeString ( filename ) ; <nl> <nl> LOG_ERROR ( " cannot create collection ' % s ' in ' % s ' , name already exists " , <nl> bool TRI_LoadParameterInfo ( char const * path , <nl> } <nl> <nl> if ( ! TRI_ExistsFile ( filename ) ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_FILE_NOT_FOUND ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_ILLEGAL_PARAMETER_FILE ) ; <nl> TRI_FreeString ( filename ) ; <nl> return false ; <nl> } <nl> bool TRI_LoadParameterInfo ( char const * path , <nl> json = TRI_JsonFile ( filename , & error ) ; <nl> <nl> if ( json = = NULL ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_ILLEGAL_PARAMETER ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_ILLEGAL_PARAMETER_FILE ) ; <nl> TRI_FreeString ( error ) ; <nl> TRI_FreeString ( filename ) ; <nl> <nl> bool TRI_LoadParameterInfo ( char const * path , <nl> TRI_FreeString ( filename ) ; <nl> <nl> if ( json - > _type ! = TRI_JSON_ARRAY ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_ILLEGAL_PARAMETER ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_ILLEGAL_PARAMETER_FILE ) ; <nl> <nl> LOG_ERROR ( " cannot open ' % s ' , file does not contain a json array " , filename ) ; <nl> <nl> TRI_collection_t * TRI_OpenCollection ( TRI_collection_t * collection , <nl> freeCol = false ; <nl> <nl> if ( ! TRI_IsDirectory ( path ) ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_WRONG_PATH ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_WRONG_VOCBASE_PATH ) ; <nl> <nl> LOG_ERROR ( " cannot open ' % s ' , not a directory or not found " , path ) ; <nl> <nl> mmm a / VocBase / compactor . c <nl> ppp b / VocBase / compactor . c <nl> static TRI_datafile_t * SelectCompactor ( TRI_sim_collection_t * collection , <nl> TRI_UnlockCondition ( & collection - > _journalsCondition ) ; <nl> return datafile ; <nl> } <nl> - else if ( ! ok & & TRI_errno ( ) ! = TRI_VOC_ERROR_DATAFILE_FULL ) { <nl> + else if ( ! ok & & TRI_errno ( ) ! = TRI_ERROR_AVOCADO_DATAFILE_FULL ) { <nl> TRI_UnlockCondition ( & collection - > _journalsCondition ) ; <nl> return NULL ; <nl> } <nl> static bool CopyDocument ( TRI_sim_collection_t * collection , <nl> journal = SelectCompactor ( collection , total , result ) ; <nl> <nl> if ( journal = = NULL ) { <nl> - collection - > base . base . _lastError = TRI_set_errno ( TRI_VOC_ERROR_NO_JOURNAL ) ; <nl> + collection - > base . base . _lastError = TRI_set_errno ( TRI_ERROR_AVOCADO_NO_JOURNAL ) ; <nl> return false ; <nl> } <nl> <nl> mmm a / VocBase / datafile . c <nl> ppp b / VocBase / datafile . c <nl> static bool CheckDatafile ( TRI_datafile_t * datafile ) { <nl> } <nl> <nl> if ( marker - > _size < sizeof ( TRI_df_marker_t ) ) { <nl> - datafile - > _lastError = TRI_set_errno ( TRI_VOC_ERROR_CORRUPTED_DATAFILE ) ; <nl> + datafile - > _lastError = TRI_set_errno ( TRI_ERROR_AVOCADO_CORRUPTED_DATAFILE ) ; <nl> datafile - > _currentSize = currentSize ; <nl> datafile - > _next = datafile - > _data + datafile - > _currentSize ; <nl> datafile - > _state = TRI_DF_STATE_OPEN_ERROR ; <nl> static bool CheckDatafile ( TRI_datafile_t * datafile ) { <nl> ok = TRI_CheckCrcMarkerDatafile ( marker ) ; <nl> <nl> if ( ! ok ) { <nl> - datafile - > _lastError = TRI_set_errno ( TRI_VOC_ERROR_CORRUPTED_DATAFILE ) ; <nl> + datafile - > _lastError = TRI_set_errno ( TRI_ERROR_AVOCADO_CORRUPTED_DATAFILE ) ; <nl> datafile - > _currentSize = currentSize ; <nl> datafile - > _next = datafile - > _data + datafile - > _currentSize ; <nl> datafile - > _state = TRI_DF_STATE_OPEN_ERROR ; <nl> static TRI_datafile_t * OpenDatafile ( char const * filename , bool ignoreErrors ) { <nl> size = status . st_size ; <nl> <nl> if ( size < sizeof ( TRI_df_header_marker_t ) + sizeof ( TRI_df_footer_marker_t ) ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_CORRUPTED_DATAFILE ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_CORRUPTED_DATAFILE ) ; <nl> close ( fd ) ; <nl> <nl> LOG_ERROR ( " datafile ' % s ' is corrupted , size is only % u " , filename , ( unsigned int ) size ) ; <nl> static TRI_datafile_t * OpenDatafile ( char const * filename , bool ignoreErrors ) { <nl> ok = TRI_CheckCrcMarkerDatafile ( & header . base ) ; <nl> <nl> if ( ! ok ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_CORRUPTED_DATAFILE ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_CORRUPTED_DATAFILE ) ; <nl> <nl> LOG_ERROR ( " corrupted datafile header read from ' % s ' " , filename ) ; <nl> <nl> static TRI_datafile_t * OpenDatafile ( char const * filename , bool ignoreErrors ) { <nl> / / check the datafile version <nl> if ( ok ) { <nl> if ( header . _version ! = TRI_DF_VERSION ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_CORRUPTED_DATAFILE ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_CORRUPTED_DATAFILE ) ; <nl> <nl> LOG_ERROR ( " unknown datafile version ' % u ' in datafile ' % s ' " , <nl> ( unsigned int ) header . _version , <nl> TRI_datafile_t * TRI_CreateDatafile ( char const * filename , TRI_voc_size_t maximal <nl> <nl> / / sanity check <nl> if ( sizeof ( TRI_df_header_marker_t ) + sizeof ( TRI_df_footer_marker_t ) > maximalSize ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_ILLEGAL_PARAMETER ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_MAXIMAL_SIZE_TOO_SMALL ) ; <nl> <nl> LOG_ERROR ( " cannot create datafile ' % s ' , maximal size ' % u ' is too small " , filename , ( unsigned int ) maximalSize ) ; <nl> <nl> bool TRI_ReserveElementDatafile ( TRI_datafile_t * datafile , <nl> <nl> if ( datafile - > _state ! = TRI_DF_STATE_WRITE ) { <nl> if ( datafile - > _state = = TRI_DF_STATE_READ ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_READ_ONLY ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_READ_ONLY ) ; <nl> <nl> LOG_ERROR ( " cannot reserve marker , datafile is read - only " ) ; <nl> <nl> return false ; <nl> } <nl> <nl> - TRI_set_errno ( TRI_VOC_ERROR_ILLEGAL_STATE ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_ILLEGAL_STATE ) ; <nl> return false ; <nl> } <nl> <nl> / / add the marker , leave enough room for the footer <nl> if ( datafile - > _currentSize + size + datafile - > _footerSize > datafile - > _maximalSize ) { <nl> - datafile - > _lastError = TRI_set_errno ( TRI_VOC_ERROR_DATAFILE_FULL ) ; <nl> + datafile - > _lastError = TRI_set_errno ( TRI_ERROR_AVOCADO_DATAFILE_FULL ) ; <nl> datafile - > _full = true ; <nl> <nl> LOG_TRACE ( " cannot write marker , not enough space " ) ; <nl> bool TRI_WriteElementDatafile ( TRI_datafile_t * datafile , <nl> <nl> if ( datafile - > _state ! = TRI_DF_STATE_WRITE ) { <nl> if ( datafile - > _state = = TRI_DF_STATE_READ ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_READ_ONLY ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_READ_ONLY ) ; <nl> <nl> LOG_ERROR ( " cannot write marker , datafile is read - only " ) ; <nl> <nl> return false ; <nl> } <nl> <nl> - TRI_set_errno ( TRI_VOC_ERROR_ILLEGAL_STATE ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_ILLEGAL_STATE ) ; <nl> return false ; <nl> } <nl> <nl> bool TRI_WriteElementDatafile ( TRI_datafile_t * datafile , <nl> datafile - > _state = TRI_DF_STATE_WRITE_ERROR ; <nl> <nl> if ( errno = = ENOSPC ) { <nl> - datafile - > _lastError = TRI_set_errno ( TRI_VOC_ERROR_FILESYSTEM_FULL ) ; <nl> + datafile - > _lastError = TRI_set_errno ( TRI_ERROR_AVOCADO_FILESYSTEM_FULL ) ; <nl> } <nl> else { <nl> datafile - > _lastError = TRI_set_errno ( TRI_ERROR_SYS_ERROR ) ; <nl> bool TRI_IterateDatafile ( TRI_datafile_t * datafile , <nl> end = datafile - > _data + datafile - > _currentSize ; <nl> <nl> if ( datafile - > _state ! = TRI_DF_STATE_READ & & datafile - > _state ! = TRI_DF_STATE_WRITE ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_ILLEGAL_STATE ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_ILLEGAL_STATE ) ; <nl> return false ; <nl> } <nl> <nl> bool TRI_CloseDatafile ( TRI_datafile_t * datafile ) { <nl> datafile - > _state = TRI_DF_STATE_WRITE_ERROR ; <nl> <nl> if ( errno = = ENOSPC ) { <nl> - datafile - > _lastError = TRI_set_errno ( TRI_VOC_ERROR_FILESYSTEM_FULL ) ; <nl> + datafile - > _lastError = TRI_set_errno ( TRI_ERROR_AVOCADO_FILESYSTEM_FULL ) ; <nl> } <nl> else { <nl> datafile - > _lastError = TRI_set_errno ( TRI_ERROR_SYS_ERROR ) ; <nl> bool TRI_CloseDatafile ( TRI_datafile_t * datafile ) { <nl> return true ; <nl> } <nl> else { <nl> - TRI_set_errno ( TRI_VOC_ERROR_ILLEGAL_STATE ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_ILLEGAL_STATE ) ; <nl> return false ; <nl> } <nl> } <nl> bool TRI_RenameDatafile ( TRI_datafile_t * datafile , char const * filename ) { <nl> if ( TRI_ExistsFile ( filename ) ) { <nl> LOG_ERROR ( " cannot overwrite datafile ' % s ' " , filename ) ; <nl> <nl> - datafile - > _lastError = TRI_set_errno ( TRI_VOC_ERROR_CANNOT_RENAME ) ; <nl> + datafile - > _lastError = TRI_set_errno ( TRI_ERROR_AVOCADO_DATAFILE_ALREADY_EXISTS ) ; <nl> return false ; <nl> } <nl> <nl> bool TRI_SealDatafile ( TRI_datafile_t * datafile ) { <nl> bool ok ; <nl> <nl> if ( datafile - > _state = = TRI_DF_STATE_READ ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_READ_ONLY ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_READ_ONLY ) ; <nl> return false ; <nl> } <nl> <nl> if ( datafile - > _state ! = TRI_DF_STATE_WRITE ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_ILLEGAL_STATE ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_ILLEGAL_STATE ) ; <nl> return false ; <nl> } <nl> <nl> if ( datafile - > _isSealed ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_DATAFILE_SEALED ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_DATAFILE_SEALED ) ; <nl> return false ; <nl> } <nl> <nl> bool TRI_SealDatafile ( TRI_datafile_t * datafile ) { <nl> datafile - > _state = TRI_DF_STATE_WRITE_ERROR ; <nl> <nl> if ( errno = = ENOSPC ) { <nl> - datafile - > _lastError = TRI_set_errno ( TRI_VOC_ERROR_FILESYSTEM_FULL ) ; <nl> + datafile - > _lastError = TRI_set_errno ( TRI_ERROR_AVOCADO_FILESYSTEM_FULL ) ; <nl> } <nl> else { <nl> datafile - > _lastError = TRI_errno ( ) ; <nl> mmm a / VocBase / datafile . h <nl> ppp b / VocBase / datafile . h <nl> TRI_df_marker_t ; <nl> / / / < td > _maximalSize < / td > <nl> / / / < td > The maximal size to which a datafile can grow . If you <nl> / / / attempt to add more datafile to a datafile , then an <nl> - / / / error TRI_VOC_ERROR_DATAFILE_FULL is returned . < / td > <nl> + / / / error TRI_ERROR_AVOCADO_DATAFILE_FULL is returned . < / td > <nl> / / / < / tr > <nl> / / / < tr > <nl> / / / < td > TRI_voc_tick_t < / td > <nl> mmm a / VocBase / document - collection . c <nl> ppp b / VocBase / document - collection . c <nl> static TRI_doc_mptr_t const CreateJson ( TRI_doc_collection_t * collection , <nl> shaped = TRI_ShapedJsonJson ( collection - > _shaper , json ) ; <nl> <nl> if ( shaped = = 0 ) { <nl> - collection - > base . _lastError = TRI_set_errno ( TRI_VOC_ERROR_SHAPER_FAILED ) ; <nl> + collection - > base . _lastError = TRI_set_errno ( TRI_ERROR_AVOCADO_SHAPER_FAILED ) ; <nl> result . _did = 0 ; <nl> return result ; <nl> } <nl> static TRI_doc_mptr_t const UpdateJson ( TRI_doc_collection_t * collection , <nl> shaped = TRI_ShapedJsonJson ( collection - > _shaper , json ) ; <nl> <nl> if ( shaped = = 0 ) { <nl> - collection - > base . _lastError = TRI_set_errno ( TRI_VOC_ERROR_SHAPER_FAILED ) ; <nl> + collection - > base . _lastError = TRI_set_errno ( TRI_ERROR_AVOCADO_SHAPER_FAILED ) ; <nl> result . _did = 0 ; <nl> return result ; <nl> } <nl> TRI_datafile_t * CreateJournalDocCollection ( TRI_doc_collection_t * collection , bo <nl> journal = TRI_CreateDatafile ( filename , collection - > base . _maximalSize ) ; <nl> <nl> if ( journal = = NULL ) { <nl> - collection - > base . _lastError = TRI_set_errno ( TRI_VOC_ERROR_NO_JOURNAL ) ; <nl> + collection - > base . _lastError = TRI_set_errno ( TRI_ERROR_AVOCADO_NO_JOURNAL ) ; <nl> collection - > base . _state = TRI_COL_STATE_WRITE_ERROR ; <nl> <nl> LOG_ERROR ( " cannot create new journal in ' % s ' " , filename ) ; <nl> bool CloseJournalDocCollection ( TRI_doc_collection_t * collection , <nl> <nl> / / no journal at this position <nl> if ( vector - > _length < = position ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_NO_JOURNAL ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_NO_JOURNAL ) ; <nl> return false ; <nl> } <nl> <nl> mmm a / VocBase / query - base . c <nl> ppp b / VocBase / query - base . c <nl> static bool InitSelectQueryTemplate ( TRI_query_template_t * const template_ ) { <nl> ) ; <nl> <nl> if ( ! select_ - > _functionCode ) { <nl> - TRI_SetQueryError ( & template_ - > _error , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_SetQueryError ( & template_ - > _error , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> TRI_RegisterStringQuery ( & template_ - > _memory . _strings , select_ - > _functionCode ) ; <nl> static bool InitWhereQueryTemplate ( TRI_query_template_t * const template_ ) { <nl> ) ; <nl> <nl> if ( ! where - > _functionCode ) { <nl> - TRI_SetQueryError ( & template_ - > _error , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_SetQueryError ( & template_ - > _error , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> TRI_RegisterStringQuery ( & template_ - > _memory . _strings , where - > _functionCode ) ; <nl> static bool InitOrderQueryTemplate ( TRI_query_template_t * const template_ ) { <nl> ) ; <nl> <nl> if ( ! order - > _functionCode ) { <nl> - TRI_SetQueryError ( & template_ - > _error , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_SetQueryError ( & template_ - > _error , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> TRI_RegisterStringQuery ( & template_ - > _memory . _strings , order - > _functionCode ) ; <nl> static bool InitFromQueryTemplate ( TRI_query_template_t * const template_ ) { <nl> ) ; <nl> <nl> if ( ! collection - > _where . _functionCode ) { <nl> - TRI_SetQueryError ( & template_ - > _error , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_SetQueryError ( & template_ - > _error , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> TRI_RegisterStringQuery ( & template_ - > _memory . _strings , collection - > _where . _functionCode ) ; <nl> bool TRI_AddBindParameterQueryTemplate ( TRI_query_template_t * const template_ , <nl> assert ( template_ ) ; <nl> <nl> if ( ! parameter ) { <nl> - TRI_SetQueryError ( & template_ - > _error , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_SetQueryError ( & template_ - > _error , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> } <nl> <nl> assert ( parameter - > _name ) ; <nl> static bool AddJoinPartQueryInstance ( TRI_query_instance_t * instance , <nl> part = ( TRI_join_part_t * ) TRI_Allocate ( sizeof ( TRI_join_part_t ) ) ; <nl> <nl> if ( ! part ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> <nl> static bool AddJoinPartQueryInstance ( TRI_query_instance_t * instance , <nl> part - > _mustMaterialize . _join = ( collection - > _refCount . _join > 0 ) ; <nl> <nl> if ( ! part - > _collectionName | | ! part - > _alias ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> part - > free ( part ) ; <nl> return false ; <nl> } <nl> static bool AddJoinPartQueryInstance ( TRI_query_instance_t * instance , <nl> assert ( part - > _where - > _functionCode ) ; <nl> part - > _context = TRI_CreateExecutionContext ( part - > _where - > _functionCode ) ; <nl> if ( ! part - > _context ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> part - > free ( part ) ; <nl> return false ; <nl> } <nl> static bool InitSelectQueryInstance ( TRI_query_instance_t * const instance ) { <nl> queryInstance - > _functionCode = functionCode ; <nl> } <nl> else { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> } <nl> static bool InitWhereQueryInstance ( TRI_query_instance_t * const instance ) { <nl> queryInstance - > _functionCode = functionCode ; <nl> } <nl> else { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> } <nl> static bool InitWhereQueryInstance ( TRI_query_instance_t * const instance ) { <nl> if ( queryInstance - > _functionCode ) { <nl> queryInstance - > _context = TRI_CreateExecutionContext ( queryInstance - > _functionCode ) ; <nl> if ( ! queryInstance - > _context ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> } <nl> static bool InitOrderQueryInstance ( TRI_query_instance_t * const instance ) { <nl> queryInstance - > _functionCode = functionCode ; <nl> } <nl> else { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> } <nl> static bool InitFromQueryInstance ( TRI_query_instance_t * const instance ) { <nl> copy = TRI_CopyQueryPartQueryInstance ( instance , source - > _where . _base ) ; <nl> if ( ! copy ) { <nl> TRI_Free ( collection ) ; <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> <nl> static bool InitFromQueryInstance ( TRI_query_instance_t * const instance ) { <nl> collection - > _where . _functionCode = functionCode ; <nl> } <nl> else { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> } <nl> static bool InitJoinsQueryInstance ( TRI_query_instance_t * const instance ) { <nl> <nl> while ( node ) { <nl> if ( ! AddJoinSecondaryCollection ( instance , node ) ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> <nl> static bool InitLocksQueryInstance ( TRI_query_instance_t * const instance ) { <nl> if ( insert ) { <nl> lock = ( TRI_query_instance_lock_t * ) TRI_Allocate ( sizeof ( TRI_query_instance_lock_t ) ) ; <nl> if ( ! lock ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> <nl> static bool InitLocksQueryInstance ( TRI_query_instance_t * const instance ) { <nl> lock - > _collectionName = TRI_DuplicateString ( part - > _collectionName ) ; <nl> if ( ! lock - > _collectionName ) { <nl> TRI_Free ( lock ) ; <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> TRI_InsertVectorPointer ( & instance - > _locks , lock , j ) ; <nl> static bool AddBindParameterValues ( TRI_query_instance_t * const instance , <nl> ( TRI_json_t * ) valueParameter ) ; <nl> <nl> if ( ! parameter ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> <nl> TRI_query_instance_t * TRI_CreateQueryInstance ( const TRI_query_template_t * const <nl> } <nl> <nl> if ( ! InitPartsQueryInstance ( instance ) ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return instance ; <nl> } <nl> <nl> static TRI_query_node_t * CreateNodeFromJson ( TRI_query_instance_t * const instanc <nl> <nl> node = TRI_CreateNodeQuery ( & instance - > _memory . _nodes , TRI_QueryNodeValueUndefined ) ; <nl> if ( ! node ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return NULL ; <nl> } <nl> <nl> static TRI_query_node_t * CreateNodeFromJson ( TRI_query_instance_t * const instanc <nl> TRI_RegisterStringQuery ( & instance - > _memory . _strings , stringValue ) ; <nl> } <nl> else { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return NULL ; <nl> } <nl> break ; <nl> static TRI_query_node_t * CreateNodeFromJson ( TRI_query_instance_t * const instanc <nl> container = TRI_CreateNodeQuery ( & instance - > _memory . _nodes , <nl> TRI_QueryNodeContainerList ) ; <nl> if ( ! container ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return NULL ; <nl> } <nl> node - > _rhs = container ; <nl> static TRI_query_node_t * CreateNodeFromJson ( TRI_query_instance_t * const instanc <nl> namedValueNode = TRI_CreateNodeQuery ( & instance - > _memory . _nodes , <nl> TRI_QueryNodeValueNamedValue ) ; <nl> if ( ! namedValueNode ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return NULL ; <nl> } <nl> <nl> static TRI_query_node_t * CreateNodeFromJson ( TRI_query_instance_t * const instanc <nl> ) ; <nl> <nl> if ( ! namedValueNode - > _lhs | | ! namedValueNode - > _rhs ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return NULL ; <nl> } <nl> <nl> static TRI_query_node_t * CreateNodeFromJson ( TRI_query_instance_t * const instanc <nl> container = TRI_CreateNodeQuery ( & instance - > _memory . _nodes , <nl> TRI_QueryNodeContainerList ) ; <nl> if ( ! container ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return NULL ; <nl> } <nl> node - > _rhs = container ; <nl> static TRI_query_node_t * CreateNodeFromJson ( TRI_query_instance_t * const instanc <nl> ) ; <nl> <nl> if ( ! subNode ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return NULL ; <nl> } <nl> <nl> TRI_query_node_t * TRI_CopyQueryPartQueryInstance ( TRI_query_instance_t * const in <nl> <nl> copy = TRI_CreateNodeQuery ( & instance - > _memory . _nodes , node - > _type ) ; <nl> if ( ! copy ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return NULL ; <nl> } <nl> copy - > _value = node - > _value ; <nl> TRI_query_node_t * TRI_CopyQueryPartQueryInstance ( TRI_query_instance_t * const in <nl> while ( next ) { <nl> copy - > _next = TRI_CopyQueryPartQueryInstance ( instance , next ) ; <nl> if ( ! copy - > _next ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return NULL ; <nl> } <nl> next = next - > _next ; <nl> mmm a / VocBase / query - cursor . c <nl> ppp b / VocBase / query - cursor . c <nl> TRI_query_cursor_t * TRI_CreateQueryCursor ( TRI_query_instance_t * const instance , <nl> <nl> cursor = TRI_Allocate ( sizeof ( TRI_query_cursor_t ) ) ; <nl> if ( ! cursor ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return NULL ; <nl> } <nl> <nl> assert ( instance - > _query . _select . _functionCode ) ; <nl> cursor - > _functionCode = TRI_DuplicateString ( instance - > _query . _select . _functionCode ) ; <nl> if ( ! cursor - > _functionCode ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> TRI_Free ( cursor ) ; <nl> return NULL ; <nl> } <nl> mmm a / VocBase / query - execute . c <nl> ppp b / VocBase / query - execute . c <nl> static bool AddCollectionsBarrierQueryInstance ( TRI_query_instance_t * const inst <nl> assert ( lock - > _collection ) ; <nl> ce = TRI_CreateBarrierElement ( & lock - > _collection - > _barrierList ) ; <nl> if ( ! ce ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> TRI_PushBackVectorPointer ( & cursor - > _containers , ce ) ; <nl> TRI_query_cursor_t * TRI_ExecuteQueryInstance ( TRI_query_instance_t * const instan <nl> / / create a select result container for the joins <nl> selectResult = TRI_JoinSelectResult ( instance ) ; <nl> if ( ! selectResult ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return NULL ; <nl> } <nl> <nl> mmm a / VocBase / query - join - execute . c <nl> ppp b / VocBase / query - join - execute . c <nl> static TRI_data_feeder_t * DetermineGeoIndexUsage ( TRI_query_instance_t * const in <nl> indexDefinitions = TRI_GetCollectionIndexes ( instance - > _template - > _vocbase , <nl> part - > _collectionName ) ; <nl> if ( ! indexDefinitions ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return NULL ; <nl> } <nl> <nl> static TRI_data_feeder_t * DetermineIndexUsage ( TRI_query_instance_t * const insta <nl> part - > _collectionName ) ; <nl> <nl> if ( ! indexDefinitions ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> goto EXIT2 ; <nl> } <nl> <nl> static TRI_data_feeder_t * DetermineIndexUsage ( TRI_query_instance_t * const insta <nl> } <nl> <nl> if ( ! feeder ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> goto EXIT ; <nl> } <nl> <nl> static bool CreateCollectionDataPart ( TRI_query_instance_t * const instance , <nl> part - > _mustMaterialize . _select , <nl> part - > _mustMaterialize . _order ) ; <nl> if ( ! datapart ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> <nl> static bool CreateGeoDataPart ( TRI_query_instance_t * const instance , <nl> part - > _mustMaterialize . _order ) ; <nl> <nl> if ( ! datapart ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> <nl> TRI_select_result_t * TRI_JoinSelectResult ( TRI_query_instance_t * const instance ) <nl> <nl> dataparts = ( TRI_vector_pointer_t * ) TRI_Allocate ( sizeof ( TRI_vector_pointer_t ) ) ; <nl> if ( ! dataparts ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return NULL ; <nl> } <nl> <nl> TRI_select_result_t * TRI_JoinSelectResult ( TRI_query_instance_t * const instance ) <nl> / / set up the data structures to retrieve the result documents <nl> result = TRI_CreateSelectResult ( dataparts ) ; <nl> if ( ! result ) { <nl> - TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_RegisterErrorQueryInstance ( instance , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> / / clean up <nl> FreeDataParts ( instance , dataparts ) ; <nl> return NULL ; <nl> mmm a / VocBase / query - parse . c <nl> ppp b / VocBase / query - parse . c <nl> static TRI_query_parser_t * InitParserQueryTemplate ( TRI_query_template_t * const <nl> <nl> parser = ( TRI_query_parser_t * ) TRI_Allocate ( sizeof ( TRI_query_parser_t ) ) ; <nl> if ( ! parser ) { <nl> - TRI_SetQueryError ( & template_ - > _error , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_SetQueryError ( & template_ - > _error , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return NULL ; <nl> } <nl> <nl> bool TRI_ParseQueryTemplate ( TRI_query_template_t * const template_ ) { <nl> <nl> template_ - > _parser = InitParserQueryTemplate ( template_ ) ; <nl> if ( ! template_ - > _parser ) { <nl> - TRI_SetQueryError ( & template_ - > _error , TRI_ERROR_QUERY_OOM , NULL ) ; <nl> + TRI_SetQueryError ( & template_ - > _error , TRI_ERROR_OUT_OF_MEMORY , NULL ) ; <nl> return false ; <nl> } <nl> <nl> mmm a / VocBase / simple - collection . c <nl> ppp b / VocBase / simple - collection . c <nl> static TRI_datafile_t * SelectJournal ( TRI_sim_collection_t * collection , <nl> TRI_UnlockCondition ( & collection - > _journalsCondition ) ; <nl> return datafile ; <nl> } <nl> - else if ( ! ok & & TRI_errno ( ) ! = TRI_VOC_ERROR_DATAFILE_FULL ) { <nl> + else if ( ! ok & & TRI_errno ( ) ! = TRI_ERROR_AVOCADO_DATAFILE_FULL ) { <nl> TRI_UnlockCondition ( & collection - > _journalsCondition ) ; <nl> return NULL ; <nl> } <nl> static TRI_doc_mptr_t CreateDocument ( TRI_sim_collection_t * collection , <nl> journal = SelectJournal ( collection , total , result ) ; <nl> <nl> if ( journal = = NULL ) { <nl> - collection - > base . base . _lastError = TRI_set_errno ( TRI_VOC_ERROR_NO_JOURNAL ) ; <nl> + collection - > base . base . _lastError = TRI_set_errno ( TRI_ERROR_AVOCADO_NO_JOURNAL ) ; <nl> <nl> if ( release ) { <nl> collection - > base . endWrite ( & collection - > base ) ; <nl> static TRI_doc_mptr_t const UpdateDocument ( TRI_sim_collection_t * collection , <nl> case TRI_DOC_UPDATE_ERROR : <nl> if ( rid ! = 0 ) { <nl> if ( rid ! = header - > _rid ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_CONFLICT ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_CONFLICT ) ; <nl> <nl> if ( release ) { <nl> collection - > base . endWrite ( & collection - > base ) ; <nl> static TRI_doc_mptr_t const UpdateDocument ( TRI_sim_collection_t * collection , <nl> break ; <nl> <nl> case TRI_DOC_UPDATE_CONFLICT : <nl> - TRI_set_errno ( TRI_VOC_ERROR_ILLEGAL_PARAMETER ) ; <nl> + TRI_set_errno ( TRI_ERROR_NOT_IMPLEMENTED ) ; <nl> <nl> if ( release ) { <nl> collection - > base . endWrite ( & collection - > base ) ; <nl> static TRI_doc_mptr_t const UpdateDocument ( TRI_sim_collection_t * collection , <nl> return mptr ; <nl> <nl> case TRI_DOC_UPDATE_ILLEGAL : <nl> - TRI_set_errno ( TRI_VOC_ERROR_ILLEGAL_PARAMETER ) ; <nl> + TRI_set_errno ( TRI_ERROR_INTERNAL ) ; <nl> <nl> if ( release ) { <nl> collection - > base . endWrite ( & collection - > base ) ; <nl> static TRI_doc_mptr_t const UpdateDocument ( TRI_sim_collection_t * collection , <nl> journal = SelectJournal ( collection , total , result ) ; <nl> <nl> if ( journal = = NULL ) { <nl> - collection - > base . base . _lastError = TRI_set_errno ( TRI_VOC_ERROR_NO_JOURNAL ) ; <nl> + collection - > base . base . _lastError = TRI_set_errno ( TRI_ERROR_AVOCADO_NO_JOURNAL ) ; <nl> <nl> if ( release ) { <nl> collection - > base . endWrite ( & collection - > base ) ; <nl> static bool DeleteDocument ( TRI_sim_collection_t * collection , <nl> header = TRI_LookupByKeyAssociativePointer ( & collection - > _primaryIndex , & marker - > _did ) ; <nl> <nl> if ( header = = NULL | | header - > _deletion ! = 0 ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_DOCUMENT_NOT_FOUND ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_DOCUMENT_NOT_FOUND ) ; <nl> <nl> if ( release ) { <nl> collection - > base . endWrite ( & collection - > base ) ; <nl> static bool DeleteDocument ( TRI_sim_collection_t * collection , <nl> case TRI_DOC_UPDATE_ERROR : <nl> if ( rid ! = 0 ) { <nl> if ( rid ! = header - > _rid ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_CONFLICT ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_CONFLICT ) ; <nl> <nl> if ( release ) { <nl> collection - > base . endWrite ( & collection - > base ) ; <nl> static bool DeleteDocument ( TRI_sim_collection_t * collection , <nl> break ; <nl> <nl> case TRI_DOC_UPDATE_CONFLICT : <nl> - TRI_set_errno ( TRI_VOC_ERROR_ILLEGAL_PARAMETER ) ; <nl> + TRI_set_errno ( TRI_ERROR_NOT_IMPLEMENTED ) ; <nl> <nl> if ( release ) { <nl> collection - > base . endWrite ( & collection - > base ) ; <nl> static bool DeleteDocument ( TRI_sim_collection_t * collection , <nl> return NULL ; <nl> <nl> case TRI_DOC_UPDATE_ILLEGAL : <nl> - TRI_set_errno ( TRI_VOC_ERROR_ILLEGAL_PARAMETER ) ; <nl> + TRI_set_errno ( TRI_ERROR_INTERNAL ) ; <nl> <nl> if ( release ) { <nl> collection - > base . endWrite ( & collection - > base ) ; <nl> static bool DeleteDocument ( TRI_sim_collection_t * collection , <nl> journal = SelectJournal ( collection , total , & result ) ; <nl> <nl> if ( journal = = NULL ) { <nl> - collection - > base . base . _lastError = TRI_set_errno ( TRI_VOC_ERROR_NO_JOURNAL ) ; <nl> + collection - > base . base . _lastError = TRI_set_errno ( TRI_ERROR_AVOCADO_NO_JOURNAL ) ; <nl> <nl> if ( release ) { <nl> collection - > base . endWrite ( & collection - > base ) ; <nl> static TRI_doc_mptr_t const UpdateShapedJson ( TRI_doc_collection_t * document , <nl> document - > endWrite ( & collection - > base ) ; <nl> } <nl> <nl> - TRI_set_errno ( TRI_VOC_ERROR_DOCUMENT_NOT_FOUND ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_DOCUMENT_NOT_FOUND ) ; <nl> mptr . _did = 0 ; <nl> return mptr ; <nl> } <nl> static bool DeleteImmediateIndexes ( TRI_sim_collection_t * collection , <nl> found = TRI_RemoveKeyAssociativePointer ( & collection - > _primaryIndex , & header - > _did ) ; <nl> <nl> if ( found = = NULL ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_DOCUMENT_NOT_FOUND ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_DOCUMENT_NOT_FOUND ) ; <nl> return false ; <nl> } <nl> <nl> static TRI_index_t * CreateGeoIndexSimCollection ( TRI_sim_collection_t * collectio <nl> idx = TRI_LookupGeoIndex2SimCollection ( collection , lat , lon ) ; <nl> } <nl> else { <nl> - TRI_set_errno ( TRI_VOC_ERROR_ILLEGAL_PARAMETER ) ; <nl> + TRI_set_errno ( TRI_ERROR_INTERNAL ) ; <nl> <nl> LOG_TRACE ( " expecting either ' location ' or ' latitude ' and ' longitude ' " ) ; <nl> <nl> mmm a / VocBase / vocbase . c <nl> ppp b / VocBase / vocbase . c <nl> bool TRI_ManifestCollectionVocBase ( TRI_vocbase_t * vocbase , TRI_vocbase_col_t co <nl> / / maybe the collection is already manifested <nl> if ( ! vc - > _newBorn ) { <nl> if ( vc - > _corrupted ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_CORRUPTED_DATAFILE ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_CORRUPTED_DATAFILE ) ; <nl> return false ; <nl> } <nl> <nl> if ( ! vc - > _loaded ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_CORRUPTED_DATAFILE ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_CORRUPTED_DATAFILE ) ; <nl> return false ; <nl> } <nl> <nl> if ( vc - > _collection = = NULL ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_CORRUPTED_DATAFILE ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_CORRUPTED_DATAFILE ) ; <nl> return false ; <nl> } <nl> <nl> bool TRI_ManifestCollectionVocBase ( TRI_vocbase_t * vocbase , TRI_vocbase_col_t co <nl> } <nl> } <nl> else { <nl> - TRI_set_errno ( TRI_VOC_ERROR_UNKNOWN_TYPE ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_UNKNOWN_COLLECTION_TYPE ) ; <nl> <nl> cnv . v - > _newBorn = 0 ; <nl> cnv . v - > _corrupted = 1 ; <nl> bool TRI_ManifestCollectionVocBase ( TRI_vocbase_t * vocbase , TRI_vocbase_col_t co <nl> } <nl> <nl> if ( collection = = NULL ) { <nl> - TRI_set_errno ( TRI_VOC_ERROR_CORRUPTED_DATAFILE ) ; <nl> + TRI_set_errno ( TRI_ERROR_AVOCADO_CORRUPTED_DATAFILE ) ; <nl> <nl> cnv . v - > _newBorn = 0 ; <nl> cnv . v - > _corrupted = 1 ; <nl> new file mode 100755 <nl> index 00000000000 . . bc1ac2c147c <nl> mmm / dev / null <nl> ppp b / config / build_errorfile . sh <nl> <nl> + # ! / bin / bash <nl> + SCRIPT = " $ 1 " <nl> + SOURCE = " $ 2 " <nl> + DEST = " $ 3 " <nl> + <nl> + python " $ SCRIPT " " $ SOURCE " " $ DEST . tmp " <nl> + if cmp - s $ DEST $ { DEST } . tmp ; then <nl> + rm $ { DEST } . tmp <nl> + else <nl> + mv $ { DEST } . tmp $ DEST <nl> + fi <nl> mmm a / config / build_header . sh <nl> ppp b / config / build_header . sh <nl> fi <nl> version = ` sed - e ' s : . * " \ ( [ ^ [ ] * [ ^ [ ] \ ) . * " : \ 1 : ' $ FILE ` <nl> <nl> if test - z " $ version " ; then <nl> - echo " $ 0 : cannot read vision from file $ FILE " <nl> + echo " $ 0 : cannot read revision from file $ FILE " <nl> exit 1 <nl> fi <nl> <nl> mmm a / js / common / bootstrap / errors . js <nl> ppp b / js / common / bootstrap / errors . js <nl> ModuleCache [ " / internal " ] . exports . errors = { <nl> " ERROR_NUMERIC_OVERFLOW " : { " code " : 6 , " message " : " numeric overflow " } , <nl> " ERROR_ILLEGAL_OPTION " : { " code " : 7 , " message " : " illegal option " } , <nl> " ERROR_DEAD_PID " : { " code " : 8 , " message " : " dead process identifier " } , <nl> - " ERROR_OPEN_ERROR " : { " code " : 9 , " message " : " open / create file failed " } , <nl> - " ERROR_WRITE_ERROR " : { " code " : 10 , " message " : " write failed " } , <nl> - " ERROR_LOCK_ERROR " : { " code " : 11 , " message " : " lock failed " } , <nl> - " ERROR_UNLOCKED_FILE " : { " code " : 12 , " message " : " unlock failed " } , <nl> - " VOC_ERROR_ILLEGAL_STATE " : { " code " : 1000 , " message " : " illegal state " } , <nl> - " VOC_ERROR_SHAPER_FAILED " : { " code " : 1001 , " message " : " illegal shaper " } , <nl> - " VOC_ERROR_CORRUPTED_DATAFILE " : { " code " : 1002 , " message " : " corrupted datafile " } , <nl> - " VOC_ERROR_MMAP_FAILED " : { " code " : 1003 , " message " : " mmap failed " } , <nl> - " VOC_ERROR_MSYNC_FAILED " : { " code " : 1004 , " message " : " msync failed " } , <nl> - " VOC_ERROR_NO_JOURNAL " : { " code " : 1005 , " message " : " no journal " } , <nl> - " VOC_ERROR_DATAFILE_SEALED " : { " code " : 1006 , " message " : " datafile sealed " } , <nl> - " VOC_ERROR_CORRUPTED_COLLECTION " : { " code " : 1007 , " message " : " corrupted collection " } , <nl> - " VOC_ERROR_UNKNOWN_TYPE " : { " code " : 1008 , " message " : " unknown type " } , <nl> - " VOC_ERROR_ILLEGAL_PARAMETER " : { " code " : 1009 , " message " : " illegal parameter " } , <nl> - " VOC_ERROR_INDEX_EXISTS " : { " code " : 1010 , " message " : " index exists " } , <nl> - " VOC_ERROR_CONFLICT " : { " code " : 1011 , " message " : " conflict " } , <nl> - " VOC_ERROR_WRONG_PATH " : { " code " : 1100 , " message " : " wrong path " } , <nl> - " VOC_ERROR_CANNOT_RENAME " : { " code " : 1101 , " message " : " cannot rename " } , <nl> - " VOC_ERROR_WRITE_FAILED " : { " code " : 1102 , " message " : " write failed " } , <nl> - " VOC_ERROR_READ_ONLY " : { " code " : 1103 , " message " : " ready only " } , <nl> - " VOC_ERROR_DATAFILE_FULL " : { " code " : 1104 , " message " : " datafile full " } , <nl> - " VOC_ERROR_FILESYSTEM_FULL " : { " code " : 1105 , " message " : " filesystem full " } , <nl> - " VOC_ERROR_READ_FAILED " : { " code " : 1106 , " message " : " read failed " } , <nl> - " VOC_ERROR_FILE_NOT_FOUND " : { " code " : 1107 , " message " : " file not found " } , <nl> - " VOC_ERROR_FILE_NOT_ACCESSIBLE " : { " code " : 1108 , " message " : " file not accessible " } , <nl> - " VOC_ERROR_DOCUMENT_NOT_FOUND " : { " code " : 1200 , " message " : " document not found " } , <nl> - " VOC_ERROR_COLLECTION_NOT_FOUND " : { " code " : 1201 , " message " : " collection not found " } , <nl> - " VOC_ERROR_COLLECTION_PARAMETER_MISSING " : { " code " : 1202 , " message " : " parameter collection not found " } , <nl> - " VOC_ERROR_DOCUMENT_ALTERED " : { " code " : 1203 , " message " : " document altered " } , <nl> - " VOC_ERROR_DOCUMENT_HANDLE_BAD " : { " code " : 1204 , " message " : " illegal document handle " } , <nl> - " VOC_ERROR_COLLECTION_EXISTS " : { " code " : 1205 , " message " : " collection already exists " } , <nl> - " ERROR_QUERY_OOM " : { " code " : 1500 , " message " : " out of memory " } , <nl> - " ERROR_QUERY_KILLED " : { " code " : 1501 , " message " : " query killed " } , <nl> - " ERROR_QUERY_PARSE " : { " code " : 1510 , " message " : " parse error : % s " } , <nl> - " ERROR_QUERY_EMPTY " : { " code " : 1511 , " message " : " query is empty " } , <nl> - " ERROR_QUERY_SPECIFICATION_INVALID " : { " code " : 1512 , " message " : " query specification invalid " } , <nl> - " ERROR_QUERY_NUMBER_OUT_OF_RANGE " : { " code " : 1520 , " message " : " number ' % s ' is out of range " } , <nl> + " ERROR_NOT_IMPLEMENTED " : { " code " : 9 , " message " : " not implemented " } , <nl> + " ERROR_HTTP_BAD_PARAMETER " : { " code " : 400 , " message " : " bad parameter " } , <nl> + " ERROR_HTTP_METHOD_NOT_ALLOWED " : { " code " : 405 , " message " : " method not supported " } , <nl> + " ERROR_HTTP_CORRUPTED_JSON " : { " code " : 600 , " message " : " invalid JSON object " } , <nl> + " ERROR_HTTP_SUPERFLUOUS_SUFFICES " : { " code " : 601 , " message " : " superfluous URL suffices " } , <nl> + " ERROR_AVOCADO_ILLEGAL_STATE " : { " code " : 1000 , " message " : " illegal state " } , <nl> + " ERROR_AVOCADO_SHAPER_FAILED " : { " code " : 1001 , " message " : " illegal shaper " } , <nl> + " ERROR_AVOCADO_DATAFILE_SEALED " : { " code " : 1002 , " message " : " datafile sealed " } , <nl> + " ERROR_AVOCADO_UNKNOWN_COLLECTION_TYPE " : { " code " : 1003 , " message " : " unknown type " } , <nl> + " ERROR_AVOCADO_READ_ONLY " : { " code " : 1004 , " message " : " ready only " } , <nl> + " ERROR_AVOCADO_CORRUPTED_DATAFILE " : { " code " : 1100 , " message " : " corrupted datafile " } , <nl> + " ERROR_AVOCADO_ILLEGAL_PARAMETER_FILE " : { " code " : 1101 , " message " : " illegal parameter file " } , <nl> + " ERROR_AVOCADO_CORRUPTED_COLLECTION " : { " code " : 1102 , " message " : " corrupted collection " } , <nl> + " ERROR_AVOCADO_MMAP_FAILED " : { " code " : 1103 , " message " : " mmap failed " } , <nl> + " ERROR_AVOCADO_MSYNC_FAILED " : { " code " : 1104 , " message " : " msync failed " } , <nl> + " ERROR_AVOCADO_NO_JOURNAL " : { " code " : 1105 , " message " : " no journal " } , <nl> + " ERROR_AVOCADO_DATAFILE_ALREADY_EXISTS " : { " code " : 1106 , " message " : " cannot rename , file ready exists " } , <nl> + " ERROR_AVOCADO_FILESYSTEM_FULL " : { " code " : 1107 , " message " : " filesystem full " } , <nl> + " ERROR_AVOCADO_CONFLICT " : { " code " : 1200 , " message " : " conflict " } , <nl> + " ERROR_AVOCADO_WRONG_VOCBASE_PATH " : { " code " : 1201 , " message " : " wrong path for database " } , <nl> + " ERROR_AVOCADO_DOCUMENT_NOT_FOUND " : { " code " : 1202 , " message " : " document not found " } , <nl> + " ERROR_AVOCADO_COLLECTION_NOT_FOUND " : { " code " : 1203 , " message " : " collection not found " } , <nl> + " ERROR_AVOCADO_COLLECTION_PARAMETER_MISSING " : { " code " : 1204 , " message " : " parameter ' collection ' not found " } , <nl> + " ERROR_AVOCADO_DOCUMENT_HANDLE_BAD " : { " code " : 1205 , " message " : " illegal document handle " } , <nl> + " ERROR_AVOCADO_MAXIMAL_SIZE_TOO_SMALL " : { " code " : 1206 , " message " : " maixaml size of journal too small " } , <nl> + " ERROR_AVOCADO_DATAFILE_FULL " : { " code " : 1300 , " message " : " datafile full " } , <nl> + " ERROR_QUERY_KILLED " : { " code " : 1500 , " message " : " query killed " } , <nl> + " ERROR_QUERY_PARSE " : { " code " : 1501 , " message " : " parse error : % s " } , <nl> + " ERROR_QUERY_EMPTY " : { " code " : 1502 , " message " : " query is empty " } , <nl> + " ERROR_QUERY_SPECIFICATION_INVALID " : { " code " : 1503 , " message " : " query specification invalid " } , <nl> + " ERROR_QUERY_NUMBER_OUT_OF_RANGE " : { " code " : 1504 , " message " : " number ' % s ' is out of range " } , <nl> " ERROR_QUERY_LIMIT_VALUE_OUT_OF_RANGE " : { " code " : 1521 , " message " : " limit value ' % s ' is out of range " } , <nl> - " ERROR_QUERY_TOO_MANY_JOINS " : { " code " : 1540 , " message " : " too many joins . " } , <nl> - " ERROR_QUERY_COLLECTION_NAME_INVALID " : { " code " : 1550 , " message " : " collection name ' % s ' is invalid " } , <nl> - " ERROR_QUERY_COLLECTION_ALIAS_INVALID " : { " code " : 1551 , " message " : " collection alias ' % s ' is invalid " } , <nl> - " ERROR_QUERY_COLLECTION_ALIAS_REDECLARED " : { " code " : 1552 , " message " : " collection alias ' % s ' is declared multiple times in the same query " } , <nl> - " ERROR_QUERY_COLLECTION_ALIAS_UNDECLARED " : { " code " : 1553 , " message " : " collection alias ' % s ' is used but was not declared in the from clause " } , <nl> - " ERROR_QUERY_COLLECTION_NOT_FOUND " : { " code " : 1560 , " message " : " unable to open collection ' % s ' " } , <nl> - " ERROR_QUERY_GEO_RESTRICTION_INVALID " : { " code " : 1570 , " message " : " geo restriction for alias ' % s ' is invalid " } , <nl> - " ERROR_QUERY_GEO_INDEX_MISSING " : { " code " : 1571 , " message " : " no suitable geo index found for geo restriction on ' % s ' " } , <nl> - " ERROR_QUERY_BIND_PARAMETER_MISSING " : { " code " : 1590 , " message " : " no value specified for declared bind parameter ' % s ' " } , <nl> - " ERROR_QUERY_BIND_PARAMETER_REDECLARED " : { " code " : 1591 , " message " : " value for bind parameter ' % s ' is declared multiple times " } , <nl> - " ERROR_QUERY_BIND_PARAMETER_UNDECLARED " : { " code " : 1592 , " message " : " bind parameter ' % s ' was not declared in the query " } , <nl> - " ERROR_QUERY_BIND_PARAMETER_VALUE_INVALID " : { " code " : 1593 , " message " : " invalid value for bind parameter ' % s ' " } , <nl> - " ERROR_QUERY_BIND_PARAMETER_NUMBER_OUT_OF_RANGE " : { " code " : 1594 , " message " : " bind parameter number ' % s ' out of range " } , <nl> + " ERROR_QUERY_TOO_MANY_JOINS " : { " code " : 1505 , " message " : " too many joins . " } , <nl> + " ERROR_QUERY_COLLECTION_NAME_INVALID " : { " code " : 1506 , " message " : " collection name ' % s ' is invalid " } , <nl> + " ERROR_QUERY_COLLECTION_ALIAS_INVALID " : { " code " : 1507 , " message " : " collection alias ' % s ' is invalid " } , <nl> + " ERROR_QUERY_COLLECTION_ALIAS_REDECLARED " : { " code " : 1508 , " message " : " collection alias ' % s ' is declared multiple times in the same query " } , <nl> + " ERROR_QUERY_COLLECTION_ALIAS_UNDECLARED " : { " code " : 1509 , " message " : " collection alias ' % s ' is used but was not declared in the from clause " } , <nl> + " ERROR_QUERY_COLLECTION_NOT_FOUND " : { " code " : 1510 , " message " : " unable to open collection ' % s ' " } , <nl> + " ERROR_QUERY_GEO_RESTRICTION_INVALID " : { " code " : 1511 , " message " : " geo restriction for alias ' % s ' is invalid " } , <nl> + " ERROR_QUERY_GEO_INDEX_MISSING " : { " code " : 1512 , " message " : " no suitable geo index found for geo restriction on ' % s ' " } , <nl> + " ERROR_QUERY_BIND_PARAMETER_MISSING " : { " code " : 1513 , " message " : " no value specified for declared bind parameter ' % s ' " } , <nl> + " ERROR_QUERY_BIND_PARAMETER_REDECLARED " : { " code " : 1514 , " message " : " value for bind parameter ' % s ' is declared multiple times " } , <nl> + " ERROR_QUERY_BIND_PARAMETER_UNDECLARED " : { " code " : 1515 , " message " : " bind parameter ' % s ' was not declared in the query " } , <nl> + " ERROR_QUERY_BIND_PARAMETER_VALUE_INVALID " : { " code " : 1516 , " message " : " invalid value for bind parameter ' % s ' " } , <nl> + " ERROR_QUERY_BIND_PARAMETER_NUMBER_OUT_OF_RANGE " : { " code " : 1517 , " message " : " bind parameter number ' % s ' out of range " } , <nl> " ERROR_CURSOR_NOT_FOUND " : { " code " : 1600 , " message " : " cursor not found " } , <nl> " ERROR_SESSION_USERHANDLER_URL_INVALID " : { " code " : 1700 , " message " : " expecting < prefix > / user / < username > " } , <nl> " ERROR_SESSION_USERHANDLER_CANNOT_CREATE_USER " : { " code " : 1701 , " message " : " cannot create user " } , <nl> ModuleCache [ " / internal " ] . exports . errors = { <nl> " SIMPLE_CLIENT_COULD_NOT_CONNECT " : { " code " : 2001 , " message " : " could not connect to server " } , <nl> " SIMPLE_CLIENT_COULD_NOT_WRITE " : { " code " : 2002 , " message " : " could not write to server " } , <nl> " SIMPLE_CLIENT_COULD_NOT_READ " : { " code " : 2003 , " message " : " could not read from server " } , <nl> - " ERROR_PROTOCOL_UNSUPPORTED_METHOD " : { " code " : 3000 , " message " : " method not supported " } , <nl> } ; <nl> <nl>
|
merge with SVN
|
arangodb/arangodb
|
62346bc32bd086e9e6c23f960d2df12e22b69d9b
|
2012-03-21T08:06:11Z
|
mmm a / src / layer / arm / convolution_arm . cpp <nl> ppp b / src / layer / arm / convolution_arm . cpp <nl> namespace ncnn { <nl> # include " convolution_5x5 . h " <nl> # include " convolution_7x7 . h " <nl> <nl> + # if __ARM_NEON <nl> # include " convolution_1x1_int8 . h " <nl> # include " convolution_3x3_int8 . h " <nl> + # endif / / __ARM_NEON <nl> <nl> DEFINE_LAYER_CREATOR ( Convolution_arm ) <nl> <nl> int Convolution_arm : : load_model ( const ModelBin & mb ) <nl> <nl> if ( use_int8_inference ) <nl> { <nl> + # if __ARM_NEON <nl> # if ! __aarch64__ <nl> if ( kernel_w = = 3 & & kernel_h = = 3 & & dilation_w = = 1 & & dilation_h = = 1 & & stride_w = = 1 & & stride_h = = 1 ) <nl> { <nl> int Convolution_arm : : load_model ( const ModelBin & mb ) <nl> conv3x3s1_transform_kernel_int8_neon ( weight_data , weight_3x3s1_int8_data , num_input , num_output ) ; <nl> } <nl> # endif / / ! __aarch64__ <nl> + # endif / / __ARM_NEON <nl> return 0 ; <nl> } <nl> <nl> int Convolution_arm : : forward ( const Mat & bottom_blob , Mat & top_blob , const Option <nl> <nl> typedef void ( * conv_int8_func ) ( const Mat & , Mat & , const Mat & , const Option & ) ; <nl> <nl> + # if __ARM_NEON <nl> / / kernel_size x stride <nl> conv_int8_func conv_int8_func_table [ 5 ] [ 5 ] = <nl> { <nl> int Convolution_arm : : forward ( const Mat & bottom_blob , Mat & top_blob , const Option <nl> 0 <nl> } / / kernel_size = 5 <nl> } ; <nl> + # endif / / __ARM_NEON <nl> <nl> conv_func conv = 0 ; <nl> conv_int8_func conv_int8 = 0 ; <nl> <nl> if ( use_int8_inference ) <nl> { <nl> + # if __ARM_NEON <nl> conv_int8 = conv_int8_func_table [ kernel_size - 1 ] [ stride - 1 ] ; <nl> if ( ! conv_int8 ) <nl> { <nl> return Convolution : : forward ( bottom_blob , top_blob , opt ) ; <nl> } <nl> + # else <nl> + return Convolution : : forward ( bottom_blob , top_blob , opt ) ; <nl> + # endif / / __ARM_NEON <nl> } <nl> else <nl> { <nl> int Convolution_arm : : forward ( const Mat & bottom_blob , Mat & top_blob , const Option <nl> <nl> if ( use_int8_inference ) <nl> { <nl> + # if __ARM_NEON <nl> # if ! __aarch64__ <nl> if ( kernel_w = = 3 & & kernel_h = = 3 & & dilation_w = = 1 & & dilation_h = = 1 & & stride_w = = 1 & & stride_h = = 1 ) <nl> { <nl> int Convolution_arm : : forward ( const Mat & bottom_blob , Mat & top_blob , const Option <nl> } <nl> else <nl> # endif / / ! __aarch64__ <nl> + # endif / / __ARM_NEON <nl> { <nl> conv_int8 ( bottom_blob_bordered , top_blob , weight_data , opt ) ; <nl> } <nl>
|
fix build without neon
|
Tencent/ncnn
|
19ad4cf284e61792c8b886bf47cc10accad24726
|
2018-08-30T04:59:57Z
|
mmm a / templates / tools / doxygen / Doxyfile . include <nl> ppp b / templates / tools / doxygen / Doxyfile . include <nl> WARN_LOGFILE = <nl> # Note : If this tag is empty the current directory is searched . <nl> <nl> INPUT = $ { <nl> - ' \ \ \ n ' . join ( sorted ( <nl> + ' \ \ \ n ' . join ( sorted ( set ( <nl> itertools . chain ( <nl> itertools . chain . from_iterable ( <nl> target . public_headers + <nl> INPUT = $ { <nl> glob . glob ( ' doc / * . md ' ) , <nl> glob . glob ( ' doc / % s / * . md ' % docpackage ) , <nl> [ ] if not internal else srcdoc ) <nl> - ) ) <nl> + ) ) ) <nl> } <nl> <nl> # This tag can be used to specify the character encoding of the source files <nl> mmm a / templates / tools / doxygen / Doxyfile . objc . include <nl> ppp b / templates / tools / doxygen / Doxyfile . objc . include <nl> WARN_LOGFILE = <nl> # Note : If this tag is empty the current directory is searched . <nl> <nl> INPUT = $ { <nl> - ' \ \ \ n ' . join ( sorted ( <nl> + ' \ \ \ n ' . join ( sorted ( set ( <nl> itertools . chain ( <nl> glob . glob ( ' src / objective - c / GRPCClient / * . h ' ) if not internal else glob_recursive ( ' src / objective - c / GRPCClient ' , ' * . h ' ) , <nl> glob . glob ( ' src / objective - c / ProtoRPC / * . h ' ) , <nl> glob . glob ( ' src / objective - c / RxLibrary / * . h ' ) if not internal else glob_recursive ( ' src / objective - c / RxLibrary ' , ' * . h ' ) , <nl> glob . glob ( ' doc / * . md ' ) , <nl> - srcdoc ) ) ) <nl> + srcdoc ) ) ) ) <nl> } <nl> <nl> # This tag can be used to specify the character encoding of the source files <nl> mmm a / tools / doxygen / Doxyfile . c + + . internal <nl> ppp b / tools / doxygen / Doxyfile . c + + . internal <nl> include / grpc + + / impl / codegen / completion_queue_tag . h \ <nl> include / grpc + + / impl / codegen / config . h \ <nl> include / grpc + + / impl / codegen / config_protobuf . h \ <nl> include / grpc + + / impl / codegen / core_codegen . h \ <nl> - include / grpc + + / impl / codegen / core_codegen . h \ <nl> include / grpc + + / impl / codegen / core_codegen_interface . h \ <nl> include / grpc + + / impl / codegen / create_auth_context . h \ <nl> include / grpc + + / impl / codegen / grpc_library . h \ <nl> include / grpcpp / impl / codegen / completion_queue_tag . h \ <nl> include / grpcpp / impl / codegen / config . h \ <nl> include / grpcpp / impl / codegen / config_protobuf . h \ <nl> include / grpcpp / impl / codegen / core_codegen . h \ <nl> - include / grpcpp / impl / codegen / core_codegen . h \ <nl> include / grpcpp / impl / codegen / core_codegen_interface . h \ <nl> include / grpcpp / impl / codegen / create_auth_context . h \ <nl> include / grpcpp / impl / codegen / delegating_channel . h \ <nl> mmm a / tools / doxygen / Doxyfile . core <nl> ppp b / tools / doxygen / Doxyfile . core <nl> include / grpc / grpc_posix . h \ <nl> include / grpc / grpc_security . h \ <nl> include / grpc / grpc_security_constants . h \ <nl> include / grpc / impl / codegen / atm . h \ <nl> - include / grpc / impl / codegen / atm . h \ <nl> - include / grpc / impl / codegen / atm_gcc_atomic . h \ <nl> include / grpc / impl / codegen / atm_gcc_atomic . h \ <nl> include / grpc / impl / codegen / atm_gcc_sync . h \ <nl> - include / grpc / impl / codegen / atm_gcc_sync . h \ <nl> - include / grpc / impl / codegen / atm_windows . h \ <nl> include / grpc / impl / codegen / atm_windows . h \ <nl> include / grpc / impl / codegen / byte_buffer . h \ <nl> include / grpc / impl / codegen / byte_buffer_reader . h \ <nl> include / grpc / impl / codegen / compression_types . h \ <nl> include / grpc / impl / codegen / connectivity_state . h \ <nl> include / grpc / impl / codegen / fork . h \ <nl> - include / grpc / impl / codegen / fork . h \ <nl> - include / grpc / impl / codegen / gpr_slice . h \ <nl> include / grpc / impl / codegen / gpr_slice . h \ <nl> include / grpc / impl / codegen / gpr_types . h \ <nl> - include / grpc / impl / codegen / gpr_types . h \ <nl> include / grpc / impl / codegen / grpc_types . h \ <nl> include / grpc / impl / codegen / log . h \ <nl> - include / grpc / impl / codegen / log . h \ <nl> - include / grpc / impl / codegen / port_platform . h \ <nl> include / grpc / impl / codegen / port_platform . h \ <nl> include / grpc / impl / codegen / propagation_bits . h \ <nl> include / grpc / impl / codegen / slice . h \ <nl> include / grpc / impl / codegen / status . h \ <nl> include / grpc / impl / codegen / sync . h \ <nl> - include / grpc / impl / codegen / sync . h \ <nl> include / grpc / impl / codegen / sync_abseil . h \ <nl> - include / grpc / impl / codegen / sync_abseil . h \ <nl> - include / grpc / impl / codegen / sync_custom . h \ <nl> include / grpc / impl / codegen / sync_custom . h \ <nl> include / grpc / impl / codegen / sync_generic . h \ <nl> - include / grpc / impl / codegen / sync_generic . h \ <nl> - include / grpc / impl / codegen / sync_posix . h \ <nl> include / grpc / impl / codegen / sync_posix . h \ <nl> include / grpc / impl / codegen / sync_windows . h \ <nl> - include / grpc / impl / codegen / sync_windows . h \ <nl> include / grpc / load_reporting . h \ <nl> include / grpc / slice . h \ <nl> include / grpc / slice_buffer . h \ <nl> mmm a / tools / doxygen / Doxyfile . core . internal <nl> ppp b / tools / doxygen / Doxyfile . core . internal <nl> include / grpc / grpc_posix . h \ <nl> include / grpc / grpc_security . h \ <nl> include / grpc / grpc_security_constants . h \ <nl> include / grpc / impl / codegen / atm . h \ <nl> - include / grpc / impl / codegen / atm . h \ <nl> - include / grpc / impl / codegen / atm_gcc_atomic . h \ <nl> include / grpc / impl / codegen / atm_gcc_atomic . h \ <nl> include / grpc / impl / codegen / atm_gcc_sync . h \ <nl> - include / grpc / impl / codegen / atm_gcc_sync . h \ <nl> - include / grpc / impl / codegen / atm_windows . h \ <nl> include / grpc / impl / codegen / atm_windows . h \ <nl> include / grpc / impl / codegen / byte_buffer . h \ <nl> include / grpc / impl / codegen / byte_buffer_reader . h \ <nl> include / grpc / impl / codegen / compression_types . h \ <nl> include / grpc / impl / codegen / connectivity_state . h \ <nl> include / grpc / impl / codegen / fork . h \ <nl> - include / grpc / impl / codegen / fork . h \ <nl> - include / grpc / impl / codegen / gpr_slice . h \ <nl> include / grpc / impl / codegen / gpr_slice . h \ <nl> include / grpc / impl / codegen / gpr_types . h \ <nl> - include / grpc / impl / codegen / gpr_types . h \ <nl> include / grpc / impl / codegen / grpc_types . h \ <nl> include / grpc / impl / codegen / log . h \ <nl> - include / grpc / impl / codegen / log . h \ <nl> - include / grpc / impl / codegen / port_platform . h \ <nl> include / grpc / impl / codegen / port_platform . h \ <nl> include / grpc / impl / codegen / propagation_bits . h \ <nl> include / grpc / impl / codegen / slice . h \ <nl> include / grpc / impl / codegen / status . h \ <nl> include / grpc / impl / codegen / sync . h \ <nl> - include / grpc / impl / codegen / sync . h \ <nl> include / grpc / impl / codegen / sync_abseil . h \ <nl> - include / grpc / impl / codegen / sync_abseil . h \ <nl> - include / grpc / impl / codegen / sync_custom . h \ <nl> include / grpc / impl / codegen / sync_custom . h \ <nl> include / grpc / impl / codegen / sync_generic . h \ <nl> - include / grpc / impl / codegen / sync_generic . h \ <nl> - include / grpc / impl / codegen / sync_posix . h \ <nl> include / grpc / impl / codegen / sync_posix . h \ <nl> include / grpc / impl / codegen / sync_windows . h \ <nl> - include / grpc / impl / codegen / sync_windows . h \ <nl> include / grpc / load_reporting . h \ <nl> include / grpc / slice . h \ <nl> include / grpc / slice_buffer . h \ <nl>
|
Merge pull request from veblush / docxyfile - unique
|
grpc/grpc
|
03660c6c42919ff6e6b22c355a23bf11843c9b3e
|
2020-02-13T20:34:29Z
|
mmm a / src / mongo / dbtests / config_upgrade_tests . cpp <nl> ppp b / src / mongo / dbtests / config_upgrade_tests . cpp <nl> TEST_F ( ConfigUpgradeTests , InitialUpgrade ) { <nl> / / <nl> <nl> string errMsg ; <nl> - ASSERT_OK ( grid . catalogManager ( & _txn ) - > checkAndUpgrade ( false ) ) ; <nl> + ASSERT_OK ( grid . catalogManager ( & _txn ) - > initConfigVersion ( ) ) ; <nl> <nl> VersionType version ; <nl> ASSERT_OK ( getConfigVersion ( grid . catalogManager ( & _txn ) , & version ) ) ; <nl> TEST_F ( ConfigUpgradeTests , BadVersionUpgrade ) { <nl> <nl> / / Default version ( not upgradeable ) <nl> ASSERT_EQ ( ErrorCodes : : IncompatibleShardingMetadata , <nl> - grid . catalogManager ( & _txn ) - > checkAndUpgrade ( false ) ) ; <nl> + grid . catalogManager ( & _txn ) - > initConfigVersion ( ) ) ; <nl> } <nl> <nl> TEST_F ( ConfigUpgradeTests , CheckMongoVersion ) { <nl> mmm a / src / mongo / s / catalog / catalog_manager . h <nl> ppp b / src / mongo / s / catalog / catalog_manager . h <nl> class CatalogManager { <nl> * A new version document will be created if the current cluster config is empty . Otherwise , <nl> * checkOnly should be false to perform the upgrade . <nl> * / <nl> - virtual Status checkAndUpgrade ( bool checkOnly ) = 0 ; <nl> + virtual Status initConfigVersion ( ) = 0 ; <nl> <nl> protected : <nl> CatalogManager ( ) = default ; <nl> mmm a / src / mongo / s / catalog / catalog_manager_mock . cpp <nl> ppp b / src / mongo / s / catalog / catalog_manager_mock . cpp <nl> StatusWith < std : : string > CatalogManagerMock : : _generateNewShardName ( ) { <nl> return { ErrorCodes : : InternalError , " Method not implemented " } ; <nl> } <nl> <nl> - Status CatalogManagerMock : : checkAndUpgrade ( bool checkOnly ) { <nl> + Status CatalogManagerMock : : initConfigVersion ( ) { <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> mmm a / src / mongo / s / catalog / catalog_manager_mock . h <nl> ppp b / src / mongo / s / catalog / catalog_manager_mock . h <nl> class CatalogManagerMock : public CatalogManagerCommon { <nl> <nl> DistLockManager * getDistLockManager ( ) override ; <nl> <nl> - Status checkAndUpgrade ( bool checkOnly ) override ; <nl> + Status initConfigVersion ( ) override ; <nl> <nl> private : <nl> Status _checkDbDoesNotExist ( const std : : string & dbName , DatabaseType * db ) override ; <nl> mmm a / src / mongo / s / catalog / forwarding_catalog_manager . cpp <nl> ppp b / src / mongo / s / catalog / forwarding_catalog_manager . cpp <nl> DistLockManager * ForwardingCatalogManager : : getDistLockManager ( ) { <nl> return retry ( [ & ] { return _actual - > getDistLockManager ( ) ; } ) ; <nl> } <nl> <nl> - Status ForwardingCatalogManager : : checkAndUpgrade ( bool checkOnly ) { <nl> - return retry ( [ & ] { return _actual - > checkAndUpgrade ( checkOnly ) ; } ) ; <nl> + Status ForwardingCatalogManager : : initConfigVersion ( ) { <nl> + return retry ( [ & ] { return _actual - > initConfigVersion ( ) ; } ) ; <nl> } <nl> <nl> StatusWith < ForwardingCatalogManager : : ScopedDistLock > ForwardingCatalogManager : : distLock ( <nl> mmm a / src / mongo / s / catalog / forwarding_catalog_manager . h <nl> ppp b / src / mongo / s / catalog / forwarding_catalog_manager . h <nl> class ForwardingCatalogManager final : public CatalogManager { <nl> <nl> DistLockManager * getDistLockManager ( ) override ; <nl> <nl> - Status checkAndUpgrade ( bool checkOnly ) override ; <nl> + Status initConfigVersion ( ) override ; <nl> <nl> class ScopedDistLock { <nl> MONGO_DISALLOW_COPYING ( ScopedDistLock ) ; <nl> mmm a / src / mongo / s / catalog / legacy / catalog_manager_legacy . cpp <nl> ppp b / src / mongo / s / catalog / legacy / catalog_manager_legacy . cpp <nl> Status CatalogManagerLegacy : : startup ( ) { <nl> return status ; <nl> } <nl> <nl> - Status CatalogManagerLegacy : : checkAndUpgrade ( bool checkOnly ) { <nl> + Status CatalogManagerLegacy : : initConfigVersion ( ) { <nl> return checkAndInitConfigVersion ( this , getDistLockManager ( ) ) ; <nl> } <nl> <nl> mmm a / src / mongo / s / catalog / legacy / catalog_manager_legacy . h <nl> ppp b / src / mongo / s / catalog / legacy / catalog_manager_legacy . h <nl> class CatalogManagerLegacy final : public CatalogManagerCommon { <nl> <nl> DistLockManager * getDistLockManager ( ) override ; <nl> <nl> - Status checkAndUpgrade ( bool checkOnly ) override ; <nl> + Status initConfigVersion ( ) override ; <nl> <nl> private : <nl> Status _checkDbDoesNotExist ( const std : : string & dbName , DatabaseType * db ) override ; <nl> mmm a / src / mongo / s / catalog / replset / catalog_manager_replica_set . cpp <nl> ppp b / src / mongo / s / catalog / replset / catalog_manager_replica_set . cpp <nl> StatusWith < long long > CatalogManagerReplicaSet : : _runCountCommandOnConfig ( const H <nl> return result ; <nl> } <nl> <nl> - Status CatalogManagerReplicaSet : : checkAndUpgrade ( bool checkOnly ) { <nl> + Status CatalogManagerReplicaSet : : initConfigVersion ( ) { <nl> auto versionStatus = _getConfigVersion ( ) ; <nl> if ( ! versionStatus . isOK ( ) ) { <nl> return versionStatus . getStatus ( ) ; <nl> mmm a / src / mongo / s / catalog / replset / catalog_manager_replica_set . h <nl> ppp b / src / mongo / s / catalog / replset / catalog_manager_replica_set . h <nl> class CatalogManagerReplicaSet final : public CatalogManagerCommon { <nl> <nl> DistLockManager * getDistLockManager ( ) override ; <nl> <nl> - Status checkAndUpgrade ( bool checkOnly ) override ; <nl> + Status initConfigVersion ( ) override ; <nl> <nl> private : <nl> Status _checkDbDoesNotExist ( const std : : string & dbName , DatabaseType * db ) override ; <nl> mmm a / src / mongo / s / catalog / replset / catalog_manager_replica_set_upgrade_test . cpp <nl> ppp b / src / mongo / s / catalog / replset / catalog_manager_replica_set_upgrade_test . cpp <nl> using CatalogManagerReplSetTest = CatalogManagerReplSetTestFixture ; <nl> TEST_F ( CatalogManagerReplSetTestFixture , UpgradeNotNeeded ) { <nl> configTargeter ( ) - > setFindHostReturnValue ( HostAndPort ( " config : 123 " ) ) ; <nl> <nl> - auto future = launchAsync ( [ this ] { ASSERT_OK ( catalogManager ( ) - > checkAndUpgrade ( true ) ) ; } ) ; <nl> + auto future = launchAsync ( [ this ] { ASSERT_OK ( catalogManager ( ) - > initConfigVersion ( ) ) ; } ) ; <nl> <nl> onFindCommand ( [ this ] ( const RemoteCommandRequest & request ) { <nl> ASSERT_EQUALS ( BSON ( rpc : : kReplSetMetadataFieldName < < 1 ) , request . metadata ) ; <nl> TEST_F ( CatalogManagerReplSetTestFixture , UpgradeTargetError ) { <nl> configTargeter ( ) - > setFindHostReturnValue ( { ErrorCodes : : InternalError , " Bad test network " } ) ; <nl> <nl> auto future = launchAsync ( [ this ] { <nl> - auto status = catalogManager ( ) - > checkAndUpgrade ( true ) ; <nl> + auto status = catalogManager ( ) - > initConfigVersion ( ) ; <nl> ASSERT_EQ ( ErrorCodes : : InternalError , status . code ( ) ) ; <nl> ASSERT_FALSE ( status . reason ( ) . empty ( ) ) ; <nl> } ) ; <nl> TEST_F ( CatalogManagerReplSetTestFixture , UpgradeClusterMultiVersion ) { <nl> configTargeter ( ) - > setFindHostReturnValue ( HostAndPort ( " config : 123 " ) ) ; <nl> <nl> auto future = launchAsync ( [ this ] { <nl> - auto status = catalogManager ( ) - > checkAndUpgrade ( true ) ; <nl> + auto status = catalogManager ( ) - > initConfigVersion ( ) ; <nl> ASSERT_EQ ( ErrorCodes : : RemoteValidationError , status . code ( ) ) ; <nl> ASSERT_FALSE ( status . reason ( ) . empty ( ) ) ; <nl> } ) ; <nl> TEST_F ( CatalogManagerReplSetTestFixture , UpgradeInvalidConfigVersionDoc ) { <nl> configTargeter ( ) - > setFindHostReturnValue ( HostAndPort ( " config : 123 " ) ) ; <nl> <nl> auto future = launchAsync ( [ this ] { <nl> - auto status = catalogManager ( ) - > checkAndUpgrade ( true ) ; <nl> + auto status = catalogManager ( ) - > initConfigVersion ( ) ; <nl> ASSERT_EQ ( ErrorCodes : : UnsupportedFormat , status . code ( ) ) ; <nl> ASSERT_FALSE ( status . reason ( ) . empty ( ) ) ; <nl> } ) ; <nl> TEST_F ( CatalogManagerReplSetTestFixture , UpgradeInvalidConfigVersionDoc ) { <nl> TEST_F ( CatalogManagerReplSetTestFixture , UpgradeNoVersionDocEmptyConfig ) { <nl> configTargeter ( ) - > setFindHostReturnValue ( HostAndPort ( " config : 123 " ) ) ; <nl> <nl> - auto future = launchAsync ( [ this ] { ASSERT_OK ( catalogManager ( ) - > checkAndUpgrade ( true ) ) ; } ) ; <nl> + auto future = launchAsync ( [ this ] { ASSERT_OK ( catalogManager ( ) - > initConfigVersion ( ) ) ; } ) ; <nl> <nl> onFindCommand ( [ ] ( const RemoteCommandRequest & request ) { return vector < BSONObj > { } ; } ) ; <nl> <nl> TEST_F ( CatalogManagerReplSetTestFixture , UpgradeNoVersionDocEmptyConfig ) { <nl> TEST_F ( CatalogManagerReplSetTestFixture , UpgradeNoVersionDocEmptyConfigWithAdmin ) { <nl> configTargeter ( ) - > setFindHostReturnValue ( HostAndPort ( " config : 123 " ) ) ; <nl> <nl> - auto future = launchAsync ( [ this ] { ASSERT_OK ( catalogManager ( ) - > checkAndUpgrade ( true ) ) ; } ) ; <nl> + auto future = launchAsync ( [ this ] { ASSERT_OK ( catalogManager ( ) - > initConfigVersion ( ) ) ; } ) ; <nl> <nl> onFindCommand ( [ ] ( const RemoteCommandRequest & request ) { return vector < BSONObj > { } ; } ) ; <nl> <nl> TEST_F ( CatalogManagerReplSetTestFixture , UpgradeWriteError ) { <nl> configTargeter ( ) - > setFindHostReturnValue ( HostAndPort ( " config : 123 " ) ) ; <nl> <nl> auto future = launchAsync ( [ this ] { <nl> - auto status = catalogManager ( ) - > checkAndUpgrade ( true ) ; <nl> + auto status = catalogManager ( ) - > initConfigVersion ( ) ; <nl> ASSERT_EQ ( ErrorCodes : : DuplicateKey , status . code ( ) ) ; <nl> ASSERT_FALSE ( status . reason ( ) . empty ( ) ) ; <nl> } ) ; <nl> TEST_F ( CatalogManagerReplSetTestFixture , UpgradeNoVersionDocNonEmptyConfigServer <nl> configTargeter ( ) - > setFindHostReturnValue ( HostAndPort ( " config : 123 " ) ) ; <nl> <nl> auto future = launchAsync ( [ this ] { <nl> - auto status = catalogManager ( ) - > checkAndUpgrade ( true ) ; <nl> + auto status = catalogManager ( ) - > initConfigVersion ( ) ; <nl> ASSERT_EQ ( ErrorCodes : : IncompatibleShardingConfigVersion , status . code ( ) ) ; <nl> ASSERT_FALSE ( status . reason ( ) . empty ( ) ) ; <nl> } ) ; <nl> TEST_F ( CatalogManagerReplSetTestFixture , UpgradeTooOld ) { <nl> configTargeter ( ) - > setFindHostReturnValue ( HostAndPort ( " config : 123 " ) ) ; <nl> <nl> auto future = launchAsync ( [ this ] { <nl> - auto status = catalogManager ( ) - > checkAndUpgrade ( true ) ; <nl> + auto status = catalogManager ( ) - > initConfigVersion ( ) ; <nl> ASSERT_EQ ( ErrorCodes : : IncompatibleShardingConfigVersion , status . code ( ) ) ; <nl> ASSERT_FALSE ( status . reason ( ) . empty ( ) ) ; <nl> } ) ; <nl> mmm a / src / mongo / s / mongos_options . cpp <nl> ppp b / src / mongo / s / mongos_options . cpp <nl> Status addMongosOptions ( moe : : OptionSection * options ) { <nl> sharding_options . addOptionChaining ( " test " , " test " , moe : : Switch , " just run unit tests " ) <nl> . setSources ( moe : : SourceAllLegacy ) ; <nl> <nl> - sharding_options . addOptionChaining ( <nl> - " upgrade " , " upgrade " , moe : : Switch , " upgrade meta data version " ) <nl> - . setSources ( moe : : SourceAllLegacy ) ; <nl> - <nl> sharding_options . addOptionChaining ( <nl> " sharding . chunkSize " , " chunkSize " , moe : : Int , " maximum amount of data per chunk " ) ; <nl> <nl> Status storeMongosOptions ( const moe : : Environment & params , const std : : vector < std : <nl> " purposes and is not recommended for production " ; <nl> } <nl> <nl> - if ( params . count ( " upgrade " ) ) { <nl> - mongosGlobalParams . upgrade = params [ " upgrade " ] . as < bool > ( ) ; <nl> - } <nl> - <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> mmm a / src / mongo / s / mongos_options . h <nl> ppp b / src / mongo / s / mongos_options . h <nl> namespace moe = mongo : : optionenvironment ; <nl> <nl> struct MongosGlobalParams { <nl> ConnectionString configdbs ; <nl> - bool upgrade ; <nl> <nl> - MongosGlobalParams ( ) : upgrade ( false ) { } <nl> + MongosGlobalParams ( ) = default ; <nl> } ; <nl> <nl> extern MongosGlobalParams mongosGlobalParams ; <nl> mmm a / src / mongo / s / server . cpp <nl> ppp b / src / mongo / s / server . cpp <nl> DBClientBase * createDirectClient ( OperationContext * txn ) { <nl> <nl> using namespace mongo ; <nl> <nl> - static Status initializeSharding ( OperationContext * txn , bool doUpgrade ) { <nl> + static Status initializeSharding ( OperationContext * txn ) { <nl> Status status = initializeGlobalShardingState ( mongosGlobalParams . configdbs ) ; <nl> if ( ! status . isOK ( ) ) { <nl> return status ; <nl> } <nl> <nl> auto catalogManager = grid . catalogManager ( txn ) ; <nl> - status = catalogManager - > checkAndUpgrade ( ! doUpgrade ) ; <nl> + status = catalogManager - > initConfigVersion ( ) ; <nl> if ( ! status . isOK ( ) ) { <nl> return status ; <nl> } <nl> <nl> - if ( doUpgrade ) { <nl> - return Status : : OK ( ) ; <nl> - } <nl> - <nl> status = catalogManager - > startup ( ) ; <nl> if ( ! status . isOK ( ) ) { <nl> return status ; <nl> static Status initializeSharding ( OperationContext * txn , bool doUpgrade ) { <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> - static ExitCode runMongosServer ( bool doUpgrade ) { <nl> + static ExitCode runMongosServer ( ) { <nl> Client : : initThread ( " mongosMain " ) ; <nl> printShardingVersionInfo ( false ) ; <nl> <nl> static ExitCode runMongosServer ( bool doUpgrade ) { <nl> <nl> { <nl> auto txn = cc ( ) . makeOperationContext ( ) ; <nl> - Status status = initializeSharding ( txn . get ( ) , doUpgrade ) ; <nl> + Status status = initializeSharding ( txn . get ( ) ) ; <nl> if ( ! status . isOK ( ) ) { <nl> error ( ) < < " Error initializing sharding system : " < < status ; <nl> return EXIT_SHARDING_ERROR ; <nl> } <nl> - if ( doUpgrade ) { <nl> - return EXIT_CLEAN ; <nl> - } <nl> <nl> ConfigServer : : reloadSettings ( txn . get ( ) ) ; <nl> } <nl> static int _main ( ) { <nl> } <nl> # endif <nl> <nl> - ExitCode exitCode = runMongosServer ( mongosGlobalParams . upgrade ) ; <nl> + ExitCode exitCode = runMongosServer ( ) ; <nl> <nl> / / To maintain backwards compatibility , we exit with EXIT_NET_ERROR if the listener loop <nl> / / returns . <nl> static ExitCode initService ( ) { <nl> ntservice : : reportStatus ( SERVICE_RUNNING ) ; <nl> log ( ) < < " Service running " ; <nl> <nl> - ExitCode exitCode = runMongosServer ( mongosGlobalParams . upgrade ) ; <nl> + ExitCode exitCode = runMongosServer ( ) ; <nl> <nl> / / ignore EXIT_NET_ERROR on clean shutdown since we return this when the listening socket <nl> / / is closed <nl>
|
SERVER - 19590 Remove - - upgrade from mongos
|
mongodb/mongo
|
cf270a30130d1794d50286594ba17d63210bea9e
|
2015-08-21T16:57:57Z
|
mmm a / ReactWindows / ReactNative . Net46 . Tests / ReactNative . Net46 . Tests . csproj <nl> ppp b / ReactWindows / ReactNative . Net46 . Tests / ReactNative . Net46 . Tests . csproj <nl> <nl> < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> < Project DefaultTargets = " Build " ToolsVersion = " 4 . 0 " xmlns = " http : / / schemas . microsoft . com / developer / msbuild / 2003 " > <nl> - < Import Project = " . . \ packages \ NUnit3TestAdapter . 3 . 9 . 0 \ build \ net35 \ NUnit3TestAdapter . props " Condition = " Exists ( ' . . \ packages \ NUnit3TestAdapter . 3 . 9 . 0 \ build \ net35 \ NUnit3TestAdapter . props ' ) " / > <nl> + < Import Project = " $ ( SolutionDir ) \ packages \ NUnit3TestAdapter . 3 . 9 . 0 \ build \ net35 \ NUnit3TestAdapter . props " Condition = " Exists ( ' $ ( SolutionDir ) \ packages \ NUnit3TestAdapter . 3 . 9 . 0 \ build \ net35 \ NUnit3TestAdapter . props ' ) " / > <nl> < PropertyGroup > <nl> < Configuration Condition = " ' $ ( Configuration ) ' = = ' ' " > Debug < / Configuration > <nl> < Platform Condition = " ' $ ( Platform ) ' = = ' ' " > x64 < / Platform > <nl> <nl> < Private > True < / Private > <nl> < / Reference > <nl> < Reference Include = " Newtonsoft . Json , Version = 10 . 0 . 0 . 0 , Culture = neutral , PublicKeyToken = 30ad4fe6b2a6aeed , processorArchitecture = MSIL " > <nl> - < HintPath > . . \ packages \ Newtonsoft . Json . 10 . 0 . 3 \ lib \ net45 \ Newtonsoft . Json . dll < / HintPath > <nl> + < HintPath > $ ( SolutionDir ) \ packages \ Newtonsoft . Json . 10 . 0 . 3 \ lib \ net45 \ Newtonsoft . Json . dll < / HintPath > <nl> < / Reference > <nl> < Reference Include = " nunit . framework , Version = 3 . 9 . 0 . 0 , Culture = neutral , PublicKeyToken = 2638cd05610744eb , processorArchitecture = MSIL " > <nl> - < HintPath > . . \ packages \ NUnit . 3 . 9 . 0 \ lib \ net45 \ nunit . framework . dll < / HintPath > <nl> + < HintPath > $ ( SolutionDir ) \ packages \ NUnit . 3 . 9 . 0 \ lib \ net45 \ nunit . framework . dll < / HintPath > <nl> < / Reference > <nl> < Reference Include = " PCLStorage , Version = 1 . 0 . 2 . 0 , Culture = neutral , PublicKeyToken = 286fe515a2c35b64 , processorArchitecture = MSIL " > <nl> < HintPath > $ ( SolutionDir ) \ packages \ PCLStorage . 1 . 0 . 2 \ lib \ net45 \ PCLStorage . dll < / HintPath > <nl> <nl> < Reference Include = " System . Net . Http " / > <nl> < Reference Include = " System . Net . Http . WebRequest " / > <nl> < Reference Include = " System . Reactive , Version = 4 . 0 . 0 . 0 , Culture = neutral , PublicKeyToken = 94bc3704cddfc263 , processorArchitecture = MSIL " > <nl> - < HintPath > . . \ packages \ System . Reactive . 4 . 0 . 0 - preview00001 \ lib \ net46 \ System . Reactive . dll < / HintPath > <nl> + < HintPath > $ ( SolutionDir ) \ packages \ System . Reactive . 4 . 0 . 0 - preview00001 \ lib \ net46 \ System . Reactive . dll < / HintPath > <nl> < / Reference > <nl> < Reference Include = " System . Reactive . Core , Version = 3 . 0 . 3000 . 0 , Culture = neutral , PublicKeyToken = 94bc3704cddfc263 , processorArchitecture = MSIL " > <nl> - < HintPath > . . \ packages \ System . Reactive . Core . 4 . 0 . 0 - preview00001 \ lib \ net46 \ System . Reactive . Core . dll < / HintPath > <nl> + < HintPath > $ ( SolutionDir ) \ packages \ System . Reactive . Core . 4 . 0 . 0 - preview00001 \ lib \ net46 \ System . Reactive . Core . dll < / HintPath > <nl> < / Reference > <nl> < Reference Include = " System . Reactive . Interfaces , Version = 3 . 0 . 1000 . 0 , Culture = neutral , PublicKeyToken = 94bc3704cddfc263 , processorArchitecture = MSIL " > <nl> - < HintPath > . . \ packages \ System . Reactive . Interfaces . 4 . 0 . 0 - preview00001 \ lib \ net45 \ System . Reactive . Interfaces . dll < / HintPath > <nl> + < HintPath > $ ( SolutionDir ) \ packages \ System . Reactive . Interfaces . 4 . 0 . 0 - preview00001 \ lib \ net45 \ System . Reactive . Interfaces . dll < / HintPath > <nl> < / Reference > <nl> < Reference Include = " System . Reactive . Linq , Version = 3 . 0 . 3000 . 0 , Culture = neutral , PublicKeyToken = 94bc3704cddfc263 , processorArchitecture = MSIL " > <nl> - < HintPath > . . \ packages \ System . Reactive . Linq . 4 . 0 . 0 - preview00001 \ lib \ net46 \ System . Reactive . Linq . dll < / HintPath > <nl> + < HintPath > $ ( SolutionDir ) \ packages \ System . Reactive . Linq . 4 . 0 . 0 - preview00001 \ lib \ net46 \ System . Reactive . Linq . dll < / HintPath > <nl> < / Reference > <nl> < Reference Include = " System . Reactive . PlatformServices , Version = 3 . 0 . 3000 . 0 , Culture = neutral , PublicKeyToken = 94bc3704cddfc263 , processorArchitecture = MSIL " > <nl> - < HintPath > . . \ packages \ System . Reactive . PlatformServices . 4 . 0 . 0 - preview00001 \ lib \ net46 \ System . Reactive . PlatformServices . dll < / HintPath > <nl> + < HintPath > $ ( SolutionDir ) \ packages \ System . Reactive . PlatformServices . 4 . 0 . 0 - preview00001 \ lib \ net46 \ System . Reactive . PlatformServices . dll < / HintPath > <nl> < / Reference > <nl> < Reference Include = " System . Reactive . Windows . Threading , Version = 3 . 0 . 1000 . 0 , Culture = neutral , PublicKeyToken = 94bc3704cddfc263 , processorArchitecture = MSIL " > <nl> - < HintPath > . . \ packages \ System . Reactive . Windows . Threading . 4 . 0 . 0 - preview00001 \ lib \ net45 \ System . Reactive . Windows . Threading . dll < / HintPath > <nl> + < HintPath > $ ( SolutionDir ) \ packages \ System . Reactive . Windows . Threading . 4 . 0 . 0 - preview00001 \ lib \ net45 \ System . Reactive . Windows . Threading . dll < / HintPath > <nl> < / Reference > <nl> < Reference Include = " System . Windows " / > <nl> < Reference Include = " System . Windows . Presentation " / > <nl> <nl> < ErrorText > This project references NuGet package ( s ) that are missing on this computer . Use NuGet Package Restore to download them . For more information , see http : / / go . microsoft . com / fwlink / ? LinkID = 322105 . The missing file is { 0 } . < / ErrorText > <nl> < / PropertyGroup > <nl> < Error Condition = " ! Exists ( ' $ ( SolutionDir ) \ packages \ Facebook . Yoga . 1 . 5 . 0 - pre1 \ build \ net45 \ Facebook . Yoga . targets ' ) " Text = " $ ( [ System . String ] : : Format ( ' $ ( ErrorText ) ' , ' $ ( SolutionDir ) \ packages \ Facebook . Yoga . 1 . 5 . 0 - pre1 \ build \ net45 \ Facebook . Yoga . targets ' ) ) " / > <nl> - < Error Condition = " ! Exists ( ' . . \ packages \ NUnit3TestAdapter . 3 . 9 . 0 \ build \ net35 \ NUnit3TestAdapter . props ' ) " Text = " $ ( [ System . String ] : : Format ( ' $ ( ErrorText ) ' , ' . . \ packages \ NUnit3TestAdapter . 3 . 9 . 0 \ build \ net35 \ NUnit3TestAdapter . props ' ) ) " / > <nl> + < Error Condition = " ! Exists ( ' $ ( SolutionDir ) \ packages \ NUnit3TestAdapter . 3 . 9 . 0 \ build \ net35 \ NUnit3TestAdapter . props ' ) " Text = " $ ( [ System . String ] : : Format ( ' $ ( ErrorText ) ' , ' $ ( SolutionDir ) \ packages \ NUnit3TestAdapter . 3 . 9 . 0 \ build \ net35 \ NUnit3TestAdapter . props ' ) ) " / > <nl> < / Target > <nl> < / Project > <nl> \ No newline at end of file <nl> mmm a / ReactWindows / ReactNative . Net46 / ReactNative . Net46 . csproj <nl> ppp b / ReactWindows / ReactNative . Net46 / ReactNative . Net46 . csproj <nl> <nl> < / PropertyGroup > <nl> < ItemGroup > <nl> < Reference Include = " Newtonsoft . Json , Version = 10 . 0 . 0 . 0 , Culture = neutral , PublicKeyToken = 30ad4fe6b2a6aeed , processorArchitecture = MSIL " > <nl> - < HintPath > . . \ packages \ Newtonsoft . Json . 10 . 0 . 3 \ lib \ net45 \ Newtonsoft . Json . dll < / HintPath > <nl> + < HintPath > $ ( SolutionDir ) \ packages \ Newtonsoft . Json . 10 . 0 . 3 \ lib \ net45 \ Newtonsoft . Json . dll < / HintPath > <nl> < / Reference > <nl> < Reference Include = " PresentationCore " / > <nl> < Reference Include = " PresentationFramework " / > <nl> <nl> < Private > True < / Private > <nl> < / Reference > <nl> < Reference Include = " System . Reactive , Version = 4 . 0 . 0 . 0 , Culture = neutral , PublicKeyToken = 94bc3704cddfc263 , processorArchitecture = MSIL " > <nl> - < HintPath > . . \ packages \ System . Reactive . 4 . 0 . 0 - preview00001 \ lib \ net46 \ System . Reactive . dll < / HintPath > <nl> + < HintPath > $ ( SolutionDir ) \ packages \ System . Reactive . 4 . 0 . 0 - preview00001 \ lib \ net46 \ System . Reactive . dll < / HintPath > <nl> < / Reference > <nl> < Reference Include = " System . Reactive . Core , Version = 3 . 0 . 3000 . 0 , Culture = neutral , PublicKeyToken = 94bc3704cddfc263 , processorArchitecture = MSIL " > <nl> - < HintPath > . . \ packages \ System . Reactive . Core . 4 . 0 . 0 - preview00001 \ lib \ net46 \ System . Reactive . Core . dll < / HintPath > <nl> + < HintPath > $ ( SolutionDir ) \ packages \ System . Reactive . Core . 4 . 0 . 0 - preview00001 \ lib \ net46 \ System . Reactive . Core . dll < / HintPath > <nl> < / Reference > <nl> < Reference Include = " System . Reactive . Interfaces , Version = 3 . 0 . 1000 . 0 , Culture = neutral , PublicKeyToken = 94bc3704cddfc263 , processorArchitecture = MSIL " > <nl> - < HintPath > . . \ packages \ System . Reactive . Interfaces . 4 . 0 . 0 - preview00001 \ lib \ net45 \ System . Reactive . Interfaces . dll < / HintPath > <nl> + < HintPath > $ ( SolutionDir ) \ packages \ System . Reactive . Interfaces . 4 . 0 . 0 - preview00001 \ lib \ net45 \ System . Reactive . Interfaces . dll < / HintPath > <nl> < / Reference > <nl> < Reference Include = " System . Reactive . Linq , Version = 3 . 0 . 3000 . 0 , Culture = neutral , PublicKeyToken = 94bc3704cddfc263 , processorArchitecture = MSIL " > <nl> - < HintPath > . . \ packages \ System . Reactive . Linq . 4 . 0 . 0 - preview00001 \ lib \ net46 \ System . Reactive . Linq . dll < / HintPath > <nl> + < HintPath > $ ( SolutionDir ) \ packages \ System . Reactive . Linq . 4 . 0 . 0 - preview00001 \ lib \ net46 \ System . Reactive . Linq . dll < / HintPath > <nl> < / Reference > <nl> < Reference Include = " System . Reactive . PlatformServices , Version = 3 . 0 . 3000 . 0 , Culture = neutral , PublicKeyToken = 94bc3704cddfc263 , processorArchitecture = MSIL " > <nl> - < HintPath > . . \ packages \ System . Reactive . PlatformServices . 4 . 0 . 0 - preview00001 \ lib \ net46 \ System . Reactive . PlatformServices . dll < / HintPath > <nl> + < HintPath > $ ( SolutionDir ) \ packages \ System . Reactive . PlatformServices . 4 . 0 . 0 - preview00001 \ lib \ net46 \ System . Reactive . PlatformServices . dll < / HintPath > <nl> < / Reference > <nl> < Reference Include = " System . Reactive . Windows . Threading , Version = 3 . 0 . 1000 . 0 , Culture = neutral , PublicKeyToken = 94bc3704cddfc263 , processorArchitecture = MSIL " > <nl> - < HintPath > . . \ packages \ System . Reactive . Windows . Threading . 4 . 0 . 0 - preview00001 \ lib \ net45 \ System . Reactive . Windows . Threading . dll < / HintPath > <nl> + < HintPath > $ ( SolutionDir ) \ packages \ System . Reactive . Windows . Threading . 4 . 0 . 0 - preview00001 \ lib \ net45 \ System . Reactive . Windows . Threading . dll < / HintPath > <nl> < / Reference > <nl> < Reference Include = " System . Runtime . Serialization " / > <nl> < Reference Include = " System . Windows " / > <nl>
|
Use ` $ ( SolutionDir ) \ packages ` instead of ` . . \ packages ` . ( )
|
microsoft/react-native-windows
|
9208f15582dda59ea167575337157c778909b371
|
2018-05-18T14:08:31Z
|
mmm a / ports / curl / CONTROL <nl> ppp b / ports / curl / CONTROL <nl> <nl> Source : curl <nl> - Version : 7 . 65 . 0 - 2 <nl> + Version : 7 . 65 . 0 - 3 <nl> Build - Depends : zlib <nl> Homepage : https : / / github . com / curl / curl <nl> Description : A library for transferring data with URLs <nl> Description : SSL support ( mbedTLS ) <nl> <nl> Feature : sectransp <nl> Description : SSL support ( sectransp ) <nl> + <nl> + Feature : c - ares <nl> + Build - Depends : c - ares <nl> + Description : c - ares support <nl> + <nl> + Feature : sspi <nl> + Description : SSPI support <nl> + <nl> + Feature : brotli <nl> + Description : brotli support ( brotli ) <nl> \ No newline at end of file <nl> mmm a / ports / curl / portfile . cmake <nl> ppp b / ports / curl / portfile . cmake <nl> if ( " tool " IN_LIST FEATURES ) <nl> set ( BUILD_CURL_EXE ON ) <nl> endif ( ) <nl> <nl> + # c - ares <nl> + set ( USE_ARES OFF ) <nl> + if ( " c - ares " IN_LIST FEATURES ) <nl> + set ( USE_ARES ON ) <nl> + endif ( ) <nl> + <nl> + # SSPI <nl> + set ( USE_WINDOWS_SSPI OFF ) <nl> + if ( " sspi " IN_LIST FEATURES ) <nl> + set ( USE_WINDOWS_SSPI ON ) <nl> + endif ( ) <nl> + <nl> + # brotli <nl> + set ( HAVE_BROTLI OFF ) <nl> + if ( " brotli " IN_LIST FEATURES ) <nl> + set ( HAVE_BROTLI ON ) <nl> + endif ( ) <nl> + <nl> # UWP targets <nl> set ( UWP_OPTIONS ) <nl> if ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL " WindowsStore " ) <nl> vcpkg_configure_cmake ( <nl> - DCMAKE_USE_SECTRANSP = $ { USE_SECTRANSP } <nl> - DCMAKE_USE_LIBSSH2 = $ { USE_LIBSSH2 } <nl> - DHTTP_ONLY = $ { USE_HTTP_ONLY } <nl> + - DENABLE_ARES = $ { USE_ARES } <nl> + - DCURL_WINDOWS_SSPI = $ { USE_WINDOWS_SSPI } <nl> + - DCURL_BROTLI = $ { HAVE_BROTLI } <nl> - DCMAKE_DISABLE_FIND_PACKAGE_Perl = ON <nl> OPTIONS_RELEASE <nl> - DBUILD_CURL_EXE = $ { BUILD_CURL_EXE } <nl>
|
[ curl ] Add features . ( )
|
microsoft/vcpkg
|
042d7d368f7417039cc8e42cc34af634d9a45f80
|
2019-07-08T06:11:01Z
|
mmm a / DEPS <nl> ppp b / DEPS <nl> vars = { <nl> <nl> deps = { <nl> " v8 / build " : <nl> - Var ( " git_url " ) + " / chromium / src / build . git " + " @ " + " e3d87b142123f2da73c94c276ee915c099afe909 " , <nl> + Var ( " git_url " ) + " / chromium / src / build . git " + " @ " + " 143dcc2b1b07c16858f16f25fefe04311f663279 " , <nl> " v8 / tools / gyp " : <nl> Var ( " git_url " ) + " / external / gyp . git " + " @ " + " 02b145a1a4f4e1c62e8bae06045caf852d9ef17f " , <nl> " v8 / third_party / icu " : <nl> deps = { <nl> " v8 / test / test262 / data " : <nl> Var ( " git_url " ) + " / external / github . com / tc39 / test262 . git " + " @ " + " 9c45e2ac684bae64614d8eb55789cae97323a7e7 " , <nl> " v8 / tools / clang " : <nl> - Var ( " git_url " ) + " / chromium / src / tools / clang . git " + " @ " + " 15dd77e3ea10e43596ec6ac07b73431135915b30 " , <nl> + Var ( " git_url " ) + " / chromium / src / tools / clang . git " + " @ " + " 18b63c680a59a7125514b1e05ca42cdfb89a19c7 " , <nl> } <nl> <nl> deps_os = { <nl>
|
Update V8 DEPS .
|
v8/v8
|
7536f837211b8042ebb872938f8445d27dd7fe43
|
2016-05-10T03:27:48Z
|
mmm a / libs / gltfio / src / Animator . cpp <nl> ppp b / libs / gltfio / src / Animator . cpp <nl> static void setTransformType ( const cgltf_animation_channel & src , Channel & dst ) { <nl> } <nl> } <nl> <nl> + static bool validateAnimation ( const cgltf_animation & anim ) { <nl> + for ( cgltf_size j = 0 ; j < anim . channels_count ; + + j ) { <nl> + const cgltf_animation_channel & channel = anim . channels [ j ] ; <nl> + const cgltf_animation_sampler * sampler = channel . sampler ; <nl> + if ( ! channel . target_node ) { <nl> + continue ; <nl> + } <nl> + if ( ! channel . sampler ) { <nl> + return false ; <nl> + } <nl> + cgltf_size components = 1 ; <nl> + if ( channel . target_path = = cgltf_animation_path_type_weights ) { <nl> + if ( ! channel . target_node - > mesh | | ! channel . target_node - > mesh - > primitives_count ) { <nl> + return false ; <nl> + } <nl> + components = channel . target_node - > mesh - > primitives [ 0 ] . targets_count ; <nl> + } <nl> + cgltf_size values = sampler - > interpolation = = cgltf_interpolation_type_cubic_spline ? 3 : 1 ; <nl> + if ( sampler - > input - > count * components * values ! = sampler - > output - > count ) { <nl> + return false ; <nl> + } <nl> + } <nl> + return true ; <nl> + } <nl> + <nl> Animator : : Animator ( FFilamentAsset * asset , FFilamentInstance * instance ) { <nl> assert ( asset - > mResourcesLoaded & & ! asset - > mIsReleased ) ; <nl> mImpl = new AnimatorImpl ( ) ; <nl> Animator : : Animator ( FFilamentAsset * asset , FFilamentInstance * instance ) { <nl> mImpl - > renderableManager = & asset - > mEngine - > getRenderableManager ( ) ; <nl> mImpl - > transformManager = & asset - > mEngine - > getTransformManager ( ) ; <nl> <nl> + const cgltf_data * srcAsset = asset - > mSourceAsset ; <nl> + const cgltf_animation * srcAnims = srcAsset - > animations ; <nl> + for ( cgltf_size i = 0 , len = srcAsset - > animations_count ; i < len ; + + i ) { <nl> + const cgltf_animation & anim = srcAnims [ i ] ; <nl> + if ( ! validateAnimation ( anim ) ) { <nl> + slog . e < < " Disabling animation due to validation failure . " < < io : : endl ; <nl> + return ; <nl> + } <nl> + } <nl> + <nl> auto addChannels = [ ] ( const NodeMap & nodeMap , const cgltf_animation & srcAnim , Animation & dst ) { <nl> cgltf_animation_channel * srcChannels = srcAnim . channels ; <nl> cgltf_animation_sampler * srcSamplers = srcAnim . samplers ; <nl> Animator : : Animator ( FFilamentAsset * asset , FFilamentInstance * instance ) { <nl> } ; <nl> <nl> / / Loop over the glTF animation definitions . <nl> - const cgltf_data * srcAsset = asset - > mSourceAsset ; <nl> - const cgltf_animation * srcAnims = srcAsset - > animations ; <nl> mImpl - > animations . resize ( srcAsset - > animations_count ) ; <nl> for ( cgltf_size i = 0 , len = srcAsset - > animations_count ; i < len ; + + i ) { <nl> const cgltf_animation & srcAnim = srcAnims [ i ] ; <nl>
|
gltfio : fix ASAN issue when consuming invalid animation .
|
google/filament
|
47521d70a1f6376cbeae58aa169133b42c262953
|
2020-10-31T22:17:15Z
|
mmm a / libraries / Servo / src / esp8266 / ServoTimers . h <nl> ppp b / libraries / Servo / src / esp8266 / ServoTimers . h <nl> struct ServoTimer0 <nl> <nl> # if ! defined ( SERVO_EXCLUDE_TIMER1 ) <nl> <nl> + # define TIMER1_TICKS_PER_US ( APB_CLK_FREQ / 1000000L ) <nl> + <nl> struct ServoTimer1 <nl> { <nl> public : <nl> struct ServoTimer1 <nl> <nl> uint32_t usToTicks ( uint32_t us ) const <nl> { <nl> - return ( clockCyclesPerMicrosecond ( ) / 16 * us ) ; / / converts microseconds to tick <nl> + return ( TIMER1_TICKS_PER_US / 16 * us ) ; / / converts microseconds to tick <nl> } <nl> uint32_t ticksToUs ( uint32_t ticks ) const <nl> { <nl> - return ( ticks / clockCyclesPerMicrosecond ( ) * 16 ) ; / / converts from ticks back to microseconds <nl> + return ( ticks / TIMER1_TICKS_PER_US * 16 ) ; / / converts from ticks back to microseconds <nl> } <nl> <nl> void InitInterrupt ( timercallback handler ) <nl>
|
Servo : use peripheral clock frequency when calculating FRC1 tick count ( )
|
esp8266/Arduino
|
633e48f3aec5f1c3c11d4498fc90d378d49e6e9f
|
2016-03-23T22:48:23Z
|
mmm a / src / gui / transferlistsortmodel . cpp <nl> ppp b / src / gui / transferlistsortmodel . cpp <nl> bool TransferListSortModel : : lessThan ( const QModelIndex & left , const QModelIndex <nl> <nl> return vL < vR ; <nl> } <nl> + else if ( column = = TorrentModelItem : : TR_RATIO_LIMIT ) { <nl> + const qreal vL = left . data ( ) . toDouble ( ) ; <nl> + const qreal vR = right . data ( ) . toDouble ( ) ; <nl> + <nl> + if ( vL = = - 1 ) return false ; <nl> + if ( vR = = - 1 ) return true ; <nl> + <nl> + return vL < vR ; <nl> + } <nl> <nl> return QSortFilterProxyModel : : lessThan ( left , right ) ; <nl> } <nl>
|
Put torrents with no ratio limit at the bottom
|
qbittorrent/qBittorrent
|
f02db79c526ed19db21ec4e447f9cdee671fbb01
|
2015-04-05T18:44:09Z
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.