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

Issue 2332923004: Add a new file descriptor watch API. (Closed)

Created:
4 years, 3 months ago by fdoray
Modified:
4 years, 3 months ago
Reviewers:
dcheng
CC:
chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add a new file descriptor watch API. This API can be used from any task from which SequencedTaskRunnerHandle::Get() returns a SequencedTaskRunner (i.e. in particular, it can be used from SINGLE_THREADED and SEQUENCED tasks running in base/task_scheduler). As opposed to the existing API which is only available from single-threaded tasks running in a MessageLoopForIO. Threads that want to support this API must instantiate a FileDescriptorWatcher. The constructor of FileDescriptorWatcher takes as argument a MessageLoopForIO to use to watch file descriptors for which callbacks are registered on the thread on which it is invoked. The MessageLoopForIO does *not* have to run on that thread. When the MessageLoopForIO detects that watched file descriptors are readable and/or writable without blocking, it posts a task to run the callback on the sequence on which it was registered. Design doc: https://docs.google.com/document/d/1F5CjON2JNtCtdEug3LOL8-avj188k_xOgqzdv288Q_s/edit?usp=sharing Discussion on chromium-dev: https://groups.google.com/a/chromium.org/d/msg/chromium-dev/voOAab4mV9A/S9xXdpPkBgAJ BUG=645114 Committed: https://crrev.com/f9f6c1e92b168281ba2fccef2693469380243db8 Cr-Commit-Position: refs/heads/master@{#418853}

Patch Set 1 #

Total comments: 12

Patch Set 2 : CR dcheng #8 #

Patch Set 3 : self-review #

Total comments: 3

Patch Set 4 : CR dcheng # 12 #

Patch Set 5 : self-review #

Unified diffs Side-by-side diffs Delta from patch set Stats (+621 lines, -0 lines) Patch
M base/BUILD.gn View 3 chunks +5 lines, -0 lines 0 comments Download
A base/files/file_descriptor_watcher_posix.h View 1 2 3 4 1 chunk +99 lines, -0 lines 0 comments Download
A base/files/file_descriptor_watcher_posix.cc View 1 2 3 4 1 chunk +199 lines, -0 lines 0 comments Download
A base/files/file_descriptor_watcher_posix_unittest.cc View 1 1 chunk +318 lines, -0 lines 0 comments Download

Messages

Total messages: 21 (10 generated)
fdoray
PTAL
4 years, 3 months ago (2016-09-13 13:17:30 UTC) #6
dcheng
Just some initial thoughts. https://codereview.chromium.org/2332923004/diff/1/base/files/file_descriptor_watcher_posix.cc File base/files/file_descriptor_watcher_posix.cc (right): https://codereview.chromium.org/2332923004/diff/1/base/files/file_descriptor_watcher_posix.cc#newcode159 base/files/file_descriptor_watcher_posix.cc:159: MessageLoopForIO::current()->AddDestructionObserver(watcher); Is it possible to ...
4 years, 3 months ago (2016-09-14 06:48:19 UTC) #8
fdoray
PTAnL https://codereview.chromium.org/2332923004/diff/1/base/files/file_descriptor_watcher_posix.cc File base/files/file_descriptor_watcher_posix.cc (right): https://codereview.chromium.org/2332923004/diff/1/base/files/file_descriptor_watcher_posix.cc#newcode159 base/files/file_descriptor_watcher_posix.cc:159: MessageLoopForIO::current()->AddDestructionObserver(watcher); On 2016/09/14 06:48:19, dcheng wrote: > Is ...
4 years, 3 months ago (2016-09-14 17:06:14 UTC) #9
dcheng
https://codereview.chromium.org/2332923004/diff/1/base/files/file_descriptor_watcher_posix.cc File base/files/file_descriptor_watcher_posix.cc (right): https://codereview.chromium.org/2332923004/diff/1/base/files/file_descriptor_watcher_posix.cc#newcode173 base/files/file_descriptor_watcher_posix.cc:173: auto callback = std::move(callback_); On 2016/09/14 17:06:14, fdoray wrote: ...
4 years, 3 months ago (2016-09-14 17:13:17 UTC) #10
fdoray
https://codereview.chromium.org/2332923004/diff/1/base/files/file_descriptor_watcher_posix.cc File base/files/file_descriptor_watcher_posix.cc (right): https://codereview.chromium.org/2332923004/diff/1/base/files/file_descriptor_watcher_posix.cc#newcode173 base/files/file_descriptor_watcher_posix.cc:173: auto callback = std::move(callback_); On 2016/09/14 17:13:17, dcheng wrote: ...
4 years, 3 months ago (2016-09-14 18:15:41 UTC) #11
dcheng
LGTM with comment addressed. https://codereview.chromium.org/2332923004/diff/40001/base/files/file_descriptor_watcher_posix.cc File base/files/file_descriptor_watcher_posix.cc (right): https://codereview.chromium.org/2332923004/diff/40001/base/files/file_descriptor_watcher_posix.cc#newcode159 base/files/file_descriptor_watcher_posix.cc:159: Unretained(watcher_.get()), called_from_constructor)); Nit: let's just ...
4 years, 3 months ago (2016-09-15 08:23:02 UTC) #12
fdoray
https://codereview.chromium.org/2332923004/diff/40001/base/files/file_descriptor_watcher_posix.cc File base/files/file_descriptor_watcher_posix.cc (right): https://codereview.chromium.org/2332923004/diff/40001/base/files/file_descriptor_watcher_posix.cc#newcode159 base/files/file_descriptor_watcher_posix.cc:159: Unretained(watcher_.get()), called_from_constructor)); On 2016/09/15 08:23:02, dcheng wrote: > Nit: ...
4 years, 3 months ago (2016-09-15 12:10:16 UTC) #13
fdoray
https://codereview.chromium.org/2332923004/diff/40001/base/files/file_descriptor_watcher_posix.cc File base/files/file_descriptor_watcher_posix.cc (right): https://codereview.chromium.org/2332923004/diff/40001/base/files/file_descriptor_watcher_posix.cc#newcode159 base/files/file_descriptor_watcher_posix.cc:159: Unretained(watcher_.get()), called_from_constructor)); On 2016/09/15 08:23:02, dcheng wrote: > Nit: ...
4 years, 3 months ago (2016-09-15 12:11:11 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2332923004/80001
4 years, 3 months ago (2016-09-15 12:14:18 UTC) #17
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years, 3 months ago (2016-09-15 13:23:49 UTC) #19
commit-bot: I haz the power
4 years, 3 months ago (2016-09-15 13:24:54 UTC) #21
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/f9f6c1e92b168281ba2fccef2693469380243db8
Cr-Commit-Position: refs/heads/master@{#418853}

Powered by Google App Engine
This is Rietveld 408576698