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

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

Issue 24133002: Make VideoCaptureController single-threaded and not ref counted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More longwinded hobbledy-nobble Created 7 years, 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // VideoCaptureHost serves video capture related messages from 5 // VideoCaptureHost serves video capture related messages from
6 // VideoCaptureMessageFilter which lives inside the render process. 6 // VideoCaptureMessageFilter which lives inside the render process.
7 // 7 //
8 // This class is owned by BrowserRenderProcessHost, and instantiated on UI 8 // This class is owned by BrowserRenderProcessHost, and instantiated on UI
9 // thread, but all other operations and method calls happen on IO thread. 9 // thread, but all other operations and method calls happen on IO thread.
10 // 10 //
(...skipping 21 matching lines...) Expand all
32 // | < VideoCaptureMsg_StateChanged | 32 // | < VideoCaptureMsg_StateChanged |
33 // | (kStopped) | 33 // | (kStopped) |
34 // v v 34 // v v
35 35
36 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ 36 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_
37 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ 37 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_
38 38
39 #include <map> 39 #include <map>
40 40
41 #include "base/memory/ref_counted.h" 41 #include "base/memory/ref_counted.h"
42 #include "base/memory/weak_ptr.h"
42 #include "base/sequenced_task_runner_helpers.h" 43 #include "base/sequenced_task_runner_helpers.h"
43 #include "content/browser/renderer_host/media/video_capture_controller.h" 44 #include "content/browser/renderer_host/media/video_capture_controller.h"
44 #include "content/common/content_export.h" 45 #include "content/common/content_export.h"
45 #include "content/public/browser/browser_message_filter.h" 46 #include "content/public/browser/browser_message_filter.h"
46 #include "ipc/ipc_message.h" 47 #include "ipc/ipc_message.h"
47 48
48 namespace media { 49 namespace media {
49 class VideoCaptureCapability; 50 class VideoCaptureCapability;
50 } 51 }
51 52
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 virtual ~VideoCaptureHost(); 91 virtual ~VideoCaptureHost();
91 92
92 // IPC message: Start capture on the VideoCaptureDevice referenced by 93 // IPC message: Start capture on the VideoCaptureDevice referenced by
93 // VideoCaptureParams::session_id. |device_id| is an id created by 94 // VideoCaptureParams::session_id. |device_id| is an id created by
94 // VideoCaptureMessageFilter to identify a session 95 // VideoCaptureMessageFilter to identify a session
95 // between a VideoCaptureMessageFilter and a VideoCaptureHost. 96 // between a VideoCaptureMessageFilter and a VideoCaptureHost.
96 void OnStartCapture(int device_id, 97 void OnStartCapture(int device_id,
97 const media::VideoCaptureParams& params); 98 const media::VideoCaptureParams& params);
98 void OnControllerAdded( 99 void OnControllerAdded(
99 int device_id, const media::VideoCaptureParams& params, 100 int device_id, const media::VideoCaptureParams& params,
100 VideoCaptureController* controller); 101 const base::WeakPtr<VideoCaptureController>& controller);
101 void DoControllerAddedOnIOThread( 102 void DoControllerAddedOnIOThread(
102 int device_id, const media::VideoCaptureParams params, 103 int device_id, const media::VideoCaptureParams params,
103 VideoCaptureController* controller); 104 const base::WeakPtr<VideoCaptureController>& controller);
104 105
105 // IPC message: Stop capture on device referenced by |device_id|. 106 // IPC message: Stop capture on device referenced by |device_id|.
106 void OnStopCapture(int device_id); 107 void OnStopCapture(int device_id);
107 108
108 // IPC message: Pause capture on device referenced by |device_id|. 109 // IPC message: Pause capture on device referenced by |device_id|.
109 void OnPauseCapture(int device_id); 110 void OnPauseCapture(int device_id);
110 111
111 // IPC message: Receive an empty buffer from renderer. Send it to device 112 // IPC message: Receive an empty buffer from renderer. Send it to device
112 // referenced by |device_id|. 113 // referenced by |device_id|.
113 void OnReceiveEmptyBuffer(int device_id, int buffer_id); 114 void OnReceiveEmptyBuffer(int device_id, int buffer_id);
(...skipping 27 matching lines...) Expand all
141 // Handle error coming from VideoCaptureDevice. 142 // Handle error coming from VideoCaptureDevice.
142 void DoHandleErrorOnIOThread(const VideoCaptureControllerID& controller_id); 143 void DoHandleErrorOnIOThread(const VideoCaptureControllerID& controller_id);
143 144
144 void DoEndedOnIOThread(const VideoCaptureControllerID& controller_id); 145 void DoEndedOnIOThread(const VideoCaptureControllerID& controller_id);
145 146
146 void DeleteVideoCaptureControllerOnIOThread( 147 void DeleteVideoCaptureControllerOnIOThread(
147 const VideoCaptureControllerID& controller_id); 148 const VideoCaptureControllerID& controller_id);
148 149
149 MediaStreamManager* media_stream_manager_; 150 MediaStreamManager* media_stream_manager_;
150 151
151 struct Entry; 152 typedef std::map<VideoCaptureControllerID,
152 typedef std::map<VideoCaptureControllerID, Entry*> EntryMap; 153 base::WeakPtr<VideoCaptureController> > EntryMap;
153 // A map of VideoCaptureControllerID to its state and VideoCaptureController. 154
155 // A map of VideoCaptureControllerID to the VideoCaptureController to which
156 // it is connected. An entry in this map temporarily has holds a null
Ami GONE FROM CHROMIUM 2013/09/14 00:32:24 has holds
ncarter (slow) 2013/09/14 01:29:31 Done.
157 // controller while it is in the process of starting.
154 EntryMap entries_; 158 EntryMap entries_;
155 159
156 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); 160 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost);
157 }; 161 };
158 162
159 } // namespace content 163 } // namespace content
160 164
161 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ 165 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698