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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 return v8::Local<v8::FunctionTemplate>(); | 120 return v8::Local<v8::FunctionTemplate>(); |
121 } | 121 } |
122 | 122 |
123 void V8PerIsolateData::setDOMTemplate(void* domTemplateKey, v8::Handle<v8::Funct
ionTemplate> templ) | 123 void V8PerIsolateData::setDOMTemplate(void* domTemplateKey, v8::Handle<v8::Funct
ionTemplate> templ) |
124 { | 124 { |
125 currentDOMTemplateMap().add(domTemplateKey, v8::Eternal<v8::FunctionTemplate
>(m_isolate, v8::Local<v8::FunctionTemplate>(templ))); | 125 currentDOMTemplateMap().add(domTemplateKey, v8::Eternal<v8::FunctionTemplate
>(m_isolate, v8::Local<v8::FunctionTemplate>(templ))); |
126 } | 126 } |
127 | 127 |
128 v8::Local<v8::Context> V8PerIsolateData::ensureDomInJSContext() | 128 v8::Local<v8::Context> V8PerIsolateData::ensureDomInJSContext() |
129 { | 129 { |
130 if (!m_blinkInJSScriptState) | 130 if (!m_blinkInJSScriptState) { |
131 m_blinkInJSScriptState = NewScriptState::create(v8::Context::New(m_isola
te), DOMWrapperWorld::create()); | 131 v8::Local<v8::Context> context(v8::Context::New(m_isolate)); |
| 132 if (context.IsEmpty()) { |
| 133 // The script execution has been terminated. |
| 134 return context; |
| 135 } |
| 136 m_blinkInJSScriptState = NewScriptState::create(context, DOMWrapperWorld
::create()); |
| 137 } |
132 return m_blinkInJSScriptState->context(); | 138 return m_blinkInJSScriptState->context(); |
133 } | 139 } |
134 | 140 |
135 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* info, v8::Handle<v8::V
alue> value) | 141 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* info, v8::Handle<v8::V
alue> value) |
136 { | 142 { |
137 return hasInstance(info, value, m_domTemplateMapForMainWorld) | 143 return hasInstance(info, value, m_domTemplateMapForMainWorld) |
138 || hasInstance(info, value, m_domTemplateMapForNonMainWorld); | 144 || hasInstance(info, value, m_domTemplateMapForNonMainWorld); |
139 } | 145 } |
140 | 146 |
141 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* info, v8::Handle<v8::V
alue> value, DOMTemplateMap& domTemplateMap) | 147 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* info, v8::Handle<v8::V
alue> value, DOMTemplateMap& domTemplateMap) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 } | 191 } |
186 | 192 |
187 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::toStringTemplate() | 193 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::toStringTemplate() |
188 { | 194 { |
189 if (m_toStringTemplate.isEmpty()) | 195 if (m_toStringTemplate.isEmpty()) |
190 m_toStringTemplate.set(m_isolate, v8::FunctionTemplate::New(m_isolate, c
onstructorOfToString)); | 196 m_toStringTemplate.set(m_isolate, v8::FunctionTemplate::New(m_isolate, c
onstructorOfToString)); |
191 return m_toStringTemplate.newLocal(m_isolate); | 197 return m_toStringTemplate.newLocal(m_isolate); |
192 } | 198 } |
193 | 199 |
194 } // namespace WebCore | 200 } // namespace WebCore |
OLD | NEW |