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

Side by Side Diff: content/browser/renderer_host/media/video_capture_host.cc

Issue 9433006: Remove GetAudioManager and GetMediaStreamManager from ResourceContext. The reason is the content mo… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/media/video_capture_host.h" 5 #include "content/browser/renderer_host/media/video_capture_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/browser/renderer_host/media/media_stream_manager.h" 10 #include "content/browser/renderer_host/media/media_stream_manager.h"
11 #include "content/browser/renderer_host/media/video_capture_manager.h" 11 #include "content/browser/renderer_host/media/video_capture_manager.h"
12 #include "content/common/media/video_capture_messages.h" 12 #include "content/common/media/video_capture_messages.h"
13 #include "content/public/browser/resource_context.h"
14 13
15 using content::BrowserMessageFilter; 14 using content::BrowserMessageFilter;
16 using content::BrowserThread; 15 using content::BrowserThread;
17 16
18 struct VideoCaptureHost::Entry { 17 struct VideoCaptureHost::Entry {
19 Entry() : state(video_capture::kStopped) {} 18 Entry() : state(video_capture::kStopped) {}
20 19
21 Entry(VideoCaptureController* controller, video_capture::State state) 20 Entry(VideoCaptureController* controller, video_capture::State state)
22 : controller(controller), 21 : controller(controller),
23 state(state) { 22 state(state) {
24 } 23 }
25 24
26 ~Entry() {} 25 ~Entry() {}
27 26
28 scoped_refptr<VideoCaptureController> controller; 27 scoped_refptr<VideoCaptureController> controller;
29 28
30 // Record state of each VideoCaptureControllerID. 29 // Record state of each VideoCaptureControllerID.
31 // There are 5 states: 30 // There are 5 states:
32 // kStarting: host has requested a controller, but has not got it yet. 31 // kStarting: host has requested a controller, but has not got it yet.
33 // kStarted: host got a controller and has called StartCapture. 32 // kStarted: host got a controller and has called StartCapture.
34 // kStopping: renderer process requests StopCapture before host gets 33 // kStopping: renderer process requests StopCapture before host gets
35 // a controller. 34 // a controller.
36 // kStopped: host has called StopCapture. 35 // kStopped: host has called StopCapture.
37 // kError: an error occurred and capture is stopped consequently. 36 // kError: an error occurred and capture is stopped consequently.
38 video_capture::State state; 37 video_capture::State state;
39 }; 38 };
40 39
41 VideoCaptureHost::VideoCaptureHost(content::ResourceContext* resource_context) 40 VideoCaptureHost::VideoCaptureHost(content::ResourceContext* resource_context,
42 : resource_context_(resource_context) { 41 AudioManager* audio_manager)
42 : resource_context_(resource_context),
43 audio_manager_(audio_manager) {
43 } 44 }
44 45
45 VideoCaptureHost::~VideoCaptureHost() {} 46 VideoCaptureHost::~VideoCaptureHost() {}
46 47
47 void VideoCaptureHost::OnChannelClosing() { 48 void VideoCaptureHost::OnChannelClosing() {
48 BrowserMessageFilter::OnChannelClosing(); 49 BrowserMessageFilter::OnChannelClosing();
49 50
50 // Since the IPC channel is gone, close all requested VideCaptureDevices. 51 // Since the IPC channel is gone, close all requested VideCaptureDevices.
51 for (EntryMap::iterator it = entries_.begin(); it != entries_.end(); it++) { 52 for (EntryMap::iterator it = entries_.begin(); it != entries_.end(); it++) {
52 VideoCaptureController* controller = it->second->controller; 53 VideoCaptureController* controller = it->second->controller;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 if (it->second->controller) { 279 if (it->second->controller) {
279 GetVideoCaptureManager()->RemoveController(it->second->controller, this); 280 GetVideoCaptureManager()->RemoveController(it->second->controller, this);
280 } 281 }
281 delete it->second; 282 delete it->second;
282 entries_.erase(id); 283 entries_.erase(id);
283 } 284 }
284 } 285 }
285 286
286 media_stream::VideoCaptureManager* VideoCaptureHost::GetVideoCaptureManager() { 287 media_stream::VideoCaptureManager* VideoCaptureHost::GetVideoCaptureManager() {
287 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 288 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
288 return resource_context_->GetMediaStreamManager()->video_capture_manager(); 289 return media_stream::MediaStreamManager::GetForResourceContext(
290 resource_context_, audio_manager_)->video_capture_manager();
289 } 291 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698