OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 v8::Local<v8::Function> V8PerContextData::constructorForTypeSlowCase(const Wrapp
erTypeInfo* type) | 90 v8::Local<v8::Function> V8PerContextData::constructorForTypeSlowCase(const Wrapp
erTypeInfo* type) |
91 { | 91 { |
92 ASSERT(!m_errorPrototype.isEmpty()); | 92 ASSERT(!m_errorPrototype.isEmpty()); |
93 | 93 |
94 v8::Local<v8::Context> currentContext = context(); | 94 v8::Local<v8::Context> currentContext = context(); |
95 v8::Context::Scope scope(currentContext); | 95 v8::Context::Scope scope(currentContext); |
96 // We shouldn't reach this point for the types that are implemented in v8 su
che as typed arrays and | 96 // We shouldn't reach this point for the types that are implemented in v8 su
che as typed arrays and |
97 // hence don't have domTemplateFunction. | 97 // hence don't have domTemplateFunction. |
98 ASSERT(type->domTemplateFunction); | 98 ASSERT(type->domTemplateFunction); |
99 v8::Handle<v8::FunctionTemplate> functionTemplate = type->domTemplate(m_isol
ate); | 99 v8::Local<v8::FunctionTemplate> functionTemplate = type->domTemplate(m_isola
te); |
100 // Getting the function might fail if we're running out of stack or memory. | 100 // Getting the function might fail if we're running out of stack or memory. |
101 v8::Local<v8::Function> function; | 101 v8::Local<v8::Function> function; |
102 if (!functionTemplate->GetFunction(currentContext).ToLocal(&function)) | 102 if (!functionTemplate->GetFunction(currentContext).ToLocal(&function)) |
103 return v8::Local<v8::Function>(); | 103 return v8::Local<v8::Function>(); |
104 | 104 |
105 if (type->parentClass) { | 105 if (type->parentClass) { |
106 v8::Local<v8::Object> prototypeTemplate = constructorForType(type->paren
tClass); | 106 v8::Local<v8::Object> prototypeTemplate = constructorForType(type->paren
tClass); |
107 if (prototypeTemplate.IsEmpty()) | 107 if (prototypeTemplate.IsEmpty()) |
108 return v8::Local<v8::Function>(); | 108 return v8::Local<v8::Function>(); |
109 if (!v8CallBoolean(function->SetPrototype(currentContext, prototypeTempl
ate))) | 109 if (!v8CallBoolean(function->SetPrototype(currentContext, prototypeTempl
ate))) |
(...skipping 24 matching lines...) Expand all Loading... |
134 if (!constructor->Get(context(), v8String(m_isolate, "prototype")).ToLocal(&
prototypeValue) || !prototypeValue->IsObject()) | 134 if (!constructor->Get(context(), v8String(m_isolate, "prototype")).ToLocal(&
prototypeValue) || !prototypeValue->IsObject()) |
135 return v8::Local<v8::Object>(); | 135 return v8::Local<v8::Object>(); |
136 return prototypeValue.As<v8::Object>(); | 136 return prototypeValue.As<v8::Object>(); |
137 } | 137 } |
138 | 138 |
139 void V8PerContextData::addCustomElementBinding(CustomElementDefinition* definiti
on, PassOwnPtr<CustomElementBinding> binding) | 139 void V8PerContextData::addCustomElementBinding(CustomElementDefinition* definiti
on, PassOwnPtr<CustomElementBinding> binding) |
140 { | 140 { |
141 m_customElementBindings.append(binding); | 141 m_customElementBindings.append(binding); |
142 } | 142 } |
143 | 143 |
144 v8::Handle<v8::Value> V8PerContextData::compiledPrivateScript(String className) | 144 v8::Local<v8::Value> V8PerContextData::compiledPrivateScript(String className) |
145 { | 145 { |
146 return m_compiledPrivateScript.Get(className); | 146 return m_compiledPrivateScript.Get(className); |
147 } | 147 } |
148 | 148 |
149 void V8PerContextData::setCompiledPrivateScript(String className, v8::Handle<v8:
:Value> compiledObject) | 149 void V8PerContextData::setCompiledPrivateScript(String className, v8::Local<v8::
Value> compiledObject) |
150 { | 150 { |
151 m_compiledPrivateScript.Set(className, compiledObject); | 151 m_compiledPrivateScript.Set(className, compiledObject); |
152 } | 152 } |
153 | 153 |
154 } // namespace blink | 154 } // namespace blink |
OLD | NEW |