OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 if (constructor.IsEmpty()) | 163 if (constructor.IsEmpty()) |
164 return v8::Local<v8::Object>(); | 164 return v8::Local<v8::Object>(); |
165 v8::Local<v8::Value> prototypeValue; | 165 v8::Local<v8::Value> prototypeValue; |
166 if (!constructor->Get(context(), v8String(m_isolate, "prototype")) | 166 if (!constructor->Get(context(), v8String(m_isolate, "prototype")) |
167 .ToLocal(&prototypeValue) || | 167 .ToLocal(&prototypeValue) || |
168 !prototypeValue->IsObject()) | 168 !prototypeValue->IsObject()) |
169 return v8::Local<v8::Object>(); | 169 return v8::Local<v8::Object>(); |
170 return prototypeValue.As<v8::Object>(); | 170 return prototypeValue.As<v8::Object>(); |
171 } | 171 } |
172 | 172 |
173 bool V8PerContextData::getExistingConstructorAndPrototypeForType( | |
174 const WrapperTypeInfo* type, | |
175 v8::Local<v8::Object>* prototypeObject, | |
176 v8::Local<v8::Function>* interfaceObject) { | |
177 *interfaceObject = m_constructorMap.Get(type); | |
178 if (interfaceObject->IsEmpty()) { | |
179 *prototypeObject = v8::Local<v8::Object>(); | |
180 return false; | |
181 } | |
182 *prototypeObject = prototypeForType(type); | |
haraken
2017/01/28 02:25:20
Shall we add DCHECK(!prototypeObject->IsEmpty())?
chasej
2017/01/30 19:15:56
Done.
| |
183 return true; | |
184 } | |
185 | |
173 void V8PerContextData::addCustomElementBinding( | 186 void V8PerContextData::addCustomElementBinding( |
174 std::unique_ptr<V0CustomElementBinding> binding) { | 187 std::unique_ptr<V0CustomElementBinding> binding) { |
175 m_customElementBindings.push_back(std::move(binding)); | 188 m_customElementBindings.push_back(std::move(binding)); |
176 } | 189 } |
177 | 190 |
178 void V8PerContextData::setModulator(Modulator* modulator) { | 191 void V8PerContextData::setModulator(Modulator* modulator) { |
179 DCHECK(!m_modulator); | 192 DCHECK(!m_modulator); |
180 DCHECK(modulator); | 193 DCHECK(modulator); |
181 m_modulator = modulator; | 194 m_modulator = modulator; |
182 } | 195 } |
183 | 196 |
184 void V8PerContextData::clearModulator() { | 197 void V8PerContextData::clearModulator() { |
185 m_modulator = nullptr; | 198 m_modulator = nullptr; |
186 } | 199 } |
187 | 200 |
188 } // namespace blink | 201 } // namespace blink |
OLD | NEW |