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

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

Issue 24469004: Amusingly deprecate the generic version of 'ExceptionState::throwDOMException'. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // FIXME(91649): support track selection 68 // FIXME(91649): support track selection
69 return m_activeSourceBuffers.get(); 69 return m_activeSourceBuffers.get();
70 } 70 }
71 71
72 WebKitSourceBuffer* WebKitMediaSource::addSourceBuffer(const String& type, Excep tionState& es) 72 WebKitSourceBuffer* WebKitMediaSource::addSourceBuffer(const String& type, Excep tionState& es)
73 { 73 {
74 // 3.1 http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-sour ce.html#dom-addsourcebuffer 74 // 3.1 http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-sour ce.html#dom-addsourcebuffer
75 // 1. If type is null or an empty then throw an InvalidAccessError exception and 75 // 1. If type is null or an empty then throw an InvalidAccessError exception and
76 // abort these steps. 76 // abort these steps.
77 if (type.isNull() || type.isEmpty()) { 77 if (type.isNull() || type.isEmpty()) {
78 es.throwDOMException(InvalidAccessError); 78 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
79 return 0; 79 return 0;
80 } 80 }
81 81
82 // 2. If type contains a MIME type that is not supported ..., then throw a 82 // 2. If type contains a MIME type that is not supported ..., then throw a
83 // NotSupportedError exception and abort these steps. 83 // NotSupportedError exception and abort these steps.
84 if (!isTypeSupported(type)) { 84 if (!isTypeSupported(type)) {
85 es.throwDOMException(NotSupportedError); 85 es.throwUninformativeAndGenericDOMException(NotSupportedError);
86 return 0; 86 return 0;
87 } 87 }
88 88
89 // 4. If the readyState attribute is not in the "open" state then throw an 89 // 4. If the readyState attribute is not in the "open" state then throw an
90 // InvalidStateError exception and abort these steps. 90 // InvalidStateError exception and abort these steps.
91 if (!isOpen()) { 91 if (!isOpen()) {
92 es.throwDOMException(InvalidStateError); 92 es.throwUninformativeAndGenericDOMException(InvalidStateError);
93 return 0; 93 return 0;
94 } 94 }
95 95
96 // 5. Create a new SourceBuffer object and associated resources. 96 // 5. Create a new SourceBuffer object and associated resources.
97 ContentType contentType(type); 97 ContentType contentType(type);
98 Vector<String> codecs = contentType.codecs(); 98 Vector<String> codecs = contentType.codecs();
99 OwnPtr<SourceBufferPrivate> sourceBufferPrivate = createSourceBufferPrivate( contentType.type(), codecs, es); 99 OwnPtr<SourceBufferPrivate> sourceBufferPrivate = createSourceBufferPrivate( contentType.type(), codecs, es);
100 if (!sourceBufferPrivate) 100 if (!sourceBufferPrivate)
101 return 0; 101 return 0;
102 102
103 RefPtr<WebKitSourceBuffer> buffer = WebKitSourceBuffer::create(sourceBufferP rivate.release(), this); 103 RefPtr<WebKitSourceBuffer> buffer = WebKitSourceBuffer::create(sourceBufferP rivate.release(), this);
104 // 6. Add the new object to sourceBuffers and fire a addsourcebuffer on that object. 104 // 6. Add the new object to sourceBuffers and fire a addsourcebuffer on that object.
105 m_sourceBuffers->add(buffer); 105 m_sourceBuffers->add(buffer);
106 m_activeSourceBuffers->add(buffer); 106 m_activeSourceBuffers->add(buffer);
107 // 7. Return the new object to the caller. 107 // 7. Return the new object to the caller.
108 return buffer.get(); 108 return buffer.get();
109 } 109 }
110 110
111 void WebKitMediaSource::removeSourceBuffer(WebKitSourceBuffer* buffer, Exception State& es) 111 void WebKitMediaSource::removeSourceBuffer(WebKitSourceBuffer* buffer, Exception State& es)
112 { 112 {
113 // 3.1 http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-sour ce.html#dom-removesourcebuffer 113 // 3.1 http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-sour ce.html#dom-removesourcebuffer
114 // 1. If sourceBuffer is null then throw an InvalidAccessError exception and 114 // 1. If sourceBuffer is null then throw an InvalidAccessError exception and
115 // abort these steps. 115 // abort these steps.
116 if (!buffer) { 116 if (!buffer) {
117 es.throwDOMException(InvalidAccessError); 117 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
118 return; 118 return;
119 } 119 }
120 120
121 // 2. If sourceBuffers is empty then throw an InvalidStateError exception an d 121 // 2. If sourceBuffers is empty then throw an InvalidStateError exception an d
122 // abort these steps. 122 // abort these steps.
123 if (isClosed() || !m_sourceBuffers->length()) { 123 if (isClosed() || !m_sourceBuffers->length()) {
124 es.throwDOMException(InvalidStateError); 124 es.throwUninformativeAndGenericDOMException(InvalidStateError);
125 return; 125 return;
126 } 126 }
127 127
128 // 3. If sourceBuffer specifies an object that is not in sourceBuffers then 128 // 3. If sourceBuffer specifies an object that is not in sourceBuffers then
129 // throw a NotFoundError exception and abort these steps. 129 // throw a NotFoundError exception and abort these steps.
130 // 6. Remove sourceBuffer from sourceBuffers and fire a removesourcebuffer e vent 130 // 6. Remove sourceBuffer from sourceBuffers and fire a removesourcebuffer e vent
131 // on that object. 131 // on that object.
132 if (!m_sourceBuffers->remove(buffer)) { 132 if (!m_sourceBuffers->remove(buffer)) {
133 es.throwDOMException(NotFoundError); 133 es.throwUninformativeAndGenericDOMException(NotFoundError);
134 return; 134 return;
135 } 135 }
136 136
137 // 7. Destroy all resources for sourceBuffer. 137 // 7. Destroy all resources for sourceBuffer.
138 m_activeSourceBuffers->remove(buffer); 138 m_activeSourceBuffers->remove(buffer);
139 139
140 // 4. Remove track information from audioTracks, videoTracks, and textTracks for all tracks 140 // 4. Remove track information from audioTracks, videoTracks, and textTracks for all tracks
141 // associated with sourceBuffer and fire a simple event named change on the modified lists. 141 // associated with sourceBuffer and fire a simple event named change on the modified lists.
142 // FIXME(91649): support track selection 142 // FIXME(91649): support track selection
143 143
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // 6. Return true. 196 // 6. Return true.
197 return MIMETypeRegistry::isSupportedMediaSourceMIMEType(contentType.type(), codecs); 197 return MIMETypeRegistry::isSupportedMediaSourceMIMEType(contentType.type(), codecs);
198 } 198 }
199 199
200 const AtomicString& WebKitMediaSource::interfaceName() const 200 const AtomicString& WebKitMediaSource::interfaceName() const
201 { 201 {
202 return eventNames().interfaceForWebKitMediaSource; 202 return eventNames().interfaceForWebKitMediaSource;
203 } 203 }
204 204
205 } // namespace WebCore 205 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/mediasource/SourceBuffer.cpp ('k') | Source/modules/mediasource/WebKitSourceBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698