OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 if (result != templates.end()) | 119 if (result != templates.end()) |
120 return result->value.newLocal(m_isolate); | 120 return result->value.newLocal(m_isolate); |
121 return v8::Local<v8::FunctionTemplate>(); | 121 return v8::Local<v8::FunctionTemplate>(); |
122 } | 122 } |
123 | 123 |
124 void V8PerIsolateData::setPrivateTemplate(WrapperWorldType currentWorldType, voi
d* privatePointer, v8::Handle<v8::FunctionTemplate> templ) | 124 void V8PerIsolateData::setPrivateTemplate(WrapperWorldType currentWorldType, voi
d* privatePointer, v8::Handle<v8::FunctionTemplate> templ) |
125 { | 125 { |
126 templateMap(currentWorldType).add(privatePointer, UnsafePersistent<v8::Funct
ionTemplate>(m_isolate, templ)); | 126 templateMap(currentWorldType).add(privatePointer, UnsafePersistent<v8::Funct
ionTemplate>(m_isolate, templ)); |
127 } | 127 } |
128 | 128 |
129 v8::Local<v8::Context> V8PerIsolateData::ensureRegexContext() | 129 v8::Local<v8::Context> V8PerIsolateData::ensureDomInJSContext() |
130 { | 130 { |
131 if (m_regexContext.isEmpty()) { | 131 if (m_domInJSContext.isEmpty()) { |
132 v8::HandleScope handleScope(m_isolate); | 132 v8::HandleScope handleScope(m_isolate); |
133 m_regexContext.set(m_isolate, v8::Context::New(m_isolate)); | 133 m_domInJSContext.set(m_isolate, v8::Context::New(m_isolate)); |
134 } | 134 } |
135 return m_regexContext.newLocal(m_isolate); | 135 return m_domInJSContext.newLocal(m_isolate); |
136 } | 136 } |
137 | 137 |
138 bool V8PerIsolateData::hasInstanceInMainWorld(const WrapperTypeInfo* info, v8::H
andle<v8::Value> value) | 138 bool V8PerIsolateData::hasInstanceInMainWorld(const WrapperTypeInfo* info, v8::H
andle<v8::Value> value) |
139 { | 139 { |
140 return hasInstance(info, value, m_templatesForMainWorld); | 140 return hasInstance(info, value, m_templatesForMainWorld); |
141 } | 141 } |
142 | 142 |
143 bool V8PerIsolateData::hasInstanceInNonMainWorld(const WrapperTypeInfo* info, v8
::Handle<v8::Value> value) | 143 bool V8PerIsolateData::hasInstanceInNonMainWorld(const WrapperTypeInfo* info, v8
::Handle<v8::Value> value) |
144 { | 144 { |
145 return hasInstance(info, value, m_templatesForNonMainWorld); | 145 return hasInstance(info, value, m_templatesForNonMainWorld); |
(...skipping 20 matching lines...) Expand all Loading... |
166 // obscure and unlikely to be a problem. | 166 // obscure and unlikely to be a problem. |
167 v8::Handle<v8::Value> value = info.Callee()->Get(v8AtomicString(info.GetIsol
ate(), "toString")); | 167 v8::Handle<v8::Value> value = info.Callee()->Get(v8AtomicString(info.GetIsol
ate(), "toString")); |
168 if (!value->IsFunction()) { | 168 if (!value->IsFunction()) { |
169 v8SetReturnValue(info, v8::String::Empty(info.GetIsolate())); | 169 v8SetReturnValue(info, v8::String::Empty(info.GetIsolate())); |
170 return; | 170 return; |
171 } | 171 } |
172 v8SetReturnValue(info, V8ScriptRunner::callInternalFunction(v8::Handle<v8::F
unction>::Cast(value), info.This(), 0, 0, v8::Isolate::GetCurrent())); | 172 v8SetReturnValue(info, V8ScriptRunner::callInternalFunction(v8::Handle<v8::F
unction>::Cast(value), info.This(), 0, 0, v8::Isolate::GetCurrent())); |
173 } | 173 } |
174 | 174 |
175 } // namespace WebCore | 175 } // namespace WebCore |
OLD | NEW |