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

Side by Side Diff: third_party/WebKit/Source/core/fileapi/FileReader.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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 // All possible events have fired and we're done, no more pending activity. 364 // All possible events have fired and we're done, no more pending activity.
365 ThrottlingController::finishReader(executionContext(), this, finalStep); 365 ThrottlingController::finishReader(executionContext(), this, finalStep);
366 } 366 }
367 367
368 void FileReader::result(StringOrArrayBuffer& resultAttribute) const 368 void FileReader::result(StringOrArrayBuffer& resultAttribute) const
369 { 369 {
370 if (!m_loader || m_error) 370 if (!m_loader || m_error)
371 return; 371 return;
372 372
373 if (m_readType == FileReaderLoader::ReadAsArrayBuffer) 373 if (m_readType == FileReaderLoader::ReadAsArrayBuffer)
374 resultAttribute.setArrayBuffer(m_loader->arrayBufferResult()); 374 resultAttribute.setArrayBuffer(m_loader->arrayBufferResultOrNull());
375 else 375 else
376 resultAttribute.setString(m_loader->stringResult()); 376 resultAttribute.setString(m_loader->stringResult());
377 } 377 }
378 378
379 void FileReader::terminate() 379 void FileReader::terminate()
380 { 380 {
381 if (m_loader) { 381 if (m_loader) {
382 m_loader->cancel(); 382 m_loader->cancel();
383 m_loader = nullptr; 383 m_loader = nullptr;
384 } 384 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 } 469 }
470 470
471 DEFINE_TRACE(FileReader) 471 DEFINE_TRACE(FileReader)
472 { 472 {
473 visitor->trace(m_error); 473 visitor->trace(m_error);
474 RefCountedGarbageCollectedEventTargetWithInlineData<FileReader>::trace(visit or); 474 RefCountedGarbageCollectedEventTargetWithInlineData<FileReader>::trace(visit or);
475 ActiveDOMObject::trace(visitor); 475 ActiveDOMObject::trace(visitor);
476 } 476 }
477 477
478 } // namespace blink 478 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/DOMTypedArray.h ('k') | third_party/WebKit/Source/core/fileapi/FileReaderLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698