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

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: rebase+more tweaks Created 5 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
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 // TODO(junov): crbug.com/536816
291 // Consider using createOrNull instead of deprecatedCreateOrCrash.
292 // It must be ascertained whether dropping the event or producing some
293 // kind of failure code would be an acceptable alternative to crashing
294 // the process when array buffer allocation fails.
295 RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::deprecatedCreateOrCrash( data, dataLength);
291 scheduleDispatchEvent(MessageEvent::create(buffer.release())); 296 scheduleDispatchEvent(MessageEvent::create(buffer.release()));
292 return; 297 return;
293 } 298 }
294 ASSERT_NOT_REACHED(); 299 ASSERT_NOT_REACHED();
295 } 300 }
296 301
297 void RTCDataChannel::didDetectError() 302 void RTCDataChannel::didDetectError()
298 { 303 {
299 if (m_stopped) 304 if (m_stopped)
300 return; 305 return;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 358
354 DEFINE_TRACE(RTCDataChannel) 359 DEFINE_TRACE(RTCDataChannel)
355 { 360 {
356 visitor->trace(m_executionContext); 361 visitor->trace(m_executionContext);
357 visitor->trace(m_scheduledEvents); 362 visitor->trace(m_scheduledEvents);
358 visitor->template registerWeakMembers<RTCDataChannel, &RTCDataChannel::clear WeakMembers>(this); 363 visitor->template registerWeakMembers<RTCDataChannel, &RTCDataChannel::clear WeakMembers>(this);
359 RefCountedGarbageCollectedEventTargetWithInlineData<RTCDataChannel>::trace(v isitor); 364 RefCountedGarbageCollectedEventTargetWithInlineData<RTCDataChannel>::trace(v isitor);
360 } 365 }
361 366
362 } // namespace blink 367 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698