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

Unified Diff: content/renderer/media/video_capture_impl_manager.h

Issue 6962006: Undo mistaken revert. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media/video_capture_impl.cc ('k') | content/renderer/media/video_capture_impl_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/video_capture_impl_manager.h
diff --git a/content/renderer/media/video_capture_impl_manager.h b/content/renderer/media/video_capture_impl_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..f6f46d053c94df359a983b04bc13abf7d12a9ce6
--- /dev/null
+++ b/content/renderer/media/video_capture_impl_manager.h
@@ -0,0 +1,68 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// VideoCaptureImplManager manages video capture devices in renderer process.
+// The video capture clients use AddDevice() to get a pointer to
+// video capture device. VideoCaputreImplManager supports multiple clients
+// accessing same device.
+
+#ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_
+#define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_
+
+#include <list>
+#include <map>
+
+#include "base/message_loop_proxy.h"
+#include "base/synchronization/lock.h"
+#include "content/renderer/media/video_capture_impl.h"
+#include "content/renderer/video_capture_message_filter.h"
+#include "media/base/callback.h"
+#include "media/base/message_loop_factory.h"
+#include "media/video/capture/video_capture.h"
+
+class VideoCaptureImplManager {
+ public:
+ VideoCaptureImplManager();
+ ~VideoCaptureImplManager();
+
+ // Called by video capture client |handler| to add device referenced
+ // by |id| to VideoCaptureImplManager's list of opened device list.
+ // A pointer to VideoCapture is returned to client so that client can
+ // operate on that pointer, such as StartCaptrue, StopCapture.
+ static media::VideoCapture* AddDevice(
+ media::VideoCaptureSessionId id,
+ media::VideoCapture::EventHandler* handler);
+
+ // Called by video capture client |handler| to remove device referenced
+ // by |id| from VideoCaptureImplManager's list of opened device list.
+ static void RemoveDevice(media::VideoCaptureSessionId id,
+ media::VideoCapture::EventHandler* handler);
+
+ static VideoCaptureImplManager* GetInstance();
+
+ private:
+ struct Device {
+ Device();
+ Device(VideoCaptureImpl* device,
+ media::VideoCapture::EventHandler* handler);
+ ~Device();
+
+ VideoCaptureImpl* vc;
+ std::list<media::VideoCapture::EventHandler*> clients;
+ };
+
+ void FreeDevice(VideoCaptureImpl* vc);
+
+ typedef std::map<media::VideoCaptureSessionId, Device> Devices;
+ Devices devices_;
+ base::Lock lock_;
+ scoped_refptr<base::MessageLoopProxy> ml_proxy_;
+ scoped_ptr<media::MessageLoopFactory> ml_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(VideoCaptureImplManager);
+};
+
+DISABLE_RUNNABLE_METHOD_REFCOUNT(VideoCaptureImplManager);
+
+#endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_
« no previous file with comments | « content/renderer/media/video_capture_impl.cc ('k') | content/renderer/media/video_capture_impl_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698