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

Issue 2398753003: Use FileDescriptorWatcher in AlarmTimer. (Closed)

Created:
4 years, 2 months ago by fdoray
Modified:
4 years, 2 months ago
Reviewers:
Chirantan Ekbote
CC:
chromium-reviews, chirantan+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use FileDescriptorWatcher in AlarmTimer. FileDescriptorWatcher is a new API that replaces MessageLoopForIO::WatchFileDescriptor. This CL also gets rid of the base::Thread created in the anonymous namespace of alarm_timer_chromeos.cc. The FileDescriptorWatcher API is supported by every TaskScheduler thread. Very soon, most tasks in Chrome will run in TaskScheduler. Therefore, there is no reason to create a base::Thread to allow AlarmTimer to be used from threads that don't support the FileDescriptorWatcher API. BUG=645114 Committed: https://crrev.com/8e17d7e9031b7e2e58473fe66a399943051357f0 Cr-Commit-Position: refs/heads/master@{#423617}

Patch Set 1 #

Patch Set 2 : fix build error #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+278 lines, -712 lines) Patch
M components/timers/alarm_timer_chromeos.h View 4 chunks +28 lines, -68 lines 0 comments Download
M components/timers/alarm_timer_chromeos.cc View 1 2 chunks +87 lines, -395 lines 2 comments Download
M components/timers/alarm_timer_unittest.cc View 8 chunks +163 lines, -249 lines 0 comments Download

Messages

Total messages: 21 (13 generated)
fdoray
PTAL
4 years, 2 months ago (2016-10-06 18:22:44 UTC) #11
Chirantan Ekbote
lgtm with one question. Thanks for doing this! https://codereview.chromium.org/2398753003/diff/20001/components/timers/alarm_timer_chromeos.cc File components/timers/alarm_timer_chromeos.cc (right): https://codereview.chromium.org/2398753003/diff/20001/components/timers/alarm_timer_chromeos.cc#newcode25 components/timers/alarm_timer_chromeos.cc:25: alarm_fd_(timerfd_create(CLOCK_REALTIME_ALARM, ...
4 years, 2 months ago (2016-10-06 18:41:51 UTC) #12
fdoray
https://codereview.chromium.org/2398753003/diff/20001/components/timers/alarm_timer_chromeos.cc File components/timers/alarm_timer_chromeos.cc (right): https://codereview.chromium.org/2398753003/diff/20001/components/timers/alarm_timer_chromeos.cc#newcode25 components/timers/alarm_timer_chromeos.cc:25: alarm_fd_(timerfd_create(CLOCK_REALTIME_ALARM, 0)), On 2016/10/06 18:41:51, Chirantan Ekbote wrote: > ...
4 years, 2 months ago (2016-10-06 18:57:34 UTC) #13
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/2398753003/20001
4 years, 2 months ago (2016-10-06 18:58:15 UTC) #15
Chirantan Ekbote
On 2016/10/06 18:57:34, fdoray wrote: > https://codereview.chromium.org/2398753003/diff/20001/components/timers/alarm_timer_chromeos.cc > File components/timers/alarm_timer_chromeos.cc (right): > > https://codereview.chromium.org/2398753003/diff/20001/components/timers/alarm_timer_chromeos.cc#newcode25 > ...
4 years, 2 months ago (2016-10-06 19:02:48 UTC) #16
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 2 months ago (2016-10-06 19:03:58 UTC) #18
commit-bot: I haz the power
Patchset 2 (id:??) landed as https://crrev.com/8e17d7e9031b7e2e58473fe66a399943051357f0 Cr-Commit-Position: refs/heads/master@{#423617}
4 years, 2 months ago (2016-10-06 19:08:57 UTC) #20
nasko
4 years, 2 months ago (2016-10-06 21:20:02 UTC) #21
Message was sent while issue was closed.
A revert of this CL (patchset #2 id:20001) has been created in
https://codereview.chromium.org/2394333002/ by nasko@chromium.org.

The reason for reverting is: This CL is causing a memory leak in the unit tests:

https://build.chromium.org/p/chromium.memory/builders/Linux%20Chromium%20OS%2...

failures:
AlarmTimerTest.RetainNonRepeatIsRunning
AlarmTimerTest.MessageLoopShutdown
AlarmTimerTest.NonRepeatIsRunning
AlarmTimerTest.RetainRepeatIsRunning

Sample report:
Direct leak of 152 byte(s) in 1 object(s) allocated from:
    #0 0xab8ebb in operator new(unsigned long)
(/b/swarm_slave/w/irlnnUGq/out/Release/components_unittests+0xab8ebb)
    #1 0x9eba8fd in MakeUnique<base::FileDescriptorWatcher::Controller::Watcher,
base::WeakPtr<base::FileDescriptorWatcher::Controller>,
base::MessageLoopForIO::Mode &, int &> base/memory/ptr_util.h:56:29
    #2 0x9eba8fd in
base::FileDescriptorWatcher::Controller::Controller(base::MessageLoopForIO::Mode,
int, base::Callback<void (), (base::internal::CopyMode)1,
(base::internal::RepeatMode)1> const&)
base/files/file_descriptor_watcher_posix.cc:159
    #3 0x9ebb293 in base::FileDescriptorWatcher::WatchReadable(int,
base::Callback<void (), (base::internal::CopyMode)1,
(base::internal::RepeatMode)1> const&)
base/files/file_descriptor_watcher_posix.cc:198:25
    #4 0xe0016a3 in timers::AlarmTimer::Reset()
components/timers/alarm_timer_chromeos.cc:103:25
    #5 0x515b488 in
timers::AlarmTimerTest_RetainRepeatIsRunning_Test::TestBody()
components/timers/alarm_timer_unittest.cc:310:9.

Powered by Google App Engine
This is Rietveld 408576698