| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 isolate()->AddCallCompletedCallback(&assertV8RecursionScope); | 81 isolate()->AddCallCompletedCallback(&assertV8RecursionScope); |
| 82 #endif | 82 #endif |
| 83 if (isMainThread()) { | 83 if (isMainThread()) { |
| 84 mainThreadPerIsolateData = this; | 84 mainThreadPerIsolateData = this; |
| 85 } | 85 } |
| 86 isolate()->SetUseCounterCallback(&useCounterCallback); | 86 isolate()->SetUseCounterCallback(&useCounterCallback); |
| 87 } | 87 } |
| 88 | 88 |
| 89 V8PerIsolateData::~V8PerIsolateData() | 89 V8PerIsolateData::~V8PerIsolateData() |
| 90 { | 90 { |
| 91 if (m_scriptRegexpScriptState) | |
| 92 m_scriptRegexpScriptState->disposePerContextData(); | |
| 93 if (isMainThread()) | 91 if (isMainThread()) |
| 94 mainThreadPerIsolateData = 0; | 92 mainThreadPerIsolateData = 0; |
| 95 } | 93 } |
| 96 | 94 |
| 97 v8::Isolate* V8PerIsolateData::mainThreadIsolate() | 95 v8::Isolate* V8PerIsolateData::mainThreadIsolate() |
| 98 { | 96 { |
| 99 ASSERT(isMainThread()); | 97 ASSERT(isMainThread()); |
| 100 ASSERT(mainThreadPerIsolateData); | 98 ASSERT(mainThreadPerIsolateData); |
| 101 return mainThreadPerIsolateData->isolate(); | 99 return mainThreadPerIsolateData->isolate(); |
| 102 } | 100 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 if (result != domTemplateMap.end()) | 152 if (result != domTemplateMap.end()) |
| 155 return result->value.Get(isolate()); | 153 return result->value.Get(isolate()); |
| 156 return v8::Local<v8::FunctionTemplate>(); | 154 return v8::Local<v8::FunctionTemplate>(); |
| 157 } | 155 } |
| 158 | 156 |
| 159 void V8PerIsolateData::setDOMTemplate(void* domTemplateKey, v8::Handle<v8::Funct
ionTemplate> templ) | 157 void V8PerIsolateData::setDOMTemplate(void* domTemplateKey, v8::Handle<v8::Funct
ionTemplate> templ) |
| 160 { | 158 { |
| 161 currentDOMTemplateMap().add(domTemplateKey, v8::Eternal<v8::FunctionTemplate
>(isolate(), v8::Local<v8::FunctionTemplate>(templ))); | 159 currentDOMTemplateMap().add(domTemplateKey, v8::Eternal<v8::FunctionTemplate
>(isolate(), v8::Local<v8::FunctionTemplate>(templ))); |
| 162 } | 160 } |
| 163 | 161 |
| 164 v8::Local<v8::Context> V8PerIsolateData::ensureScriptRegexpContext() | |
| 165 { | |
| 166 if (!m_scriptRegexpScriptState) { | |
| 167 v8::Local<v8::Context> context(v8::Context::New(isolate())); | |
| 168 m_scriptRegexpScriptState = ScriptState::create(context, DOMWrapperWorld
::create()); | |
| 169 } | |
| 170 return m_scriptRegexpScriptState->context(); | |
| 171 } | |
| 172 | |
| 173 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* info, v8::Handle<v8::V
alue> value) | 162 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* info, v8::Handle<v8::V
alue> value) |
| 174 { | 163 { |
| 175 return hasInstance(info, value, m_domTemplateMapForMainWorld) | 164 return hasInstance(info, value, m_domTemplateMapForMainWorld) |
| 176 || hasInstance(info, value, m_domTemplateMapForNonMainWorld); | 165 || hasInstance(info, value, m_domTemplateMapForNonMainWorld); |
| 177 } | 166 } |
| 178 | 167 |
| 179 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* info, v8::Handle<v8::V
alue> value, DOMTemplateMap& domTemplateMap) | 168 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* info, v8::Handle<v8::V
alue> value, DOMTemplateMap& domTemplateMap) |
| 180 { | 169 { |
| 181 DOMTemplateMap::iterator result = domTemplateMap.find(info); | 170 DOMTemplateMap::iterator result = domTemplateMap.find(info); |
| 182 if (result == domTemplateMap.end()) | 171 if (result == domTemplateMap.end()) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 } | 212 } |
| 224 | 213 |
| 225 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::toStringTemplate() | 214 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::toStringTemplate() |
| 226 { | 215 { |
| 227 if (m_toStringTemplate.isEmpty()) | 216 if (m_toStringTemplate.isEmpty()) |
| 228 m_toStringTemplate.set(isolate(), v8::FunctionTemplate::New(isolate(), c
onstructorOfToString)); | 217 m_toStringTemplate.set(isolate(), v8::FunctionTemplate::New(isolate(), c
onstructorOfToString)); |
| 229 return m_toStringTemplate.newLocal(isolate()); | 218 return m_toStringTemplate.newLocal(isolate()); |
| 230 } | 219 } |
| 231 | 220 |
| 232 } // namespace blink | 221 } // namespace blink |
| OLD | NEW |