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

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

Issue 2529853002: Fix shutdown crash in AudioOutputAuthorizationHandler. (Closed)
Patch Set: . 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 AudioOutputAuthorizationHandler(media::AudioManager* audio_manager,
44 MediaStreamManager* media_stream_manager,
44 int render_process_id_, 45 int render_process_id_,
45 const std::string& salt); 46 const std::string& salt);
46 47
47 ~AudioOutputAuthorizationHandler(); 48 ~AudioOutputAuthorizationHandler();
48 49
49 // Checks authorization of the device with the hashed id |device_id| for the 50 // 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 51 // 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 52 // authorization. Looks up device id (if |session_id| is used for device
52 // selection) and default device parameters. 53 // selection) and default device parameters.
53 void RequestDeviceAuthorization(int render_frame_id, 54 void RequestDeviceAuthorization(int render_frame_id,
(...skipping 22 matching lines...) Expand all
76 77
77 void GetDeviceParameters(AuthorizationCompletedCallback cb, 78 void GetDeviceParameters(AuthorizationCompletedCallback cb,
78 const std::string& raw_device_id) const; 79 const std::string& raw_device_id) const;
79 80
80 void DeviceParametersReceived( 81 void DeviceParametersReceived(
81 AuthorizationCompletedCallback cb, 82 AuthorizationCompletedCallback cb,
82 bool should_send_id, 83 bool should_send_id,
83 const std::string& raw_device_id, 84 const std::string& raw_device_id,
84 const media::AudioParameters& output_params) const; 85 const media::AudioParameters& output_params) const;
85 86
87 media::AudioManager* audio_manager_;
86 MediaStreamManager* const media_stream_manager_; 88 MediaStreamManager* const media_stream_manager_;
87 std::unique_ptr<MediaDevicesPermissionChecker> permission_checker_; 89 std::unique_ptr<MediaDevicesPermissionChecker> permission_checker_;
88 const int render_process_id_; 90 const int render_process_id_;
89 const std::string salt_; 91 const std::string salt_;
90 // All access is on the IO thread, and taking a weak pointer to const looks 92 // All access is on the IO thread, and taking a weak pointer to const looks
91 // const, so this can be mutable. 93 // const, so this can be mutable.
92 mutable base::WeakPtrFactory<const AudioOutputAuthorizationHandler> 94 mutable base::WeakPtrFactory<const AudioOutputAuthorizationHandler>
93 weak_factory_; 95 weak_factory_;
94 96
95 DISALLOW_COPY_AND_ASSIGN(AudioOutputAuthorizationHandler); 97 DISALLOW_COPY_AND_ASSIGN(AudioOutputAuthorizationHandler);
96 }; 98 };
97 99
98 } // namespace content 100 } // namespace content
99 101
100 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_AUTHORIZATION_HANDLE R_H_ 102 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_AUTHORIZATION_HANDLE R_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698