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

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

Issue 978993002: Changed thread_checker on VideoCaptureImpl and VideoCaptureImplManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 9 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
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 // TODO(hclam): This class should be renamed to VideoCaptureService.
6
7 // This class provides access to a video capture device in the browser
8 // process through IPC. The main function is to deliver video frames
9 // to a client.
10 //
11 // THREADING
12 //
13 // VideoCaptureImplManager lives only on the render thread. All methods
14 // must be called on this thread.
15 //
16 // VideoFrames are delivered on the IO thread. Callbacks provided by
17 // a client are also called on the IO thread.
18
19 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_
20 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_ 6 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_
21 7
22 #include <map> 8 #include <map>
23 9
24 #include "base/callback.h" 10 #include "base/callback.h"
25 #include "base/memory/linked_ptr.h" 11 #include "base/memory/linked_ptr.h"
26 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
27 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
28 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
29 #include "base/message_loop/message_loop_proxy.h" 15 #include "base/message_loop/message_loop_proxy.h"
30 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
31 #include "base/threading/thread_checker.h" 17 #include "base/threading/thread_checker.h"
32 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
33 #include "content/common/media/video_capture.h" 19 #include "content/common/media/video_capture.h"
34 #include "content/public/renderer/media_stream_video_sink.h" 20 #include "content/public/renderer/media_stream_video_sink.h"
35 #include "media/base/video_capture_types.h" 21 #include "media/base/video_capture_types.h"
36 22
37 namespace content { 23 namespace content {
38 24
39 class VideoCaptureImpl; 25 class VideoCaptureImpl;
40 class VideoCaptureMessageFilter; 26 class VideoCaptureMessageFilter;
41 27
28 // TODO(hclam): This class should be renamed to VideoCaptureService.
29
30 // This class provides access to a video capture device in the browser
31 // process through IPC. The main function is to deliver video frames
32 // to a client.
33 //
34 // THREADING
35 //
36 // VideoCaptureImplManager lives only on the Render Main thread. All methods
37 // must be called on this thread.
38 //
39 // VideoFrames are delivered on the IO thread. Callbacks provided by
40 // a client are also called on the IO thread.
42 class CONTENT_EXPORT VideoCaptureImplManager { 41 class CONTENT_EXPORT VideoCaptureImplManager {
43 public: 42 public:
44 VideoCaptureImplManager(); 43 VideoCaptureImplManager();
45 virtual ~VideoCaptureImplManager(); 44 virtual ~VideoCaptureImplManager();
46 45
47 // Open a device associated with the session ID. 46 // Open a device associated with the session ID.
48 // This method must be called before any methods with the same ID 47 // This method must be called before any methods with the same ID
49 // is used. 48 // is used.
50 // Returns a callback that should be used to release the acquired 49 // Returns a callback that should be used to release the acquired
51 // resources. 50 // resources.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 std::pair<int, VideoCaptureImpl*> > 108 std::pair<int, VideoCaptureImpl*> >
110 VideoCaptureDeviceMap; 109 VideoCaptureDeviceMap;
111 VideoCaptureDeviceMap devices_; 110 VideoCaptureDeviceMap devices_;
112 111
113 // This is an internal ID for identifying clients of VideoCaptureImpl. 112 // This is an internal ID for identifying clients of VideoCaptureImpl.
114 // The ID is global for the render process. 113 // The ID is global for the render process.
115 int next_client_id_; 114 int next_client_id_;
116 115
117 const scoped_refptr<VideoCaptureMessageFilter> filter_; 116 const scoped_refptr<VideoCaptureMessageFilter> filter_;
118 117
119 // Bound to the render thread. 118 // Hold a pointer to the Render Main message loop to check we operate on the
120 base::ThreadChecker render_main_thread_checker_; 119 // right thread.
120 const scoped_refptr<base::MessageLoopProxy> render_main_message_loop_;
121 121
122 // Bound to the render thread. 122 // Bound to the render thread.
123 // NOTE: Weak pointers must be invalidated before all other member variables. 123 // NOTE: Weak pointers must be invalidated before all other member variables.
124 base::WeakPtrFactory<VideoCaptureImplManager> weak_factory_; 124 base::WeakPtrFactory<VideoCaptureImplManager> weak_factory_;
125 125
126 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImplManager); 126 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImplManager);
127 }; 127 };
128 128
129 } // namespace content 129 } // namespace content
130 130
131 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_ 131 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698