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

Side by Side Diff: content/renderer/media/video_capture_impl_manager.h

Issue 10071038: RefCounted types should not have public destructors, content/browser part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 // VideoCaptureImplManager manages video capture devices in renderer process. 5 // VideoCaptureImplManager manages video capture devices in renderer process.
6 // The video capture clients use AddDevice() to get a pointer to 6 // The video capture clients use AddDevice() to get a pointer to
7 // video capture device. VideoCaputreImplManager supports multiple clients 7 // video capture device. VideoCaputreImplManager supports multiple clients
8 // accessing same device. 8 // accessing same device.
9 9
10 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_ 10 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_
11 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_ 11 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_
12 12
13 #include <list> 13 #include <list>
14 #include <map> 14 #include <map>
15 15
16 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
17 #include "base/message_loop_proxy.h" 17 #include "base/message_loop_proxy.h"
18 #include "base/synchronization/lock.h" 18 #include "base/synchronization/lock.h"
19 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
20 #include "media/video/capture/video_capture.h" 20 #include "media/video/capture/video_capture.h"
21 21
22 class VideoCaptureImpl; 22 class VideoCaptureImpl;
23 class VideoCaptureMessageFilter; 23 class VideoCaptureMessageFilter;
24 24
25 class CONTENT_EXPORT VideoCaptureImplManager 25 class CONTENT_EXPORT VideoCaptureImplManager
26 : public base::RefCountedThreadSafe<VideoCaptureImplManager> { 26 : public base::RefCountedThreadSafe<VideoCaptureImplManager> {
27 public: 27 public:
28 VideoCaptureImplManager(); 28 VideoCaptureImplManager();
29 virtual ~VideoCaptureImplManager();
30 29
31 // Called by video capture client |handler| to add device referenced 30 // Called by video capture client |handler| to add device referenced
32 // by |id| to VideoCaptureImplManager's list of opened device list. 31 // by |id| to VideoCaptureImplManager's list of opened device list.
33 // A pointer to VideoCapture is returned to client so that client can 32 // A pointer to VideoCapture is returned to client so that client can
34 // operate on that pointer, such as StartCaptrue, StopCapture. 33 // operate on that pointer, such as StartCaptrue, StopCapture.
35 virtual media::VideoCapture* AddDevice( 34 virtual media::VideoCapture* AddDevice(
36 media::VideoCaptureSessionId id, 35 media::VideoCaptureSessionId id,
37 media::VideoCapture::EventHandler* handler); 36 media::VideoCapture::EventHandler* handler);
38 37
39 // Called by video capture client |handler| to remove device referenced 38 // Called by video capture client |handler| to remove device referenced
40 // by |id| from VideoCaptureImplManager's list of opened device list. 39 // by |id| from VideoCaptureImplManager's list of opened device list.
41 virtual void RemoveDevice(media::VideoCaptureSessionId id, 40 virtual void RemoveDevice(media::VideoCaptureSessionId id,
42 media::VideoCapture::EventHandler* handler); 41 media::VideoCapture::EventHandler* handler);
43 42
44 VideoCaptureMessageFilter* video_capture_message_filter() const { 43 VideoCaptureMessageFilter* video_capture_message_filter() const {
45 return filter_; 44 return filter_;
46 } 45 }
47 46
48 private: 47 private:
48 friend class base::RefCountedThreadSafe<VideoCaptureImplManager>;
49 friend class MockVideoCaptureImplManager;
scherkus (not reviewing) 2012/04/27 20:59:48 is this needed because the dtor isn't protected?
50
49 struct Device { 51 struct Device {
50 Device(VideoCaptureImpl* device, 52 Device(VideoCaptureImpl* device,
51 media::VideoCapture::EventHandler* handler); 53 media::VideoCapture::EventHandler* handler);
52 ~Device(); 54 ~Device();
53 55
54 VideoCaptureImpl* vc; 56 VideoCaptureImpl* vc;
55 std::list<media::VideoCapture::EventHandler*> clients; 57 std::list<media::VideoCapture::EventHandler*> clients;
56 }; 58 };
57 59
60 virtual ~VideoCaptureImplManager();
61
58 void FreeDevice(VideoCaptureImpl* vc); 62 void FreeDevice(VideoCaptureImpl* vc);
59 63
60 typedef std::map<media::VideoCaptureSessionId, Device*> Devices; 64 typedef std::map<media::VideoCaptureSessionId, Device*> Devices;
61 Devices devices_; 65 Devices devices_;
62 base::Lock lock_; 66 base::Lock lock_;
63 scoped_refptr<VideoCaptureMessageFilter> filter_; 67 scoped_refptr<VideoCaptureMessageFilter> filter_;
64 base::Thread thread_; 68 base::Thread thread_;
65 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; 69 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
66 70
67 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImplManager); 71 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImplManager);
68 }; 72 };
69 73
70 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_ 74 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698