Commit Graph

24 Commits

Author SHA1 Message Date
2b18084d40 Only allow static strings as ProcessThread names.
Review URL: https://codereview.webrtc.org/1336293002

Cr-Commit-Position: refs/heads/master@{#9932}
2015-09-14 14:53:46 +00:00
847855b865 Add a name to the ProcessThread constructor.
Helps differentiate between different instances when debugging.

Review URL: https://codereview.webrtc.org/1337003003

Cr-Commit-Position: refs/heads/master@{#9927}
2015-09-11 16:52:22 +00:00
9e260f184b Prevent TimeUntilNextProcess log spam.
Negative values from TimeUntilNextProcess indicate that the module
wanted to run sooner than possible, not that an invalid error code was
returned. As such it's not a contract error.

BUG=webrtc:4879
NOTRY=true

Review URL: https://codereview.webrtc.org/1257833004

Cr-Commit-Position: refs/heads/master@{#9740}
2015-08-20 08:23:56 +00:00
bc4b93453c Add a DCHECK to RegisterModule to make sure it's called on the controller thread.
BUG=4508
TBR=perkj

Review URL: https://webrtc-codereview.appspot.com/43039004

Cr-Commit-Position: refs/heads/master@{#8925}
2015-04-02 18:34:43 +00:00
7f375f0ef8 ProcessThreadImpl - hold the lock while checking thread_ and calling ProcessThreadAttached().
This is needed since DeRegisterModule is currently being called on arbitrary threads.

BUG=4508
R=perkj@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/48829004

Cr-Commit-Position: refs/heads/master@{#8924}
2015-04-02 14:50:27 +00:00
842a4a6b50 Add locks to Start(), Stop() methods in ProcessThread.
This is necessary unfortunately since there are a few places where DeRegisterModule does not reliably occur on the same thread.

BUG=4473
R=pbos@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/42979004

Cr-Commit-Position: refs/heads/master@{#8891}
2015-03-30 14:16:25 +00:00
38492c5b6f Re-land 8810 "- Add a SetPriority method to ThreadWr..."
> Revert 8810 "- Add a SetPriority method to ThreadWrapper"
> Seeing if this is causing roll issues.
> 
> > - Add a SetPriority method to ThreadWrapper
> > - Remove 'priority' from CreateThread and related member variables from implementations
> > - Make supplying a name for threads, non-optional
> > 
> > BUG=
> > R=magjed@webrtc.org
> > 
> > Review URL: https://webrtc-codereview.appspot.com/44729004
> 
> TBR=tommi@webrtc.org
> 
> Review URL: https://webrtc-codereview.appspot.com/48609004

TBR=tommi@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/50459005

Cr-Commit-Position: refs/heads/master@{#8819}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8819 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-03-22 14:42:46 +00:00
90a1cb4630 Revert 8810 "- Add a SetPriority method to ThreadWrapper"
Seeing if this is causing roll issues.

> - Add a SetPriority method to ThreadWrapper
> - Remove 'priority' from CreateThread and related member variables from implementations
> - Make supplying a name for threads, non-optional
> 
> BUG=
> R=magjed@webrtc.org
> 
> Review URL: https://webrtc-codereview.appspot.com/44729004

TBR=tommi@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/48609004

Cr-Commit-Position: refs/heads/master@{#8818}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8818 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-03-22 14:34:46 +00:00
b6817d793f - Add a SetPriority method to ThreadWrapper
- Remove 'priority' from CreateThread and related member variables from implementations
- Make supplying a name for threads, non-optional

BUG=
R=magjed@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/44729004

Cr-Commit-Position: refs/heads/master@{#8810}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8810 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-03-20 15:52:43 +00:00
361981faa8 Use scoped_ptr for ThreadWrapper::CreateThread.
BUG=
R=henrika@webrtc.org, pbos@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/45799004

Cr-Commit-Position: refs/heads/master@{#8794}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8794 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-03-19 14:45:42 +00:00
86639737b8 Remove thread id from ThreadWrapper::Start().
Removes ThreadPosix::InitParams and a corresponding wait for an event.
This unblocks ThreadPosix::Start which had to wait for thread scheduling
for an event to trigger on the spawned thread, giving faster Start()
calls.

BUG=4413
R=tommi@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/43699004

Cr-Commit-Position: refs/heads/master@{#8709}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8709 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-03-13 00:07:45 +00:00
03054486f5 Adding basic support for posting tasks to a process thread.
BUG=
R=magjed@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/41099004

Cr-Commit-Position: refs/heads/master@{#8614}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8614 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-03-05 13:14:19 +00:00
3985f0151a ProcessThread improvements.
* Added a way to notify a Module that it's been attached to a ProcessThread.
  The benefit of this is to give the module a way to wake up the thread
  when it needs work to happen on the worker thread, immediately.
  Today, module instances are typically registered with a process thread
  outside the control of the modules themselves.  I.e. they typically
  don't know about the process thread they're attached to.

* Improve ProcessThread's WakeUp algorithm to not call TimeUntilNextProcess
  when a WakeUp call is requested.  This is an optimization for the above
  case which avoids the module having to acquire a lock or do an interlocked
  operation before calling WakeUp(), which would ensure the module's
  TimeUntilNextProcess() implementation would return 0.

BUG=2822
R=stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/39239004

Cr-Commit-Position: refs/heads/master@{#8527}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8527 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-02-27 13:37:25 +00:00
103f3289b5 Fix the binary layout of ProcessThreadImpl.
We apparently hit an obscure problem on mac where seemingly an unaligned mutex causes memory corruption.
The effect was that the |modules_| list became corrupt and we crashed.  At this point I'm not exactly
sure what the alignment requirements are but for now, I've fixed up the layout in a way that doesn't cause these same issues.

I'm also changing auto->proper type at the request of drive by reviewers from my previous cl in the same file.

TBR=pbos@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/38989004

Cr-Commit-Position: refs/heads/master@{#8286}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8286 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-02-08 00:48:40 +00:00
0c3e12b7bf Revamp the ProcessThreadImpl implementation.
* Add a new WakeUp method that gives a module a chance to be called back right away on the worker thread.
* Wrote unit tests for the class.
* Significantly reduce the amount of locking.
  - ProcessThreadImpl itself does a lot less locking.
  - Reimplemented the way we keep track of when to make calls to Process.
    This reduces the amount of calls to TimeUntilNextProcess and since most implementations of that function grab a lock, this means less locking.
* Renamed ProcessThread::CreateProcessThread to ProcessThread::Create.
* Added thread checks for Start/Stop.  Threading model of other functions is now documented.
* We now log an error if an implementation of TimeUntilNextProcess returns a negative value (some implementations do, but the method should only return a positive nr of ms).
* Removed the DestroyProcessThread method and instead force callers to use scoped_ptr<> to maintain object lifetime.

BUG=2822
R=henrika@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/35999004

Cr-Commit-Position: refs/heads/master@{#8261}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8261 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-02-06 09:44:45 +00:00
875c97ed9d Remove SetNotAlive method from the thread class.
Also cleaning up methods with the same name in other classes that are derived from the above method.

R=perkj@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/41759004

Cr-Commit-Position: refs/heads/master@{#8242}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8242 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-02-04 11:12:39 +00:00
0b1534c52e Use int64_t for milliseconds more often, primarily for TimeUntilNextProcess.
This fixes a variety of MSVC warnings about value truncations when implicitly
storing the 64-bit values we get back from e.g. TimeTicks in 32-bit objects, and
removes the need for a number of explicit casts.

This also moves a number of constants so they're declared right where they're used, which is easier to read and maintain, and makes some of them of integral type rather than using the "enum hack".

BUG=chromium:81439
TEST=none
R=tommi@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/33649004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7905 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-12-15 22:09:40 +00:00
8b2ec15d1e Convert WEBRTC_TRACE to LOG in utility.
BUG=3153
R=mflodman@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/11099004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5886 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-04-11 07:59:43 +00:00
79cf3acc79 Removes usage of ListWrapper from several files.
BUG=2164
R=andrew@webrtc.org, pbos@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/6269004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5373 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-01-13 15:21:30 +00:00
8b06200802 Include files from webrtc/.. paths in utility/.
BUG=1662
R=henrike@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/1786004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4336 4adac7df-926f-26a2-2b94-8c16560cd09d
2013-07-12 08:28:10 +00:00
d900e8bea8 Proper spacing for end-of-namespace comments.
BUG=
R=mflodman@webrtc.org, tina.legrand@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/1760006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4293 4adac7df-926f-26a2-2b94-8c16560cd09d
2013-07-03 15:12:26 +00:00
c75102eba7 WebRtc_Word32 -> int32_t in utility/
BUG=314

Review URL: https://webrtc-codereview.appspot.com/1307005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3797 4adac7df-926f-26a2-2b94-8c16560cd09d
2013-04-09 13:32:55 +00:00
4ff956f428 Fixes data race in WebRTCAudioDeviceTest.Construct reported by ThreadSanitizer
BUG=159112

Review URL: https://webrtc-codereview.appspot.com/1201007

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3750 4adac7df-926f-26a2-2b94-8c16560cd09d
2013-04-02 11:59:11 +00:00
14b43beb7c Move src/ -> webrtc/
TBR=niklas.enbom@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/915006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2963 4adac7df-926f-26a2-2b94-8c16560cd09d
2012-10-22 18:19:23 +00:00