This reverts commit 793bac569f.
Reason for revert: rare compilation error fixed
Original change's description:
> Revert "Refactor the PlatformThread API."
>
> This reverts commit c89fdd716c.
>
> Reason for revert: Causes rare compilation error on win-libfuzzer-asan trybot.
> See https://ci.chromium.org/p/chromium/builders/try/win-libfuzzer-asan-rel/713745?
>
> Original change's description:
> > Refactor the PlatformThread API.
> >
> > PlatformThread's API is using old style function pointers, causes
> > casting, is unintuitive and forces artificial call sequences, and
> > is additionally possible to misuse in release mode.
> >
> > Fix this by an API face lift:
> > 1. The class is turned into a handle, which can be empty.
> > 2. The only way of getting a non-empty PlatformThread is by calling
> > SpawnJoinable or SpawnDetached, clearly conveying the semantics to the
> > code reader.
> > 3. Handles can be Finalized, which works differently for joinable and
> > detached threads:
> > a) Handles for detached threads are simply closed where applicable.
> > b) Joinable threads are joined before handles are closed.
> > 4. The destructor finalizes handles. No explicit call is needed.
> >
> > Fixed: webrtc:12727
> > Change-Id: Id00a0464edf4fc9e552b6a1fbb5d2e1280e88811
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215075
> > Commit-Queue: Markus Handell <handellm@webrtc.org>
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> > Reviewed-by: Tommi <tommi@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#33923}
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> TBR=handellm@webrtc.org
>
> Bug: webrtc:12727
> Change-Id: Ic0146be8866f6dd3ad9c364fb8646650b8e07419
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217583
> Reviewed-by: Guido Urdaneta <guidou@webrtc.org>
> Reviewed-by: Markus Handell <handellm@webrtc.org>
> Commit-Queue: Guido Urdaneta <guidou@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#33936}
# Not skipping CQ checks because this is a reland.
Bug: webrtc:12727
Change-Id: Ifd6f44eac72fed84474277a1be03eb84d2f4376e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217881
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Markus Handell <handellm@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33950}
This reverts commit c89fdd716c.
Reason for revert: Causes rare compilation error on win-libfuzzer-asan trybot.
See https://ci.chromium.org/p/chromium/builders/try/win-libfuzzer-asan-rel/713745?
Original change's description:
> Refactor the PlatformThread API.
>
> PlatformThread's API is using old style function pointers, causes
> casting, is unintuitive and forces artificial call sequences, and
> is additionally possible to misuse in release mode.
>
> Fix this by an API face lift:
> 1. The class is turned into a handle, which can be empty.
> 2. The only way of getting a non-empty PlatformThread is by calling
> SpawnJoinable or SpawnDetached, clearly conveying the semantics to the
> code reader.
> 3. Handles can be Finalized, which works differently for joinable and
> detached threads:
> a) Handles for detached threads are simply closed where applicable.
> b) Joinable threads are joined before handles are closed.
> 4. The destructor finalizes handles. No explicit call is needed.
>
> Fixed: webrtc:12727
> Change-Id: Id00a0464edf4fc9e552b6a1fbb5d2e1280e88811
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215075
> Commit-Queue: Markus Handell <handellm@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Tommi <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#33923}
# Not skipping CQ checks because original CL landed > 1 day ago.
TBR=handellm@webrtc.org
Bug: webrtc:12727
Change-Id: Ic0146be8866f6dd3ad9c364fb8646650b8e07419
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217583
Reviewed-by: Guido Urdaneta <guidou@webrtc.org>
Reviewed-by: Markus Handell <handellm@webrtc.org>
Commit-Queue: Guido Urdaneta <guidou@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33936}
PlatformThread's API is using old style function pointers, causes
casting, is unintuitive and forces artificial call sequences, and
is additionally possible to misuse in release mode.
Fix this by an API face lift:
1. The class is turned into a handle, which can be empty.
2. The only way of getting a non-empty PlatformThread is by calling
SpawnJoinable or SpawnDetached, clearly conveying the semantics to the
code reader.
3. Handles can be Finalized, which works differently for joinable and
detached threads:
a) Handles for detached threads are simply closed where applicable.
b) Joinable threads are joined before handles are closed.
4. The destructor finalizes handles. No explicit call is needed.
Fixed: webrtc:12727
Change-Id: Id00a0464edf4fc9e552b6a1fbb5d2e1280e88811
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215075
Commit-Queue: Markus Handell <handellm@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33923}
The change introduces support for detachable PlatformThreads, for which
the Stop() call doesn't wait until the thread has finished executing.
The change also introduces rtc::ThreadAttributes that carries priority
and detachability thread attributes. It additionally refactors all
known use to use the new semantics.
Bug: b:181572711, webrtc:12659
Change-Id: Id96e87c2a0dafabc8047767d241fd5da4505d14c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214704
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33796}
Wine implements ::QueueUserAPC incorrectly and returns
ERROR_ACCESS_DENIED when the thread is terminating instead of
ERROR_GEN_FAILURE. This is (hopefully) safe to do, assuming
the correct Windows implementation would never use ERROR_ACCESS_DENIED
in an actual failure case. I can't find documentation that says one
way or the other.
Bug: None
Change-Id: If74a40bb7e1cd49cc2266c31684bd88f1c667422
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/131042
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27432}
Introduces SequenceChecker, merging the functionality of ThreadChecker
and SequencedTaskChecker. Also making the two latter use the former as
the underlying implementation for backwards compatibility.
This allows code that uses thread checker to accept running on a thread
pool backed task queue.
Bug: webrtc:10365
Change-Id: Ifefc4925694f263088a8a095fdf98a2407c62081
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/129721
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27365}
PlatfromThread is used by several TaskQueue implementations that plan
to take it's name as string_view and thus wouldn't guarantee it is 0-terminated.
Bug: webrtc:10191
Change-Id: I7dadb917192257f0185f9cb4f0ec207d7156d3c3
Reviewed-on: https://webrtc-review.googlesource.com/c/118140
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26317}
This CL is the result of running include-what-you-use tool on part
of the code base (audio target and dependencies) plus manual fixes.
bug: webrtc:8311
Change-Id: I277d281ce943c3ecc1bd45fd8d83055931743604
Reviewed-on: https://webrtc-review.googlesource.com/c/106280
Commit-Queue: Yves Gerey <yvesg@google.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25311}
The eventual goal is to allow PlatformThread to use
SequencedTaskChecker, but getting to that point will require
some more detangling.
Here are (roughly) the steps taken in this CL:
* Make constructormagic a separate target.
* Move atomicops and arraysize to separate targets
* Move platform_thread_types to a separate target
* Move criticalsection to a separate target
* Move thread_checker to separate target
* Make sequenced_task_checker not depend on base_approved
* Move ptr_util to a separate target
* Move scoped_ptr to ptr_util
* Make rtc_task_queue_api not depend on base_approved
* Make sequenced_task_checker depend on rtc_task_queue_api
* Move rtc::Event to its own target
* Move basictypes.h to constructormagic
* Move format_macros and stringize_macros into constructormagic
* Rename constructormagic target to... macromagic
* Move stringencode to stringutils
* New target for safe_conversions
* Move timeutils to a new target.
* Move logging to a new target.
* Move platform_thread to a new target.
* Make refcount a new target (refcount, refcountedobject, refcounter).
* Remove rtc_base_approved from deps of TQ
* Remove a circular dependency between event tracer and platform thread.
Further steps will probably be to factor TaskQueue::Current() to not
be a part of the TaskQueue class itself and have it declared+implemented
in a target that's lower level than TQ itself. SequencedTaskChecker can
then depend on that target and avoid the TQ dependency. Once we're there,
PlatformThread will be able to depend on SequencedTaskChecker.
Attempted but eventually removed from this CL:
* Make TQ a part of rtc_base_approved
* Remove direct dependencies on sequenced_task_checker.
* Profit.
A few include-what-you-use updates along the way.
Fix a few targets that were depending on rtc_task_queue_api
Change-Id: Iee79aa2e81d978444c51b3005db9df7dc12d92a9
Bug: webrtc:8957
Reviewed-on: https://webrtc-review.googlesource.com/58480
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22487}
This is a reland of 5af97ee3ad.
What's changed from the original?
- Moved the #include for <process.h> for Fuchsia to the types header.
Original change's description:
> Remove criticalsection.cc dependency on platform_thread.cc.
>
> As part of this, I'm moving global thread related functions over to
> platform_thread_types.* and introducing platform_thread_types.cc
> for the implementation.
>
> Change-Id: I4624877fb379e77d215f4ecd60f20b06d8df3ce5
> Bug: webrtc:8893
> Reviewed-on: https://webrtc-review.googlesource.com/53940
> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> Commit-Queue: Tommi <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22037}
Bug: webrtc:8893
Change-Id: Idd0baa6756efd10ad11a5c6e4791eaa7a9dbc97f
Tbr: danilchap@webrtc.org
Reviewed-on: https://webrtc-review.googlesource.com/54800
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22068}
As part of this, I'm moving global thread related functions over to
platform_thread_types.* and introducing platform_thread_types.cc
for the implementation.
Change-Id: I4624877fb379e77d215f4ecd60f20b06d8df3ce5
Bug: webrtc:8893
Reviewed-on: https://webrtc-review.googlesource.com/53940
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22037}
1. Added WEBRTC_FUCHSIA define.
2. Added PlatformThreadId typedef for Fuchsia.
3. Updated ifdefs for _strnicmp()/strncasecmd(), so _strnicmp()
is used on all platforms
3. Updated ifdefs in clock.cc to avoid invalid assumption that
POSIX = LINUX || MAC .
Bug: chromium:750940
Change-Id: Id7aa98e017f467bcebb78a0b298ba91655502072
Reviewed-on: https://webrtc-review.googlesource.com/31641
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21233}
In https://webrtc-review.googlesource.com/c/src/+/1560 we moved WebRTC
from src/webrtc to src/ (in order to preserve an healthy git history).
This CL takes care of fixing header guards, #include paths, etc...
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
TBR=tommi@webrtc.org
Bug: chromium:611808
Change-Id: Iea91618212bee0af16aa3f05071eab8f93706578
Reviewed-on: https://webrtc-review.googlesource.com/1561
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19846}
In order to eliminate the WebRTC Subtree mirror in Chromium,
WebRTC is moving the content of the src/webrtc directory up
to the src/ directory.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
TBR=tommi@webrtc.org
Bug: chromium:611808
Change-Id: Iac59c5b51b950f174119565bac87955a7994bc38
Reviewed-on: https://webrtc-review.googlesource.com/1560
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19845}
2017-09-15 04:25:06 +00:00
Renamed from webrtc/rtc_base/platform_thread.cc (Browse further)