Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: webrtc/rtc_base/task_queue_impl_factory.h

Issue 2936213003: Test using a global, replacable TaskQueueImpl factory.
Patch Set: Added global factory. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/rtc_base/task_queue_impl_factory.h
diff --git a/webrtc/rtc_base/task_queue_impl_factory.h b/webrtc/rtc_base/task_queue_impl_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..3f3b9473e8f9c2a4c7eb84210cf7609cfde1085c
--- /dev/null
+++ b/webrtc/rtc_base/task_queue_impl_factory.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2017 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_RTC_BASE_TASK_QUEUE_IMPL_FACTORY_H_
+#define WEBRTC_RTC_BASE_TASK_QUEUE_IMPL_FACTORY_H_
+
+#include "webrtc/rtc_base/scoped_ref_ptr.h"
+#include "webrtc/rtc_base/task_queue.h"
+#include "webrtc/rtc_base/task_queue_impl.h"
+
+namespace rtc {
+
+class TaskQueueImplFactory {
+ public:
+ virtual ~TaskQueueImplFactory() = default;
+
+ virtual scoped_refptr<TaskQueueImpl> CreateImpl(
nisse-webrtc 2017/08/18 11:45:45 Naming: I'd prefer any of CreateTaskQueueImpl, Cre
+ const char* queue_name,
+ TaskQueue* queue, // only used for GetCurrent()
+ TaskQueue::Priority priority) = 0;
+
+ virtual TaskQueue* CurrentQueue() = 0;
+
+ // Sets the factory to be used by this process. May only be called once
+ // before any TaskQueues are created.
+ static void Set(TaskQueueImplFactory* factory);
+ static TaskQueueImplFactory* Get();
+};
+
+#if defined(WEBRTC_LINUX)
+class TaskQueueLibEventFactory : public TaskQueueImplFactory {
kwiberg-webrtc 2017/08/21 09:21:55 Does this class definition need to be here, in a h
+ public:
+ TaskQueueLibEventFactory() = default;
+ ~TaskQueueLibEventFactory() override = default;
kwiberg-webrtc 2017/08/21 09:21:55 Do you need these two?
+ // TaskQueueLibEventFactory is neither copyable nor movable.
+ TaskQueueLibEventFactory(const TaskQueueLibEventFactory&) = delete;
+ TaskQueueLibEventFactory& operator=(const TaskQueueLibEventFactory&) = delete;
kwiberg-webrtc 2017/08/21 09:21:55 I don't think you need these two. Copying or movin
+
+ scoped_refptr<TaskQueueImpl> CreateImpl(
+ const char* queue_name,
+ TaskQueue* queue,
+ TaskQueue::Priority priority) override;
+
+ TaskQueue* CurrentQueue() override;
+};
+#endif
+
+} // namespace rtc
+#endif // WEBRTC_RTC_BASE_TASK_QUEUE_IMPL_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698