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

Issue 9433006: Remove GetAudioManager and GetMediaStreamManager from ResourceContext. The reason is the content mo… (Closed)

Created:
8 years, 10 months ago by jam
Modified:
8 years, 10 months ago
CC:
chromium-reviews, hclam+watch_chromium.org, ddorwin+watch_chromium.org, fischman+watch_chromium.org, acolwell+watch_chromium.org, annacc+watch_chromium.org, mihaip+watch_chromium.org, joi+watch-content_chromium.org, Aaron Boodman, darin-cc_chromium.org, vrk (LEFT CHROMIUM), scherkus (not reviewing), ihf+watch_chromium.org
Visibility:
Public.

Description

Remove GetAudioManager and GetMediaStreamManager from ResourceContext. The reason is the content module should create all the concrete objects that it knows about, instead of depending on every embedder to do so. ResourceContext is then just the interfaces that it implements and which it provides on the IO thread. MediaStreamManager now has its own static getter like other internal content classes on ResourceContext or BrowserContext. BUG=98716 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=123264

Patch Set 1 #

Patch Set 2 : fix deps #

Total comments: 3

Patch Set 3 : update per review comments #

Patch Set 4 : sync to head #

Total comments: 11

Patch Set 5 : review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+260 lines, -343 lines) Patch
M chrome/browser/DEPS View 1 2 3 2 chunks +0 lines, -2 lines 0 comments Download
M chrome/browser/browser_process.h View 1 2 3 2 chunks +0 lines, -3 lines 0 comments Download
M chrome/browser/browser_process_impl.h View 1 2 3 2 chunks +0 lines, -3 lines 0 comments Download
M chrome/browser/browser_process_impl.cc View 1 2 3 2 chunks +0 lines, -9 lines 0 comments Download
M chrome/browser/profiles/profile_io_data.h View 1 2 3 6 chunks +0 lines, -11 lines 0 comments Download
M chrome/browser/profiles/profile_io_data.cc View 1 2 3 5 chunks +0 lines, -21 lines 0 comments Download
M chrome/browser/speech/chrome_speech_input_manager.h View 1 2 3 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/speech/chrome_speech_input_manager.cc View 1 2 3 5 chunks +6 lines, -11 lines 0 comments Download
M chrome/browser/speech/speech_input_bubble_gtk.cc View 1 2 3 2 chunks +1 line, -3 lines 0 comments Download
M chrome/browser/speech/speech_input_bubble_views.cc View 1 2 3 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/speech/speech_input_extension_apitest.cc View 1 2 3 3 chunks +2 lines, -6 lines 0 comments Download
M chrome/browser/speech/speech_input_extension_manager.h View 1 2 3 4 chunks +5 lines, -15 lines 0 comments Download
M chrome/browser/speech/speech_input_extension_manager.cc View 1 2 3 6 chunks +31 lines, -39 lines 0 comments Download
M chrome/browser/ui/cocoa/speech_input_window_controller.mm View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
M chrome/test/base/testing_browser_process.h View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
M chrome/test/base/testing_browser_process.cc View 1 2 3 1 chunk +0 lines, -4 lines 0 comments Download
M content/browser/DEPS View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/browser_main_loop.h View 1 2 3 4 chunks +6 lines, -0 lines 0 comments Download
M content/browser/browser_main_loop.cc View 1 2 3 4 chunks +14 lines, -8 lines 0 comments Download
M content/browser/mock_resource_context.h View 1 2 3 1 chunk +0 lines, -8 lines 0 comments Download
M content/browser/mock_resource_context.cc View 1 2 3 2 chunks +2 lines, -15 lines 0 comments Download
M content/browser/renderer_host/media/audio_input_renderer_host.h View 1 2 3 2 chunks +3 lines, -2 lines 0 comments Download
M content/browser/renderer_host/media/audio_input_renderer_host.cc View 1 2 3 5 chunks +9 lines, -6 lines 0 comments Download
M content/browser/renderer_host/media/audio_renderer_host.h View 1 2 3 2 chunks +3 lines, -1 line 0 comments Download
M content/browser/renderer_host/media/audio_renderer_host.cc View 1 2 3 3 chunks +5 lines, -3 lines 0 comments Download
M content/browser/renderer_host/media/audio_renderer_host_unittest.cc View 1 2 3 2 chunks +4 lines, -4 lines 0 comments Download
M content/browser/renderer_host/media/media_stream_dispatcher_host.h View 1 2 3 2 chunks +3 lines, -1 line 0 comments Download
M content/browser/renderer_host/media/media_stream_dispatcher_host.cc View 1 2 3 2 chunks +7 lines, -4 lines 0 comments Download
M content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc View 1 2 3 5 chunks +12 lines, -12 lines 0 comments Download
M content/browser/renderer_host/media/media_stream_manager.h View 1 2 3 3 chunks +13 lines, -1 line 0 comments Download
M content/browser/renderer_host/media/media_stream_manager.cc View 1 2 3 2 chunks +16 lines, -0 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_host.h View 1 2 3 3 chunks +5 lines, -1 line 0 comments Download
M content/browser/renderer_host/media/video_capture_host.cc View 1 2 3 3 chunks +6 lines, -4 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_host_unittest.cc View 1 2 3 4 6 chunks +15 lines, -19 lines 0 comments Download
M content/browser/renderer_host/render_process_host_impl.cc View 1 2 3 4 3 chunks +8 lines, -5 lines 0 comments Download
M content/browser/speech/speech_input_browsertest.cc View 1 2 3 2 chunks +12 lines, -13 lines 0 comments Download
M content/browser/speech/speech_input_dispatcher_host.h View 1 2 3 3 chunks +3 lines, -3 lines 0 comments Download
M content/browser/speech/speech_input_dispatcher_host.cc View 1 2 3 3 chunks +3 lines, -5 lines 0 comments Download
M content/browser/speech/speech_input_manager.h View 1 2 3 3 chunks +8 lines, -11 lines 0 comments Download
M content/browser/speech/speech_input_manager.cc View 1 2 3 10 chunks +31 lines, -35 lines 0 comments Download
M content/browser/speech/speech_recognizer.h View 1 2 3 6 chunks +7 lines, -4 lines 0 comments Download
M content/browser/speech/speech_recognizer.cc View 1 2 3 5 chunks +11 lines, -5 lines 0 comments Download
M content/browser/speech/speech_recognizer_unittest.cc View 1 2 3 1 chunk +3 lines, -2 lines 0 comments Download
M content/public/browser/browser_main_parts.h View 1 2 3 1 chunk +0 lines, -3 lines 0 comments Download
M content/public/browser/resource_context.h View 1 2 3 3 chunks +0 lines, -7 lines 0 comments Download
M content/shell/shell_resource_context.h View 1 2 3 2 chunks +0 lines, -4 lines 0 comments Download
M content/shell/shell_resource_context.cc View 1 2 3 1 chunk +0 lines, -9 lines 0 comments Download
M content/test/webrtc_audio_device_test.cc View 1 2 3 3 chunks +3 lines, -7 lines 0 comments Download
M media/audio/audio_manager.cc View 1 2 3 1 chunk +0 lines, -8 lines 0 comments Download

Messages

Total messages: 12 (0 generated)
jam
8 years, 10 months ago (2012-02-21 18:49:30 UTC) #1
scherkus (not reviewing)
+tommi who landed the initial AudioManager de-singleton-ification http://src.chromium.org/viewvc/chrome?view=rev&revision=114084 Is AudioManager leaked at shutdown now? This ...
8 years, 10 months ago (2012-02-21 19:12:44 UTC) #2
jam
(my reply isn't making it here for some reason, so pasting on rietveld) I didn't ...
8 years, 10 months ago (2012-02-21 20:29:33 UTC) #3
tommi (sloooow) - chröme
https://chromiumcodereview.appspot.com/9433006/diff/4018/media/audio/audio_manager.cc File media/audio/audio_manager.cc (right): https://chromiumcodereview.appspot.com/9433006/diff/4018/media/audio/audio_manager.cc#newcode37 media/audio/audio_manager.cc:37: return g_audio_manager; See the comment above for g_audio_manager: " ...
8 years, 10 months ago (2012-02-21 21:04:07 UTC) #4
jam
thanks for the review! https://chromiumcodereview.appspot.com/9433006/diff/4018/media/audio/audio_manager.cc File media/audio/audio_manager.cc (right): https://chromiumcodereview.appspot.com/9433006/diff/4018/media/audio/audio_manager.cc#newcode37 media/audio/audio_manager.cc:37: return g_audio_manager; On 2012/02/21 21:04:08, ...
8 years, 10 months ago (2012-02-21 21:09:47 UTC) #5
tommi (sloooow) - chröme
https://chromiumcodereview.appspot.com/9433006/diff/4018/media/audio/audio_manager.cc File media/audio/audio_manager.cc (right): https://chromiumcodereview.appspot.com/9433006/diff/4018/media/audio/audio_manager.cc#newcode37 media/audio/audio_manager.cc:37: return g_audio_manager; On 2012/02/21 21:09:47, John Abd-El-Malek wrote: > ...
8 years, 10 months ago (2012-02-21 21:15:22 UTC) #6
vrk (LEFT CHROMIUM)
drive-by: Thanks for getting this sorted out! I will update my CL 9316077 accordingly when ...
8 years, 10 months ago (2012-02-22 19:07:02 UTC) #7
jam
Tommi/Andrew: please take another look. I've removed the static getter on AudioManager and plumbed AudioManager ...
8 years, 10 months ago (2012-02-23 00:42:34 UTC) #8
jam
On 2012/02/22 19:07:02, Victoria Kirst wrote: > drive-by: Thanks for getting this sorted out! I ...
8 years, 10 months ago (2012-02-23 00:43:00 UTC) #9
tommi (sloooow) - chröme
awesome. no concerns, just a couple of questions and nits. https://chromiumcodereview.appspot.com/9433006/diff/15001/content/browser/renderer_host/media/media_stream_manager.cc File content/browser/renderer_host/media/media_stream_manager.cc (right): https://chromiumcodereview.appspot.com/9433006/diff/15001/content/browser/renderer_host/media/media_stream_manager.cc#newcode24 ...
8 years, 10 months ago (2012-02-23 07:50:59 UTC) #10
jam
https://chromiumcodereview.appspot.com/9433006/diff/15001/content/browser/renderer_host/media/media_stream_manager.cc File content/browser/renderer_host/media/media_stream_manager.cc (right): https://chromiumcodereview.appspot.com/9433006/diff/15001/content/browser/renderer_host/media/media_stream_manager.cc#newcode24 content/browser/renderer_host/media/media_stream_manager.cc:24: static const char* kMediaStreamManagerKeyName = "content_media_stream_manager"; On 2012/02/23 07:50:59, ...
8 years, 10 months ago (2012-02-23 08:05:08 UTC) #11
tommi (sloooow) - chröme
8 years, 10 months ago (2012-02-23 08:20:29 UTC) #12
lgtm.  thanks for doing this.

Regarding the "ForTest" method, that's fine with me.  I've seen both approaches
in Chrome and have a slight personal preference for not adding test types into
production code.  Not big enough to make a fuzz though.

https://chromiumcodereview.appspot.com/9433006/diff/15001/content/browser/ren...
File content/browser/renderer_host/media/media_stream_manager.cc (right):

https://chromiumcodereview.appspot.com/9433006/diff/15001/content/browser/ren...
content/browser/renderer_host/media/media_stream_manager.cc:24: static const
char* kMediaStreamManagerKeyName = "content_media_stream_manager";
On 2012/02/23 08:05:09, John Abd-El-Malek wrote:
> On 2012/02/23 07:50:59, tommi wrote:
> > char[] instead of char*
> 
> what's the reason for this? i see both styles in the code, and the chrome
style
> guide gives this as an example:
> http://www.chromium.org/developers/coding-style#Static_Variables

The practical difference is that in this example:

const char* kFoo = "12345";

The compiler makes two allocations: 4 bytes for the kFoo pointer and 6 for the
"12345" string (including \0).  sizeof(kFoo) is 4.

However, for in this case:

const char kFoo[] = "12345";

There's no pointer that the compiler has to allocate, only the string.
Furthermore sizeof(kFoo) is 6, so we can write code like this:

for (int i = 0; i < arraysize(kFoo); ++i)
  OnChar(kFoo[i]);

Powered by Google App Engine
This is Rietveld 408576698