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

Issue 14757022: Add a non-blocking "OneShotEvent" class (Closed)

Created:
7 years, 7 months ago by Jeffrey Yasskin
Modified:
7 years, 7 months ago
CC:
chromium-reviews, Aaron Boodman, chromium-apps-reviews_chromium.org, Devlin
Visibility:
Public.

Description

Add a non-blocking "OneShotEvent" class to simplify code that needs to run after something has happened, and start using it for the ExtensionService's READY notification. This change doesn't, in itself replace any uses of NOTIFICATION_EXTENSIONS_READY, but it paves the way for doing so. BUG=240968 R=atwilson@chromium.org, kalman@chromium.org, mpcomplete@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=200918

Patch Set 1 #

Patch Set 2 : Fix tests; add a test #

Total comments: 18

Patch Set 3 : dcronin's comments; ExtensionSystem::ready; and WeakPtr support #

Total comments: 21

Patch Set 4 : Rename AsyncEvent to Latch, and move 'ready' fully into ExtensionSystem #

Patch Set 5 : Remove unnecessary changes, and add a comment yoz requested #

Patch Set 6 : Rename Latch to OneShotEvent #

Total comments: 19

Patch Set 7 : kalman's comments #

Patch Set 8 : s/ThenRun/Post/ and sync #

Patch Set 9 : Replace ExtensionServiceReady() with passing &ready_ into the ExtensionService constructor #

Total comments: 2

Patch Set 10 : Add a test for the behavior within a Post()ed callback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+320 lines, -18 lines) Patch
M chrome/browser/background/background_application_list_model_unittest.cc View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/extension_service.h View 1 2 3 4 5 6 7 8 4 chunks +6 lines, -5 lines 0 comments Download
M chrome/browser/extensions/extension_service.cc View 1 2 3 4 5 6 7 8 8 chunks +11 lines, -9 lines 0 comments Download
M chrome/browser/extensions/extension_system.h View 1 2 3 4 5 6 7 8 5 chunks +9 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_system.cc View 1 2 3 4 5 6 7 8 2 chunks +6 lines, -1 line 0 comments Download
M chrome/browser/extensions/test_extension_system.h View 1 2 3 4 5 6 7 8 2 chunks +2 lines, -0 lines 0 comments Download
M chrome/browser/extensions/test_extension_system.cc View 1 2 3 4 5 6 7 8 2 chunks +6 lines, -1 line 0 comments Download
M chrome/chrome_common.gypi View 1 2 3 4 5 6 7 2 chunks +3 lines, -1 line 0 comments Download
M chrome/chrome_tests_unit.gypi View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
A extensions/common/one_shot_event.h View 1 2 3 4 5 6 7 1 chunk +98 lines, -0 lines 0 comments Download
A extensions/common/one_shot_event.cc View 1 2 3 4 5 6 7 1 chunk +66 lines, -0 lines 0 comments Download
A extensions/common/one_shot_event_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +111 lines, -0 lines 0 comments Download

Messages

Total messages: 29 (0 generated)
Devlin
Neat. :) Saw your post in #crx; decided to take a look for my own ...
7 years, 7 months ago (2013-05-15 00:21:16 UTC) #1
Jeffrey Yasskin
Thanks for the review and the attention to detail! I haven't renamed anything yet, but ...
7 years, 7 months ago (2013-05-15 03:07:18 UTC) #2
Jeffrey Yasskin
Ok, see https://codereview.chromium.org/14895016/ for a use that demonstrates that this does in fact save code. ...
7 years, 7 months ago (2013-05-15 03:45:18 UTC) #3
Matt Perry
https://codereview.chromium.org/14757022/diff/19001/chrome/browser/extensions/extension_service.h File chrome/browser/extensions/extension_service.h (right): https://codereview.chromium.org/14757022/diff/19001/chrome/browser/extensions/extension_service.h#newcode137 chrome/browser/extensions/extension_service.h:137: const extensions::AsyncEvent& ready() { return ready_; } I can ...
7 years, 7 months ago (2013-05-15 21:08:54 UTC) #4
Yoyo Zhou
https://codereview.chromium.org/14757022/diff/19001/chrome/browser/extensions/extension_service.h File chrome/browser/extensions/extension_service.h (right): https://codereview.chromium.org/14757022/diff/19001/chrome/browser/extensions/extension_service.h#newcode136 chrome/browser/extensions/extension_service.h:136: bool is_ready() const { return ready_.has_happened(); } Arguably, the ...
7 years, 7 months ago (2013-05-15 22:38:40 UTC) #5
Matt Perry
https://codereview.chromium.org/14757022/diff/19001/chrome/browser/extensions/extension_service.h File chrome/browser/extensions/extension_service.h (right): https://codereview.chromium.org/14757022/diff/19001/chrome/browser/extensions/extension_service.h#newcode136 chrome/browser/extensions/extension_service.h:136: bool is_ready() const { return ready_.has_happened(); } On 2013/05/15 ...
7 years, 7 months ago (2013-05-15 22:41:54 UTC) #6
Jeffrey Yasskin
https://codereview.chromium.org/14757022/diff/19001/chrome/browser/extensions/extension_service.h File chrome/browser/extensions/extension_service.h (right): https://codereview.chromium.org/14757022/diff/19001/chrome/browser/extensions/extension_service.h#newcode136 chrome/browser/extensions/extension_service.h:136: bool is_ready() const { return ready_.has_happened(); } On 2013/05/15 ...
7 years, 7 months ago (2013-05-15 22:46:50 UTC) #7
Matt Perry
https://codereview.chromium.org/14757022/diff/19001/extensions/common/async_event.h File extensions/common/async_event.h (right): https://codereview.chromium.org/14757022/diff/19001/extensions/common/async_event.h#newcode32 extensions/common/async_event.h:32: // WaitableEventWatchers, but using it is simpler. On 2013/05/15 ...
7 years, 7 months ago (2013-05-15 22:55:40 UTC) #8
Jeffrey Yasskin
https://codereview.chromium.org/14757022/diff/19001/extensions/common/async_event.h File extensions/common/async_event.h (right): https://codereview.chromium.org/14757022/diff/19001/extensions/common/async_event.h#newcode32 extensions/common/async_event.h:32: // WaitableEventWatchers, but using it is simpler. On 2013/05/15 ...
7 years, 7 months ago (2013-05-15 23:17:53 UTC) #9
Jeffrey Yasskin
Andrew, would you review the line in background_application_list_model_unittest?
7 years, 7 months ago (2013-05-15 23:26:26 UTC) #10
Matt Perry
lgtm https://codereview.chromium.org/14757022/diff/39001/chrome/browser/extensions/test_extension_system.cc File chrome/browser/extensions/test_extension_system.cc (right): https://codereview.chromium.org/14757022/diff/39001/chrome/browser/extensions/test_extension_system.cc#newcode188 chrome/browser/extensions/test_extension_system.cc:188: void TestExtensionSystem::MakeReady() { ready_.Signal(); } Might this cause ...
7 years, 7 months ago (2013-05-16 00:55:50 UTC) #11
Jeffrey Yasskin
https://codereview.chromium.org/14757022/diff/39001/chrome/browser/extensions/test_extension_system.cc File chrome/browser/extensions/test_extension_system.cc (right): https://codereview.chromium.org/14757022/diff/39001/chrome/browser/extensions/test_extension_system.cc#newcode188 chrome/browser/extensions/test_extension_system.cc:188: void TestExtensionSystem::MakeReady() { ready_.Signal(); } On 2013/05/16 00:55:50, Matt ...
7 years, 7 months ago (2013-05-16 00:59:20 UTC) #12
Andrew T Wilson (Slow)
browser/background LGTM
7 years, 7 months ago (2013-05-16 08:58:13 UTC) #13
not at google - send to devlin
just adding a few thoughts, I know it's already been lg'd. https://codereview.chromium.org/14757022/diff/39001/chrome/browser/extensions/extension_system.h File chrome/browser/extensions/extension_system.h (right): ...
7 years, 7 months ago (2013-05-16 15:51:08 UTC) #14
Jeffrey Yasskin
https://codereview.chromium.org/14757022/diff/39001/chrome/browser/extensions/extension_system.h File chrome/browser/extensions/extension_system.h (right): https://codereview.chromium.org/14757022/diff/39001/chrome/browser/extensions/extension_system.h#newcode145 chrome/browser/extensions/extension_system.h:145: // Whether the extension system has completed its startup ...
7 years, 7 months ago (2013-05-16 19:05:35 UTC) #15
Matt Perry
https://codereview.chromium.org/14757022/diff/39001/extensions/common/one_shot_event.cc File extensions/common/one_shot_event.cc (right): https://codereview.chromium.org/14757022/diff/39001/extensions/common/one_shot_event.cc#newcode42 extensions/common/one_shot_event.cc:42: if (is_signaled()) { On 2013/05/16 19:05:36, Jeffrey Yasskin wrote: ...
7 years, 7 months ago (2013-05-16 19:12:03 UTC) #16
not at google - send to devlin
My current favourite name is Post(), it's the only one so far which is both ...
7 years, 7 months ago (2013-05-16 19:13:16 UTC) #17
Jeffrey Yasskin
https://codereview.chromium.org/14757022/diff/39001/extensions/common/one_shot_event.cc File extensions/common/one_shot_event.cc (right): https://codereview.chromium.org/14757022/diff/39001/extensions/common/one_shot_event.cc#newcode42 extensions/common/one_shot_event.cc:42: if (is_signaled()) { On 2013/05/16 19:12:04, Matt Perry wrote: ...
7 years, 7 months ago (2013-05-16 19:14:42 UTC) #18
Jeffrey Yasskin
https://codereview.chromium.org/14757022/diff/39001/extensions/common/one_shot_event.cc File extensions/common/one_shot_event.cc (right): https://codereview.chromium.org/14757022/diff/39001/extensions/common/one_shot_event.cc#newcode42 extensions/common/one_shot_event.cc:42: if (is_signaled()) { On 2013/05/16 19:14:42, Jeffrey Yasskin wrote: ...
7 years, 7 months ago (2013-05-16 21:36:16 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jyasskin@chromium.org/14757022/61001
7 years, 7 months ago (2013-05-16 21:37:12 UTC) #20
not at google - send to devlin
https://codereview.chromium.org/14757022/diff/39001/chrome/browser/extensions/extension_system.h File chrome/browser/extensions/extension_system.h (right): https://codereview.chromium.org/14757022/diff/39001/chrome/browser/extensions/extension_system.h#newcode152 chrome/browser/extensions/extension_system.h:152: virtual void ExtensionServiceReady() = 0; On 2013/05/16 19:05:36, Jeffrey ...
7 years, 7 months ago (2013-05-16 21:38:17 UTC) #21
Jeffrey Yasskin
https://codereview.chromium.org/14757022/diff/39001/chrome/browser/extensions/extension_system.h File chrome/browser/extensions/extension_system.h (right): https://codereview.chromium.org/14757022/diff/39001/chrome/browser/extensions/extension_system.h#newcode152 chrome/browser/extensions/extension_system.h:152: virtual void ExtensionServiceReady() = 0; On 2013/05/16 21:38:17, kalman ...
7 years, 7 months ago (2013-05-16 22:19:21 UTC) #22
not at google - send to devlin
nice, thanks for that. lgtm but see my comment about testing, it's an important corner ...
7 years, 7 months ago (2013-05-16 22:26:11 UTC) #23
Jeffrey Yasskin
https://codereview.chromium.org/14757022/diff/88001/extensions/common/one_shot_event_unittest.cc File extensions/common/one_shot_event_unittest.cc (right): https://codereview.chromium.org/14757022/diff/88001/extensions/common/one_shot_event_unittest.cc#newcode16 extensions/common/one_shot_event_unittest.cc:16: void Increment(int* i) { ++*i; } On 2013/05/16 22:26:11, ...
7 years, 7 months ago (2013-05-16 22:45:51 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jyasskin@chromium.org/14757022/75002
7 years, 7 months ago (2013-05-16 23:04:48 UTC) #25
commit-bot: I haz the power
Retried try job too often on win_rel for step(s) interactive_ui_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_rel&number=150154
7 years, 7 months ago (2013-05-17 07:25:51 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jyasskin@chromium.org/14757022/75002
7 years, 7 months ago (2013-05-17 15:37:37 UTC) #27
commit-bot: I haz the power
Retried try job too often on win_rel for step(s) interactive_ui_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_rel&number=150373
7 years, 7 months ago (2013-05-17 19:30:47 UTC) #28
Jeffrey Yasskin
7 years, 7 months ago (2013-05-17 23:18:40 UTC) #29
Message was sent while issue was closed.
Committed patchset #10 manually as r200918 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698