Chromium Code Reviews
|
| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // VideoCaptureImplManager manages video capture devices in renderer process. | |
| 6 // The video capture clients use AddDevice() to get a pointer to | |
| 7 // video capture device. VideoCaputreImplManager supports multiple clients | |
| 8 // accessing same device. | |
| 9 | |
| 10 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_ | |
| 11 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_ | |
| 12 | |
| 13 #include <list> | |
| 14 #include <map> | |
| 15 | |
| 16 #include "base/message_loop_proxy.h" | |
| 17 #include "base/synchronization/lock.h" | |
| 18 #include "content/renderer/media/video_capture_impl.h" | |
| 19 #include "content/renderer/video_capture_message_filter.h" | |
| 20 #include "media/base/callback.h" | |
| 21 #include "media/base/message_loop_factory.h" | |
| 22 #include "media/video/capture/video_capture.h" | |
| 23 | |
| 24 class VideoCaptureImplManager { | |
| 25 public: | |
| 26 VideoCaptureImplManager(); | |
| 27 virtual ~VideoCaptureImplManager() {} | |
|
scherkus (not reviewing)
2011/05/23 03:45:54
does this need to be virtual?
also don't inline
wjia(left Chromium)
2011/05/23 21:23:52
no, remove virtual. also remove inline.
| |
| 28 | |
| 29 static media::VideoCapture* AddDevice( | |
|
scherkus (not reviewing)
2011/05/23 03:45:54
comments for these functiosn
wjia(left Chromium)
2011/05/23 21:23:52
Done.
| |
| 30 media::VideoCaptureSessionId id, | |
| 31 media::VideoCapture::EventHandler* handler); | |
| 32 static void RemoveDevice(media::VideoCaptureSessionId id, | |
| 33 media::VideoCapture::EventHandler* handler); | |
| 34 | |
| 35 static VideoCaptureImplManager* GetInstance(); | |
| 36 | |
| 37 private: | |
| 38 struct Device { | |
| 39 Device(); | |
| 40 Device(VideoCaptureImpl* device, | |
| 41 media::VideoCapture::EventHandler* handler); | |
| 42 | |
| 43 VideoCaptureImpl* vc; | |
| 44 std::list<media::VideoCapture::EventHandler*> clients; | |
| 45 }; | |
| 46 | |
| 47 void FreeDevice(VideoCaptureImpl* vc); | |
| 48 | |
| 49 typedef std::map<media::VideoCaptureSessionId, Device> Devices; | |
| 50 Devices devices_; | |
| 51 base::Lock lock_; | |
| 52 scoped_refptr<base::MessageLoopProxy> ml_proxy_; | |
| 53 scoped_ptr<media::MessageLoopFactory> ml_factory_; | |
| 54 | |
| 55 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImplManager); | |
| 56 }; | |
| 57 | |
| 58 DISABLE_RUNNABLE_METHOD_REFCOUNT(VideoCaptureImplManager); | |
| 59 | |
| 60 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_ | |
| OLD | NEW |