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

Issue 2612873004: Remove some usages of AsyncExtensionFunction::results_. (Closed)

Created:
3 years, 11 months ago by lazyboy
Modified:
3 years, 11 months ago
Reviewers:
Devlin
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, stevenjb+watch_chromium.org, extensions-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Introduce AlreadyResponded() response action from ExtensionFunction. Currently ExtensionFunction::Run has to either: call RespondNow() to synchronously respond or call RespondLater() to asynchronously Respond() later point in time after Run() finishes. There are some asynchronous ExtensionFunction implementations where, due to how base:: callbacks are used in them, it can be difficult to pick either one of the two responses above. This happens when a callback used in Run() can sometimes synchronously fire and if the callback calls Respond(), then returning RespondLater() from Run() would be a wrong choice. This CL provides AlreadyResponded() response action for those cases. While returning response from Run(), the ExtensionFunction can check whether it has already responded and return AlreadyResponded(). Otherwise, it can return RespondLater(). This CL removes some usages of AsyncExtensionFunction::results_ in turn. This CL also converts those classes to directly inherit from UIThreadExtensionFunction. BUG=648275 Review-Url: https://codereview.chromium.org/2612873004 Cr-Commit-Position: refs/heads/master@{#445507} Committed: https://chromium.googlesource.com/chromium/src/+/30abd07e271e93f99b70745a08b360793be779cc

Patch Set 1 #

Total comments: 15

Patch Set 2 : fix async calls + introduce AlreadyResponded() #

Patch Set 3 : revert system_network_api changes #

Patch Set 4 : add DCHECK message #

Total comments: 4

Patch Set 5 : address comments #

Patch Set 6 : fix argument types of Get*NetworksFunction #

Patch Set 7 : sync #

Unified diffs Side-by-side diffs Delta from patch set Stats (+335 lines, -275 lines) Patch
M extensions/browser/api/management/management_api.h View 7 chunks +6 lines, -11 lines 0 comments Download
M extensions/browser/api/management/management_api.cc View 1 2 3 4 10 chunks +42 lines, -60 lines 0 comments Download
M extensions/browser/api/networking_private/networking_private_api.h View 1 35 chunks +63 lines, -57 lines 0 comments Download
M extensions/browser/api/networking_private/networking_private_api.cc View 1 2 3 4 5 39 chunks +161 lines, -122 lines 0 comments Download
M extensions/browser/api/system_storage/system_storage_api.h View 1 4 chunks +11 lines, -7 lines 0 comments Download
M extensions/browser/api/system_storage/system_storage_api.cc View 1 6 chunks +15 lines, -17 lines 0 comments Download
M extensions/browser/extension_function.h View 1 2 chunks +24 lines, -1 line 0 comments Download
M extensions/browser/extension_function.cc View 1 2 3 4 2 chunks +13 lines, -0 lines 0 comments Download

Messages

Total messages: 29 (19 generated)
lazyboy
https://codereview.chromium.org/2612873004/diff/1/extensions/browser/api/management/management_api.cc File extensions/browser/api/management/management_api.cc (right): https://codereview.chromium.org/2612873004/diff/1/extensions/browser/api/management/management_api.cc#newcode342 extensions/browser/api/management/management_api.cc:342: return RespondNow(Error("")); There was a Release(Ref) call in OnParseFailure(), ...
3 years, 11 months ago (2017-01-06 03:40:30 UTC) #3
Devlin
Thanks for helping! :) https://codereview.chromium.org/2612873004/diff/1/extensions/browser/api/management/management_api.cc File extensions/browser/api/management/management_api.cc (right): https://codereview.chromium.org/2612873004/diff/1/extensions/browser/api/management/management_api.cc#newcode342 extensions/browser/api/management/management_api.cc:342: return RespondNow(Error("")); let's make this ...
3 years, 11 months ago (2017-01-06 15:51:06 UTC) #4
lazyboy
Still trying to figure out what we should do here... https://codereview.chromium.org/2612873004/diff/1/extensions/browser/api/management/management_api.cc File extensions/browser/api/management/management_api.cc (right): https://codereview.chromium.org/2612873004/diff/1/extensions/browser/api/management/management_api.cc#newcode670 ...
3 years, 11 months ago (2017-01-07 02:55:18 UTC) #5
Devlin
https://codereview.chromium.org/2612873004/diff/1/extensions/browser/api/management/management_api.cc File extensions/browser/api/management/management_api.cc (right): https://codereview.chromium.org/2612873004/diff/1/extensions/browser/api/management/management_api.cc#newcode670 extensions/browser/api/management/management_api.cc:670: return RespondLater(); On 2017/01/07 02:55:18, lazyboy wrote: > On ...
3 years, 11 months ago (2017-01-09 22:05:26 UTC) #6
lazyboy
I've updated the patch to use AlreadyResponded ResponseAction. https://codereview.chromium.org/2612873004/diff/1/extensions/browser/api/management/management_api.cc File extensions/browser/api/management/management_api.cc (right): https://codereview.chromium.org/2612873004/diff/1/extensions/browser/api/management/management_api.cc#newcode342 extensions/browser/api/management/management_api.cc:342: return ...
3 years, 11 months ago (2017-01-19 03:47:59 UTC) #7
Devlin
Nice! Please also update the CL description. :) https://codereview.chromium.org/2612873004/diff/60001/extensions/browser/api/management/management_api.cc File extensions/browser/api/management/management_api.cc (right): https://codereview.chromium.org/2612873004/diff/60001/extensions/browser/api/management/management_api.cc#newcode636 extensions/browser/api/management/management_api.cc:636: Release(); ...
3 years, 11 months ago (2017-01-20 00:16:02 UTC) #8
lazyboy
CL description updated. https://codereview.chromium.org/2612873004/diff/60001/extensions/browser/api/management/management_api.cc File extensions/browser/api/management/management_api.cc (right): https://codereview.chromium.org/2612873004/diff/60001/extensions/browser/api/management/management_api.cc#newcode636 extensions/browser/api/management/management_api.cc:636: Release(); On 2017/01/20 00:16:01, Devlin (slow) ...
3 years, 11 months ago (2017-01-20 00:54:47 UTC) #10
Devlin
lgtm
3 years, 11 months ago (2017-01-20 16:31:00 UTC) #11
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/2612873004/120001
3 years, 11 months ago (2017-01-23 21:10:53 UTC) #26
commit-bot: I haz the power
3 years, 11 months ago (2017-01-23 22:13:07 UTC) #29
Message was sent while issue was closed.
Committed patchset #7 (id:120001) as
https://chromium.googlesource.com/chromium/src/+/30abd07e271e93f99b70745a08b3...

Powered by Google App Engine
This is Rietveld 408576698