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

Side by Side Diff: media/base/android/media_drm_bridge.h

Issue 1906423005: Replace scoped_ptr with std::unique_ptr in //media/base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-media-base: android Created 4 years, 7 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
« no previous file with comments | « media/base/android/media_decoder_job.h ('k') | media/base/android/media_drm_bridge.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ 6 #define MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <stdint.h> 9 #include <stdint.h>
10
11 #include <memory>
10 #include <string> 12 #include <string>
11 #include <vector> 13 #include <vector>
12 14
13 #include "base/android/scoped_java_ref.h" 15 #include "base/android/scoped_java_ref.h"
14 #include "base/callback.h" 16 #include "base/callback.h"
15 #include "base/macros.h" 17 #include "base/macros.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
18 #include "media/base/android/media_drm_bridge_cdm_context.h" 19 #include "media/base/android/media_drm_bridge_cdm_context.h"
19 #include "media/base/android/provision_fetcher.h" 20 #include "media/base/android/provision_fetcher.h"
20 #include "media/base/cdm_promise_adapter.h" 21 #include "media/base/cdm_promise_adapter.h"
21 #include "media/base/media_export.h" 22 #include "media/base/media_export.h"
22 #include "media/base/media_keys.h" 23 #include "media/base/media_keys.h"
23 #include "media/base/player_tracker.h" 24 #include "media/base/player_tracker.h"
24 #include "media/cdm/player_tracker_impl.h" 25 #include "media/cdm/player_tracker_impl.h"
25 #include "url/gurl.h" 26 #include "url/gurl.h"
26 27
(...skipping 11 matching lines...) Expand all
38 39
39 class MEDIA_EXPORT MediaDrmBridge : public MediaKeys, public PlayerTracker { 40 class MEDIA_EXPORT MediaDrmBridge : public MediaKeys, public PlayerTracker {
40 public: 41 public:
41 // TODO(ddorwin): These are specific to Widevine. http://crbug.com/459400 42 // TODO(ddorwin): These are specific to Widevine. http://crbug.com/459400
42 enum SecurityLevel { 43 enum SecurityLevel {
43 SECURITY_LEVEL_DEFAULT = 0, 44 SECURITY_LEVEL_DEFAULT = 0,
44 SECURITY_LEVEL_1 = 1, 45 SECURITY_LEVEL_1 = 1,
45 SECURITY_LEVEL_3 = 3, 46 SECURITY_LEVEL_3 = 3,
46 }; 47 };
47 48
48 using JavaObjectPtr = scoped_ptr<base::android::ScopedJavaGlobalRef<jobject>>; 49 using JavaObjectPtr =
50 std::unique_ptr<base::android::ScopedJavaGlobalRef<jobject>>;
49 51
50 using ResetCredentialsCB = base::Callback<void(bool)>; 52 using ResetCredentialsCB = base::Callback<void(bool)>;
51 53
52 // Notification called when MediaCrypto object is ready. 54 // Notification called when MediaCrypto object is ready.
53 // Parameters: 55 // Parameters:
54 // |media_crypto| - global reference to MediaCrypto object 56 // |media_crypto| - global reference to MediaCrypto object
55 // |needs_protected_surface| - true if protected surface is required. 57 // |needs_protected_surface| - true if protected surface is required.
56 using MediaCryptoReadyCB = base::Callback<void(JavaObjectPtr media_crypto, 58 using MediaCryptoReadyCB = base::Callback<void(JavaObjectPtr media_crypto,
57 bool needs_protected_surface)>; 59 bool needs_protected_surface)>;
58 60
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // Same as Create() except that no session callbacks are provided. This is 94 // Same as Create() except that no session callbacks are provided. This is
93 // used when we need to use MediaDrmBridge without creating any sessions. 95 // used when we need to use MediaDrmBridge without creating any sessions.
94 static scoped_refptr<MediaDrmBridge> CreateWithoutSessionSupport( 96 static scoped_refptr<MediaDrmBridge> CreateWithoutSessionSupport(
95 const std::string& key_system, 97 const std::string& key_system,
96 SecurityLevel security_level, 98 SecurityLevel security_level,
97 const CreateFetcherCB& create_fetcher_cb); 99 const CreateFetcherCB& create_fetcher_cb);
98 100
99 // MediaKeys implementation. 101 // MediaKeys implementation.
100 void SetServerCertificate( 102 void SetServerCertificate(
101 const std::vector<uint8_t>& certificate, 103 const std::vector<uint8_t>& certificate,
102 scoped_ptr<media::SimpleCdmPromise> promise) override; 104 std::unique_ptr<media::SimpleCdmPromise> promise) override;
103 void CreateSessionAndGenerateRequest( 105 void CreateSessionAndGenerateRequest(
104 SessionType session_type, 106 SessionType session_type,
105 media::EmeInitDataType init_data_type, 107 media::EmeInitDataType init_data_type,
106 const std::vector<uint8_t>& init_data, 108 const std::vector<uint8_t>& init_data,
107 scoped_ptr<media::NewSessionCdmPromise> promise) override; 109 std::unique_ptr<media::NewSessionCdmPromise> promise) override;
108 void LoadSession(SessionType session_type, 110 void LoadSession(
109 const std::string& session_id, 111 SessionType session_type,
110 scoped_ptr<media::NewSessionCdmPromise> promise) override; 112 const std::string& session_id,
113 std::unique_ptr<media::NewSessionCdmPromise> promise) override;
111 void UpdateSession(const std::string& session_id, 114 void UpdateSession(const std::string& session_id,
112 const std::vector<uint8_t>& response, 115 const std::vector<uint8_t>& response,
113 scoped_ptr<media::SimpleCdmPromise> promise) override; 116 std::unique_ptr<media::SimpleCdmPromise> promise) override;
114 void CloseSession(const std::string& session_id, 117 void CloseSession(const std::string& session_id,
115 scoped_ptr<media::SimpleCdmPromise> promise) override; 118 std::unique_ptr<media::SimpleCdmPromise> promise) override;
116 void RemoveSession(const std::string& session_id, 119 void RemoveSession(const std::string& session_id,
117 scoped_ptr<media::SimpleCdmPromise> promise) override; 120 std::unique_ptr<media::SimpleCdmPromise> promise) override;
118 CdmContext* GetCdmContext() override; 121 CdmContext* GetCdmContext() override;
119 void DeleteOnCorrectThread() const override; 122 void DeleteOnCorrectThread() const override;
120 123
121 // PlayerTracker implementation. Can be called on any thread. 124 // PlayerTracker implementation. Can be called on any thread.
122 // The registered callbacks will be fired on |task_runner_|. The caller 125 // The registered callbacks will be fired on |task_runner_|. The caller
123 // should make sure that the callbacks are posted to the correct thread. 126 // should make sure that the callbacks are posted to the correct thread.
124 // 127 //
125 // Note: RegisterPlayer() should be called before SetMediaCryptoReadyCB() to 128 // Note: RegisterPlayer() should be called before SetMediaCryptoReadyCB() to
126 // avoid missing any new key notifications. 129 // avoid missing any new key notifications.
127 int RegisterPlayer(const base::Closure& new_key_cb, 130 int RegisterPlayer(const base::Closure& new_key_cb,
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 // MediaCrypto creation succeeded and it has been notified. 307 // MediaCrypto creation succeeded and it has been notified.
305 // j_media_crypto_->is_null(): 308 // j_media_crypto_->is_null():
306 // MediaCrypto creation failed and it has been notified. 309 // MediaCrypto creation failed and it has been notified.
307 JavaObjectPtr j_media_crypto_; 310 JavaObjectPtr j_media_crypto_;
308 311
309 // The callback to create a ProvisionFetcher. 312 // The callback to create a ProvisionFetcher.
310 CreateFetcherCB create_fetcher_cb_; 313 CreateFetcherCB create_fetcher_cb_;
311 314
312 // The ProvisionFetcher that requests and receives provisioning data. 315 // The ProvisionFetcher that requests and receives provisioning data.
313 // Non-null iff when a provision request is pending. 316 // Non-null iff when a provision request is pending.
314 scoped_ptr<ProvisionFetcher> provision_fetcher_; 317 std::unique_ptr<ProvisionFetcher> provision_fetcher_;
315 318
316 // Callbacks for firing session events. 319 // Callbacks for firing session events.
317 SessionMessageCB session_message_cb_; 320 SessionMessageCB session_message_cb_;
318 SessionClosedCB session_closed_cb_; 321 SessionClosedCB session_closed_cb_;
319 LegacySessionErrorCB legacy_session_error_cb_; 322 LegacySessionErrorCB legacy_session_error_cb_;
320 SessionKeysChangeCB session_keys_change_cb_; 323 SessionKeysChangeCB session_keys_change_cb_;
321 SessionExpirationUpdateCB session_expiration_update_cb_; 324 SessionExpirationUpdateCB session_expiration_update_cb_;
322 325
323 MediaCryptoReadyCB media_crypto_ready_cb_; 326 MediaCryptoReadyCB media_crypto_ready_cb_;
324 327
(...skipping 10 matching lines...) Expand all
335 338
336 // NOTE: Weak pointers must be invalidated before all other member variables. 339 // NOTE: Weak pointers must be invalidated before all other member variables.
337 base::WeakPtrFactory<MediaDrmBridge> weak_factory_; 340 base::WeakPtrFactory<MediaDrmBridge> weak_factory_;
338 341
339 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); 342 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge);
340 }; 343 };
341 344
342 } // namespace media 345 } // namespace media
343 346
344 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ 347 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_
OLDNEW
« no previous file with comments | « media/base/android/media_decoder_job.h ('k') | media/base/android/media_drm_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698