| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 bool V8PerIsolateData::hasInstance(WrapperTypeInfo* info, v8::Handle<v8::Value>
value, WrapperWorldType currentWorldType) | 159 bool V8PerIsolateData::hasInstance(WrapperTypeInfo* info, v8::Handle<v8::Value>
value, WrapperWorldType currentWorldType) |
| 160 { | 160 { |
| 161 TemplateMap& templates = rawTemplateMap(currentWorldType); | 161 TemplateMap& templates = rawTemplateMap(currentWorldType); |
| 162 TemplateMap::iterator result = templates.find(info); | 162 TemplateMap::iterator result = templates.find(info); |
| 163 if (result == templates.end()) | 163 if (result == templates.end()) |
| 164 return false; | 164 return false; |
| 165 return result->value->HasInstance(value); | 165 return result->value->HasInstance(value); |
| 166 } | 166 } |
| 167 | 167 |
| 168 #if ENABLE(INSPECTOR) | |
| 169 void V8PerIsolateData::visitExternalStrings(ExternalStringVisitor* visitor) | 168 void V8PerIsolateData::visitExternalStrings(ExternalStringVisitor* visitor) |
| 170 { | 169 { |
| 171 v8::HandleScope handleScope; | 170 v8::HandleScope handleScope; |
| 172 class VisitorImpl : public v8::ExternalResourceVisitor { | 171 class VisitorImpl : public v8::ExternalResourceVisitor { |
| 173 public: | 172 public: |
| 174 VisitorImpl(ExternalStringVisitor* visitor) : m_visitor(visitor) { } | 173 VisitorImpl(ExternalStringVisitor* visitor) : m_visitor(visitor) { } |
| 175 virtual ~VisitorImpl() { } | 174 virtual ~VisitorImpl() { } |
| 176 virtual void VisitExternalString(v8::Handle<v8::String> string) | 175 virtual void VisitExternalString(v8::Handle<v8::String> string) |
| 177 { | 176 { |
| 178 WebCoreStringResourceBase* resource = WebCoreStringResourceBase::toW
ebCoreStringResourceBase(string); | 177 WebCoreStringResourceBase* resource = WebCoreStringResourceBase::toW
ebCoreStringResourceBase(string); |
| 179 if (resource) | 178 if (resource) |
| 180 resource->visitStrings(m_visitor); | 179 resource->visitStrings(m_visitor); |
| 181 } | 180 } |
| 182 private: | 181 private: |
| 183 ExternalStringVisitor* m_visitor; | 182 ExternalStringVisitor* m_visitor; |
| 184 } v8Visitor(visitor); | 183 } v8Visitor(visitor); |
| 185 v8::V8::VisitExternalResources(&v8Visitor); | 184 v8::V8::VisitExternalResources(&v8Visitor); |
| 186 } | 185 } |
| 187 #endif | |
| 188 | 186 |
| 189 v8::Handle<v8::Value> V8PerIsolateData::constructorOfToString(const v8::Argument
s& args) | 187 v8::Handle<v8::Value> V8PerIsolateData::constructorOfToString(const v8::Argument
s& args) |
| 190 { | 188 { |
| 191 // The DOM constructors' toString functions grab the current toString | 189 // The DOM constructors' toString functions grab the current toString |
| 192 // for Functions by taking the toString function of itself and then | 190 // for Functions by taking the toString function of itself and then |
| 193 // calling it with the constructor as its receiver. This means that | 191 // calling it with the constructor as its receiver. This means that |
| 194 // changes to the Function prototype chain or toString function are | 192 // changes to the Function prototype chain or toString function are |
| 195 // reflected when printing DOM constructors. The only wart is that | 193 // reflected when printing DOM constructors. The only wart is that |
| 196 // changes to a DOM constructor's toString's toString will cause the | 194 // changes to a DOM constructor's toString's toString will cause the |
| 197 // toString of the DOM constructor itself to change. This is extremely | 195 // toString of the DOM constructor itself to change. This is extremely |
| 198 // obscure and unlikely to be a problem. | 196 // obscure and unlikely to be a problem. |
| 199 v8::Handle<v8::Value> value = args.Callee()->Get(v8::String::NewSymbol("toSt
ring")); | 197 v8::Handle<v8::Value> value = args.Callee()->Get(v8::String::NewSymbol("toSt
ring")); |
| 200 if (!value->IsFunction()) | 198 if (!value->IsFunction()) |
| 201 return v8::String::Empty(args.GetIsolate()); | 199 return v8::String::Empty(args.GetIsolate()); |
| 202 return v8::Handle<v8::Function>::Cast(value)->Call(args.This(), 0, 0); | 200 return v8::Handle<v8::Function>::Cast(value)->Call(args.This(), 0, 0); |
| 203 } | 201 } |
| 204 | 202 |
| 205 } // namespace WebCore | 203 } // namespace WebCore |
| OLD | NEW |