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

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

Issue 10662049: Move the device enumerate/open/close work to device thread from IO thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: small changes to fix the trybots' failure Created 8 years, 5 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 // VideCaptureMessageFilter which lives inside the render process. 6 // VideCaptureMessageFilter 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 27 matching lines...) Expand all
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/sequenced_task_runner_helpers.h" 42 #include "base/sequenced_task_runner_helpers.h"
43 #include "content/browser/renderer_host/media/video_capture_controller.h" 43 #include "content/browser/renderer_host/media/video_capture_controller.h"
44 #include "content/common/content_export.h" 44 #include "content/common/content_export.h"
45 #include "content/public/browser/browser_message_filter.h" 45 #include "content/public/browser/browser_message_filter.h"
46 #include "ipc/ipc_message.h" 46 #include "ipc/ipc_message.h"
47 47
48 namespace content {
49 class ResourceContext;
50 } // namespace content
51
52 namespace media {
53 class AudioManager;
54 }
55
56 class CONTENT_EXPORT VideoCaptureHost 48 class CONTENT_EXPORT VideoCaptureHost
57 : public content::BrowserMessageFilter, 49 : public content::BrowserMessageFilter,
58 public VideoCaptureControllerEventHandler { 50 public VideoCaptureControllerEventHandler {
59 public: 51 public:
60 explicit VideoCaptureHost(content::ResourceContext* resource_context, 52 VideoCaptureHost();
61 media::AudioManager* audio_manager);
62 53
63 // content::BrowserMessageFilter implementation. 54 // content::BrowserMessageFilter implementation.
64 virtual void OnChannelClosing() OVERRIDE; 55 virtual void OnChannelClosing() OVERRIDE;
65 virtual void OnDestruct() const OVERRIDE; 56 virtual void OnDestruct() const OVERRIDE;
66 virtual bool OnMessageReceived(const IPC::Message& message, 57 virtual bool OnMessageReceived(const IPC::Message& message,
67 bool* message_was_ok) OVERRIDE; 58 bool* message_was_ok) OVERRIDE;
68 59
69 // VideoCaptureControllerEventHandler implementation. 60 // VideoCaptureControllerEventHandler implementation.
70 virtual void OnError(const VideoCaptureControllerID& id) OVERRIDE; 61 virtual void OnError(const VideoCaptureControllerID& id) OVERRIDE;
71 virtual void OnBufferCreated(const VideoCaptureControllerID& id, 62 virtual void OnBufferCreated(const VideoCaptureControllerID& id,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 int frame_per_second); 124 int frame_per_second);
134 125
135 // Handle error coming from VideoCaptureDevice. 126 // Handle error coming from VideoCaptureDevice.
136 void DoHandleErrorOnIOThread(const VideoCaptureControllerID& controller_id); 127 void DoHandleErrorOnIOThread(const VideoCaptureControllerID& controller_id);
137 128
138 void DoPausedOnIOThread(const VideoCaptureControllerID& controller_id); 129 void DoPausedOnIOThread(const VideoCaptureControllerID& controller_id);
139 130
140 void DeleteVideoCaptureControllerOnIOThread( 131 void DeleteVideoCaptureControllerOnIOThread(
141 const VideoCaptureControllerID& controller_id); 132 const VideoCaptureControllerID& controller_id);
142 133
143 // Helpers. 134 // Returns the video capture manager. This is a virtual function so that
144 media_stream::VideoCaptureManager* GetVideoCaptureManager(); 135 // the unit tests can inject their own MediaStreamManager.
136 virtual media_stream::VideoCaptureManager* GetVideoCaptureManager();
145 137
146 struct Entry; 138 struct Entry;
147 typedef std::map<VideoCaptureControllerID, Entry*> EntryMap; 139 typedef std::map<VideoCaptureControllerID, Entry*> EntryMap;
148 // A map of VideoCaptureControllerID to its state and VideoCaptureController. 140 // A map of VideoCaptureControllerID to its state and VideoCaptureController.
149 EntryMap entries_; 141 EntryMap entries_;
150 142
151 // Used to get a pointer to VideoCaptureManager to start/stop capture devices.
152 content::ResourceContext* resource_context_;
153 media::AudioManager* audio_manager_;
154
155 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); 143 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost);
156 }; 144 };
157 145
158 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ 146 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698