1 // Copyright 2022 gRPC authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #include <grpc/support/port_platform.h> 16 17 #include "src/core/lib/event_engine/shim.h" 18 19 #include "src/core/lib/experiments/experiments.h" 20 #include "src/core/lib/iomgr/port.h" 21 22 namespace grpc_event_engine { 23 namespace experimental { 24 UseEventEngineClient()25bool UseEventEngineClient() { 26 // TODO(hork, eryu): Adjust the ifdefs accordingly when event engines become 27 // available for other platforms. 28 #if defined(GRPC_POSIX_SOCKET_TCP) && !defined(GRPC_CFSTREAM) && \ 29 !defined(GRPC_DO_NOT_INSTANTIATE_POSIX_POLLER) 30 return grpc_core::IsEventEngineClientEnabled(); 31 #elif defined(GPR_WINDOWS) && !defined(GRPC_DO_NOT_INSTANTIATE_POSIX_POLLER) 32 return grpc_core::IsEventEngineClientEnabled(); 33 #elif defined(GRPC_IOS_EVENT_ENGINE_CLIENT) 34 return true; 35 #else 36 return false; 37 #endif 38 } 39 UseEventEngineListener()40bool UseEventEngineListener() { 41 // TODO(hork, eryu): Adjust the ifdefs accordingly when event engines become 42 // available for other platforms. 43 #if defined(GRPC_POSIX_SOCKET_TCP) && !defined(GRPC_CFSTREAM) && \ 44 !defined(GRPC_DO_NOT_INSTANTIATE_POSIX_POLLER) 45 return grpc_core::IsEventEngineListenerEnabled(); 46 #else 47 return false; 48 #endif 49 } 50 51 } // namespace experimental 52 } // namespace grpc_event_engine 53