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

Unified Diff: src/api.cc

Issue 7331035: Implement API functions for handling the AccessorDescriptor (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 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 | « include/v8.h ('k') | src/handles.h » ('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 71a715c1bb28b20189b91421f7605518f9174f98..45a62aba109f2951760e749593a22f4280ad8591 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2919,6 +2919,60 @@ bool Object::SetAccessor(Handle<String> name,
}
+bool v8::Object::DefineGetter(Handle<String> name, Handle<Value> fun) {
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate, "v8::Object::DefineGetter()", return false);
+ ENTER_V8(isolate);
+ i::HandleScope scope(isolate);
+ i::Handle<i::Object> result = i::SetAccessor(Utils::OpenHandle(this),
+ Utils::OpenHandle(*name),
+ true,
+ Utils::OpenHandle(*fun),
+ NONE);
+ return !result.is_null() && !result->IsUndefined();
+}
+
+
+bool v8::Object::DefineSetter(Handle<String> name, Handle<Value> fun) {
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate, "v8::Object::DefineSetter()", return false);
+ ENTER_V8(isolate);
+ i::HandleScope scope(isolate);
+ i::Handle<i::Object> result = i::SetAccessor(Utils::OpenHandle(this),
+ Utils::OpenHandle(*name),
+ false,
+ Utils::OpenHandle(*fun),
+ NONE);
+ return !result.is_null() && !result->IsUndefined();
+}
+
+
+Local<v8::Value> v8::Object::LookupGetter(Handle<String> name) {
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate, "v8::Object::LookupGetter()",
+ return Local<v8::Value>());
+ ENTER_V8(isolate);
+ i::HandleScope scope(isolate);
+ i::Handle<i::Object> result = i::GetAccessor(Utils::OpenHandle(this),
+ Utils::OpenHandle(*name),
+ true);
+ return v8::Utils::ToLocal(scope.CloseAndEscape(result));
+}
+
+
+Local<v8::Value> v8::Object::LookupSetter(Handle<String> name) {
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate, "v8::Object::LookupSetter()",
+ return Local<v8::Value>());
+ ENTER_V8(isolate);
+ i::HandleScope scope(isolate);
+ i::Handle<i::Object> result = i::GetAccessor(Utils::OpenHandle(this),
+ Utils::OpenHandle(*name),
+ false);
+ return v8::Utils::ToLocal(scope.CloseAndEscape(result));
+}
+
+
bool v8::Object::HasOwnProperty(Handle<String> key) {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::HasOwnProperty()",
« no previous file with comments | « include/v8.h ('k') | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698