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

Unified Diff: src/api.cc

Issue 2531653002: [api] Support sharing prototypes between FunctionTemplates (Closed)
Patch Set: fixing test Created 4 years, 1 month 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.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 a9a17b458bb45330d0a903598b181c51decb5c30..dc410c01af6d0620210ade616f85c57f7dcfd8f9 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -1174,6 +1174,16 @@ Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() {
return ToApiHandle<ObjectTemplate>(result);
}
+void FunctionTemplate::SetPrototypeProviderTemplate(
+ Local<FunctionTemplate> prototype_provider) {
+ i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate();
+ ENTER_V8(i_isolate);
+ i::Handle<i::Object> result = Utils::OpenHandle(*prototype_provider);
+ auto info = Utils::OpenHandle(this);
+ CHECK(info->prototype_template()->IsUndefined(i_isolate));
+ CHECK(info->parent_template()->IsUndefined(i_isolate));
+ info->set_prototype_provider_template(*result);
+}
static void EnsureNotInstantiated(i::Handle<i::FunctionTemplateInfo> info,
const char* func) {
@@ -1185,8 +1195,9 @@ static void EnsureNotInstantiated(i::Handle<i::FunctionTemplateInfo> info,
void FunctionTemplate::Inherit(v8::Local<FunctionTemplate> value) {
auto info = Utils::OpenHandle(this);
EnsureNotInstantiated(info, "v8::FunctionTemplate::Inherit");
- i::Isolate* isolate = info->GetIsolate();
- ENTER_V8(isolate);
+ i::Isolate* i_isolate = info->GetIsolate();
+ ENTER_V8(i_isolate);
+ CHECK(info->prototype_provider_template()->IsUndefined(i_isolate));
info->set_parent_template(*Utils::OpenHandle(*value));
}
« no previous file with comments | « include/v8.h ('k') | src/api-natives.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698