Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: Source/bindings/v8/CustomElementConstructorBuilder.cpp

Issue 18258003: Pow __proto__, sock :unresolved, and clunk the created callback at once. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Try to be nicer to MSVC. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 } 215 }
216 216
217 if (m_prototype->GetPropertyAttributes(v8String("constructor", m_context->Ge tIsolate())) & v8::DontDelete) { 217 if (m_prototype->GetPropertyAttributes(v8String("constructor", m_context->Ge tIsolate())) & v8::DontDelete) {
218 // "constructor" is not configurable. 218 // "constructor" is not configurable.
219 return false; 219 return false;
220 } 220 }
221 221
222 return true; 222 return true;
223 } 223 }
224 224
225 bool CustomElementConstructorBuilder::didRegisterDefinition(CustomElementDefinit ion* definition, const HashSet<Element*>& upgradeCandidates) const 225 bool CustomElementConstructorBuilder::didRegisterDefinition(CustomElementDefinit ion* definition) const
226 { 226 {
227 ASSERT(!m_constructor.IsEmpty()); 227 ASSERT(!m_constructor.IsEmpty());
228 228
229 V8PerContextData* perContextData = V8PerContextData::from(m_context); 229 V8PerContextData* perContextData = V8PerContextData::from(m_context);
230 if (!perContextData) 230 if (!perContextData)
231 return false; 231 return false;
232 232
233 // Bindings retrieve the prototype when needed from per-context data. 233 // Bindings retrieve the prototype when needed from per-context data.
234 v8::Persistent<v8::Object> persistentPrototype(m_context->GetIsolate(), m_pr ototype); 234 v8::Persistent<v8::Object> persistentPrototype(m_context->GetIsolate(), m_pr ototype);
235 perContextData->customElementPrototypes()->add(definition->type(), UnsafePer sistent<v8::Object>(persistentPrototype)); 235 perContextData->customElementPrototypes()->add(definition->type(), UnsafePer sistent<v8::Object>(persistentPrototype));
236 236
237 // Upgrade any wrappers alcreated created for this definition
238 for (HashSet<Element*>::const_iterator it = upgradeCandidates.begin(); it != upgradeCandidates.end(); ++it) {
239 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(*i t);
240 if (wrapper.IsEmpty()) {
241 // The wrapper will be created with the right prototype when
242 // retrieved; we don't need to eagerly create the wrapper.
243 continue;
244 }
245 wrapper->SetPrototype(m_prototype);
246 }
247
248 return true; 237 return true;
249 } 238 }
250 239
251 ScriptValue CustomElementConstructorBuilder::bindingsReturnValue() const 240 ScriptValue CustomElementConstructorBuilder::bindingsReturnValue() const
252 { 241 {
253 return ScriptValue(m_constructor); 242 return ScriptValue(m_constructor);
254 } 243 }
255 244
256 bool CustomElementConstructorBuilder::hasValidPrototypeChainFor(V8PerContextData * perContextData, WrapperTypeInfo* typeInfo) const 245 bool CustomElementConstructorBuilder::hasValidPrototypeChainFor(V8PerContextData * perContextData, WrapperTypeInfo* typeInfo) const
257 { 246 {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 285 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
297 RefPtr<Element> element = document->createElementNS(namespaceURI, name, mayb eType->IsNull() ? nullAtom : type, ec); 286 RefPtr<Element> element = document->createElementNS(namespaceURI, name, mayb eType->IsNull() ? nullAtom : type, ec);
298 if (ec) { 287 if (ec) {
299 setDOMException(ec, isolate); 288 setDOMException(ec, isolate);
300 return; 289 return;
301 } 290 }
302 v8SetReturnValue(args, toV8Fast(element.release(), args, document)); 291 v8SetReturnValue(args, toV8Fast(element.release(), args, document));
303 } 292 }
304 293
305 } // namespace WebCore 294 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/CustomElementConstructorBuilder.h ('k') | Source/bindings/v8/CustomElementHelpers.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698