12 Commits

Author SHA1 Message Date
deadbeef
b85a88853a Fixing race between CallbackCanceled and CancelCallback in AsyncInvoker.
Pointer was already protected by a critical section in two places but
not the third. Added thread annotations to prevent this from happening
in the future.

BUG=None

Review-Url: https://codereview.webrtc.org/2726263004
Cr-Commit-Position: refs/heads/master@{#17017}
2017-03-03 18:33:18 +00:00
deadbeef
37f5ecfd8f Replace NULL with nullptr or null in webrtc/base/.
BUG=webrtc:7147

Review-Url: https://codereview.webrtc.org/2718663005
Cr-Commit-Position: refs/heads/master@{#16878}
2017-02-27 22:06:41 +00:00
deadbeef
162cb53e7b Making AsyncInvoker destructor thread-safe.
The documentation for AsyncInvoker states that it owns the lifetime of
calls, and when its destructor is called, all in-flight calls are
cancelled or finish executing. The "cancelled" part is working, but if
a call is in the middle of executing, the destructor does *not* wait.

This is fixed by keeping a count of pending invocations, which is
decremented when a call is either cleared from a message queue or
finishes executing.

BUG=webrtc:3914, webrtc:3911

Review-Url: https://codereview.webrtc.org/2694723004
Cr-Commit-Position: refs/heads/master@{#16811}
2017-02-24 01:10:07 +00:00
deadbeef
a8bc1a1f63 Relanding: Use std::unique_ptr instead of rtc::scoped_refptr in AsyncInvoker.
The AsyncClosures only ever have one thing referencing them, so they
should be using std::unique_ptr to manage ownership. Maybe this code was
written before std::unique_ptr was available.

Originally reverted because it made a change to ScopedMessageData
that wasn't backwards compatible, and applications using the rtc::Thread
infrastructure may be using it.

BUG=None
NOTRY=True

Review-Url: https://codereview.webrtc.org/2689233003
Cr-Commit-Position: refs/heads/master@{#16684}
2017-02-18 02:06:26 +00:00
deadbeef
884a7284bd Revert of Use std::unique_ptr instead of rtc::scoped_refptr in AsyncInvoker. (patchset #2 id:20001 of https://codereview.webrtc.org/2689233003/ )
Reason for revert:
The change to messagequeue.h isn't backwards compatible. Will reland after making it backwards compatible.

Original issue's description:
> Use std::unique_ptr instead of rtc::scoped_refptr in AsyncInvoker.
>
> The AsyncClosures only ever have one thing referencing them, so they
> should be using std::unique_ptr to manage ownership. Maybe this code was
> written before std::unique_ptr was available.
>
> BUG=None
>
> Review-Url: https://codereview.webrtc.org/2689233003
> Cr-Commit-Position: refs/heads/master@{#16680}
> Committed: a5a472927b

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

Review-Url: https://codereview.webrtc.org/2703613006
Cr-Commit-Position: refs/heads/master@{#16683}
2017-02-17 23:57:05 +00:00
deadbeef
a5a472927b Use std::unique_ptr instead of rtc::scoped_refptr in AsyncInvoker.
The AsyncClosures only ever have one thing referencing them, so they
should be using std::unique_ptr to manage ownership. Maybe this code was
written before std::unique_ptr was available.

BUG=None

Review-Url: https://codereview.webrtc.org/2689233003
Cr-Commit-Position: refs/heads/master@{#16680}
2017-02-17 23:19:19 +00:00
Taylor Brandstetter
5d97a9a05b Adding more detail to MessageQueue::Dispatch logging.
Every message will now be traced with the location from which it was
posted, including function name, file and line number.

This CL also writes a normal LOG message when the dispatch took more
than a certain amount of time (currently 50ms).

This logging should help us identify messages that are taking
longer than expected to be dispatched.

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

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

Cr-Commit-Position: refs/heads/master@{#13104}
2016-06-10 21:17:33 +00:00
kwiberg@webrtc.org
67186fe00c Fix clang style warnings in webrtc/base
Mostly this consists of marking functions with override when
applicable, and moving function bodies from .h to .cc files.

Not inlining virtual functions with simple bodies such as

  { return false; }

strikes me as probably losing more in readability than we gain in
binary size and compilation time, but I guess it's just like any other
case where enabling a generally good warning forces us to write
slightly worse code in a couple of places.

BUG=163
R=kjellander@webrtc.org, tommi@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#8656}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8656 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-03-09 22:24:25 +00:00
perkj@webrtc.org
827d7e806a Change AsyncInvoker to store its closure in a scoped_refptr instead of using a raw pointer.
This is just a cosmetic change and does not solve a particular bug.

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

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

Cr-Commit-Position: refs/heads/master@{#8194}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8194 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-01-29 08:54: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