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

Side by Side Diff: src/api.cc

Issue 600723005: Introduce PromiseRejectCallback. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 5967 matching lines...) Expand 10 before | Expand all | Expand 10 after
5978 isolate, 5978 isolate,
5979 isolate->promise_then(), 5979 isolate->promise_then(),
5980 promise, 5980 promise,
5981 arraysize(argv), argv, 5981 arraysize(argv), argv,
5982 false).ToHandle(&result); 5982 false).ToHandle(&result);
5983 EXCEPTION_BAILOUT_CHECK(isolate, Local<Promise>()); 5983 EXCEPTION_BAILOUT_CHECK(isolate, Local<Promise>());
5984 return Local<Promise>::Cast(Utils::ToLocal(result)); 5984 return Local<Promise>::Cast(Utils::ToLocal(result));
5985 } 5985 }
5986 5986
5987 5987
5988 bool Promise::HasHandler() {
5989 i::Handle<i::JSObject> promise = Utils::OpenHandle(this);
5990 i::Isolate* isolate = promise->GetIsolate();
5991 LOG_API(isolate, "Promise::HasRejectHandler");
5992 ENTER_V8(isolate);
5993 i::Handle<i::Symbol> key = isolate->factory()->promise_has_handler_symbol();
5994 return i::JSObject::GetDataProperty(promise, key)->IsTrue();
5995 }
5996
5997
5988 bool v8::ArrayBuffer::IsExternal() const { 5998 bool v8::ArrayBuffer::IsExternal() const {
5989 return Utils::OpenHandle(this)->is_external(); 5999 return Utils::OpenHandle(this)->is_external();
5990 } 6000 }
5991 6001
5992 6002
5993 v8::ArrayBuffer::Contents v8::ArrayBuffer::Externalize() { 6003 v8::ArrayBuffer::Contents v8::ArrayBuffer::Externalize() {
5994 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this); 6004 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this);
5995 Utils::ApiCheck(!obj->is_external(), 6005 Utils::ApiCheck(!obj->is_external(),
5996 "v8::ArrayBuffer::Externalize", 6006 "v8::ArrayBuffer::Externalize",
5997 "ArrayBuffer already externalized"); 6007 "ArrayBuffer already externalized");
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
6725 isolate->AddCallCompletedCallback(callback); 6735 isolate->AddCallCompletedCallback(callback);
6726 } 6736 }
6727 6737
6728 6738
6729 void Isolate::RemoveCallCompletedCallback(CallCompletedCallback callback) { 6739 void Isolate::RemoveCallCompletedCallback(CallCompletedCallback callback) {
6730 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6740 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6731 isolate->RemoveCallCompletedCallback(callback); 6741 isolate->RemoveCallCompletedCallback(callback);
6732 } 6742 }
6733 6743
6734 6744
6745 void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
6746 if (callback == NULL) return;
6747 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6748 isolate->SetPromiseRejectCallback(callback);
6749 }
6750
6751
6735 void Isolate::RunMicrotasks() { 6752 void Isolate::RunMicrotasks() {
6736 reinterpret_cast<i::Isolate*>(this)->RunMicrotasks(); 6753 reinterpret_cast<i::Isolate*>(this)->RunMicrotasks();
6737 } 6754 }
6738 6755
6739 6756
6740 void Isolate::EnqueueMicrotask(Handle<Function> microtask) { 6757 void Isolate::EnqueueMicrotask(Handle<Function> microtask) {
6741 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6758 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6742 isolate->EnqueueMicrotask(Utils::OpenHandle(*microtask)); 6759 isolate->EnqueueMicrotask(Utils::OpenHandle(*microtask));
6743 } 6760 }
6744 6761
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
7690 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7707 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7691 Address callback_address = 7708 Address callback_address =
7692 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7709 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7693 VMState<EXTERNAL> state(isolate); 7710 VMState<EXTERNAL> state(isolate);
7694 ExternalCallbackScope call_scope(isolate, callback_address); 7711 ExternalCallbackScope call_scope(isolate, callback_address);
7695 callback(info); 7712 callback(info);
7696 } 7713 }
7697 7714
7698 7715
7699 } } // namespace v8::internal 7716 } } // namespace v8::internal
OLDNEW
« include/v8.h ('K') | « src/api.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698