| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * Copyright (C) 2013 Google Inc. All rights reserved. |    2  * Copyright (C) 2013 Google Inc. All rights reserved. | 
|    3  * |    3  * | 
|    4  * Redistribution and use in source and binary forms, with or without |    4  * Redistribution and use in source and binary forms, with or without | 
|    5  * modification, are permitted provided that the following conditions are |    5  * modification, are permitted provided that the following conditions are | 
|    6  * met: |    6  * met: | 
|    7  * |    7  * | 
|    8  *     * Redistributions of source code must retain the above copyright |    8  *     * Redistributions of source code must retain the above copyright | 
|    9  * notice, this list of conditions and the following disclaimer. |    9  * notice, this list of conditions and the following disclaimer. | 
|   10  *     * Redistributions in binary form must reproduce the above |   10  *     * Redistributions in binary form must reproduce the above | 
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  176         isolate, currentWorldType); |  176         isolate, currentWorldType); | 
|  177     UNUSED_PARAM(defaultSignature); |  177     UNUSED_PARAM(defaultSignature); | 
|  178     functionTemplate->SetCallHandler(V8TestNode::constructorCallback); |  178     functionTemplate->SetCallHandler(V8TestNode::constructorCallback); | 
|  179     functionTemplate->SetLength(0); |  179     functionTemplate->SetLength(0); | 
|  180     v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
     emplate(); |  180     v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
     emplate(); | 
|  181     v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
     eTemplate(); |  181     v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
     eTemplate(); | 
|  182     UNUSED_PARAM(instanceTemplate); |  182     UNUSED_PARAM(instanceTemplate); | 
|  183     UNUSED_PARAM(prototypeTemplate); |  183     UNUSED_PARAM(prototypeTemplate); | 
|  184  |  184  | 
|  185     // Custom toString template |  185     // Custom toString template | 
|  186     functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
     urrent()->toStringTemplate()); |  186     functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
     g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); | 
|  187     return functionTemplate; |  187     return functionTemplate; | 
|  188 } |  188 } | 
|  189  |  189  | 
|  190 v8::Handle<v8::FunctionTemplate> V8TestNode::GetTemplate(v8::Isolate* isolate, W
     rapperWorldType currentWorldType) |  190 v8::Handle<v8::FunctionTemplate> V8TestNode::GetTemplate(v8::Isolate* isolate, W
     rapperWorldType currentWorldType) | 
|  191 { |  191 { | 
|  192     V8PerIsolateData* data = V8PerIsolateData::from(isolate); |  192     V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 
|  193     V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
     rldType).find(&wrapperTypeInfo); |  193     V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
     rldType).find(&wrapperTypeInfo); | 
|  194     if (result != data->templateMap(currentWorldType).end()) |  194     if (result != data->templateMap(currentWorldType).end()) | 
|  195         return result->value.newLocal(isolate); |  195         return result->value.newLocal(isolate); | 
|  196  |  196  | 
|  197     TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |  197     TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 
|  198     v8::HandleScope handleScope(isolate); |  198     v8::EscapableHandleScope handleScope(isolate); | 
|  199     v8::Handle<v8::FunctionTemplate> templ = |  199     v8::Local<v8::FunctionTemplate> templ = | 
|  200         ConfigureV8TestNodeTemplate(data->rawTemplate(&wrapperTypeInfo, currentW
     orldType), isolate, currentWorldType); |  200         ConfigureV8TestNodeTemplate(data->rawTemplate(&wrapperTypeInfo, currentW
     orldType), isolate, currentWorldType); | 
|  201     data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
     8::FunctionTemplate>(isolate, templ)); |  201     data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
     8::FunctionTemplate>(isolate, templ)); | 
|  202     return handleScope.Close(templ); |  202     return handleScope.Escape(templ); | 
|  203 } |  203 } | 
|  204  |  204  | 
|  205 bool V8TestNode::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate
     , WrapperWorldType currentWorldType) |  205 bool V8TestNode::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate
     , WrapperWorldType currentWorldType) | 
|  206 { |  206 { | 
|  207     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
     e, currentWorldType); |  207     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
     e, currentWorldType); | 
|  208 } |  208 } | 
|  209  |  209  | 
|  210 bool V8TestNode::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Isolat
     e* isolate) |  210 bool V8TestNode::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Isolat
     e* isolate) | 
|  211 { |  211 { | 
|  212     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
     e, MainWorld) |  212     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
     e, MainWorld) | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  244     fromInternalPointer(object)->deref(); |  244     fromInternalPointer(object)->deref(); | 
|  245 } |  245 } | 
|  246  |  246  | 
|  247 template<> |  247 template<> | 
|  248 v8::Handle<v8::Value> toV8NoInline(TestNode* impl, v8::Handle<v8::Object> creati
     onContext, v8::Isolate* isolate) |  248 v8::Handle<v8::Value> toV8NoInline(TestNode* impl, v8::Handle<v8::Object> creati
     onContext, v8::Isolate* isolate) | 
|  249 { |  249 { | 
|  250     return toV8(impl, creationContext, isolate); |  250     return toV8(impl, creationContext, isolate); | 
|  251 } |  251 } | 
|  252  |  252  | 
|  253 } // namespace WebCore |  253 } // namespace WebCore | 
| OLD | NEW |