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

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

Issue 1414553002: Fix out-of-memory crashes related to ArrayBuffer allocation Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 void RTCDataChannel::didReceiveRawData(const char* data, size_t dataLength) 280 void RTCDataChannel::didReceiveRawData(const char* data, size_t dataLength)
281 { 281 {
282 if (m_stopped) 282 if (m_stopped)
283 return; 283 return;
284 284
285 if (m_binaryType == BinaryTypeBlob) { 285 if (m_binaryType == BinaryTypeBlob) {
286 // FIXME: Implement. 286 // FIXME: Implement.
287 return; 287 return;
288 } 288 }
289 if (m_binaryType == BinaryTypeArrayBuffer) { 289 if (m_binaryType == BinaryTypeArrayBuffer) {
290 RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::create(data, dataLength) ; 290 RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::createOrNull(data, dataL ength);
291 scheduleDispatchEvent(MessageEvent::create(buffer.release())); 291 // Being out of memory results in silent failure: message dropped.
292 if (buffer)
293 scheduleDispatchEvent(MessageEvent::create(buffer.release()));
292 return; 294 return;
293 } 295 }
294 ASSERT_NOT_REACHED(); 296 ASSERT_NOT_REACHED();
295 } 297 }
296 298
297 void RTCDataChannel::didDetectError() 299 void RTCDataChannel::didDetectError()
298 { 300 {
299 if (m_stopped) 301 if (m_stopped)
300 return; 302 return;
301 303
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 355
354 DEFINE_TRACE(RTCDataChannel) 356 DEFINE_TRACE(RTCDataChannel)
355 { 357 {
356 visitor->trace(m_executionContext); 358 visitor->trace(m_executionContext);
357 visitor->trace(m_scheduledEvents); 359 visitor->trace(m_scheduledEvents);
358 visitor->template registerWeakMembers<RTCDataChannel, &RTCDataChannel::clear WeakMembers>(this); 360 visitor->template registerWeakMembers<RTCDataChannel, &RTCDataChannel::clear WeakMembers>(this);
359 RefCountedGarbageCollectedEventTargetWithInlineData<RTCDataChannel>::trace(v isitor); 361 RefCountedGarbageCollectedEventTargetWithInlineData<RTCDataChannel>::trace(v isitor);
360 } 362 }
361 363
362 } // namespace blink 364 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698