v8::Persistent<v8::FunctionTemplate> V8TestException::GetTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType) { V8PerIsolateData* data = V8PerIsolateData::from(isolate); V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWorldType).find(&info); if (result != data->templateMap(currentWorldType).end()) return result->value; v8::HandleScope handleScope; v8::Persistent<v8::FunctionTemplate> templ = ConfigureV8TestExceptionTemplate(data->rawTemplate(&info, currentWorldType), isolate, currentWorldType); data->templateMap(currentWorldType).add(&info, templ); return templ; }
v8::Persistent<v8::FunctionTemplate> V8TestException::GetTemplate() { V8PerIsolateData* data = V8PerIsolateData::current(); V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info); if (result != data->templateMap().end()) return result->value; v8::HandleScope handleScope; v8::Persistent<v8::FunctionTemplate> templ = ConfigureV8TestExceptionTemplate(GetRawTemplate()); data->templateMap().add(&info, templ); return templ; }
v8::Handle<v8::FunctionTemplate> V8TestException::GetTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType) { V8PerIsolateData* data = V8PerIsolateData::from(isolate); V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWorldType).find(&info); if (result != data->templateMap(currentWorldType).end()) return result->value.newLocal(isolate); TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); v8::HandleScope handleScope(isolate); v8::Handle<v8::FunctionTemplate> templ = ConfigureV8TestExceptionTemplate(data->rawTemplate(&info, currentWorldType), isolate, currentWorldType); data->templateMap(currentWorldType).add(&info, UnsafePersistent<v8::FunctionTemplate>(isolate, templ)); return handleScope.Close(templ); }