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

Side by Side Diff: Source/modules/mediastream/RTCDataChannel.cpp

Issue 18548003: Rename ExceptionCode constants to use the names in the spec (2/3) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 return String(); 114 return String();
115 } 115 }
116 116
117 void RTCDataChannel::setBinaryType(const String& binaryType, ExceptionCode& ec) 117 void RTCDataChannel::setBinaryType(const String& binaryType, ExceptionCode& ec)
118 { 118 {
119 if (binaryType == "blob") 119 if (binaryType == "blob")
120 ec = NotSupportedError; 120 ec = NotSupportedError;
121 else if (binaryType == "arraybuffer") 121 else if (binaryType == "arraybuffer")
122 m_binaryType = BinaryTypeArrayBuffer; 122 m_binaryType = BinaryTypeArrayBuffer;
123 else 123 else
124 ec = TYPE_MISMATCH_ERR; 124 ec = TypeMismatchError;
125 } 125 }
126 126
127 void RTCDataChannel::send(const String& data, ExceptionCode& ec) 127 void RTCDataChannel::send(const String& data, ExceptionCode& ec)
128 { 128 {
129 if (m_readyState != ReadyStateOpen) { 129 if (m_readyState != ReadyStateOpen) {
130 ec = INVALID_STATE_ERR; 130 ec = InvalidStateError;
131 return; 131 return;
132 } 132 }
133 if (!m_handler->sendStringData(data)) { 133 if (!m_handler->sendStringData(data)) {
134 // FIXME: Decide what the right exception here is. 134 // FIXME: Decide what the right exception here is.
135 ec = SYNTAX_ERR; 135 ec = SyntaxError;
136 } 136 }
137 } 137 }
138 138
139 void RTCDataChannel::send(PassRefPtr<ArrayBuffer> prpData, ExceptionCode& ec) 139 void RTCDataChannel::send(PassRefPtr<ArrayBuffer> prpData, ExceptionCode& ec)
140 { 140 {
141 if (m_readyState != ReadyStateOpen) { 141 if (m_readyState != ReadyStateOpen) {
142 ec = INVALID_STATE_ERR; 142 ec = InvalidStateError;
143 return; 143 return;
144 } 144 }
145 145
146 RefPtr<ArrayBuffer> data = prpData; 146 RefPtr<ArrayBuffer> data = prpData;
147 147
148 size_t dataLength = data->byteLength(); 148 size_t dataLength = data->byteLength();
149 if (!dataLength) 149 if (!dataLength)
150 return; 150 return;
151 151
152 const char* dataPointer = static_cast<const char*>(data->data()); 152 const char* dataPointer = static_cast<const char*>(data->data());
153 153
154 if (!m_handler->sendRawData(dataPointer, dataLength)) { 154 if (!m_handler->sendRawData(dataPointer, dataLength)) {
155 // FIXME: Decide what the right exception here is. 155 // FIXME: Decide what the right exception here is.
156 ec = SYNTAX_ERR; 156 ec = SyntaxError;
157 } 157 }
158 } 158 }
159 159
160 void RTCDataChannel::send(PassRefPtr<ArrayBufferView> data, ExceptionCode& ec) 160 void RTCDataChannel::send(PassRefPtr<ArrayBufferView> data, ExceptionCode& ec)
161 { 161 {
162 RefPtr<ArrayBuffer> arrayBuffer(data->buffer()); 162 RefPtr<ArrayBuffer> arrayBuffer(data->buffer());
163 send(arrayBuffer.release(), ec); 163 send(arrayBuffer.release(), ec);
164 } 164 }
165 165
166 void RTCDataChannel::send(PassRefPtr<Blob> data, ExceptionCode& ec) 166 void RTCDataChannel::send(PassRefPtr<Blob> data, ExceptionCode& ec)
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 events.swap(m_scheduledEvents); 274 events.swap(m_scheduledEvents);
275 275
276 Vector<RefPtr<Event> >::iterator it = events.begin(); 276 Vector<RefPtr<Event> >::iterator it = events.begin();
277 for (; it != events.end(); ++it) 277 for (; it != events.end(); ++it)
278 dispatchEvent((*it).release()); 278 dispatchEvent((*it).release());
279 279
280 events.clear(); 280 events.clear();
281 } 281 }
282 282
283 } // namespace WebCore 283 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/mediastream/RTCDTMFSender.cpp ('k') | Source/modules/mediastream/RTCIceCandidate.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698