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

Unified Diff: src/api.cc

Issue 2657463004: Merged: Squashed multiple commits. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/value-serializer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 0418c08ff6c24aa02d74e7326c2c26989dc829c0..e6284965d0719aa3f2b9f6db327b34d8da8daf8b 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -7572,7 +7572,11 @@ Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* isolate, size_t byte_length) {
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
i::Handle<i::JSArrayBuffer> obj =
i_isolate->factory()->NewJSArrayBuffer(i::SharedFlag::kNotShared);
- i::JSArrayBuffer::SetupAllocatingData(obj, i_isolate, byte_length);
+ // TODO(jbroman): It may be useful in the future to provide a MaybeLocal
+ // version that throws an exception or otherwise does not crash.
+ if (!i::JSArrayBuffer::SetupAllocatingData(obj, i_isolate, byte_length)) {
+ i::FatalProcessOutOfMemory("v8::ArrayBuffer::New");
+ }
return Utils::ToLocal(obj);
}
@@ -7762,8 +7766,12 @@ Local<SharedArrayBuffer> v8::SharedArrayBuffer::New(Isolate* isolate,
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
i::Handle<i::JSArrayBuffer> obj =
i_isolate->factory()->NewJSArrayBuffer(i::SharedFlag::kShared);
- i::JSArrayBuffer::SetupAllocatingData(obj, i_isolate, byte_length, true,
- i::SharedFlag::kShared);
+ // TODO(jbroman): It may be useful in the future to provide a MaybeLocal
+ // version that throws an exception or otherwise does not crash.
+ if (!i::JSArrayBuffer::SetupAllocatingData(obj, i_isolate, byte_length, true,
+ i::SharedFlag::kShared)) {
+ i::FatalProcessOutOfMemory("v8::SharedArrayBuffer::New");
+ }
return Utils::ToLocalShared(obj);
}
« no previous file with comments | « no previous file | src/value-serializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698