20 Commits

Author SHA1 Message Date
danilchap
bebf54cad1 Adds clearer function to create rtc::Thread without Physical SocketServer
Moves logic of default SocketServer from MessageQueue to SocketServer

Review-Url: https://codereview.webrtc.org/1891293002
Cr-Commit-Position: refs/heads/master@{#12541}
2016-04-28 08:32:57 +00:00
jbauch
9ccedc38f6 Reland: Prevent data race in MessageQueue.
The CL prevents a data race in MessageQueue where the variable "ss_" is
modified without a lock while sometimes read inside a lock.

Also thread annotations have been added to the MessageQueue class.

This was already reviewed and landed in https://codereview.webrtc.org/1675923002/
but failed in Chromium GN builds due to sharedexclusivelock.cc not being
compiled in these builds. This changed in https://codereview.webrtc.org/1712773003/
so the reland should work fine now.

BUG=webrtc:5496

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

Cr-Commit-Position: refs/heads/master@{#11758}
2016-02-25 09:15:05 +00:00
jbauch
9674d7cb89 Revert of Prevent data race in MessageQueue. (patchset #3 id:40001 of https://codereview.webrtc.org/1675923002/ )
Reason for revert:
Broke chromium.webrtc.fyi bots:
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/9891
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20GN/builds/11416

Fails with
-----
Undefined symbols for architecture x86_64:
  "rtc::SharedExclusiveLock::LockShared()", referenced from:
      rtc::MessageQueue::DoDestroy() in librtc_base.a(messagequeue.o)
      rtc::MessageQueue::socketserver() in librtc_base.a(messagequeue.o)
      rtc::MessageQueue::WakeUpSocketServer() in librtc_base.a(messagequeue.o)
      rtc::MessageQueue::Quit() in librtc_base.a(messagequeue.o)
      rtc::MessageQueue::Get(rtc::Message*, int, bool) in librtc_base.a(messagequeue.o)
      rtc::MessageQueue::Post(rtc::MessageHandler*, unsigned int, rtc::MessageData*, bool) in librtc_base.a(messagequeue.o)
      rtc::MessageQueue::DoDelayPost(int, unsigned int, rtc::MessageHandler*, unsigned int, rtc::MessageData*) in librtc_base.a(messagequeue.o)
      ...
  "rtc::SharedExclusiveLock::UnlockShared()", referenced from:
      rtc::MessageQueue::DoDestroy() in librtc_base.a(messagequeue.o)
      rtc::MessageQueue::socketserver() in librtc_base.a(messagequeue.o)
      rtc::MessageQueue::WakeUpSocketServer() in librtc_base.a(messagequeue.o)
      rtc::MessageQueue::Quit() in librtc_base.a(messagequeue.o)
      rtc::MessageQueue::Get(rtc::Message*, int, bool) in librtc_base.a(messagequeue.o)
      rtc::MessageQueue::Post(rtc::MessageHandler*, unsigned int, rtc::MessageData*, bool) in librtc_base.a(messagequeue.o)
      rtc::MessageQueue::DoDelayPost(int, unsigned int, rtc::MessageHandler*, unsigned int, rtc::MessageData*) in librtc_base.a(messagequeue.o)
      ...
  "rtc::SharedExclusiveLock::SharedExclusiveLock()", referenced from:
      rtc::MessageQueue::MessageQueue(rtc::SocketServer*, bool) in librtc_base.a(messagequeue.o)
ld: symbol(s) not found for architecture x86_64
-----

Looks like these are compiling without "webrtc/base/sharedexclusivelock.cc".

Original issue's description:
> Prevent data race in MessageQueue.
>
> The CL prevents a data race in MessageQueue where the variable "ss_" is
> modified without a lock while sometimes read inside a lock.
>
> Also thread annotations have been added to the MessageQueue class.
>
> BUG=webrtc:5496
>
> Committed: https://crrev.com/df88460372e7ce78c871a87774d7e6d82aac6ee3
> Cr-Commit-Position: refs/heads/master@{#11683}

TBR=ivoc@webrtc.org,pthatcher@webrtc.org,deadbeef@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5496

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

Cr-Commit-Position: refs/heads/master@{#11686}
2016-02-19 15:16:19 +00:00
jbauch
df88460372 Prevent data race in MessageQueue.
The CL prevents a data race in MessageQueue where the variable "ss_" is
modified without a lock while sometimes read inside a lock.

Also thread annotations have been added to the MessageQueue class.

BUG=webrtc:5496

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

Cr-Commit-Position: refs/heads/master@{#11683}
2016-02-19 15:03:36 +00:00
jbauch
25d1f28fa9 Fix race between Thread ctor/dtor and MessageQueueManager registrations.
This CL fixes a race where for Thread objects the parent MessageQueue
constructor registers the object in the MessageQueueManager even though
the Thread is not constructed completely yet. Same happens during
destruction.

BUG=webrtc:1225

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

Cr-Commit-Position: refs/heads/master@{#11497}
2016-02-05 08:25:04 +00:00
Peter Boström
8c38e8b9b9 Clean up PlatformThread.
* Move PlatformThread to rtc::.
* Remove ::CreateThread factory method.
* Make non-scoped_ptr from a lot of invocations.
* Make Start/Stop void.
* Remove rtc::Thread priorities, which were unused and would collide.
* Add ::IsRunning() to PlatformThread.

BUG=
R=tommi@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10812}
2015-11-26 16:45:57 +00:00
tfarina
a41ab9326c Switch usage of _DEBUG macro to NDEBUG.
http://stackoverflow.com/a/29253284/5237416

BUG=None
R=tommi@webrtc.org
NOPRESUBMIT=true

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

Cr-Commit-Position: refs/heads/master@{#10468}
2015-10-30 23:08:54 +00:00
Peter Boström
0c4e06b4c6 Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.

BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 10:23:32 +00:00
Andrew MacDonald
469c2c04aa Make Config::default_value leak instead of having an exit-time destructor.
I wanted to use Config::Get in Chromium code, but it triggered the following
warning:
../../third_party/webrtc/common.h:89:20: error: declaration requires an exit-time destructor [-Werror,-Wexit-time-destructors]
    static const T def;
                   ^
../../third_party/webrtc/common.h:110:10: note: in instantiation of function template specialization requested here
  return default_value<T>();
         ^

I assume we don't hit this in webrtc because the warning is disabled.

This also switches to the RTC_ prefix from the deprecated LIBJINGLE_.

Needed due to this Chromium CL:
https://codereview.chromium.org/1148843004/

R=andresp@webrtc.org, tommi@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9268}
2015-05-23 00:50:33 +00:00
Tommi
ea14f0ac11 Move SetCurrentThreadName to platform_thread.* in rtc_base_approved,
update all webrtc and libjingle code to use the same function and remove
extra implementations.

BUG=
R=andresp@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9205}
2015-05-18 11:50:31 +00:00
tommi@webrtc.org
7c64ed2e0c Move trace_event and associated files to webrtc/base.
Also starting to use TRACE_EVENT from thread.cc in webrtc/base, to track Invoke() calls.

BUG=
R=magjed@webrtc.org, tina.legrand@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#8755}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8755 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-03-17 14:26:15 +00:00
jiayl@webrtc.org
1fd362c31e Do not assert for blocking call allowed in Thread::Join.
We do not allow blocking call from the worker thread, but on Android the worker thread may stop/join a SignalThread, which hits the assert.
AssertBlockingIsAllowedOnCurrentThread is used to make sure a thread does not do Invoke, so check that in Thread::Join does not seem to add much value.

BUG=3857
R=juberti@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7308 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-09-26 16:57:07 +00:00
jiayl@webrtc.org
3987b6de50 Fix a problem in Thread::Send.
Previously if thread A->Send is called on thread B, B->ReceiveSends will be called, which enables an arbitrary thread to invoke calls on B while B is wait for A->Send to return. This caused mutliple problems like issue 3559, 3579.
The fix is to limit B->ReceiveSends to only process requests from A.
Also disallow the worker thread invoking other threads.

BUG=3559
R=juberti@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7290 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-09-24 17:14:05 +00:00
jiayl@webrtc.org
ba737cba1a Do not require synchronization access on the thread if called from rtc::Thread::WrapCurrent.
The synchronization access is unnecessary for rtc::Thread::WrapCurrent (called from JingleThreadWrapper) since JingleThreadWrapper never calls rtc::Thread::Stop or rtc::Thread::Join. Failing to get the access caused crashes in Chrome since rtc::Thread::Current will be NULL when rtc::Thread::WrapCurrent fails.

rtc::ThreadManager::WrapCurrentThread still requires the synchronization access, since I am not sure if the callers (e.g. the plugin) depends on it.

BUG=crbug/413853
R=juberti@webrtc.org, tommi@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7224 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-09-18 16:45:21 +00:00
henrike@webrtc.org
92a9bacf9a Rebase webrtc/base with r6682 version of talk/base:
cls ported: r6671, r6672, r6679 (reverts and unreverts in r6680, r6682).
svn diff -r 6656:6682 http://webrtc.googlecode.com/svn/trunk/talk/base >
6682.diff
sed -i.bak "s/talk_base/rtc/g" 6682.diff
sed -i.bak "s/#ifdef WIN32/#if defined(WEBRTC_WIN)/g" 6682.diff
sed -i.bak "s/#if defined(WIN32)/#if defined(WEBRTC_WIN)/g" 6682.diff
patch -p0 -i 6682.diff

BUG=3379
TBR=tommi@webrtc.org,jiayl@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6683 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-07-14 22:03:57 +00:00
fischman@webrtc.org
e5063b1733 Thread: delete racy API (Release()) and fix racy code (started()).
- Thread::Release() wrote a local variable on the calling thread but read it on
  another thread, with no synchronization.  Happily it has no non-test callers
  so deleting it instead of trying to fix it (see bug for details).
- Thread::started_ similarly was racily being written to; replaced with a
  running_ Event, and hid the accessor except for tests & legacy callers,
  with a note about why it's a bad idea.

webrtc/base patched with:
git diff origin --relative=talk/base | patch -p1 -dwebrtc/base
followed by manual merge of 3 thunks that ran afoul of naming differences
between talk/base and webrtc/base.

BUG=3388
R=andrew@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6236 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-05-23 17:28:50 +00:00
henrike@webrtc.org
99b4162ccf Rebase webrtc/base 6163:6216 (svn diff -r 6163:6216 http://webrtc.googlecode.com/svn/trunk/talk/base, apply diff manually)
BUG=3379
TBR=wu@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6217 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-05-21 20:42:17 +00:00
henrike@webrtc.org
f048872e91 Adds a modified copy of talk/base to webrtc/base. It is the first step in
migrating talk/base to webrtc/base.

BUG=N/A
R=niklas.enbom@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6129 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-05-13 18:00:26 +00:00
perkj@webrtc.org
e9a604accd Revert 6107 "Adds a modified copy of talk/base to webrtc/base. I..."
This breaks Chromium FYI builds and prevent roll of webrtc/libjingle to Chrome.

http://chromegw.corp.google.com/i/chromium.webrtc.fyi/builders/Win%20Builder/builds/457


> Adds a modified copy of talk/base to webrtc/base. It is the first step in migrating talk/base to webrtc/base.
> 
> BUG=N/A
> R=andrew@webrtc.org, wu@webrtc.org
> 
> Review URL: https://webrtc-codereview.appspot.com/12199004

TBR=henrike@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6116 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-05-13 08:15:48 +00:00
henrike@webrtc.org
2c7d1b39b9 Adds a modified copy of talk/base to webrtc/base. It is the first step in migrating talk/base to webrtc/base.
BUG=N/A
R=andrew@webrtc.org, wu@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6107 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-05-12 18:03:09 +00:00