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

Unified Diff: src/api.cc

Issue 1367953002: Allow JavaScript accessors on API objects. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: typo, and/or defective time machine. Created 5 years, 3 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/api-natives.h » ('j') | src/api-natives.h » ('J')
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 1cb00f271fa7d0e9a4c7f0014606eb74535f8438..e8816affa94a0e27c0bd65f67d8a66e652765c54 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -955,6 +955,28 @@ void Template::SetAccessorProperty(
}
+#ifdef V8_JS_ACCESSORS
+void Template::SetAccessorProperty(v8::Local<v8::Name> name,
+ v8::Local<Function> getter,
+ v8::Local<Function> setter,
+ v8::PropertyAttribute attribute,
+ v8::AccessControl access_control) {
+ // TODO(verwaest): Remove |access_control|.
+ DCHECK_EQ(v8::DEFAULT, access_control);
jochen (gone - plz use gerrit) 2015/09/25 09:20:51 Why not just remove the parameter?
vogelheim 2015/09/25 12:59:45 Done.
+ auto templ = Utils::OpenHandle(this);
+ auto isolate = templ->GetIsolate();
+ ENTER_V8(isolate);
+ DCHECK(!name.IsEmpty());
+ DCHECK(!getter.IsEmpty() || !setter.IsEmpty());
+ i::HandleScope scope(isolate);
+ i::ApiNatives::AddAccessorProperty(
+ isolate, templ, Utils::OpenHandle(*name),
+ Utils::OpenHandle(*getter, true), Utils::OpenHandle(*setter, true),
+ static_cast<PropertyAttributes>(attribute));
+}
+#endif // V8_JS_ACCESSORS
+
+
// --- F u n c t i o n T e m p l a t e ---
static void InitializeFunctionTemplate(
i::Handle<i::FunctionTemplateInfo> info) {
« no previous file with comments | « include/v8.h ('k') | src/api-natives.h » ('j') | src/api-natives.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698