aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/filters/client_channel/lb_policy.h
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-12-06 09:05:05 -0800
committerGravatar GitHub <noreply@github.com>2017-12-06 09:05:05 -0800
commitad4d2dde0052efbbf49d64b0843c45f0381cfeb3 (patch)
tree6a657f8c6179d873b34505cdc24bce9462ca68eb /src/core/ext/filters/client_channel/lb_policy.h
parenta3df36cc2505a89c2f481eea4a66a87b3002844a (diff)
Revert "All instances of exec_ctx being passed around in src/core removed"
Diffstat (limited to 'src/core/ext/filters/client_channel/lb_policy.h')
-rw-r--r--src/core/ext/filters/client_channel/lb_policy.h80
1 files changed, 46 insertions, 34 deletions
diff --git a/src/core/ext/filters/client_channel/lb_policy.h b/src/core/ext/filters/client_channel/lb_policy.h
index fd28a2b623..d3159eebf3 100644
--- a/src/core/ext/filters/client_channel/lb_policy.h
+++ b/src/core/ext/filters/client_channel/lb_policy.h
@@ -55,49 +55,53 @@ typedef struct grpc_lb_policy_pick_args {
} grpc_lb_policy_pick_args;
struct grpc_lb_policy_vtable {
- void (*destroy)(grpc_lb_policy* policy);
- void (*shutdown_locked)(grpc_lb_policy* policy);
+ void (*destroy)(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy);
+ void (*shutdown_locked)(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy);
/** \see grpc_lb_policy_pick */
- int (*pick_locked)(grpc_lb_policy* policy,
+ int (*pick_locked)(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
const grpc_lb_policy_pick_args* pick_args,
grpc_connected_subchannel** target,
grpc_call_context_element* context, void** user_data,
grpc_closure* on_complete);
/** \see grpc_lb_policy_cancel_pick */
- void (*cancel_pick_locked)(grpc_lb_policy* policy,
+ void (*cancel_pick_locked)(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
grpc_connected_subchannel** target,
grpc_error* error);
/** \see grpc_lb_policy_cancel_picks */
- void (*cancel_picks_locked)(grpc_lb_policy* policy,
+ void (*cancel_picks_locked)(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
uint32_t initial_metadata_flags_mask,
uint32_t initial_metadata_flags_eq,
grpc_error* error);
/** \see grpc_lb_policy_ping_one */
- void (*ping_one_locked)(grpc_lb_policy* policy, grpc_closure* closure);
+ void (*ping_one_locked)(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
+ grpc_closure* closure);
/** Try to enter a READY connectivity state */
- void (*exit_idle_locked)(grpc_lb_policy* policy);
+ void (*exit_idle_locked)(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy);
/** check the current connectivity of the lb_policy */
grpc_connectivity_state (*check_connectivity_locked)(
- grpc_lb_policy* policy, grpc_error** connectivity_error);
+ grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
+ grpc_error** connectivity_error);
/** call notify when the connectivity state of a channel changes from *state.
Updates *state with the new state of the policy. Calling with a NULL \a
state cancels the subscription. */
- void (*notify_on_state_change_locked)(grpc_lb_policy* policy,
+ void (*notify_on_state_change_locked)(grpc_exec_ctx* exec_ctx,
+ grpc_lb_policy* policy,
grpc_connectivity_state* state,
grpc_closure* closure);
- void (*update_locked)(grpc_lb_policy* policy,
+ void (*update_locked)(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
const grpc_lb_policy_args* args);
/** \see grpc_lb_policy_set_reresolve_closure */
- void (*set_reresolve_closure_locked)(grpc_lb_policy* policy,
+ void (*set_reresolve_closure_locked)(grpc_exec_ctx* exec_ctx,
+ grpc_lb_policy* policy,
grpc_closure* request_reresolution);
};
@@ -106,33 +110,33 @@ struct grpc_lb_policy_vtable {
/* Strong references: the policy will shutdown when they reach zero */
#define GRPC_LB_POLICY_REF(p, r) \
grpc_lb_policy_ref((p), __FILE__, __LINE__, (r))
-#define GRPC_LB_POLICY_UNREF(p, r) \
- grpc_lb_policy_unref((p), __FILE__, __LINE__, (r))
+#define GRPC_LB_POLICY_UNREF(exec_ctx, p, r) \
+ grpc_lb_policy_unref((exec_ctx), (p), __FILE__, __LINE__, (r))
/* Weak references: they don't prevent the shutdown of the LB policy. When no
* strong references are left but there are still weak ones, shutdown is called.
* Once the weak reference also reaches zero, the LB policy is destroyed. */
#define GRPC_LB_POLICY_WEAK_REF(p, r) \
grpc_lb_policy_weak_ref((p), __FILE__, __LINE__, (r))
-#define GRPC_LB_POLICY_WEAK_UNREF(p, r) \
- grpc_lb_policy_weak_unref((p), __FILE__, __LINE__, (r))
+#define GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, p, r) \
+ grpc_lb_policy_weak_unref((exec_ctx), (p), __FILE__, __LINE__, (r))
void grpc_lb_policy_ref(grpc_lb_policy* policy, const char* file, int line,
const char* reason);
-void grpc_lb_policy_unref(grpc_lb_policy* policy, const char* file, int line,
- const char* reason);
+void grpc_lb_policy_unref(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
+ const char* file, int line, const char* reason);
void grpc_lb_policy_weak_ref(grpc_lb_policy* policy, const char* file, int line,
const char* reason);
-void grpc_lb_policy_weak_unref(grpc_lb_policy* policy, const char* file,
- int line, const char* reason);
+void grpc_lb_policy_weak_unref(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
+ const char* file, int line, const char* reason);
#else
#define GRPC_LB_POLICY_REF(p, r) grpc_lb_policy_ref((p))
-#define GRPC_LB_POLICY_UNREF(p, r) grpc_lb_policy_unref((p))
+#define GRPC_LB_POLICY_UNREF(cl, p, r) grpc_lb_policy_unref((cl), (p))
#define GRPC_LB_POLICY_WEAK_REF(p, r) grpc_lb_policy_weak_ref((p))
-#define GRPC_LB_POLICY_WEAK_UNREF(p, r) grpc_lb_policy_weak_unref((p))
+#define GRPC_LB_POLICY_WEAK_UNREF(cl, p, r) grpc_lb_policy_weak_unref((cl), (p))
void grpc_lb_policy_ref(grpc_lb_policy* policy);
-void grpc_lb_policy_unref(grpc_lb_policy* policy);
+void grpc_lb_policy_unref(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy);
void grpc_lb_policy_weak_ref(grpc_lb_policy* policy);
-void grpc_lb_policy_weak_unref(grpc_lb_policy* policy);
+void grpc_lb_policy_weak_unref(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy);
#endif
/** called by concrete implementations to initialize the base struct */
@@ -157,7 +161,7 @@ void grpc_lb_policy_init(grpc_lb_policy* policy,
Any IO should be done under the \a interested_parties \a grpc_pollset_set
in the \a grpc_lb_policy struct. */
-int grpc_lb_policy_pick_locked(grpc_lb_policy* policy,
+int grpc_lb_policy_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
const grpc_lb_policy_pick_args* pick_args,
grpc_connected_subchannel** target,
grpc_call_context_element* context,
@@ -165,47 +169,55 @@ int grpc_lb_policy_pick_locked(grpc_lb_policy* policy,
/** Perform a connected subchannel ping (see \a grpc_connected_subchannel_ping)
against one of the connected subchannels managed by \a policy. */
-void grpc_lb_policy_ping_one_locked(grpc_lb_policy* policy,
+void grpc_lb_policy_ping_one_locked(grpc_exec_ctx* exec_ctx,
+ grpc_lb_policy* policy,
grpc_closure* closure);
/** Cancel picks for \a target.
The \a on_complete callback of the pending picks will be invoked with \a
*target set to NULL. */
-void grpc_lb_policy_cancel_pick_locked(grpc_lb_policy* policy,
+void grpc_lb_policy_cancel_pick_locked(grpc_exec_ctx* exec_ctx,
+ grpc_lb_policy* policy,
grpc_connected_subchannel** target,
grpc_error* error);
/** Cancel all pending picks for which their \a initial_metadata_flags (as given
in the call to \a grpc_lb_policy_pick) matches \a initial_metadata_flags_eq
when AND'd with \a initial_metadata_flags_mask */
-void grpc_lb_policy_cancel_picks_locked(grpc_lb_policy* policy,
+void grpc_lb_policy_cancel_picks_locked(grpc_exec_ctx* exec_ctx,
+ grpc_lb_policy* policy,
uint32_t initial_metadata_flags_mask,
uint32_t initial_metadata_flags_eq,
grpc_error* error);
/** Try to enter a READY connectivity state */
-void grpc_lb_policy_exit_idle_locked(grpc_lb_policy* policy);
+void grpc_lb_policy_exit_idle_locked(grpc_exec_ctx* exec_ctx,
+ grpc_lb_policy* policy);
/* Call notify when the connectivity state of a channel changes from \a *state.
* Updates \a *state with the new state of the policy */
void grpc_lb_policy_notify_on_state_change_locked(
- grpc_lb_policy* policy, grpc_connectivity_state* state,
- grpc_closure* closure);
+ grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
+ grpc_connectivity_state* state, grpc_closure* closure);
grpc_connectivity_state grpc_lb_policy_check_connectivity_locked(
- grpc_lb_policy* policy, grpc_error** connectivity_error);
+ grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
+ grpc_error** connectivity_error);
/** Update \a policy with \a lb_policy_args. */
-void grpc_lb_policy_update_locked(grpc_lb_policy* policy,
+void grpc_lb_policy_update_locked(grpc_exec_ctx* exec_ctx,
+ grpc_lb_policy* policy,
const grpc_lb_policy_args* lb_policy_args);
/** Set the re-resolution closure to \a request_reresolution. */
void grpc_lb_policy_set_reresolve_closure_locked(
- grpc_lb_policy* policy, grpc_closure* request_reresolution);
+ grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
+ grpc_closure* request_reresolution);
/** Try to request a re-resolution. It's NOT a public API; it's only for use by
the LB policy implementations. */
-void grpc_lb_policy_try_reresolve(grpc_lb_policy* policy,
+void grpc_lb_policy_try_reresolve(grpc_exec_ctx* exec_ctx,
+ grpc_lb_policy* policy,
grpc_core::TraceFlag* grpc_lb_trace,
grpc_error* error);