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

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

Issue 2474923002: Fix race in MediaDevicesPermissionChecker. (Closed)
Patch Set: Fix rebase Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_BROWSER_RENDERER_HOST_MEDIA_MEDIA_DEVICES_DISPATCHER_HOST_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_DEVICES_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_DEVICES_DISPATCHER_HOST_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_DEVICES_DISPATCHER_HOST_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 uint32_t subscription_id, 53 uint32_t subscription_id,
54 const url::Origin& security_origin) override; 54 const url::Origin& security_origin) override;
55 void UnsubscribeDeviceChangeNotifications(MediaDeviceType type, 55 void UnsubscribeDeviceChangeNotifications(MediaDeviceType type,
56 uint32_t subscription_id) override; 56 uint32_t subscription_id) override;
57 57
58 // MediaDeviceChangeSubscriber implementation. 58 // MediaDeviceChangeSubscriber implementation.
59 void OnDevicesChanged(MediaDeviceType type, 59 void OnDevicesChanged(MediaDeviceType type,
60 const MediaDeviceInfoArray& device_infos) override; 60 const MediaDeviceInfoArray& device_infos) override;
61 61
62 void SetPermissionChecker( 62 void SetPermissionChecker(
63 const MediaDevicesPermissionChecker& permission_checker); 63 std::unique_ptr<MediaDevicesPermissionChecker> permission_checker);
64 64
65 void SetDeviceChangeListenerForTesting( 65 void SetDeviceChangeListenerForTesting(
66 ::mojom::MediaDevicesListenerPtr listener); 66 ::mojom::MediaDevicesListenerPtr listener);
67 67
68 private: 68 private:
69 void DoEnumerateDevices( 69 void DoEnumerateDevices(
70 const MediaDevicesManager::BoolDeviceTypes& requested_types, 70 const MediaDevicesManager::BoolDeviceTypes& requested_types,
71 const url::Origin& security_origin, 71 const url::Origin& security_origin,
72 const EnumerateDevicesCallback& client_callback, 72 const EnumerateDevicesCallback& client_callback,
73 const MediaDevicesManager::BoolDeviceTypes& permissions); 73 const MediaDevicesManager::BoolDeviceTypes& permissions);
(...skipping 12 matching lines...) Expand all
86 const MediaDeviceInfoArray& device_infos); 86 const MediaDeviceInfoArray& device_infos);
87 87
88 // The following const fields can be accessed on any thread. 88 // The following const fields can be accessed on any thread.
89 const int render_process_id_; 89 const int render_process_id_;
90 const int render_frame_id_; 90 const int render_frame_id_;
91 const std::string device_id_salt_; 91 const std::string device_id_salt_;
92 const std::string group_id_salt_; 92 const std::string group_id_salt_;
93 93
94 // The following fields can only be accessed on the IO thread. 94 // The following fields can only be accessed on the IO thread.
95 MediaStreamManager* media_stream_manager_; 95 MediaStreamManager* media_stream_manager_;
96 MediaDevicesPermissionChecker permission_checker_; 96 std::unique_ptr<MediaDevicesPermissionChecker> permission_checker_;
97 std::vector<SubscriptionInfo> 97 std::vector<SubscriptionInfo>
98 device_change_subscriptions_[NUM_MEDIA_DEVICE_TYPES]; 98 device_change_subscriptions_[NUM_MEDIA_DEVICE_TYPES];
99 99
100 // This field can only be accessed on the UI thread. 100 // This field can only be accessed on the UI thread.
101 ::mojom::MediaDevicesListenerPtr device_change_listener_; 101 ::mojom::MediaDevicesListenerPtr device_change_listener_;
102 102
103 base::WeakPtrFactory<MediaDevicesDispatcherHost> weak_factory_; 103 base::WeakPtrFactory<MediaDevicesDispatcherHost> weak_factory_;
104 104
105 DISALLOW_COPY_AND_ASSIGN(MediaDevicesDispatcherHost); 105 DISALLOW_COPY_AND_ASSIGN(MediaDevicesDispatcherHost);
106 }; 106 };
107 107
108 } // namespace content 108 } // namespace content
109 109
110 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_DEVICES_DISPATCHER_HOST_H_ 110 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_DEVICES_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698