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

Issue 1926873002: MediaStream Image Capture (3): Adding mojo and browser impl for dummy takePhoto(). (Closed)

Created:
4 years, 7 months ago by mcasas
Modified:
4 years, 7 months ago
CC:
Aaron Boodman, abarth-chromium, ben+mojo_chromium.org, blink-reviews, blink-reviews-api_chromium.org, chromium-reviews, creis+watch_chromium.org, darin (slow to review), darin-cc_chromium.org, dglazkov+blink, feature-media-reviews_chromium.org, jam, mcasas+watch+vc_chromium.org, miu+watch_chromium.org, nasko+codewatch_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

MediaStream Image Capture (3): Adding mojo and browser impl for dummy takePhoto(). This CL adds idl and mojo definitions of JS method takePhoto(). It also adds the necessary browser side files: context and implementation. finally, it plugs them into RendererBlinkPlatformImpl. (The idea is to land all the necessary files and gyp/gn/DEPS changes without having to dig deep into the functionality, since that would make the CL intractable, and would ramify into MediaStreamManager, VideoCaptureManager etc.) A LayoutTest is also added for takePhoto(). BUG=518807 TEST= run demo html in https://cdn.rawgit.com/Miguelao/demos/master/imagecapture.html with flag --enable-blink-features=ImageCapture (click on "Open Camera 320x240", then on "Create Image Capturer" and finally, repeatedly, on "takePhoto"). Committed: https://crrev.com/5b6b8cb7dce823cd25c9ff0aa695559b4bc3a432 Cr-Commit-Position: refs/heads/master@{#391163}

Patch Set 1 : #

Total comments: 4

Patch Set 2 : reillyg@ comments #

Total comments: 11

Patch Set 3 : comments; rebased; removed ImageCaptureContext. #

Total comments: 2

Patch Set 4 : Removed isActive() in favour of checking m_serviceRequests.isEmpty() #

Total comments: 4

Patch Set 5 : haraken@ comments #

Total comments: 6

Patch Set 6 : miu@s comments and minor rebase. #

Total comments: 4

Patch Set 7 : dcheng@ comments: |string data| --> array<uint8_t> #

Total comments: 2

Patch Set 8 : const auto& #

Unified diffs Side-by-side diffs Delta from patch set Stats (+204 lines, -4 lines) Patch
M content/browser/DEPS View 1 chunk +1 line, -0 lines 0 comments Download
A content/browser/media/capture/image_capture_impl.h View 1 2 3 4 5 1 chunk +35 lines, -0 lines 0 comments Download
A content/browser/media/capture/image_capture_impl.cc View 1 2 3 4 5 6 1 chunk +34 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_process_host_impl.cc View 1 2 2 chunks +5 lines, -0 lines 0 comments Download
M content/content_browser.gypi View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-takePhoto.html View 1 chunk +32 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/imagecapture/ImageCapture.h View 1 2 3 4 5 6 3 chunks +9 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp View 1 2 3 4 5 6 7 5 chunks +72 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/modules/imagecapture/ImageCapture.idl View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/public/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/public/blink.gyp View 1 chunk +1 line, -0 lines 0 comments Download
A + third_party/WebKit/public/platform/modules/imagecapture/OWNERS View 1 2 0 chunks +-1 lines, --1 lines 0 comments Download
A third_party/WebKit/public/platform/modules/imagecapture/image_capture.mojom View 1 2 3 4 5 6 1 chunk +11 lines, -0 lines 0 comments Download

Messages

Total messages: 45 (14 generated)
Reilly Grant (use Gerrit)
https://codereview.chromium.org/1926873002/diff/60001/content/browser/media/capture/image_capture_context.h File content/browser/media/capture/image_capture_context.h (right): https://codereview.chromium.org/1926873002/diff/60001/content/browser/media/capture/image_capture_context.h#newcode8 content/browser/media/capture/image_capture_context.h:8: #include "base/memory/scoped_vector.h" ScopedVector is deprecated in favor of std::vector<std::unique_ptr>. ...
4 years, 7 months ago (2016-04-28 00:44:03 UTC) #6
mcasas
PTAL https://codereview.chromium.org/1926873002/diff/60001/content/browser/media/capture/image_capture_context.h File content/browser/media/capture/image_capture_context.h (right): https://codereview.chromium.org/1926873002/diff/60001/content/browser/media/capture/image_capture_context.h#newcode8 content/browser/media/capture/image_capture_context.h:8: #include "base/memory/scoped_vector.h" On 2016/04/28 00:44:03, Reilly Grant wrote: ...
4 years, 7 months ago (2016-04-28 01:03:09 UTC) #7
Reilly Grant (use Gerrit)
https://codereview.chromium.org/1926873002/diff/80001/content/browser/media/capture/image_capture_context.cc File content/browser/media/capture/image_capture_context.cc (right): https://codereview.chromium.org/1926873002/diff/80001/content/browser/media/capture/image_capture_context.cc#newcode17 content/browser/media/capture/image_capture_context.cc:17: services_.push_back(std::unique_ptr<ImageCaptureImpl>( Sorry, I should have been clearer. Now that ...
4 years, 7 months ago (2016-04-28 01:09:57 UTC) #8
haraken
https://codereview.chromium.org/1926873002/diff/80001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp File third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp (right): https://codereview.chromium.org/1926873002/diff/80001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp#newcode141 third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp:141: if (isActive(resolver)) Why do we need to check isActive? ...
4 years, 7 months ago (2016-04-28 15:20:00 UTC) #10
Reilly Grant (use Gerrit)
https://codereview.chromium.org/1926873002/diff/80001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp File third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp (right): https://codereview.chromium.org/1926873002/diff/80001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp#newcode141 third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp:141: if (isActive(resolver)) On 2016/04/28 at 15:19:59, haraken wrote: > ...
4 years, 7 months ago (2016-04-28 15:27:56 UTC) #11
haraken
https://codereview.chromium.org/1926873002/diff/80001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp File third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp (right): https://codereview.chromium.org/1926873002/diff/80001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp#newcode141 third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp:141: if (isActive(resolver)) On 2016/04/28 15:27:56, Reilly Grant wrote: > ...
4 years, 7 months ago (2016-04-28 15:45:00 UTC) #12
Reilly Grant (use Gerrit)
https://codereview.chromium.org/1926873002/diff/80001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp File third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp (right): https://codereview.chromium.org/1926873002/diff/80001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp#newcode128 third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp:128: resolver->reject(DOMException::create(AbortError, "Operation was aborted")); If the context is inactive ...
4 years, 7 months ago (2016-04-28 16:19:40 UTC) #13
dcheng
https://codereview.chromium.org/1926873002/diff/80001/third_party/WebKit/public/platform/modules/imagecapture/image_capture.mojom File third_party/WebKit/public/platform/modules/imagecapture/image_capture.mojom (right): https://codereview.chromium.org/1926873002/diff/80001/third_party/WebKit/public/platform/modules/imagecapture/image_capture.mojom#newcode1 third_party/WebKit/public/platform/modules/imagecapture/image_capture.mojom:1: // Copyright 2016 The Chromium Authors. All rights reserved. ...
4 years, 7 months ago (2016-04-28 16:57:28 UTC) #15
mcasas
guys PTAL https://codereview.chromium.org/1926873002/diff/80001/content/browser/media/capture/image_capture_context.cc File content/browser/media/capture/image_capture_context.cc (right): https://codereview.chromium.org/1926873002/diff/80001/content/browser/media/capture/image_capture_context.cc#newcode17 content/browser/media/capture/image_capture_context.cc:17: services_.push_back(std::unique_ptr<ImageCaptureImpl>( On 2016/04/28 01:09:57, Reilly Grant wrote: ...
4 years, 7 months ago (2016-04-28 19:35:49 UTC) #16
haraken
https://codereview.chromium.org/1926873002/diff/100001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp File third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp (right): https://codereview.chromium.org/1926873002/diff/100001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp#newcode148 third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp:148: if (!isActive(resolver)) Would you instead check if(m_serviceRequests.isEmpty()) and remove ...
4 years, 7 months ago (2016-04-28 19:41:36 UTC) #17
mcasas
https://codereview.chromium.org/1926873002/diff/100001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp File third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp (right): https://codereview.chromium.org/1926873002/diff/100001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp#newcode148 third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp:148: if (!isActive(resolver)) On 2016/04/28 19:41:36, haraken wrote: > > ...
4 years, 7 months ago (2016-04-28 20:13:16 UTC) #18
haraken
https://codereview.chromium.org/1926873002/diff/120001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp File third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp (right): https://codereview.chromium.org/1926873002/diff/120001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp#newcode72 third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp:72: m_serviceRequests.clear(); I'm just curious but don't you need to ...
4 years, 7 months ago (2016-04-29 06:50:20 UTC) #20
mcasas
guys PTAL https://codereview.chromium.org/1926873002/diff/120001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp File third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp (right): https://codereview.chromium.org/1926873002/diff/120001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp#newcode72 third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp:72: m_serviceRequests.clear(); On 2016/04/29 06:50:20, haraken wrote: > ...
4 years, 7 months ago (2016-04-29 21:03:14 UTC) #21
haraken
On 2016/04/29 21:03:14, mcasas wrote: > guys PTAL > > https://codereview.chromium.org/1926873002/diff/120001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp > File third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp (right): ...
4 years, 7 months ago (2016-04-30 04:35:54 UTC) #22
yhirano
On 2016/04/30 04:35:54, haraken wrote: > On 2016/04/29 21:03:14, mcasas wrote: > > guys PTAL ...
4 years, 7 months ago (2016-05-02 03:17:52 UTC) #23
haraken
On 2016/05/02 03:17:52, yhirano wrote: > On 2016/04/30 04:35:54, haraken wrote: > > On 2016/04/29 ...
4 years, 7 months ago (2016-05-02 03:45:57 UTC) #24
Reilly Grant (use Gerrit)
lgtm
4 years, 7 months ago (2016-05-02 17:53:22 UTC) #25
mcasas
miu@ PTAL at content/browser/media/capture plz
4 years, 7 months ago (2016-05-02 21:28:48 UTC) #27
miu
lgtm, with advice: https://codereview.chromium.org/1926873002/diff/140001/content/browser/media/capture/image_capture_impl.cc File content/browser/media/capture/image_capture_impl.cc (right): https://codereview.chromium.org/1926873002/diff/140001/content/browser/media/capture/image_capture_impl.cc#newcode31 content/browser/media/capture/image_capture_impl.cc:31: : binding_(this, std::move(request)) {} Weird! But, ...
4 years, 7 months ago (2016-05-02 21:44:51 UTC) #28
mcasas
piman@ plz RS content/browser/DEPS content/browser/renderer_host/render_process_host_impl.cc https://codereview.chromium.org/1926873002/diff/140001/content/browser/media/capture/image_capture_impl.cc File content/browser/media/capture/image_capture_impl.cc (right): https://codereview.chromium.org/1926873002/diff/140001/content/browser/media/capture/image_capture_impl.cc#newcode31 content/browser/media/capture/image_capture_impl.cc:31: : binding_(this, std::move(request)) {} ...
4 years, 7 months ago (2016-05-02 22:03:36 UTC) #30
piman
lgtm
4 years, 7 months ago (2016-05-02 22:14:25 UTC) #31
mcasas
dcheng@ plz RS changes in third_party/WebKit/public/
4 years, 7 months ago (2016-05-02 22:31:52 UTC) #32
dcheng
https://codereview.chromium.org/1926873002/diff/160001/content/browser/media/capture/image_capture_impl.cc File content/browser/media/capture/image_capture_impl.cc (right): https://codereview.chromium.org/1926873002/diff/160001/content/browser/media/capture/image_capture_impl.cc#newcode26 content/browser/media/capture/image_capture_impl.cc:26: callback.Run("text/plain", "not implemented"); Please add a mojom reviewer when ...
4 years, 7 months ago (2016-05-02 22:38:58 UTC) #33
mcasas
dcheng@ PTAL https://codereview.chromium.org/1926873002/diff/160001/content/browser/media/capture/image_capture_impl.cc File content/browser/media/capture/image_capture_impl.cc (right): https://codereview.chromium.org/1926873002/diff/160001/content/browser/media/capture/image_capture_impl.cc#newcode26 content/browser/media/capture/image_capture_impl.cc:26: callback.Run("text/plain", "not implemented"); On 2016/05/02 22:38:58, dcheng ...
4 years, 7 months ago (2016-05-02 23:17:16 UTC) #34
dcheng
lgtm https://codereview.chromium.org/1926873002/diff/180001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp File third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp (right): https://codereview.chromium.org/1926873002/diff/180001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp#newcode146 third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp:146: const auto storage = data.storage(); const auto& to ...
4 years, 7 months ago (2016-05-03 00:23:55 UTC) #35
mcasas
https://codereview.chromium.org/1926873002/diff/180001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp File third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp (right): https://codereview.chromium.org/1926873002/diff/180001/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp#newcode146 third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp:146: const auto storage = data.storage(); On 2016/05/03 00:23:55, dcheng ...
4 years, 7 months ago (2016-05-03 02:00:48 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1926873002/200001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1926873002/200001
4 years, 7 months ago (2016-05-03 02:01:37 UTC) #39
commit-bot: I haz the power
Committed patchset #8 (id:200001)
4 years, 7 months ago (2016-05-03 03:15:00 UTC) #41
commit-bot: I haz the power
Patchset 8 (id:??) landed as https://crrev.com/5b6b8cb7dce823cd25c9ff0aa695559b4bc3a432 Cr-Commit-Position: refs/heads/master@{#391163}
4 years, 7 months ago (2016-05-03 03:17:32 UTC) #43
yhirano
On 2016/05/02 03:45:57, haraken wrote: > On 2016/05/02 03:17:52, yhirano wrote: > > On 2016/04/30 ...
4 years, 7 months ago (2016-05-06 03:43:49 UTC) #44
haraken
4 years, 7 months ago (2016-05-06 03:45:22 UTC) #45
Message was sent while issue was closed.
On 2016/05/06 03:43:49, yhirano wrote:
> On 2016/05/02 03:45:57, haraken wrote:
> > On 2016/05/02 03:17:52, yhirano wrote:
> > > On 2016/04/30 04:35:54, haraken wrote:
> > > > On 2016/04/29 21:03:14, mcasas wrote:
> > > > > guys PTAL
> > > > > 
> > > > >
> > > >
> > >
> >
>
https://codereview.chromium.org/1926873002/diff/120001/third_party/WebKit/Sou...
> > > > > File third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp
> > > (right):
> > > > > 
> > > > >
> > > >
> > >
> >
>
https://codereview.chromium.org/1926873002/diff/120001/third_party/WebKit/Sou...
> > > > > third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp:72:
> > > > > m_serviceRequests.clear();
> > > > > On 2016/04/29 06:50:20, haraken wrote:
> > > > > > 
> > > > > > I'm just curious but don't you need to reject the promises when the
> > > > execution
> > > > > > context is gone?
> > > > > > 
> > > > > 
> > > > > I'm checking other callers like
> > > > > USB::contextDestroyed() [1]
> > > > > PaymentRequest::contextDestroyed() [2]
> > > > > MediaKeys::contextDestroyed() [3]
> > > > > 
> > > > > and none of them do anything special
> > > > > for the promises around.
> > > > > 
> > > > > [1]
> > > > >
> > > >
> > >
> >
>
https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit...
> > > > > [2]
> > > > >
> > > >
> > >
> >
>
https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit...
> > > > > [3]
> > > > >
> > > >
> > >
> >
>
https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit...
> > > > > 
> > > > > 
> > > > > > +yhirano
> > > > 
> > > > I'm wondering why it doesn't hit an assert.
> > > > 
> > > >
> > >
> >
>
https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit...
> > > > 
> > > > All promises must be resolved, rejected or detached before the
> corresponding
> > > > ScriptPromiseResolver gets destructed.
> > > > 
> > > > But given that next week is a holiday week in Tokyo and I'm not sure if
> > > yhirano@
> > > > is available or not, LGTM to land this for now. Let's clarify the point
> once
> > > > yhirano@ is back.
> > > 
> > > That assertion passes when the execution context is stopped. IIUC it
should
> be
> > > stopped before contextDestroyed is called.
> > 
> > ah, got it.
> > 
> > Is it okay that we don't reject the promises when the execution context is
> > stopped?
> 
> Currently ScriptPromiseResolver gets detached when the execution context is
> stopped: after that, calling resolve or reject do nothing. This is related to
> https://codereview.chromium.org/1897783002/ and I'm open to change the
behavior
> if we agree on what we can do after the execution context is stopped.

What's the speced behavior, and how do other browsers behave? Does Promise get
rejected when the execution context stops?

Powered by Google App Engine
This is Rietveld 408576698