diff options
author | Soheil Hassas Yeganeh <soheil@cs.toronto.edu> | 2018-11-05 12:10:03 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-05 12:10:03 -0500 |
commit | b41a44dc2e001358602e8e885c674ddc49387edd (patch) | |
tree | d2f0c6d01ea7f47daebc288969032572b604af87 /src/core/ext/filters/deadline/deadline_filter.h | |
parent | 7109bd1c6563c09daa7b36139170a9f41d603ddf (diff) | |
parent | 48e4a81b05f2ad6541d72e819cd4f638055f13d5 (diff) |
Merge pull request #16944 from soheilhy/worktree-memset
Remove memset(0) from arena allocate memory.
Diffstat (limited to 'src/core/ext/filters/deadline/deadline_filter.h')
-rw-r--r-- | src/core/ext/filters/deadline/deadline_filter.h | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/core/ext/filters/deadline/deadline_filter.h b/src/core/ext/filters/deadline/deadline_filter.h index 1d797f445a..e37032999c 100644 --- a/src/core/ext/filters/deadline/deadline_filter.h +++ b/src/core/ext/filters/deadline/deadline_filter.h @@ -22,19 +22,23 @@ #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/iomgr/timer.h" -typedef enum grpc_deadline_timer_state { +enum grpc_deadline_timer_state { GRPC_DEADLINE_STATE_INITIAL, GRPC_DEADLINE_STATE_PENDING, GRPC_DEADLINE_STATE_FINISHED -} grpc_deadline_timer_state; +}; // State used for filters that enforce call deadlines. // Must be the first field in the filter's call_data. -typedef struct grpc_deadline_state { +struct grpc_deadline_state { + grpc_deadline_state(grpc_call_element* elem, grpc_call_stack* call_stack, + grpc_call_combiner* call_combiner, grpc_millis deadline); + ~grpc_deadline_state(); + // We take a reference to the call stack for the timer callback. grpc_call_stack* call_stack; grpc_call_combiner* call_combiner; - grpc_deadline_timer_state timer_state; + grpc_deadline_timer_state timer_state = GRPC_DEADLINE_STATE_INITIAL; grpc_timer timer; grpc_closure timer_callback; // Closure to invoke when we receive trailing metadata. @@ -43,21 +47,13 @@ typedef struct grpc_deadline_state { // The original recv_trailing_metadata_ready closure, which we chain to // after our own closure is invoked. grpc_closure* original_recv_trailing_metadata_ready; -} grpc_deadline_state; +}; // // NOTE: All of these functions require that the first field in // elem->call_data is a grpc_deadline_state. // -// assumes elem->call_data is zero'd -void grpc_deadline_state_init(grpc_call_element* elem, - grpc_call_stack* call_stack, - grpc_call_combiner* call_combiner, - grpc_millis deadline); - -void grpc_deadline_state_destroy(grpc_call_element* elem); - // Cancels the existing timer and starts a new one with new_deadline. // // Note: It is generally safe to call this with an earlier deadline |