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

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

Issue 1577783004: [v8] don't crash when ArrayBuffer allocation fails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a solution which doesn't modify behaviour of existing code, apart from JS TypedArrays Created 4 years, 11 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) 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 isolate->SetAutorunMicrotasks(false); 326 isolate->SetAutorunMicrotasks(false);
327 } 327 }
328 328
329 namespace { 329 namespace {
330 330
331 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 331 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
332 void* Allocate(size_t size) override 332 void* Allocate(size_t size) override
333 { 333 {
334 void* data; 334 void* data;
335 WTF::ArrayBufferContents::allocateMemory(size, WTF::ArrayBufferContents: :ZeroInitialize, data); 335 WTF::ArrayBufferContents::allocateMemoryOrNull(size, WTF::ArrayBufferCon tents::ZeroInitialize, data);
haraken 2016/01/14 01:52:33 I'm a bit confused. If you call allocateMemoryOrNu
caitp (gmail) 2016/01/14 01:59:04 The ArrayBufferAllocator is used (only) by v8, whi
haraken 2016/01/14 02:17:31 Thanks, makes sense. Can you add a comment about i
336 return data; 336 return data;
337 } 337 }
338 338
339 void* AllocateUninitialized(size_t size) override 339 void* AllocateUninitialized(size_t size) override
340 { 340 {
341 void* data; 341 void* data;
342 WTF::ArrayBufferContents::allocateMemory(size, WTF::ArrayBufferContents: :DontInitialize, data); 342 WTF::ArrayBufferContents::allocateMemoryOrNull(size, WTF::ArrayBufferCon tents::DontInitialize, data);
343 return data; 343 return data;
344 } 344 }
345 345
346 void Free(void* data, size_t size) override 346 void Free(void* data, size_t size) override
347 { 347 {
348 WTF::ArrayBufferContents::freeMemory(data, size); 348 WTF::ArrayBufferContents::freeMemory(data, size);
349 } 349 }
350 }; 350 };
351 351
352 } // namespace 352 } // namespace
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 439
440 isolate->AddMessageListener(messageHandlerInWorker); 440 isolate->AddMessageListener(messageHandlerInWorker);
441 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); 441 isolate->SetFatalErrorHandler(reportFatalErrorInWorker);
442 442
443 uint32_t here; 443 uint32_t here;
444 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*))); 444 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*)));
445 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); 445 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker);
446 } 446 }
447 447
448 } // namespace blink 448 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698