Modernize base::Thread
No-op cleanup extracted from https://codereview.chromium.org/2135413003/#ps40001
In this CL:
- Explicitly document the threading requirements of the API after grokking its use of locks
in some places and lack of in some others)
- (It's mostly thread unsafe; except for a few calls which are okay from the owner
as well as the underlying thread; and one method which is actually thread-safe)
- Add assertions as such (and catch issues on try bots :-O -- http://crbug.com/629139)
- Remove |thread_lock_| which is unnecessary under the documented conditions
(delayed until http://crbug.com/629139 is fixed..).
- C++11 member initializers (makes it cleaner to add new POD members and
makes constructors simpler -- e.g. |run_loop_| was uninitialized)
- Assertions and tests for current API which allows Start/Stop/Start cycles
but wasn't tested... (actually more than that is poorly/not tested in this class
but I'm merely adding tests for parts I'm stressing in my actual follow-up CL).
- Comment nits
- Make event-based tests use WaitableEvent instead of sleeping + toggling a bool.
BUG=629716, 629139
Review-Url: https://codereview.chromium.org/2145463002
Cr-Commit-Position: refs/heads/master@{#407265}
3 files changed