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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 if (resource) | 125 if (resource) |
126 resource->visitStrings(m_visitor); | 126 resource->visitStrings(m_visitor); |
127 } | 127 } |
128 private: | 128 private: |
129 ExternalStringVisitor* m_visitor; | 129 ExternalStringVisitor* m_visitor; |
130 } v8Visitor(visitor); | 130 } v8Visitor(visitor); |
131 v8::V8::VisitExternalResources(&v8Visitor); | 131 v8::V8::VisitExternalResources(&v8Visitor); |
132 } | 132 } |
133 #endif | 133 #endif |
134 | 134 |
135 v8::Handle<v8::Context> V8PerIsolateData::ensureAuxiliaryContext() | |
136 { | |
137 if (m_auxiliaryContext.isEmpty()) | |
138 m_auxiliaryContext.adopt(v8::Context::New()); | |
139 return m_auxiliaryContext.get(); | |
140 } | |
141 | |
142 v8::Handle<v8::Value> V8PerIsolateData::constructorOfToString(const v8::Argument
s& args) | 135 v8::Handle<v8::Value> V8PerIsolateData::constructorOfToString(const v8::Argument
s& args) |
143 { | 136 { |
144 // The DOM constructors' toString functions grab the current toString | 137 // The DOM constructors' toString functions grab the current toString |
145 // for Functions by taking the toString function of itself and then | 138 // for Functions by taking the toString function of itself and then |
146 // calling it with the constructor as its receiver. This means that | 139 // calling it with the constructor as its receiver. This means that |
147 // changes to the Function prototype chain or toString function are | 140 // changes to the Function prototype chain or toString function are |
148 // reflected when printing DOM constructors. The only wart is that | 141 // reflected when printing DOM constructors. The only wart is that |
149 // changes to a DOM constructor's toString's toString will cause the | 142 // changes to a DOM constructor's toString's toString will cause the |
150 // toString of the DOM constructor itself to change. This is extremely | 143 // toString of the DOM constructor itself to change. This is extremely |
151 // obscure and unlikely to be a problem. | 144 // obscure and unlikely to be a problem. |
152 v8::Handle<v8::Value> value = args.Callee()->Get(v8::String::NewSymbol("toSt
ring")); | 145 v8::Handle<v8::Value> value = args.Callee()->Get(v8::String::NewSymbol("toSt
ring")); |
153 if (!value->IsFunction()) | 146 if (!value->IsFunction()) |
154 return v8::String::New(""); | 147 return v8::String::New(""); |
155 return v8::Handle<v8::Function>::Cast(value)->Call(args.This(), 0, 0); | 148 return v8::Handle<v8::Function>::Cast(value)->Call(args.This(), 0, 0); |
156 } | 149 } |
157 | 150 |
158 } // namespace WebCore | 151 } // namespace WebCore |
OLD | NEW |