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

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

Issue 10744002: Fix COM initialization on media thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_stream_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // MediaStreamManager is used to open/enumerate media capture devices (video 5 // MediaStreamManager is used to open/enumerate media capture devices (video
6 // supported now). Call flow: 6 // supported now). Call flow:
7 // 1. GenerateStream is called when a render process wants to use a capture 7 // 1. GenerateStream is called when a render process wants to use a capture
8 // device. 8 // device.
9 // 2. MediaStreamManager will ask MediaStreamDeviceSettings for permission to 9 // 2. MediaStreamManager will ask MediaStreamDeviceSettings for permission to
10 // use devices and for which device to use. 10 // use devices and for which device to use.
(...skipping 12 matching lines...) Expand all
23 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ 23 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_
24 24
25 #include <map> 25 #include <map>
26 #include <string> 26 #include <string>
27 #include <vector> 27 #include <vector>
28 28
29 #include "base/basictypes.h" 29 #include "base/basictypes.h"
30 #include "base/memory/scoped_ptr.h" 30 #include "base/memory/scoped_ptr.h"
31 #include "base/memory/ref_counted.h" 31 #include "base/memory/ref_counted.h"
32 #include "base/threading/thread.h" 32 #include "base/threading/thread.h"
33 #include "base/win/scoped_com_initializer.h"
34 #include "content/browser/renderer_host/media/media_stream_provider.h" 33 #include "content/browser/renderer_host/media/media_stream_provider.h"
35 #include "content/browser/renderer_host/media/media_stream_settings_requester.h" 34 #include "content/browser/renderer_host/media/media_stream_settings_requester.h"
36 #include "content/common/media/media_stream_options.h" 35 #include "content/common/media/media_stream_options.h"
37 #include "content/common/content_export.h" 36 #include "content/common/content_export.h"
38 #include "content/public/browser/browser_thread.h" 37 #include "content/public/browser/browser_thread.h"
39 38
40 using base::win::ScopedCOMInitializer; 39 namespace base {
40 namespace win {
41 class ScopedCOMInitializer;
42 }
43 }
41 44
42 namespace media_stream { 45 namespace media_stream {
43 46
44 class AudioInputDeviceManager; 47 class AudioInputDeviceManager;
45 class MediaStreamDeviceSettings; 48 class MediaStreamDeviceSettings;
46 class MediaStreamRequester; 49 class MediaStreamRequester;
47 class VideoCaptureManager; 50 class VideoCaptureManager;
48 51
49 // Thread that enters MTA on windows, and is base::Thread on linux and mac. 52 // Thread that enters MTA on windows, and is base::Thread on linux and mac.
50 class DeviceThread : public base::Thread { 53 class DeviceThread : public base::Thread {
51 public: 54 public:
52 explicit DeviceThread(const char* name) 55 explicit DeviceThread(const char* name);
53 : base::Thread(name), 56 virtual ~DeviceThread();
54 com_init_(ScopedCOMInitializer::kMTA) {} 57
58 protected:
59 virtual void Init() OVERRIDE;
60 virtual void CleanUp() OVERRIDE;
55 61
56 private: 62 private:
57 ScopedCOMInitializer com_init_; 63 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_;
58 DISALLOW_COPY_AND_ASSIGN(DeviceThread); 64 DISALLOW_COPY_AND_ASSIGN(DeviceThread);
59 }; 65 };
60 66
61 // MediaStreamManager is used to generate and close new media devices, not to 67 // MediaStreamManager is used to generate and close new media devices, not to
62 // start the media flow. 68 // start the media flow.
63 // The classes requesting new media streams are answered using 69 // The classes requesting new media streams are answered using
64 // MediaStreamManager::Listener. 70 // MediaStreamManager::Listener.
65 class CONTENT_EXPORT MediaStreamManager 71 class CONTENT_EXPORT MediaStreamManager
66 : public MediaStreamProviderListener, 72 : public MediaStreamProviderListener,
67 public SettingsRequester { 73 public SettingsRequester {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // All non-closed request. 180 // All non-closed request.
175 typedef std::map<std::string, DeviceRequest> DeviceRequests; 181 typedef std::map<std::string, DeviceRequest> DeviceRequests;
176 DeviceRequests requests_; 182 DeviceRequests requests_;
177 183
178 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); 184 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager);
179 }; 185 };
180 186
181 } // namespace media_stream 187 } // namespace media_stream
182 188
183 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ 189 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_stream_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698