Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |