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

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

Issue 2529853002: Fix shutdown crash in AudioOutputAuthorizationHandler. (Closed)
Patch Set: Add mac comment. Created 4 years 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_AUDIO_OUTPUT_AUTHORIZATION_HANDLER_H _ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_AUTHORIZATION_HANDLER_H _
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_AUTHORIZATION_HANDLER_H _ 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_AUTHORIZATION_HANDLER_H _
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 22 matching lines...) Expand all
33 // also has the default audio parameters for the device, and the id for the 33 // also has the default audio parameters for the device, and the id for the
34 // device, which is needed to open a stream for the device. This id is not 34 // device, which is needed to open a stream for the device. This id is not
35 // hashed, so it must be hashed before sending it to the renderer. 35 // hashed, so it must be hashed before sending it to the renderer.
36 // TODO(maxmorin): Change to OnceCallback once base:: code is ready for it. 36 // TODO(maxmorin): Change to OnceCallback once base:: code is ready for it.
37 using AuthorizationCompletedCallback = 37 using AuthorizationCompletedCallback =
38 base::Callback<void(media::OutputDeviceStatus status, 38 base::Callback<void(media::OutputDeviceStatus status,
39 bool should_send_id, 39 bool should_send_id,
40 const media::AudioParameters& params, 40 const media::AudioParameters& params,
41 const std::string& raw_device_id)>; 41 const std::string& raw_device_id)>;
42 42
43 AudioOutputAuthorizationHandler(MediaStreamManager* media_stream_manager, 43 // |audio_manager| and |media_stream_manager| must outlive the
44 // AudioOutputAuthorizationHandler.
o1ka 2016/11/24 13:17:36 This is kind of obvious: you pass pointers to them
Max Morin 2016/11/24 14:12:20 Done.
45 AudioOutputAuthorizationHandler(media::AudioManager* audio_manager,
46 MediaStreamManager* media_stream_manager,
44 int render_process_id_, 47 int render_process_id_,
45 const std::string& salt); 48 const std::string& salt);
46 49
47 ~AudioOutputAuthorizationHandler(); 50 ~AudioOutputAuthorizationHandler();
48 51
49 // Checks authorization of the device with the hashed id |device_id| for the 52 // Checks authorization of the device with the hashed id |device_id| for the
50 // given render frame id and security origin, or uses |session_id| for 53 // given render frame id and security origin, or uses |session_id| for
51 // authorization. Looks up device id (if |session_id| is used for device 54 // authorization. Looks up device id (if |session_id| is used for device
52 // selection) and default device parameters. 55 // selection) and default device parameters.
53 void RequestDeviceAuthorization(int render_frame_id, 56 void RequestDeviceAuthorization(int render_frame_id,
(...skipping 22 matching lines...) Expand all
76 79
77 void GetDeviceParameters(AuthorizationCompletedCallback cb, 80 void GetDeviceParameters(AuthorizationCompletedCallback cb,
78 const std::string& raw_device_id) const; 81 const std::string& raw_device_id) const;
79 82
80 void DeviceParametersReceived( 83 void DeviceParametersReceived(
81 AuthorizationCompletedCallback cb, 84 AuthorizationCompletedCallback cb,
82 bool should_send_id, 85 bool should_send_id,
83 const std::string& raw_device_id, 86 const std::string& raw_device_id,
84 const media::AudioParameters& output_params) const; 87 const media::AudioParameters& output_params) const;
85 88
89 media::AudioManager* audio_manager_;
86 MediaStreamManager* const media_stream_manager_; 90 MediaStreamManager* const media_stream_manager_;
87 std::unique_ptr<MediaDevicesPermissionChecker> permission_checker_; 91 std::unique_ptr<MediaDevicesPermissionChecker> permission_checker_;
88 const int render_process_id_; 92 const int render_process_id_;
89 const std::string salt_; 93 const std::string salt_;
90 // All access is on the IO thread, and taking a weak pointer to const looks 94 // All access is on the IO thread, and taking a weak pointer to const looks
91 // const, so this can be mutable. 95 // const, so this can be mutable.
92 mutable base::WeakPtrFactory<const AudioOutputAuthorizationHandler> 96 mutable base::WeakPtrFactory<const AudioOutputAuthorizationHandler>
93 weak_factory_; 97 weak_factory_;
94 98
95 DISALLOW_COPY_AND_ASSIGN(AudioOutputAuthorizationHandler); 99 DISALLOW_COPY_AND_ASSIGN(AudioOutputAuthorizationHandler);
96 }; 100 };
97 101
98 } // namespace content 102 } // namespace content
99 103
100 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_AUTHORIZATION_HANDLE R_H_ 104 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_AUTHORIZATION_HANDLE R_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698