|
|
|
@ -57,10 +57,17 @@ const char* ConnectivityStateName(grpc_connectivity_state state) { |
|
|
|
|
class AsyncConnectivityStateWatcherInterface::Notifier { |
|
|
|
|
public: |
|
|
|
|
Notifier(RefCountedPtr<AsyncConnectivityStateWatcherInterface> watcher, |
|
|
|
|
grpc_connectivity_state state, grpc_closure_scheduler* scheduler) |
|
|
|
|
grpc_connectivity_state state, grpc_core::Combiner* combiner) |
|
|
|
|
: watcher_(std::move(watcher)), state_(state) { |
|
|
|
|
GRPC_CLOSURE_INIT(&closure_, SendNotification, this, scheduler); |
|
|
|
|
GRPC_CLOSURE_SCHED(&closure_, GRPC_ERROR_NONE); |
|
|
|
|
if (combiner != nullptr) { |
|
|
|
|
combiner->Run( |
|
|
|
|
GRPC_CLOSURE_INIT(&closure_, SendNotification, this, nullptr), |
|
|
|
|
GRPC_ERROR_NONE); |
|
|
|
|
} else { |
|
|
|
|
GRPC_CLOSURE_INIT(&closure_, SendNotification, this, |
|
|
|
|
grpc_schedule_on_exec_ctx); |
|
|
|
|
GRPC_CLOSURE_SCHED(&closure_, GRPC_ERROR_NONE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
@ -81,7 +88,7 @@ class AsyncConnectivityStateWatcherInterface::Notifier { |
|
|
|
|
|
|
|
|
|
void AsyncConnectivityStateWatcherInterface::Notify( |
|
|
|
|
grpc_connectivity_state state) { |
|
|
|
|
New<Notifier>(Ref(), state, scheduler_); // Deletes itself when done.
|
|
|
|
|
New<Notifier>(Ref(), state, combiner_); // Deletes itself when done.
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|