Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Issue 2691973002: Add support for multimedia timers to TaskQueue on Windows. (Closed)

Created:
3 years, 10 months ago by tommi
Modified:
3 years, 10 months ago
Reviewers:
the sun
CC:
webrtc-reviews_webrtc.org, tterriberry_mozilla.com
Target Ref:
refs/heads/master
Project:
webrtc
Visibility:
Public.

Description

Add support for multimedia timers to TaskQueue on Windows. Multimedia timers are higher precision than WM_TIMER, but they're also a limited resource and more costly. So this implementation is a best effort implementation that falls back on WM_TIMER when multimedia timers aren't available. A possible future change could be to make high precision timers in a TaskQueue, optional. The reason for doing so would be for TaskQueues that don't need high precision timers, won't eat up timers from TQ instances that really need it. BUG=webrtc:7151 Review-Url: https://codereview.webrtc.org/2691973002 Cr-Commit-Position: refs/heads/master@{#16661} Committed: https://chromium.googlesource.com/external/webrtc/+/f9d91548084c39fae6c355fd03202fb8f66eb5a1

Patch Set 1 #

Total comments: 4

Patch Set 2 : Update comment #

Total comments: 27

Patch Set 3 : Address comments #

Patch Set 4 : Add documentation, WAIT_OBJECT_0 and remove LOG(WARNING) #

Unified diffs Side-by-side diffs Delta from patch set Stats (+202 lines, -25 lines) Patch
M webrtc/base/task_queue.h View 1 2 3 3 chunks +9 lines, -1 line 0 comments Download
M webrtc/base/task_queue_unittest.cc View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M webrtc/base/task_queue_win.cc View 1 2 3 12 chunks +191 lines, -22 lines 0 comments Download

Messages

Total messages: 25 (10 generated)
tommi
Please take a look Fredrik. I'll associate a bug with the issue as soon as ...
3 years, 10 months ago (2017-02-13 14:53:55 UTC) #2
tommi
On 2017/02/13 14:53:55, tommi (webrtc) wrote: > Please take a look Fredrik. I'll associate a ...
3 years, 10 months ago (2017-02-14 09:39:14 UTC) #8
the sun
Chances are you've already looked into this, but it's been a while since I dealt ...
3 years, 10 months ago (2017-02-14 10:29:19 UTC) #9
tommi
Update comment
3 years, 10 months ago (2017-02-14 10:42:59 UTC) #10
tommi
https://codereview.webrtc.org/2691973002/diff/1/webrtc/base/task_queue_win.cc File webrtc/base/task_queue_win.cc (right): https://codereview.webrtc.org/2691973002/diff/1/webrtc/base/task_queue_win.cc#newcode61 webrtc/base/task_queue_win.cc:61: // limit of concurrently active multimedia timers, is much ...
3 years, 10 months ago (2017-02-14 10:43:07 UTC) #11
the sun
Generally LG, but do we really need it? PostThreadMessage will introduce an indeterminate delay anyway, ...
3 years, 10 months ago (2017-02-16 12:07:25 UTC) #12
tommi
https://codereview.webrtc.org/2691973002/diff/20001/webrtc/base/task_queue_win.cc File webrtc/base/task_queue_win.cc (right): https://codereview.webrtc.org/2691973002/diff/20001/webrtc/base/task_queue_win.cc#newcode36 webrtc/base/task_queue_win.cc:36: InitOnceExecuteOnce(&init_once, InitializeTls, nullptr, nullptr); On 2017/02/16 12:07:25, the sun ...
3 years, 10 months ago (2017-02-16 17:38:47 UTC) #13
tommi
Address comments
3 years, 10 months ago (2017-02-16 17:38:48 UTC) #14
tommi
On 2017/02/16 12:07:25, the sun wrote: > Generally LG, but do we really need it? ...
3 years, 10 months ago (2017-02-16 17:46:09 UTC) #15
the sun
That's a reasonable tradeoff. LGTM % document timing expectations in task_queue.h https://codereview.webrtc.org/2691973002/diff/20001/webrtc/base/task_queue_win.cc File webrtc/base/task_queue_win.cc (right): ...
3 years, 10 months ago (2017-02-16 20:18:47 UTC) #16
tommi
Add documentation, WAIT_OBJECT_0 and remove LOG(WARNING)
3 years, 10 months ago (2017-02-17 09:43:32 UTC) #17
tommi
https://codereview.webrtc.org/2691973002/diff/20001/webrtc/base/task_queue_win.cc File webrtc/base/task_queue_win.cc (right): https://codereview.webrtc.org/2691973002/diff/20001/webrtc/base/task_queue_win.cc#newcode245 webrtc/base/task_queue_win.cc:245: if (result == count) { On 2017/02/16 20:18:47, the ...
3 years, 10 months ago (2017-02-17 09:43:57 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/2691973002/60001
3 years, 10 months ago (2017-02-17 09:44:10 UTC) #21
commit-bot: I haz the power
Committed patchset #4 (id:60001) as https://chromium.googlesource.com/external/webrtc/+/f9d91548084c39fae6c355fd03202fb8f66eb5a1
3 years, 10 months ago (2017-02-17 10:47:19 UTC) #24
the sun
3 years, 10 months ago (2017-02-17 10:50:14 UTC) #25
Message was sent while issue was closed.
https://codereview.webrtc.org/2691973002/diff/20001/webrtc/base/task_queue_wi...
File webrtc/base/task_queue_win.cc (right):

https://codereview.webrtc.org/2691973002/diff/20001/webrtc/base/task_queue_wi...
webrtc/base/task_queue_win.cc:311: timers->emplace_back();
On 2017/02/17 09:43:57, tommi (webrtc) wrote:
> On 2017/02/16 20:18:47, the sun wrote:
> > On 2017/02/16 17:38:47, tommi (webrtc) wrote:
> > > On 2017/02/16 12:07:25, the sun wrote:
> > > > What's the overhead of recreating timers (CreateEvent/CloseHandle,
> > > > specifically). Is it easier to just have a pool of them than to figure
out
> > > > potential lag in queueing timers?
> > > 
> > > CreateEvent creates a kernel object, so the cost can be noticeable (a few
> ms)
> > > when the machine is busy.  They're also a limited resource, so while we do
> > have
> > > a pool here (unused ones are garbage collected when we have over 8
> allocated),
> > > it's not a big pool (for some definition of big).
> > 
> > Out of curiosity, what's the limit? The only limit I can quickly find, is
16M
> > (2^24) HANDLEs (I trust Russinovich on this stuff). Are there other limits
per
> > kernel object? Not sure what other costs are associated with events.
> 
> That's probably correct, given the source :)  I don't know the exact cost
> associated, but some things that come to mind that are different from a
regular
> in-process event-like object, would be bookkeeping overhead since events are
> cross-process-capable synchronization objects (events can be named and shared
> with other processes, duplicated etc), associated security descriptor, even a
> stack trace and various other info as you probably saw when looking at Mark's
> data (was it the 'testlimit article' you read?).

Yeah that was it.

Powered by Google App Engine
This is Rietveld 408576698