v8::Persistent<v8::FunctionTemplate> V8TestMediaQueryListListener::GetTemplate(v8::Isolate* isolate, WrapperWorldType worldType) { V8PerIsolateData* data = V8PerIsolateData::from(isolate); V8PerIsolateData::TemplateMap::iterator result = data->templateMap(worldType).find(&info); if (result != data->templateMap(worldType).end()) return result->value; v8::HandleScope handleScope; v8::Persistent<v8::FunctionTemplate> templ = ConfigureV8TestMediaQueryListListenerTemplate(data->rawTemplate(&info, worldType), isolate, worldType); data->templateMap(worldType).add(&info, templ); return templ; }
v8::Persistent<v8::FunctionTemplate> V8TestMediaQueryListListener::GetTemplate() { V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info); if (result != data->templateMap().end()) return result->second; v8::HandleScope handleScope; v8::Persistent<v8::FunctionTemplate> templ = ConfigureV8TestMediaQueryListListenerTemplate(GetRawTemplate()); data->templateMap().add(&info, templ); return templ; }
v8::Handle<v8::FunctionTemplate> V8TestMediaQueryListListener::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 = ConfigureV8TestMediaQueryListListenerTemplate(data->rawTemplate(&info, currentWorldType), isolate, currentWorldType); data->templateMap(currentWorldType).add(&info, UnsafePersistent<v8::FunctionTemplate>(isolate, templ)); return handleScope.Close(templ); }