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 2308533003: Break tight coupling of VideoCaptureDeviceClient to renderer_host (Closed)

Created:
4 years, 3 months ago by chfremer
Modified:
4 years, 3 months ago
Reviewers:
emircan, mcasas, miu
CC:
chromium-reviews, posciak+watch_chromium.org, jam, feature-media-reviews_chromium.org, darin-cc_chromium.org, mcasas+watch+vc_chromium.org, miu+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Break tight coupling of VideoCaptureDeviceClient to renderer_host This CL is part of the Mojo Video Capture work. For the bigger picture, see [1] CL1.6. This CL is a step towards being able to reuse the classes VideoCaptureDeviceClient and VideoCaptureBufferPool as part of the Video Capture Mojo Service, because they implement functionality that is needed there. Expressed in class-diagram form, we want to go from [2] to [3]. Currently, the classes VideoCaptureDeviceClient and VideoCaptureBufferPool live in content/browser/renderer_host/media. Even though their functionality is not specific to renderer_host, their dependencies create a tight coupling to code that is. In order to use them in services/video_capture, we need to move them out of there (and probably into media/capture/video). In this CL we break the tight coupling by extracting interfaces and having the two classes depend on the abstractions instead of the implementations. The class VideoCaptureDeviceClient has a second type of tight coupling, which is that it knows about BrowserThread and wants to post tasks to the Browser IO thread. We break this dependency by moving the logic to forward calls to the Browser IO Thread into a decorator "PostOnBrowserIoThreadDecorator" (using the Decorator Pattern). No new files are created in this CL. Interfaces will be moved to new files in a new location in a follow-up CL. BUG=584797 TEST=This is a pure refactoring. No new functionality. All tests still pass. [1] https://docs.google.com/a/chromium.org/document/d/1Qw7rw1AJy0QHXjha36jZNiEuxsxWslJ_X-zpOhijvI8/edit?usp=sharing [2] https://docs.google.com/a/chromium.org/drawings/d/1jgDkxl1WvQCO-zeg87eLh5XkB4RP0wt46xlsB_XFfP8/edit?usp=sharing [3] https://docs.google.com/a/chromium.org/drawings/d/12yOdum03TP1dL7DmUjPxtAfSo16K8La6GJovSisqyRk/edit?usp=sharing Committed: https://crrev.com/42b7da0b82c0f67702f3f0f0033d611ff44916f5 Cr-Commit-Position: refs/heads/master@{#419565}

Patch Set 1 #

Patch Set 2 : Merge branch 'master' into DeviceClientRefactor #

Patch Set 3 : Apply method name changes to Mock #

Total comments: 24

Patch Set 4 : mcasas' comments plus rebase #

Total comments: 16

Patch Set 5 : mcasas' & emircan's comments #

Total comments: 16

Patch Set 6 : mcasas' comments #

Total comments: 34

Patch Set 7 : Rename interface/impl, fix tests #

Patch Set 8 : miu's comments #

Patch Set 9 : miu's comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+303 lines, -208 lines) Patch
M content/browser/media/capture/web_contents_video_capture_device_unittest.cc View 1 2 3 4 5 6 3 chunks +3 lines, -3 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_buffer_pool.h View 1 2 3 4 5 6 7 8 5 chunks +98 lines, -66 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_buffer_pool.cc View 1 2 3 4 5 6 7 8 15 chunks +32 lines, -32 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc View 1 2 3 4 5 6 3 chunks +4 lines, -4 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_controller.h View 1 2 3 4 5 6 7 8 3 chunks +20 lines, -8 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_controller.cc View 1 2 3 4 5 6 7 8 7 chunks +56 lines, -7 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_device_client.h View 1 2 3 4 5 6 3 chunks +17 lines, -12 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_device_client.cc View 1 2 3 4 5 6 6 chunks +13 lines, -29 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_device_client_unittest.cc View 1 2 7 chunks +16 lines, -21 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h View 1 2 3 4 5 6 7 8 2 chunks +40 lines, -22 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_manager.cc View 1 2 3 4 5 6 7 8 3 chunks +4 lines, -4 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 52 (28 generated)
chfremer
mcasas@: PTAL emircan@: FYI
4 years, 3 months ago (2016-09-02 19:56:28 UTC) #4
mcasas
A couple of comments https://codereview.chromium.org/2308533003/diff/40001/content/browser/renderer_host/media/video_capture_buffer_pool.h File content/browser/renderer_host/media/video_capture_buffer_pool.h (right): https://codereview.chromium.org/2308533003/diff/40001/content/browser/renderer_host/media/video_capture_buffer_pool.h#newcode41 content/browser/renderer_host/media/video_capture_buffer_pool.h:41: class CONTENT_EXPORT VideoCaptureBufferPoolInterface Using Base ...
4 years, 3 months ago (2016-09-07 22:43:40 UTC) #17
chfremer
https://codereview.chromium.org/2308533003/diff/40001/content/browser/renderer_host/media/video_capture_buffer_pool.h File content/browser/renderer_host/media/video_capture_buffer_pool.h (right): https://codereview.chromium.org/2308533003/diff/40001/content/browser/renderer_host/media/video_capture_buffer_pool.h#newcode41 content/browser/renderer_host/media/video_capture_buffer_pool.h:41: class CONTENT_EXPORT VideoCaptureBufferPoolInterface On 2016/09/07 22:43:40, mcasas wrote: > ...
4 years, 3 months ago (2016-09-08 17:28:51 UTC) #19
emircan
https://codereview.chromium.org/2308533003/diff/60001/content/browser/renderer_host/media/video_capture_buffer_pool.h File content/browser/renderer_host/media/video_capture_buffer_pool.h (right): https://codereview.chromium.org/2308533003/diff/60001/content/browser/renderer_host/media/video_capture_buffer_pool.h#newcode28 content/browser/renderer_host/media/video_capture_buffer_pool.h:28: // TODO(emircan): See https://crbug.com/521059, refactor this class. You can ...
4 years, 3 months ago (2016-09-08 19:57:56 UTC) #20
mcasas
https://codereview.chromium.org/2308533003/diff/40001/content/browser/renderer_host/media/video_capture_controller.cc File content/browser/renderer_host/media/video_capture_controller.cc (right): https://codereview.chromium.org/2308533003/diff/40001/content/browser/renderer_host/media/video_capture_controller.cc#newcode96 content/browser/renderer_host/media/video_capture_controller.cc:96: }; On 2016/09/08 17:28:51, chfremer wrote: > On 2016/09/07 ...
4 years, 3 months ago (2016-09-08 20:25:45 UTC) #21
chfremer
I am posting my replies to the open comments at this time without uploading a ...
4 years, 3 months ago (2016-09-09 00:55:38 UTC) #22
chfremer
mcasas@: PTAL emircan@: PTAL https://codereview.chromium.org/2308533003/diff/40001/content/browser/renderer_host/media/video_capture_device_client.cc File content/browser/renderer_host/media/video_capture_device_client.cc (right): https://codereview.chromium.org/2308533003/diff/40001/content/browser/renderer_host/media/video_capture_device_client.cc#newcode76 content/browser/renderer_host/media/video_capture_device_client.cc:76: check_thread_closure.Run(); On 2016/09/09 00:55:37, chfremer ...
4 years, 3 months ago (2016-09-09 16:48:06 UTC) #23
mcasas
Almost there. A few nits and naming suggestion. https://codereview.chromium.org/2308533003/diff/40001/content/browser/renderer_host/media/video_capture_buffer_pool.h File content/browser/renderer_host/media/video_capture_buffer_pool.h (right): https://codereview.chromium.org/2308533003/diff/40001/content/browser/renderer_host/media/video_capture_buffer_pool.h#newcode41 content/browser/renderer_host/media/video_capture_buffer_pool.h:41: class ...
4 years, 3 months ago (2016-09-09 22:28:02 UTC) #28
emircan
lgtm % nits below. https://codereview.chromium.org/2308533003/diff/60001/content/browser/renderer_host/media/video_capture_buffer_pool.h File content/browser/renderer_host/media/video_capture_buffer_pool.h (right): https://codereview.chromium.org/2308533003/diff/60001/content/browser/renderer_host/media/video_capture_buffer_pool.h#newcode27 content/browser/renderer_host/media/video_capture_buffer_pool.h:27: // Abstraction of a pool's ...
4 years, 3 months ago (2016-09-10 00:08:46 UTC) #29
chfremer
mcasas@: PTAL miu@: PTAL RS https://codereview.chromium.org/2308533003/diff/80001/content/browser/renderer_host/media/video_capture_buffer_pool.h File content/browser/renderer_host/media/video_capture_buffer_pool.h (right): https://codereview.chromium.org/2308533003/diff/80001/content/browser/renderer_host/media/video_capture_buffer_pool.h#newcode92 content/browser/renderer_host/media/video_capture_buffer_pool.h:92: }; On 2016/09/09 22:28:01, ...
4 years, 3 months ago (2016-09-12 18:31:22 UTC) #30
miu
On 2016/09/12 18:31:22, chfremer wrote: > miu@: PTAL RS Looking now...
4 years, 3 months ago (2016-09-12 19:38:50 UTC) #31
miu
https://codereview.chromium.org/2308533003/diff/100001/content/browser/renderer_host/media/video_capture_buffer_pool.h File content/browser/renderer_host/media/video_capture_buffer_pool.h (right): https://codereview.chromium.org/2308533003/diff/100001/content/browser/renderer_host/media/video_capture_buffer_pool.h#newcode39 content/browser/renderer_host/media/video_capture_buffer_pool.h:39: class CONTENT_EXPORT ProducerVideoCaptureBufferPool The naming feels reversed to me: ...
4 years, 3 months ago (2016-09-12 20:16:47 UTC) #32
chfremer
miu@: PTAL my responses https://codereview.chromium.org/2308533003/diff/100001/content/browser/renderer_host/media/video_capture_buffer_pool.h File content/browser/renderer_host/media/video_capture_buffer_pool.h (right): https://codereview.chromium.org/2308533003/diff/100001/content/browser/renderer_host/media/video_capture_buffer_pool.h#newcode39 content/browser/renderer_host/media/video_capture_buffer_pool.h:39: class CONTENT_EXPORT ProducerVideoCaptureBufferPool On 2016/09/12 ...
4 years, 3 months ago (2016-09-12 22:23:34 UTC) #33
chfremer
Updated comments after offline discussion. https://codereview.chromium.org/2308533003/diff/100001/content/browser/renderer_host/media/video_capture_buffer_pool.h File content/browser/renderer_host/media/video_capture_buffer_pool.h (right): https://codereview.chromium.org/2308533003/diff/100001/content/browser/renderer_host/media/video_capture_buffer_pool.h#newcode39 content/browser/renderer_host/media/video_capture_buffer_pool.h:39: class CONTENT_EXPORT ProducerVideoCaptureBufferPool On ...
4 years, 3 months ago (2016-09-12 23:57:10 UTC) #34
chfremer
* Renamed VideoCaptureBufferPool -> VideoCaptureBufferPoolImpl * Fixed missing type rename in test code. (Not sure ...
4 years, 3 months ago (2016-09-13 00:30:57 UTC) #35
miu
https://codereview.chromium.org/2308533003/diff/100001/content/browser/renderer_host/media/video_capture_buffer_pool.h File content/browser/renderer_host/media/video_capture_buffer_pool.h (right): https://codereview.chromium.org/2308533003/diff/100001/content/browser/renderer_host/media/video_capture_buffer_pool.h#newcode39 content/browser/renderer_host/media/video_capture_buffer_pool.h:39: class CONTENT_EXPORT ProducerVideoCaptureBufferPool On 2016/09/12 22:23:33, chfremer wrote: > ...
4 years, 3 months ago (2016-09-13 00:33:30 UTC) #36
chfremer
miu@: PTAL mcasas@: PTAL * Renamed class PostOnIOThreadVideoFrameReceiver to VideoFrameReceiverOnIOThread in order to adhere to ...
4 years, 3 months ago (2016-09-14 16:26:01 UTC) #37
miu
Responses here (rather lengthy, sorry). Let me know when you are ready for me to ...
4 years, 3 months ago (2016-09-16 21:10:25 UTC) #38
chfremer
miu@: PTAL mcasas@: PTAL https://codereview.chromium.org/2308533003/diff/100001/content/browser/renderer_host/media/video_capture_buffer_pool.h File content/browser/renderer_host/media/video_capture_buffer_pool.h (right): https://codereview.chromium.org/2308533003/diff/100001/content/browser/renderer_host/media/video_capture_buffer_pool.h#newcode85 content/browser/renderer_host/media/video_capture_buffer_pool.h:85: virtual double GetBufferPoolUtilization() = 0; ...
4 years, 3 months ago (2016-09-17 00:09:21 UTC) #39
miu
lgtm
4 years, 3 months ago (2016-09-17 00:18:37 UTC) #42
mcasas
On 2016/09/17 00:18:37, miu wrote: > lgtm lgtm, ship it!
4 years, 3 months ago (2016-09-19 18:20:10 UTC) #45
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/2308533003/160001
4 years, 3 months ago (2016-09-19 20:53:35 UTC) #48
commit-bot: I haz the power
Committed patchset #9 (id:160001)
4 years, 3 months ago (2016-09-19 21:39:12 UTC) #50
commit-bot: I haz the power
4 years, 3 months ago (2016-09-19 21:40:53 UTC) #52
Message was sent while issue was closed.
Patchset 9 (id:??) landed as
https://crrev.com/42b7da0b82c0f67702f3f0f0033d611ff44916f5
Cr-Commit-Position: refs/heads/master@{#419565}

Powered by Google App Engine
This is Rietveld 408576698