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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp

Issue 1414553002: Fix out-of-memory crashes related to ArrayBuffer allocation Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverting some behavior changes 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 345
346 isolate->SetAutorunMicrotasks(false); 346 isolate->SetAutorunMicrotasks(false);
347 } 347 }
348 348
349 namespace { 349 namespace {
350 350
351 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 351 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
352 void* Allocate(size_t size) override 352 void* Allocate(size_t size) override
353 { 353 {
354 void* data; 354 void* data;
355 WTF::ArrayBufferContents::allocateMemory(size, WTF::ArrayBufferContents: :ZeroInitialize, data); 355 // FIXME: Use AllocateMemoryOrNull. Requires verification that all
haraken 2015/10/29 16:24:34 FIXME => TODO
356 // call sites can handle allocation failures (nullptr) gracefully.
357 WTF::ArrayBufferContents::deprecatedAllocateMemoryOrCrash(size, WTF::Arr ayBufferContents::ZeroInitialize, data);
356 return data; 358 return data;
357 } 359 }
358 360
359 void* AllocateUninitialized(size_t size) override 361 void* AllocateUninitialized(size_t size) override
360 { 362 {
361 void* data; 363 void* data;
362 WTF::ArrayBufferContents::allocateMemory(size, WTF::ArrayBufferContents: :DontInitialize, data); 364 // FIXME: Use AllocateMemoryOrNull. Requires verification that all
haraken 2015/10/29 16:24:34 Ditto.
365 // call sites can handle allocation failures (nullptr) gracefully.
366 WTF::ArrayBufferContents::deprecatedAllocateMemoryOrCrash(size, WTF::Arr ayBufferContents::DontInitialize, data);
363 return data; 367 return data;
364 } 368 }
365 369
366 void Free(void* data, size_t size) override 370 void Free(void* data, size_t size) override
367 { 371 {
368 WTF::ArrayBufferContents::freeMemory(data, size); 372 WTF::ArrayBufferContents::freeMemory(data, size);
369 } 373 }
370 }; 374 };
371 375
372 } // namespace 376 } // namespace
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 463
460 v8::V8::AddMessageListener(messageHandlerInWorker); 464 v8::V8::AddMessageListener(messageHandlerInWorker);
461 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); 465 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker);
462 466
463 uint32_t here; 467 uint32_t here;
464 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*))); 468 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*)));
465 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); 469 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker);
466 } 470 }
467 471
468 } // namespace blink 472 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698