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

Issue 2754863002: Mojo: Don't hold a watch context ref in SimpleWatcher posted task (Closed)

Created:
3 years, 9 months ago by Ken Rockot(use gerrit already)
Modified:
3 years, 9 months ago
Reviewers:
yzshen1
CC:
Aaron Boodman, abarth-chromium, chromium-reviews, darin (slow to review), qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Mojo: Don't hold a watch context ref in SimpleWatcher posted task In test environments it's fairly common for task runners to be torn down without flushing posted tasks. If there's e.g. a binding object on the test function stack that gets destroyed on unwind, this might end up posting a SimpleWatcher notification task that then never runs. Currently we disambiguate watch contexts in SimpleWatcher by retaining a ref to the Context in said notification task and comparing to the currently known Context instance on the SimpleWatcher's thread. This can lead to indirect leaks in the aforementioned testing scenario. This CL instead introduces a sequence number in SimpleWatcher which is incremented every time a new watch is started. This sequence number is used to disambiguate notifications which might have come from a previous watch, thus avoiding the unnecessary ref count on Context. BUG=702180 R=yzshen@chromium.org Review-Url: https://codereview.chromium.org/2754863002 Cr-Commit-Position: refs/heads/master@{#457455} Committed: https://chromium.googlesource.com/chromium/src/+/58e6cc73277d3bc9e67687df2c1dd575019d3282

Patch Set 1 : . #

Unified diffs Side-by-side diffs Delta from patch set Stats (+23 lines, -13 lines) Patch
M mojo/public/cpp/system/simple_watcher.h View 2 chunks +5 lines, -1 line 0 comments Download
M mojo/public/cpp/system/simple_watcher.cc View 5 chunks +18 lines, -12 lines 0 comments Download

Messages

Total messages: 13 (9 generated)
Ken Rockot(use gerrit already)
PTAL, thanks!
3 years, 9 months ago (2017-03-16 14:17:58 UTC) #6
yzshen1
lgtm
3 years, 9 months ago (2017-03-16 15:50:16 UTC) #7
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/2754863002/20001
3 years, 9 months ago (2017-03-16 15:50:43 UTC) #10
commit-bot: I haz the power
3 years, 9 months ago (2017-03-16 16:37:32 UTC) #13
Message was sent while issue was closed.
Committed patchset #1 (id:20001) as
https://chromium.googlesource.com/chromium/src/+/58e6cc73277d3bc9e67687df2c1d...

Powered by Google App Engine
This is Rietveld 408576698