| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 info.addMember(m_workerDomDataStore, "workerDomDataStore"); | 114 info.addMember(m_workerDomDataStore, "workerDomDataStore"); |
| 115 info.addMember(m_hiddenPropertyName, "hiddenPropertyName"); | 115 info.addMember(m_hiddenPropertyName, "hiddenPropertyName"); |
| 116 info.addMember(m_gcEventData, "gcEventData"); | 116 info.addMember(m_gcEventData, "gcEventData"); |
| 117 | 117 |
| 118 info.addPrivateBuffer(ScriptProfiler::profilerSnapshotsSize(), WebCoreMemory
Types::InspectorProfilerAgent, "HeapSnapshots", "snapshots"); | 118 info.addPrivateBuffer(ScriptProfiler::profilerSnapshotsSize(), WebCoreMemory
Types::InspectorProfilerAgent, "HeapSnapshots", "snapshots"); |
| 119 | 119 |
| 120 info.ignoreMember(m_toStringTemplate); | 120 info.ignoreMember(m_toStringTemplate); |
| 121 info.ignoreMember(m_lazyEventListenerToStringTemplate); | 121 info.ignoreMember(m_lazyEventListenerToStringTemplate); |
| 122 info.ignoreMember(m_v8Null); | 122 info.ignoreMember(m_v8Null); |
| 123 info.ignoreMember(m_liveRoot); | 123 info.ignoreMember(m_liveRoot); |
| 124 info.ignoreMember(m_auxiliaryContext); | 124 info.ignoreMember(m_regexContext); |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool V8PerIsolateData::hasPrivateTemplate(WrapperWorldType currentWorldType, voi
d* privatePointer) | 127 bool V8PerIsolateData::hasPrivateTemplate(WrapperWorldType currentWorldType, voi
d* privatePointer) |
| 128 { | 128 { |
| 129 if (currentWorldType == MainWorld) | 129 if (currentWorldType == MainWorld) |
| 130 return m_templatesForMainWorld.find(privatePointer) != m_templatesForMai
nWorld.end(); | 130 return m_templatesForMainWorld.find(privatePointer) != m_templatesForMai
nWorld.end(); |
| 131 return m_templatesForNonMainWorld.find(privatePointer) != m_templatesForNonM
ainWorld.end(); | 131 return m_templatesForNonMainWorld.find(privatePointer) != m_templatesForNonM
ainWorld.end(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 v8::Persistent<v8::FunctionTemplate> V8PerIsolateData::privateTemplate(WrapperWo
rldType currentWorldType, void* privatePointer, v8::InvocationCallback callback,
v8::Handle<v8::Value> data, v8::Handle<v8::Signature> signature, int length) | 134 v8::Persistent<v8::FunctionTemplate> V8PerIsolateData::privateTemplate(WrapperWo
rldType currentWorldType, void* privatePointer, v8::InvocationCallback callback,
v8::Handle<v8::Value> data, v8::Handle<v8::Signature> signature, int length) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 149 TemplateMap::iterator result = templates.find(info); | 149 TemplateMap::iterator result = templates.find(info); |
| 150 if (result != templates.end()) | 150 if (result != templates.end()) |
| 151 return result->value; | 151 return result->value; |
| 152 | 152 |
| 153 v8::HandleScope handleScope; | 153 v8::HandleScope handleScope; |
| 154 v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(m_isolate); | 154 v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(m_isolate); |
| 155 templates.add(info, templ); | 155 templates.add(info, templ); |
| 156 return templ; | 156 return templ; |
| 157 } | 157 } |
| 158 | 158 |
| 159 v8::Local<v8::Context> V8PerIsolateData::ensureRegexContext() |
| 160 { |
| 161 if (m_regexContext.isEmpty()) |
| 162 m_regexContext.set(v8::Context::New()); |
| 163 return v8::Local<v8::Context>::New(m_regexContext.get()); |
| 164 } |
| 165 |
| 159 bool V8PerIsolateData::hasInstance(WrapperTypeInfo* info, v8::Handle<v8::Value>
value, WrapperWorldType currentWorldType) | 166 bool V8PerIsolateData::hasInstance(WrapperTypeInfo* info, v8::Handle<v8::Value>
value, WrapperWorldType currentWorldType) |
| 160 { | 167 { |
| 161 TemplateMap& templates = rawTemplateMap(currentWorldType); | 168 TemplateMap& templates = rawTemplateMap(currentWorldType); |
| 162 TemplateMap::iterator result = templates.find(info); | 169 TemplateMap::iterator result = templates.find(info); |
| 163 if (result == templates.end()) | 170 if (result == templates.end()) |
| 164 return false; | 171 return false; |
| 165 return result->value->HasInstance(value); | 172 return result->value->HasInstance(value); |
| 166 } | 173 } |
| 167 | 174 |
| 168 void V8PerIsolateData::visitExternalStrings(ExternalStringVisitor* visitor) | 175 void V8PerIsolateData::visitExternalStrings(ExternalStringVisitor* visitor) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 194 // changes to a DOM constructor's toString's toString will cause the | 201 // changes to a DOM constructor's toString's toString will cause the |
| 195 // toString of the DOM constructor itself to change. This is extremely | 202 // toString of the DOM constructor itself to change. This is extremely |
| 196 // obscure and unlikely to be a problem. | 203 // obscure and unlikely to be a problem. |
| 197 v8::Handle<v8::Value> value = args.Callee()->Get(v8::String::NewSymbol("toSt
ring")); | 204 v8::Handle<v8::Value> value = args.Callee()->Get(v8::String::NewSymbol("toSt
ring")); |
| 198 if (!value->IsFunction()) | 205 if (!value->IsFunction()) |
| 199 return v8::String::Empty(args.GetIsolate()); | 206 return v8::String::Empty(args.GetIsolate()); |
| 200 return v8::Handle<v8::Function>::Cast(value)->Call(args.This(), 0, 0); | 207 return v8::Handle<v8::Function>::Cast(value)->Call(args.This(), 0, 0); |
| 201 } | 208 } |
| 202 | 209 |
| 203 } // namespace WebCore | 210 } // namespace WebCore |
| OLD | NEW |