1 /* 2 * Copyright 2022 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #include <memory> 12 13 #include "api/field_trials_view.h" 14 #include "api/task_queue/task_queue_factory.h" 15 #include "api/transport/field_trial_based_config.h" 16 #include "rtc_base/logging.h" 17 #include "rtc_base/memory/always_valid_pointer.h" 18 #include "rtc_base/task_queue_libevent.h" 19 #include "rtc_base/task_queue_stdlib.h" 20 21 namespace webrtc { 22 CreateDefaultTaskQueueFactory(const FieldTrialsView * field_trials_view)23std::unique_ptr<TaskQueueFactory> CreateDefaultTaskQueueFactory( 24 const FieldTrialsView* field_trials_view) { 25 AlwaysValidPointer<const FieldTrialsView, FieldTrialBasedConfig> field_trials( 26 field_trials_view); 27 if (field_trials->IsEnabled("WebRTC-TaskQueue-ReplaceLibeventWithStdlib")) { 28 RTC_LOG(LS_INFO) << "WebRTC-TaskQueue-ReplaceLibeventWithStdlib: " 29 << "using TaskQueueStdlibFactory."; 30 return CreateTaskQueueStdlibFactory(); 31 } 32 33 RTC_LOG(LS_INFO) << "WebRTC-TaskQueue-ReplaceLibeventWithStdlib: " 34 << "using TaskQueueLibeventFactory."; 35 return CreateTaskQueueLibeventFactory(); 36 } 37 38 } // namespace webrtc 39