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

Issue 2005753006: ImageCapture: ScopedResultCallback (Closed)

Created:
4 years, 7 months ago by mcasas
Modified:
4 years, 6 months ago
CC:
Aaron Boodman, abarth-chromium, ben+mojo_chromium.org, chromium-reviews, darin (slow to review), darin-cc_chromium.org, feature-media-reviews_chromium.org, jam, mcasas+watch+vc_chromium.org, miu+watch_chromium.org, posciak+watch_chromium.org, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

ImageCapture: ScopedResultCallback ImageCapture mojo command servicing in the Browser needs to jump several threads (UI --> IO --> Device(s)). On ToT, each possible error condition in this chain is treated more or less individually, which is ugly, (especially as I'm adding capability retrieval/settings in // CLs). This CL proposes ScopedResultCallback, which is a move-only type wrapping a Mojo |callback_| _and_ an associated |error_callback_|, which is a callback provided to signal to Blink-side that something went wrong. Using and passing this callback along the callstack allows for: - removing the boolean return value - not having to run the callback by hand: If and when the methods/functions receiving this ScopedCallback don't Run() it nor pass it explicitly, it would be tantamount to "rejecting" it. For reference, the callstack follows a sequence: ImageCaptureImpl --> VideoCaptureManager --> VideoCaptureDevice (implementation). BUG=518807 Committed: https://crrev.com/033172cfd48f0c1d634324a38bf75711572cfb13 Cr-Commit-Position: refs/heads/master@{#397182}

Patch Set 1 #

Total comments: 10

Patch Set 2 : reillyg@ comments #

Total comments: 4

Patch Set 3 : Android and threading #

Total comments: 12

Patch Set 4 : reillyg@ second round of comments #

Total comments: 4

Patch Set 5 : miu@s comments #

Total comments: 16

Patch Set 6 : miu@s comments (minus renaming) #

Patch Set 7 : s/ScopedCallback/ScopedResultCallback/ #

Total comments: 2

Patch Set 8 : rockot@s nit #

Unified diffs Side-by-side diffs Delta from patch set Stats (+184 lines, -121 lines) Patch
M content/browser/media/capture/image_capture_impl.cc View 1 2 3 4 5 6 2 chunks +44 lines, -27 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_manager.h View 1 2 3 4 5 6 2 chunks +3 lines, -7 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_manager.cc View 1 2 3 4 5 6 1 chunk +8 lines, -20 lines 0 comments Download
M media/capture.gypi View 1 2 3 4 5 6 3 chunks +4 lines, -3 lines 0 comments Download
M media/capture/BUILD.gn View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
A media/capture/video/DEPS View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download
M media/capture/video/android/video_capture_device_android.h View 1 2 3 4 5 6 2 chunks +3 lines, -2 lines 0 comments Download
M media/capture/video/android/video_capture_device_android.cc View 1 2 3 4 5 6 4 chunks +19 lines, -27 lines 0 comments Download
M media/capture/video/fake_video_capture_device.h View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M media/capture/video/fake_video_capture_device.cc View 1 2 3 4 5 6 3 chunks +15 lines, -13 lines 0 comments Download
M media/capture/video/fake_video_capture_device_unittest.cc View 1 2 3 4 5 6 3 chunks +16 lines, -10 lines 0 comments Download
A media/capture/video/scoped_result_callback.h View 1 2 3 4 5 6 7 1 chunk +58 lines, -0 lines 0 comments Download
M media/capture/video/video_capture_device.h View 1 2 3 4 5 6 2 chunks +7 lines, -7 lines 0 comments Download
M media/capture/video/video_capture_device.cc View 1 2 3 4 5 6 1 chunk +2 lines, -4 lines 0 comments Download

Messages

Total messages: 53 (27 generated)
mcasas
reillyg@ can you please take a first look? FTR, the call sequence is: ImageCaptureImpl --> ...
4 years, 7 months ago (2016-05-25 16:27:50 UTC) #6
Reilly Grant (use Gerrit)
https://codereview.chromium.org/2005753006/diff/60001/media/capture/video/android/video_capture_device_android.cc File media/capture/video/android/video_capture_device_android.cc (right): https://codereview.chromium.org/2005753006/diff/60001/media/capture/video/android/video_capture_device_android.cc#newcode150 media/capture/video/android/video_capture_device_android.cc:150: new ScopedMojoCallback<TakePhotoCallback>(callback)); Something is wrong here. Shouldn't it be ...
4 years, 7 months ago (2016-05-25 18:32:57 UTC) #8
mcasas
reillyg@ PTAL (VCDAndroid still untested) https://codereview.chromium.org/2005753006/diff/60001/media/capture/video/android/video_capture_device_android.cc File media/capture/video/android/video_capture_device_android.cc (right): https://codereview.chromium.org/2005753006/diff/60001/media/capture/video/android/video_capture_device_android.cc#newcode150 media/capture/video/android/video_capture_device_android.cc:150: new ScopedMojoCallback<TakePhotoCallback>(callback)); On 2016/05/25 ...
4 years, 7 months ago (2016-05-26 00:02:21 UTC) #11
Reilly Grant (use Gerrit)
ScopedCallback looks good (with nits) but this patch needs more testing before I'll sign off ...
4 years, 7 months ago (2016-05-26 00:27:45 UTC) #12
mcasas
reillyg@ now the Android part is working, and had to fine tune the threading in ...
4 years, 7 months ago (2016-05-26 17:24:04 UTC) #14
Reilly Grant (use Gerrit)
lgtm with nits https://codereview.chromium.org/2005753006/diff/140001/content/browser/media/capture/image_capture_impl.cc File content/browser/media/capture/image_capture_impl.cc (right): https://codereview.chromium.org/2005753006/diff/140001/content/browser/media/capture/image_capture_impl.cc#newcode82 content/browser/media/capture/image_capture_impl.cc:82: std::move(callback), nit: Unnecessary move. https://codereview.chromium.org/2005753006/diff/140001/content/browser/media/capture/image_capture_impl.cc#newcode99 content/browser/media/capture/image_capture_impl.cc:99: ...
4 years, 7 months ago (2016-05-26 17:50:04 UTC) #16
mcasas
miu@ PTAL (especially at image_capture_impl.cc and scoped_callback.h) https://codereview.chromium.org/2005753006/diff/140001/content/browser/media/capture/image_capture_impl.cc File content/browser/media/capture/image_capture_impl.cc (right): https://codereview.chromium.org/2005753006/diff/140001/content/browser/media/capture/image_capture_impl.cc#newcode82 content/browser/media/capture/image_capture_impl.cc:82: std::move(callback), On ...
4 years, 7 months ago (2016-05-26 18:33:32 UTC) #18
miu
Initial comments on Patch Set 4: https://codereview.chromium.org/2005753006/diff/160001/content/browser/media/capture/image_capture_impl.cc File content/browser/media/capture/image_capture_impl.cc (right): https://codereview.chromium.org/2005753006/diff/160001/content/browser/media/capture/image_capture_impl.cc#newcode33 content/browser/media/capture/image_capture_impl.cc:33: if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { ...
4 years, 6 months ago (2016-05-27 22:36:38 UTC) #19
mcasas
miu@ PTAL https://codereview.chromium.org/2005753006/diff/160001/content/browser/media/capture/image_capture_impl.cc File content/browser/media/capture/image_capture_impl.cc (right): https://codereview.chromium.org/2005753006/diff/160001/content/browser/media/capture/image_capture_impl.cc#newcode33 content/browser/media/capture/image_capture_impl.cc:33: if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { On 2016/05/27 22:36:38, miu ...
4 years, 6 months ago (2016-05-27 23:36:06 UTC) #20
miu
I like this idea. This utility would be useful in a number of situations I've ...
4 years, 6 months ago (2016-05-28 01:29:56 UTC) #21
mcasas
miu@ PTAL https://codereview.chromium.org/2005753006/diff/180001/media/capture/video/DEPS File media/capture/video/DEPS (right): https://codereview.chromium.org/2005753006/diff/180001/media/capture/video/DEPS#newcode2 media/capture/video/DEPS:2: "+third_party/WebKit/public/platform/modules/imagecapture", On 2016/05/28 01:29:56, miu wrote: > ...
4 years, 6 months ago (2016-05-31 20:19:05 UTC) #24
miu
lgtm % nit: https://codereview.chromium.org/2005753006/diff/180001/media/capture/video/scoped_callback.h File media/capture/video/scoped_callback.h (right): https://codereview.chromium.org/2005753006/diff/180001/media/capture/video/scoped_callback.h#newcode17 media/capture/video/scoped_callback.h:17: class ScopedCallback { On 2016/05/31 20:19:04, ...
4 years, 6 months ago (2016-06-01 00:53:37 UTC) #27
mcasas
xhwang@ plz RS for trivial media/capture.gypi addition. https://codereview.chromium.org/2005753006/diff/180001/media/capture/video/scoped_callback.h File media/capture/video/scoped_callback.h (right): https://codereview.chromium.org/2005753006/diff/180001/media/capture/video/scoped_callback.h#newcode17 media/capture/video/scoped_callback.h:17: class ScopedCallback ...
4 years, 6 months ago (2016-06-01 01:21:01 UTC) #31
xhwang
rs lgtm
4 years, 6 months ago (2016-06-01 04:13:13 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2005753006/300001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2005753006/300001
4 years, 6 months ago (2016-06-01 04:20:42 UTC) #35
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/192692)
4 years, 6 months ago (2016-06-01 04:27:39 UTC) #37
mcasas
rockot@ OWNERS RS for addition to a DEPS: ** Presubmit ERRORS ** Missing LGTM from ...
4 years, 6 months ago (2016-06-01 06:12:32 UTC) #39
Ken Rockot(use gerrit already)
lgtm but I have an inline nit as a non-OWNER https://codereview.chromium.org/2005753006/diff/300001/media/capture/video/scoped_result_callback.h File media/capture/video/scoped_result_callback.h (right): https://codereview.chromium.org/2005753006/diff/300001/media/capture/video/scoped_result_callback.h#newcode39 ...
4 years, 6 months ago (2016-06-01 06:23:52 UTC) #40
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2005753006/320001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2005753006/320001
4 years, 6 months ago (2016-06-01 16:08:22 UTC) #43
Ken Rockot(use gerrit already)
Forgot to mention, might want to update the CL description (ScopedReturnCallback?)
4 years, 6 months ago (2016-06-01 16:15:35 UTC) #44
mcasas
rockot@: the CL description was changed to ScopedReturnCallback a while back but the emails being ...
4 years, 6 months ago (2016-06-01 17:12:08 UTC) #45
xhwang
On 2016/06/01 17:12:08, mcasas wrote: > rockot@: the CL description was changed > to ScopedReturnCallback ...
4 years, 6 months ago (2016-06-01 17:19:39 UTC) #46
Ken Rockot(use gerrit already)
On 2016/06/01 at 17:19:39, xhwang wrote: > On 2016/06/01 17:12:08, mcasas wrote: > > rockot@: ...
4 years, 6 months ago (2016-06-01 17:32:01 UTC) #47
mcasas
On 2016/06/01 17:32:01, Ken Rockot wrote: > On 2016/06/01 at 17:19:39, xhwang wrote: > > ...
4 years, 6 months ago (2016-06-01 17:46:04 UTC) #49
commit-bot: I haz the power
Committed patchset #8 (id:320001)
4 years, 6 months ago (2016-06-01 17:59:58 UTC) #51
commit-bot: I haz the power
4 years, 6 months ago (2016-06-01 18:02:06 UTC) #53
Message was sent while issue was closed.
Patchset 8 (id:??) landed as
https://crrev.com/033172cfd48f0c1d634324a38bf75711572cfb13
Cr-Commit-Position: refs/heads/master@{#397182}

Powered by Google App Engine
This is Rietveld 408576698