webrtc_m130/rtc_base/task_queue.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

120 lines
4.0 KiB
C
Raw Normal View History

/*
* Copyright 2016 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 RTC_BASE_TASK_QUEUE_H_
#define RTC_BASE_TASK_QUEUE_H_
#include <stdint.h>
#include <memory>
#include <utility>
#include "absl/functional/any_invocable.h"
#include "absl/memory/memory.h"
#include "api/task_queue/queued_task.h"
#include "api/task_queue/task_queue_base.h"
#include "api/task_queue/task_queue_factory.h"
#include "api/task_queue/to_queued_task.h"
Reland "Export symbols needed by the Chromium component build (part 1)." This reverts commit 16fe3f290a524a136f71660a114d0b03ef501f10. Reason for revert: After discussing this problem with nisse@ and yvesg@, we decided to modify how RTC_EXPORT works and avoid to depend on the macro COMPONENT_BUILD. RTC_EXPORT will instead depend on a macro WEBRTC_COMPONENT_BUILD (which can be set as a GN argument which defaults to false). When all the symbols needed by Chromium will be marked with RTC_EXPORT we will flip the GN arg in Chromium, setting to to `component_build` and from that moment, Chromium will depend on a WebRTC shared library when `component_build=true`. Original change's description: > Revert "Export symbols needed by the Chromium component build (part 1)." > > This reverts commit 99eea42fc1fe0be0ebed13c5eba7e1e42059bc5a. > > Reason for revert: > lld-link: error: undefined symbol: "__declspec(dllimport) bool __cdecl cricket::UnwrapTurnPacket(unsigned char const *, unsigned int, unsigned int *, unsigned int *)" (__imp_?UnwrapTurnPacket@cricket@@YA_NPBEIPAI1@Z) > >>> referenced by obj/services/network/network_service/socket_manager.obj:("virtual void __thiscall network::P2PSocketManager::DumpPacket(class base::span<unsigned char const, 4294967295>, bool)" (?DumpPacket@P2PSocketManager@network@@EAEXV?$span@$$CBE$0PPPPPPPP@@base@@_N@Z)) > lld-link: error: undefined symbol: "__declspec(dllimport) bool __cdecl cricket::ValidateRtpHeader(unsigned char const *, unsigned int, unsigned int *)" (__imp_?ValidateRtpHeader@cricket@@YA_NPBEIPAI@Z) > >>> referenced by obj/services/network/network_service/socket_manager.obj:("virtual void __thiscall network::P2PSocketManager::DumpPacket(class base::span<unsigned char const, 4294967295>, bool)" (?DumpPacket@P2PSocketManager@network@@EAEXV?$span@$$CBE$0PPPPPPPP@@base@@_N@Z)) > lld-link: error: undefined symbol: "__declspec(dllimport) bool __cdecl cricket::ApplyPacketOptions(unsigned char *, unsigned int, struct rtc::PacketTimeUpdateParams const &, unsigned __int64)" (__imp_?ApplyPacketOptions@cricket@@YA_NPAEIABUPacketTimeUpdateParams@rtc@@_K@Z) > >>> referenced by obj/services/network/network_service/socket_tcp.obj:("virtual void __thiscall network::P2PSocketTcp::DoSend(class net::IPEndPoint const &, class std::vector<signed char, class std::allocator<signed char>> const &, struct rtc::PacketOptions const &, struct net::NetworkTrafficAnnotationTag)" (?DoSend@P2PSocketTcp@network@@MAEXABVIPEndPoint@net@@ABV?$vector@CV?$allocator@C@std@@@std@@ABUPacketOptions@rtc@@UNetworkTrafficAnnotationTag@4@@Z)) > >>> referenced by obj/services/network/network_service/socket_tcp.obj:("virtual void __thiscall network::P2PSocketStunTcp::DoSend(class net::IPEndPoint const &, class std::vector<signed char, class std::allocator<signed char>> const &, struct rtc::PacketOptions const &, struct net::NetworkTrafficAnnotationTag)" (?DoSend@P2PSocketStunTcp@network@@MAEXABVIPEndPoint@net@@ABV?$vector@CV?$allocator@C@std@@@std@@ABUPacketOptions@rtc@@UNetworkTrafficAnnotationTag@4@@Z)) > lld-link: error: undefined symbol: "__declspec(dllimport) bool __cdecl cricket::ApplyPacketOptions(unsigned char *, unsigned int, struct rtc::PacketTimeUpdateParams const &, unsigned __int64)" (__imp_?ApplyPacketOptions@cricket@@YA_NPAEIABUPacketTimeUpdateParams@rtc@@_K@Z) > >>> referenced by obj/services/network/network_service/socket_udp.obj:("bool __thiscall network::P2PSocketUdp::DoSend(struct network::P2PSocketUdp::PendingPacket const &)" (?DoSend@P2PSocketUdp@network@@AAE_NABUPendingPacket@12@@Z)) > > Original change's description: > > Reland "Reland "Export symbols needed by the Chromium component build (part 1)."" > > > > This reverts commit b49520bfc08f5c5832dda1d642125f0bb898f974. > > > > Reason for revert: Problem fixed in https://chromium-review.googlesource.com/c/chromium/src/+/1261398. > > > > Original change's description: > > > Revert "Reland "Export symbols needed by the Chromium component build (part 1)."" > > > > > > This reverts commit 588f4642d1a29f7beaf28265dbd08728191b4c52. > > > > > > Reason for revert: Breaks WebRTC Chromium FYI Win Builder (dbg). > > > lld-link: error: undefined symbol: "__declspec(dllimport) __thiscall webrtc::Config::Config(void)" (__imp_??0Config@webrtc@@QAE@XZ) > > > [...] > > > > > > Original change's description: > > > > Reland "Export symbols needed by the Chromium component build (part 1)." > > > > > > > > This reverts commit 2ea9af227517556136fd629dd2663c0d75d77c7b. > > > > > > > > Reason for revert: The problem will be fixed by > > > > https://chromium-review.googlesource.com/c/chromium/src/+/1261122. > > > > > > > > Original change's description: > > > > > Revert "Export symbols needed by the Chromium component build (part 1)." > > > > > > > > > > This reverts commit 9e24dcff167c4eb3555bf0ce6eaba090c10fbe53. > > > > > > > > > > Reason for revert: Breaks chromium.webrtc.fyi bots. > > > > > > > > > > Original change's description: > > > > > > Export symbols needed by the Chromium component build (part 1). > > > > > > > > > > > > This CL uses RTC_EXPORT (defined in rtc_base/system/rtc_export.h) > > > > > > to mark WebRTC symbols as visible from a shared library, this doesn't > > > > > > mean these symbols are part of the public API (please continue to refer > > > > > > to [1] for info about what is considered public WebRTC API). > > > > > > > > > > > > [1] - https://webrtc.googlesource.com/src/+/HEAD/native-api.md > > > > > > > > > > > > Bug: webrtc:9419 > > > > > > Change-Id: I802abd32874d42d3aa5ecd3c8022e7cf5e043d99 > > > > > > Reviewed-on: https://webrtc-review.googlesource.com/c/103505 > > > > > > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > > > > > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > > > > > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> > > > > > > Cr-Commit-Position: refs/heads/master@{#24969} > > > > > > > > > > TBR=mbonadei@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org > > > > > > > > > > Change-Id: I01f6e18f0d2c0f0309cdaa6c943c3927e1f1f49f > > > > > No-Presubmit: true > > > > > No-Tree-Checks: true > > > > > No-Try: true > > > > > Bug: webrtc:9419 > > > > > Reviewed-on: https://webrtc-review.googlesource.com/c/103720 > > > > > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > > > > > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > > > > > Cr-Commit-Position: refs/heads/master@{#24974} > > > > > > > > TBR=mbonadei@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org > > > > > > > > Change-Id: I83bbc7f550fc23e823c4d055e0a6f60c828960dd > > > > No-Presubmit: true > > > > No-Tree-Checks: true > > > > No-Try: true > > > > Bug: webrtc:9419 > > > > Reviewed-on: https://webrtc-review.googlesource.com/c/103740 > > > > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > > > > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > > > > Cr-Commit-Position: refs/heads/master@{#24980} > > > > > > TBR=mbonadei@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org > > > > > > Change-Id: I4b7cfe492f2c8eeda5c8ac52520e0cfc95ade9b0 > > > No-Presubmit: true > > > No-Tree-Checks: true > > > No-Try: true > > > Bug: webrtc:9419 > > > Reviewed-on: https://webrtc-review.googlesource.com/c/103801 > > > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > > > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > > > Cr-Commit-Position: refs/heads/master@{#24983} > > > > TBR=mbonadei@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org > > > > # Not skipping CQ checks because original CL landed > 1 day ago. > > > > Bug: webrtc:9419 > > Change-Id: Id986a0a03cdc2818690337784396882af067f7fa > > Reviewed-on: https://webrtc-review.googlesource.com/c/104602 > > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#25049} > > TBR=mbonadei@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org > > Change-Id: I6f58b9c90defccdb160307783fb55271ab424fa1 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:9419 > Reviewed-on: https://webrtc-review.googlesource.com/c/104623 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#25050} TBR=mbonadei@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org Change-Id: I4d01ed96ae40a8f9ca42c466be5c87653d75d7c1 Bug: webrtc:9419 Reviewed-on: https://webrtc-review.googlesource.com/c/104641 Reviewed-by: Yves Gerey <yvesg@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25108}
2018-10-11 10:50:45 +02:00
#include "rtc_base/system/rtc_export.h"
#include "rtc_base/thread_annotations.h"
namespace rtc {
// Implements a task queue that asynchronously executes tasks in a way that
// guarantees that they're executed in FIFO order and that tasks never overlap.
// Tasks may always execute on the same worker thread and they may not.
// To DCHECK that tasks are executing on a known task queue, use IsCurrent().
//
// Here are some usage examples:
//
// 1) Asynchronously running a lambda:
//
// class MyClass {
// ...
// TaskQueue queue_("MyQueue");
// };
//
// void MyClass::StartWork() {
// queue_.PostTask([]() { Work(); });
// ...
//
// 2) Posting a custom task on a timer. The task posts itself again after
// every running:
//
// class TimerTask : public QueuedTask {
// public:
// TimerTask() {}
// private:
// bool Run() override {
// ++count_;
Reland "Delete rtc::TaskQueue::Current in favor of webrtc::TaskQueueBase::Current" This reverts commit 42d8c93ec351b68554825b58a3dc6525a7dc84da. Reason for revert: Got Aliby for FEC test flakes Original change's description: > Revert "Delete rtc::TaskQueue::Current in favor of webrtc::TaskQueueBase::Current" > > This reverts commit 304e9d2df347630d71fd4423f5971f30dac73e41. > > Reason for revert: Breaks downstream projects. > Seems to make VideoSendStreamTest.SupportsFlexfecSimulcastVp8 flaky. > > Original change's description: > > Delete rtc::TaskQueue::Current in favor of webrtc::TaskQueueBase::Current > > > > Bug: webrtc:10191 > > Change-Id: I506cc50a90c73a6a4f6a3de36de0999cca72f5ba > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/126230 > > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> > > Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#27035} > > TBR=danilchap@webrtc.org,kwiberg@webrtc.org > > Change-Id: If98324f88e4b3d18bf2fe33597dfb9711867c243 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:10191 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/126484 > Reviewed-by: Yves Gerey <yvesg@webrtc.org> > Commit-Queue: Yves Gerey <yvesg@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#27041} TBR=danilchap@webrtc.org,kwiberg@webrtc.org,yvesg@webrtc.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:10191 Change-Id: Id87a17ae415142b8e0b11ba03ae7bad84a473fb0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/126720 Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Yves Gerey <yvesg@webrtc.org> Commit-Queue: Yves Gerey <yvesg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27056}
2019-03-11 10:28:05 +00:00
// TaskQueueBase::Current()->PostDelayedTask(
// absl::WrapUnique(this), 1000);
// // Ownership has been transferred to the next occurance,
// // so return false to prevent from being deleted now.
// return false;
// }
// int count_ = 0;
// };
// ...
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
// queue_.PostDelayedTask(std::make_unique<TimerTask>(), 1000);
//
// For more examples, see task_queue_unittests.cc.
//
// A note on destruction:
//
// When a TaskQueue is deleted, pending tasks will not be executed but they will
// be deleted. The deletion of tasks may happen asynchronously after the
// TaskQueue itself has been deleted or it may happen synchronously while the
// TaskQueue instance is being deleted. This may vary from one OS to the next
// so assumptions about lifetimes of pending tasks should not be made.
Reland "Export symbols needed by the Chromium component build (part 1)." This reverts commit 16fe3f290a524a136f71660a114d0b03ef501f10. Reason for revert: After discussing this problem with nisse@ and yvesg@, we decided to modify how RTC_EXPORT works and avoid to depend on the macro COMPONENT_BUILD. RTC_EXPORT will instead depend on a macro WEBRTC_COMPONENT_BUILD (which can be set as a GN argument which defaults to false). When all the symbols needed by Chromium will be marked with RTC_EXPORT we will flip the GN arg in Chromium, setting to to `component_build` and from that moment, Chromium will depend on a WebRTC shared library when `component_build=true`. Original change's description: > Revert "Export symbols needed by the Chromium component build (part 1)." > > This reverts commit 99eea42fc1fe0be0ebed13c5eba7e1e42059bc5a. > > Reason for revert: > lld-link: error: undefined symbol: "__declspec(dllimport) bool __cdecl cricket::UnwrapTurnPacket(unsigned char const *, unsigned int, unsigned int *, unsigned int *)" (__imp_?UnwrapTurnPacket@cricket@@YA_NPBEIPAI1@Z) > >>> referenced by obj/services/network/network_service/socket_manager.obj:("virtual void __thiscall network::P2PSocketManager::DumpPacket(class base::span<unsigned char const, 4294967295>, bool)" (?DumpPacket@P2PSocketManager@network@@EAEXV?$span@$$CBE$0PPPPPPPP@@base@@_N@Z)) > lld-link: error: undefined symbol: "__declspec(dllimport) bool __cdecl cricket::ValidateRtpHeader(unsigned char const *, unsigned int, unsigned int *)" (__imp_?ValidateRtpHeader@cricket@@YA_NPBEIPAI@Z) > >>> referenced by obj/services/network/network_service/socket_manager.obj:("virtual void __thiscall network::P2PSocketManager::DumpPacket(class base::span<unsigned char const, 4294967295>, bool)" (?DumpPacket@P2PSocketManager@network@@EAEXV?$span@$$CBE$0PPPPPPPP@@base@@_N@Z)) > lld-link: error: undefined symbol: "__declspec(dllimport) bool __cdecl cricket::ApplyPacketOptions(unsigned char *, unsigned int, struct rtc::PacketTimeUpdateParams const &, unsigned __int64)" (__imp_?ApplyPacketOptions@cricket@@YA_NPAEIABUPacketTimeUpdateParams@rtc@@_K@Z) > >>> referenced by obj/services/network/network_service/socket_tcp.obj:("virtual void __thiscall network::P2PSocketTcp::DoSend(class net::IPEndPoint const &, class std::vector<signed char, class std::allocator<signed char>> const &, struct rtc::PacketOptions const &, struct net::NetworkTrafficAnnotationTag)" (?DoSend@P2PSocketTcp@network@@MAEXABVIPEndPoint@net@@ABV?$vector@CV?$allocator@C@std@@@std@@ABUPacketOptions@rtc@@UNetworkTrafficAnnotationTag@4@@Z)) > >>> referenced by obj/services/network/network_service/socket_tcp.obj:("virtual void __thiscall network::P2PSocketStunTcp::DoSend(class net::IPEndPoint const &, class std::vector<signed char, class std::allocator<signed char>> const &, struct rtc::PacketOptions const &, struct net::NetworkTrafficAnnotationTag)" (?DoSend@P2PSocketStunTcp@network@@MAEXABVIPEndPoint@net@@ABV?$vector@CV?$allocator@C@std@@@std@@ABUPacketOptions@rtc@@UNetworkTrafficAnnotationTag@4@@Z)) > lld-link: error: undefined symbol: "__declspec(dllimport) bool __cdecl cricket::ApplyPacketOptions(unsigned char *, unsigned int, struct rtc::PacketTimeUpdateParams const &, unsigned __int64)" (__imp_?ApplyPacketOptions@cricket@@YA_NPAEIABUPacketTimeUpdateParams@rtc@@_K@Z) > >>> referenced by obj/services/network/network_service/socket_udp.obj:("bool __thiscall network::P2PSocketUdp::DoSend(struct network::P2PSocketUdp::PendingPacket const &)" (?DoSend@P2PSocketUdp@network@@AAE_NABUPendingPacket@12@@Z)) > > Original change's description: > > Reland "Reland "Export symbols needed by the Chromium component build (part 1)."" > > > > This reverts commit b49520bfc08f5c5832dda1d642125f0bb898f974. > > > > Reason for revert: Problem fixed in https://chromium-review.googlesource.com/c/chromium/src/+/1261398. > > > > Original change's description: > > > Revert "Reland "Export symbols needed by the Chromium component build (part 1)."" > > > > > > This reverts commit 588f4642d1a29f7beaf28265dbd08728191b4c52. > > > > > > Reason for revert: Breaks WebRTC Chromium FYI Win Builder (dbg). > > > lld-link: error: undefined symbol: "__declspec(dllimport) __thiscall webrtc::Config::Config(void)" (__imp_??0Config@webrtc@@QAE@XZ) > > > [...] > > > > > > Original change's description: > > > > Reland "Export symbols needed by the Chromium component build (part 1)." > > > > > > > > This reverts commit 2ea9af227517556136fd629dd2663c0d75d77c7b. > > > > > > > > Reason for revert: The problem will be fixed by > > > > https://chromium-review.googlesource.com/c/chromium/src/+/1261122. > > > > > > > > Original change's description: > > > > > Revert "Export symbols needed by the Chromium component build (part 1)." > > > > > > > > > > This reverts commit 9e24dcff167c4eb3555bf0ce6eaba090c10fbe53. > > > > > > > > > > Reason for revert: Breaks chromium.webrtc.fyi bots. > > > > > > > > > > Original change's description: > > > > > > Export symbols needed by the Chromium component build (part 1). > > > > > > > > > > > > This CL uses RTC_EXPORT (defined in rtc_base/system/rtc_export.h) > > > > > > to mark WebRTC symbols as visible from a shared library, this doesn't > > > > > > mean these symbols are part of the public API (please continue to refer > > > > > > to [1] for info about what is considered public WebRTC API). > > > > > > > > > > > > [1] - https://webrtc.googlesource.com/src/+/HEAD/native-api.md > > > > > > > > > > > > Bug: webrtc:9419 > > > > > > Change-Id: I802abd32874d42d3aa5ecd3c8022e7cf5e043d99 > > > > > > Reviewed-on: https://webrtc-review.googlesource.com/c/103505 > > > > > > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > > > > > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > > > > > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> > > > > > > Cr-Commit-Position: refs/heads/master@{#24969} > > > > > > > > > > TBR=mbonadei@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org > > > > > > > > > > Change-Id: I01f6e18f0d2c0f0309cdaa6c943c3927e1f1f49f > > > > > No-Presubmit: true > > > > > No-Tree-Checks: true > > > > > No-Try: true > > > > > Bug: webrtc:9419 > > > > > Reviewed-on: https://webrtc-review.googlesource.com/c/103720 > > > > > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > > > > > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > > > > > Cr-Commit-Position: refs/heads/master@{#24974} > > > > > > > > TBR=mbonadei@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org > > > > > > > > Change-Id: I83bbc7f550fc23e823c4d055e0a6f60c828960dd > > > > No-Presubmit: true > > > > No-Tree-Checks: true > > > > No-Try: true > > > > Bug: webrtc:9419 > > > > Reviewed-on: https://webrtc-review.googlesource.com/c/103740 > > > > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > > > > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > > > > Cr-Commit-Position: refs/heads/master@{#24980} > > > > > > TBR=mbonadei@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org > > > > > > Change-Id: I4b7cfe492f2c8eeda5c8ac52520e0cfc95ade9b0 > > > No-Presubmit: true > > > No-Tree-Checks: true > > > No-Try: true > > > Bug: webrtc:9419 > > > Reviewed-on: https://webrtc-review.googlesource.com/c/103801 > > > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > > > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > > > Cr-Commit-Position: refs/heads/master@{#24983} > > > > TBR=mbonadei@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org > > > > # Not skipping CQ checks because original CL landed > 1 day ago. > > > > Bug: webrtc:9419 > > Change-Id: Id986a0a03cdc2818690337784396882af067f7fa > > Reviewed-on: https://webrtc-review.googlesource.com/c/104602 > > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#25049} > > TBR=mbonadei@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org > > Change-Id: I6f58b9c90defccdb160307783fb55271ab424fa1 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:9419 > Reviewed-on: https://webrtc-review.googlesource.com/c/104623 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#25050} TBR=mbonadei@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org Change-Id: I4d01ed96ae40a8f9ca42c466be5c87653d75d7c1 Bug: webrtc:9419 Reviewed-on: https://webrtc-review.googlesource.com/c/104641 Reviewed-by: Yves Gerey <yvesg@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25108}
2018-10-11 10:50:45 +02:00
class RTC_LOCKABLE RTC_EXPORT TaskQueue {
public:
// TaskQueue priority levels. On some platforms these will map to thread
// priorities, on others such as Mac and iOS, GCD queue priorities.
using Priority = ::webrtc::TaskQueueFactory::Priority;
explicit TaskQueue(std::unique_ptr<webrtc::TaskQueueBase,
webrtc::TaskQueueDeleter> task_queue);
~TaskQueue();
TaskQueue(const TaskQueue&) = delete;
TaskQueue& operator=(const TaskQueue&) = delete;
// Used for DCHECKing the current queue.
bool IsCurrent() const;
// Returns non-owning pointer to the task queue implementation.
webrtc::TaskQueueBase* Get() { return impl_; }
// TODO(tommi): For better debuggability, implement RTC_FROM_HERE.
// Ownership of the task is passed to PostTask.
void PostTask(std::unique_ptr<webrtc::QueuedTask> task);
// See webrtc::TaskQueueBase for precision expectations.
void PostDelayedTask(std::unique_ptr<webrtc::QueuedTask> task,
uint32_t milliseconds);
void PostDelayedHighPrecisionTask(std::unique_ptr<webrtc::QueuedTask> task,
uint32_t milliseconds);
void PostDelayedTaskWithPrecision(
webrtc::TaskQueueBase::DelayPrecision precision,
std::unique_ptr<webrtc::QueuedTask> task,
uint32_t milliseconds);
void PostTask(absl::AnyInvocable<void() &&> task) {
impl_->PostTask(std::move(task));
}
private:
webrtc::TaskQueueBase* const impl_;
};
} // namespace rtc
#endif // RTC_BASE_TASK_QUEUE_H_