| OLD | NEW |
| 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 #ifndef CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/optional.h" | 17 #include "base/optional.h" |
| 18 #include "base/threading/non_thread_safe.h" | 18 #include "base/sequence_checker.h" |
| 19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
| 20 #include "content/common/media/media_devices.h" | 20 #include "content/common/media/media_devices.h" |
| 21 #include "content/common/media/media_devices.mojom.h" | 21 #include "content/common/media/media_devices.mojom.h" |
| 22 #include "content/public/renderer/render_frame_observer.h" | 22 #include "content/public/renderer/render_frame_observer.h" |
| 23 #include "content/renderer/media/media_devices_event_dispatcher.h" | 23 #include "content/renderer/media/media_devices_event_dispatcher.h" |
| 24 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h" | 24 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h" |
| 25 #include "content/renderer/media/media_stream_source.h" | 25 #include "content/renderer/media/media_stream_source.h" |
| 26 #include "services/service_manager/public/cpp/interface_provider.h" | 26 #include "services/service_manager/public/cpp/interface_provider.h" |
| 27 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 27 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
| 28 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 28 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 44 class VideoCaptureSettings; | 44 class VideoCaptureSettings; |
| 45 | 45 |
| 46 // UserMediaClientImpl is a delegate for the Media Stream GetUserMedia API. | 46 // UserMediaClientImpl is a delegate for the Media Stream GetUserMedia API. |
| 47 // It ties together WebKit and MediaStreamManager | 47 // It ties together WebKit and MediaStreamManager |
| 48 // (via MediaStreamDispatcher and MediaStreamDispatcherHost) | 48 // (via MediaStreamDispatcher and MediaStreamDispatcherHost) |
| 49 // in the browser process. It must be created, called and destroyed on the | 49 // in the browser process. It must be created, called and destroyed on the |
| 50 // render thread. | 50 // render thread. |
| 51 class CONTENT_EXPORT UserMediaClientImpl | 51 class CONTENT_EXPORT UserMediaClientImpl |
| 52 : public RenderFrameObserver, | 52 : public RenderFrameObserver, |
| 53 NON_EXPORTED_BASE(public blink::WebUserMediaClient), | 53 NON_EXPORTED_BASE(public blink::WebUserMediaClient), |
| 54 public MediaStreamDispatcherEventHandler, | 54 public MediaStreamDispatcherEventHandler { |
| 55 NON_EXPORTED_BASE(public base::NonThreadSafe) { | |
| 56 public: | 55 public: |
| 57 // |render_frame| and |dependency_factory| must outlive this instance. | 56 // |render_frame| and |dependency_factory| must outlive this instance. |
| 58 UserMediaClientImpl( | 57 UserMediaClientImpl( |
| 59 RenderFrame* render_frame, | 58 RenderFrame* render_frame, |
| 60 PeerConnectionDependencyFactory* dependency_factory, | 59 PeerConnectionDependencyFactory* dependency_factory, |
| 61 std::unique_ptr<MediaStreamDispatcher> media_stream_dispatcher, | 60 std::unique_ptr<MediaStreamDispatcher> media_stream_dispatcher, |
| 62 const scoped_refptr<base::TaskRunner>& worker_task_runner); | 61 const scoped_refptr<base::TaskRunner>& worker_task_runner); |
| 63 ~UserMediaClientImpl() override; | 62 ~UserMediaClientImpl() override; |
| 64 | 63 |
| 65 MediaStreamDispatcher* media_stream_dispatcher() const { | 64 MediaStreamDispatcher* media_stream_dispatcher() const { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 std::unique_ptr<UserMediaRequestInfo> current_request_info_; | 272 std::unique_ptr<UserMediaRequestInfo> current_request_info_; |
| 274 std::list<std::unique_ptr<UserMediaRequestInfo>> pending_request_infos_; | 273 std::list<std::unique_ptr<UserMediaRequestInfo>> pending_request_infos_; |
| 275 | 274 |
| 276 MediaDevicesEventDispatcher::SubscriptionIdList | 275 MediaDevicesEventDispatcher::SubscriptionIdList |
| 277 device_change_subscription_ids_; | 276 device_change_subscription_ids_; |
| 278 | 277 |
| 279 blink::WebMediaDeviceChangeObserver media_device_change_observer_; | 278 blink::WebMediaDeviceChangeObserver media_device_change_observer_; |
| 280 | 279 |
| 281 const scoped_refptr<base::TaskRunner> worker_task_runner_; | 280 const scoped_refptr<base::TaskRunner> worker_task_runner_; |
| 282 | 281 |
| 282 SEQUENCE_CHECKER(sequence_checker_); |
| 283 |
| 283 // Note: This member must be the last to ensure all outstanding weak pointers | 284 // Note: This member must be the last to ensure all outstanding weak pointers |
| 284 // are invalidated first. | 285 // are invalidated first. |
| 285 base::WeakPtrFactory<UserMediaClientImpl> weak_factory_; | 286 base::WeakPtrFactory<UserMediaClientImpl> weak_factory_; |
| 286 | 287 |
| 287 DISALLOW_COPY_AND_ASSIGN(UserMediaClientImpl); | 288 DISALLOW_COPY_AND_ASSIGN(UserMediaClientImpl); |
| 288 }; | 289 }; |
| 289 | 290 |
| 290 } // namespace content | 291 } // namespace content |
| 291 | 292 |
| 292 #endif // CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_ | 293 #endif // CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_ |
| OLD | NEW |