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

Side by Side Diff: Source/modules/encryptedmedia/MediaKeys.cpp

Issue 170603003: Use nullptr_t for RefPtr, PassRefPtr and RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final rebase Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/modules/encoding/TextEncoder.cpp ('k') | Source/modules/filesystem/DOMFileSystem.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 DEFINE_GC_INFO(MediaKeys); 42 DEFINE_GC_INFO(MediaKeys);
43 43
44 PassRefPtrWillBeRawPtr<MediaKeys> MediaKeys::create(ExecutionContext* context, c onst String& keySystem, ExceptionState& exceptionState) 44 PassRefPtrWillBeRawPtr<MediaKeys> MediaKeys::create(ExecutionContext* context, c onst String& keySystem, ExceptionState& exceptionState)
45 { 45 {
46 // From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e ncrypted-media.html#dom-media-keys-constructor>: 46 // From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e ncrypted-media.html#dom-media-keys-constructor>:
47 // The MediaKeys(keySystem) constructor must run the following steps: 47 // The MediaKeys(keySystem) constructor must run the following steps:
48 48
49 // 1. If keySystem is null or an empty string, throw an InvalidAccessError e xception and abort these steps. 49 // 1. If keySystem is null or an empty string, throw an InvalidAccessError e xception and abort these steps.
50 if (keySystem.isEmpty()) { 50 if (keySystem.isEmpty()) {
51 exceptionState.throwDOMException(InvalidAccessError, "The key system pro vided is invalid."); 51 exceptionState.throwDOMException(InvalidAccessError, "The key system pro vided is invalid.");
52 return 0; 52 return nullptr;
53 } 53 }
54 54
55 // 2. If keySystem is not one of the user agent's supported Key Systems, thr ow a NotSupportedError and abort these steps. 55 // 2. If keySystem is not one of the user agent's supported Key Systems, thr ow a NotSupportedError and abort these steps.
56 if (!ContentDecryptionModule::supportsKeySystem(keySystem)) { 56 if (!ContentDecryptionModule::supportsKeySystem(keySystem)) {
57 exceptionState.throwDOMException(NotSupportedError, "The '" + keySystem + "' key system is not supported."); 57 exceptionState.throwDOMException(NotSupportedError, "The '" + keySystem + "' key system is not supported.");
58 return 0; 58 return nullptr;
59 } 59 }
60 60
61 // 3. Let cdm be the content decryption module corresponding to keySystem. 61 // 3. Let cdm be the content decryption module corresponding to keySystem.
62 // 4. Load cdm if necessary. 62 // 4. Load cdm if necessary.
63 OwnPtr<ContentDecryptionModule> cdm = ContentDecryptionModule::create(keySys tem); 63 OwnPtr<ContentDecryptionModule> cdm = ContentDecryptionModule::create(keySys tem);
64 if (!cdm) { 64 if (!cdm) {
65 exceptionState.throwDOMException(NotSupportedError, "A content decryptio n module could not be loaded for the '" + keySystem + "' key system."); 65 exceptionState.throwDOMException(NotSupportedError, "A content decryptio n module could not be loaded for the '" + keySystem + "' key system.");
66 return 0; 66 return nullptr;
67 } 67 }
68 68
69 // 5. Create a new MediaKeys object. 69 // 5. Create a new MediaKeys object.
70 // 5.1 Let the keySystem attribute be keySystem. 70 // 5.1 Let the keySystem attribute be keySystem.
71 // 6. Return the new object to the caller. 71 // 6. Return the new object to the caller.
72 return adoptRefWillBeNoop(new MediaKeys(context, keySystem, cdm.release())); 72 return adoptRefWillBeNoop(new MediaKeys(context, keySystem, cdm.release()));
73 } 73 }
74 74
75 MediaKeys::MediaKeys(ExecutionContext* context, const String& keySystem, PassOwn Ptr<ContentDecryptionModule> cdm) 75 MediaKeys::MediaKeys(ExecutionContext* context, const String& keySystem, PassOwn Ptr<ContentDecryptionModule> cdm)
76 : ContextLifecycleObserver(context) 76 : ContextLifecycleObserver(context)
(...skipping 14 matching lines...) Expand all
91 PassRefPtrWillBeRawPtr<MediaKeySession> MediaKeys::createSession(ExecutionContex t* context, const String& contentType, Uint8Array* initData, ExceptionState& exc eptionState) 91 PassRefPtrWillBeRawPtr<MediaKeySession> MediaKeys::createSession(ExecutionContex t* context, const String& contentType, Uint8Array* initData, ExceptionState& exc eptionState)
92 { 92 {
93 WTF_LOG(Media, "MediaKeys::createSession"); 93 WTF_LOG(Media, "MediaKeys::createSession");
94 94
95 // From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e ncrypted-media.html#dom-createsession>: 95 // From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e ncrypted-media.html#dom-createsession>:
96 // The createSession(type, initData) method must run the following steps: 96 // The createSession(type, initData) method must run the following steps:
97 // Note: The contents of initData are container-specific Initialization Data . 97 // Note: The contents of initData are container-specific Initialization Data .
98 98
99 if (contentType.isEmpty()) { 99 if (contentType.isEmpty()) {
100 exceptionState.throwDOMException(InvalidAccessError, "The contentType pr ovided ('" + contentType + "') is empty."); 100 exceptionState.throwDOMException(InvalidAccessError, "The contentType pr ovided ('" + contentType + "') is empty.");
101 return 0; 101 return nullptr;
102 } 102 }
103 103
104 if (!initData || !initData->length()) { 104 if (!initData || !initData->length()) {
105 exceptionState.throwDOMException(InvalidAccessError, "The initData provi ded is null or empty."); 105 exceptionState.throwDOMException(InvalidAccessError, "The initData provi ded is null or empty.");
106 return 0; 106 return nullptr;
107 } 107 }
108 108
109 // 1. If type contains a MIME type that is not supported or is not supported by the keySystem, 109 // 1. If type contains a MIME type that is not supported or is not supported by the keySystem,
110 // throw a NOT_SUPPORTED_ERR exception and abort these steps. 110 // throw a NOT_SUPPORTED_ERR exception and abort these steps.
111 if (!m_cdm->supportsMIMEType(contentType)) { 111 if (!m_cdm->supportsMIMEType(contentType)) {
112 exceptionState.throwDOMException(NotSupportedError, "The type provided ( '" + contentType + "') is unsupported."); 112 exceptionState.throwDOMException(NotSupportedError, "The type provided ( '" + contentType + "') is unsupported.");
113 return 0; 113 return nullptr;
114 } 114 }
115 115
116 // 2. Create a new MediaKeySession object. 116 // 2. Create a new MediaKeySession object.
117 RefPtrWillBeRawPtr<MediaKeySession> session = MediaKeySession::create(contex t, m_cdm.get(), m_weakFactory.createWeakPtr()); 117 RefPtrWillBeRawPtr<MediaKeySession> session = MediaKeySession::create(contex t, m_cdm.get(), m_weakFactory.createWeakPtr());
118 // 2.1 Let the keySystem attribute be keySystem. 118 // 2.1 Let the keySystem attribute be keySystem.
119 ASSERT(!session->keySystem().isEmpty()); 119 ASSERT(!session->keySystem().isEmpty());
120 // FIXME: 2.2 Let the state of the session be CREATED. 120 // FIXME: 2.2 Let the state of the session be CREATED.
121 121
122 // 3. Add the new object to an internal list of session objects (not needed) . 122 // 3. Add the new object to an internal list of session objects (not needed) .
123 123
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 void MediaKeys::contextDestroyed() 168 void MediaKeys::contextDestroyed()
169 { 169 {
170 ContextLifecycleObserver::contextDestroyed(); 170 ContextLifecycleObserver::contextDestroyed();
171 171
172 // We don't need the CDM anymore. 172 // We don't need the CDM anymore.
173 m_cdm.clear(); 173 m_cdm.clear();
174 } 174 }
175 175
176 } 176 }
OLDNEW
« no previous file with comments | « Source/modules/encoding/TextEncoder.cpp ('k') | Source/modules/filesystem/DOMFileSystem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698