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

Side by Side Diff: Source/modules/mediasource/MediaSource.cpp

Issue 72363002: Rename es => exceptionState in other than bindings/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Retry Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 m_sourceBuffers = SourceBufferList::create(executionContext(), asyncEventQue ue()); 63 m_sourceBuffers = SourceBufferList::create(executionContext(), asyncEventQue ue());
64 m_activeSourceBuffers = SourceBufferList::create(executionContext(), asyncEv entQueue()); 64 m_activeSourceBuffers = SourceBufferList::create(executionContext(), asyncEv entQueue());
65 } 65 }
66 66
67 MediaSource::~MediaSource() 67 MediaSource::~MediaSource()
68 { 68 {
69 LOG(Media, "MediaSource::~MediaSource %p", this); 69 LOG(Media, "MediaSource::~MediaSource %p", this);
70 ASSERT(isClosed()); 70 ASSERT(isClosed());
71 } 71 }
72 72
73 SourceBuffer* MediaSource::addSourceBuffer(const String& type, ExceptionState& e s) 73 SourceBuffer* MediaSource::addSourceBuffer(const String& type, ExceptionState& e xceptionState)
74 { 74 {
75 LOG(Media, "MediaSource::addSourceBuffer(%s) %p", type.ascii().data(), this) ; 75 LOG(Media, "MediaSource::addSourceBuffer(%s) %p", type.ascii().data(), this) ;
76 76
77 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media -source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type 77 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media -source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type
78 // 1. If type is null or an empty then throw an InvalidAccessError exception and 78 // 1. If type is null or an empty then throw an InvalidAccessError exception and
79 // abort these steps. 79 // abort these steps.
80 if (type.isNull() || type.isEmpty()) { 80 if (type.isNull() || type.isEmpty()) {
81 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 81 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
82 return 0; 82 return 0;
83 } 83 }
84 84
85 // 2. If type contains a MIME type that is not supported ..., then throw a 85 // 2. If type contains a MIME type that is not supported ..., then throw a
86 // NotSupportedError exception and abort these steps. 86 // NotSupportedError exception and abort these steps.
87 if (!isTypeSupported(type)) { 87 if (!isTypeSupported(type)) {
88 es.throwUninformativeAndGenericDOMException(NotSupportedError); 88 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
89 return 0; 89 return 0;
90 } 90 }
91 91
92 // 4. If the readyState attribute is not in the "open" state then throw an 92 // 4. If the readyState attribute is not in the "open" state then throw an
93 // InvalidStateError exception and abort these steps. 93 // InvalidStateError exception and abort these steps.
94 if (!isOpen()) { 94 if (!isOpen()) {
95 es.throwUninformativeAndGenericDOMException(InvalidStateError); 95 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro r);
96 return 0; 96 return 0;
97 } 97 }
98 98
99 // 5. Create a new SourceBuffer object and associated resources. 99 // 5. Create a new SourceBuffer object and associated resources.
100 ContentType contentType(type); 100 ContentType contentType(type);
101 Vector<String> codecs = contentType.codecs(); 101 Vector<String> codecs = contentType.codecs();
102 OwnPtr<WebSourceBuffer> webSourceBuffer = createWebSourceBuffer(contentType. type(), codecs, es); 102 OwnPtr<WebSourceBuffer> webSourceBuffer = createWebSourceBuffer(contentType. type(), codecs, exceptionState);
103 103
104 if (!webSourceBuffer) { 104 if (!webSourceBuffer) {
105 ASSERT(es.code() == NotSupportedError || es.code() == QuotaExceededError ); 105 ASSERT(exceptionState.code() == NotSupportedError || exceptionState.code () == QuotaExceededError);
106 // 2. If type contains a MIME type that is not supported ..., then throw a NotSupportedError exception and abort these steps. 106 // 2. If type contains a MIME type that is not supported ..., then throw a NotSupportedError exception and abort these steps.
107 // 3. If the user agent can't handle any more SourceBuffer objects then throw a QuotaExceededError exception and abort these steps 107 // 3. If the user agent can't handle any more SourceBuffer objects then throw a QuotaExceededError exception and abort these steps
108 return 0; 108 return 0;
109 } 109 }
110 110
111 RefPtr<SourceBuffer> buffer = SourceBuffer::create(webSourceBuffer.release() , this, asyncEventQueue()); 111 RefPtr<SourceBuffer> buffer = SourceBuffer::create(webSourceBuffer.release() , this, asyncEventQueue());
112 // 6. Add the new object to sourceBuffers and fire a addsourcebuffer on that object. 112 // 6. Add the new object to sourceBuffers and fire a addsourcebuffer on that object.
113 m_sourceBuffers->add(buffer); 113 m_sourceBuffers->add(buffer);
114 m_activeSourceBuffers->add(buffer); 114 m_activeSourceBuffers->add(buffer);
115 // 7. Return the new object to the caller. 115 // 7. Return the new object to the caller.
116 return buffer.get(); 116 return buffer.get();
117 } 117 }
118 118
119 void MediaSource::removeSourceBuffer(SourceBuffer* buffer, ExceptionState& es) 119 void MediaSource::removeSourceBuffer(SourceBuffer* buffer, ExceptionState& excep tionState)
120 { 120 {
121 LOG(Media, "MediaSource::removeSourceBuffer() %p", this); 121 LOG(Media, "MediaSource::removeSourceBuffer() %p", this);
122 RefPtr<SourceBuffer> protect(buffer); 122 RefPtr<SourceBuffer> protect(buffer);
123 123
124 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media -source.html#widl-MediaSource-removeSourceBuffer-void-SourceBuffer-sourceBuffer 124 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media -source.html#widl-MediaSource-removeSourceBuffer-void-SourceBuffer-sourceBuffer
125 // 1. If sourceBuffer is null then throw an InvalidAccessError exception and 125 // 1. If sourceBuffer is null then throw an InvalidAccessError exception and
126 // abort these steps. 126 // abort these steps.
127 if (!buffer) { 127 if (!buffer) {
128 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 128 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
129 return; 129 return;
130 } 130 }
131 131
132 // 2. If sourceBuffer specifies an object that is not in sourceBuffers then 132 // 2. If sourceBuffer specifies an object that is not in sourceBuffers then
133 // throw a NotFoundError exception and abort these steps. 133 // throw a NotFoundError exception and abort these steps.
134 if (!m_sourceBuffers->length() || !m_sourceBuffers->contains(buffer)) { 134 if (!m_sourceBuffers->length() || !m_sourceBuffers->contains(buffer)) {
135 es.throwUninformativeAndGenericDOMException(NotFoundError); 135 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError);
136 return; 136 return;
137 } 137 }
138 138
139 // 3. If the sourceBuffer.updating attribute equals true, then run the follo wing steps: ... 139 // 3. If the sourceBuffer.updating attribute equals true, then run the follo wing steps: ...
140 buffer->abortIfUpdating(); 140 buffer->abortIfUpdating();
141 141
142 // Steps 4-9 are related to updating audioTracks, videoTracks, and textTrack s which aren't implmented yet. 142 // Steps 4-9 are related to updating audioTracks, videoTracks, and textTrack s which aren't implmented yet.
143 // FIXME(91649): support track selection 143 // FIXME(91649): support track selection
144 144
145 // 10. If sourceBuffer is in activeSourceBuffers, then remove sourceBuffer f rom activeSourceBuffers ... 145 // 10. If sourceBuffer is in activeSourceBuffers, then remove sourceBuffer f rom activeSourceBuffers ...
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // 6. Return true. 209 // 6. Return true.
210 return MIMETypeRegistry::isSupportedMediaSourceMIMEType(contentType.type(), codecs); 210 return MIMETypeRegistry::isSupportedMediaSourceMIMEType(contentType.type(), codecs);
211 } 211 }
212 212
213 const AtomicString& MediaSource::interfaceName() const 213 const AtomicString& MediaSource::interfaceName() const
214 { 214 {
215 return EventTargetNames::MediaSource; 215 return EventTargetNames::MediaSource;
216 } 216 }
217 217
218 } // namespace WebCore 218 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/IDBTransaction.cpp ('k') | Source/modules/mediasource/MediaSourceBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698