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

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

Issue 209713003: Make DOMWrapperWorld::current() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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) 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 template<typename ElementType, typename WrapperType> 88 template<typename ElementType, typename WrapperType>
89 v8::Handle<v8::Object> CustomElementWrapper<ElementType, WrapperType>::wrap(Pass RefPtr<ElementType> element, v8::Handle<v8::Object> creationContext, v8::Isolate * isolate, v8::Handle<v8::Object> (*createSpecificWrapper)(ElementType* element, v8::Handle<v8::Object> creationContext, v8::Isolate*)) 89 v8::Handle<v8::Object> CustomElementWrapper<ElementType, WrapperType>::wrap(Pass RefPtr<ElementType> element, v8::Handle<v8::Object> creationContext, v8::Isolate * isolate, v8::Handle<v8::Object> (*createSpecificWrapper)(ElementType* element, v8::Handle<v8::Object> creationContext, v8::Isolate*))
90 { 90 {
91 ASSERT(DOMDataStore::getWrapper<V8Element>(element.get(), isolate).IsEmpty() ); 91 ASSERT(DOMDataStore::getWrapper<V8Element>(element.get(), isolate).IsEmpty() );
92 92
93 // FIXME: creationContext.IsEmpty() should never happen. Remove 93 // FIXME: creationContext.IsEmpty() should never happen. Remove
94 // this when callers (like InspectorController::inspect) are fixed 94 // this when callers (like InspectorController::inspect) are fixed
95 // to never pass an empty creation context. 95 // to never pass an empty creation context.
96 v8::Handle<v8::Context> context = creationContext.IsEmpty() ? isolate->GetCu rrentContext() : creationContext->CreationContext(); 96 v8::Handle<v8::Context> context = creationContext.IsEmpty() ? isolate->GetCu rrentContext() : creationContext->CreationContext();
97 97
98 if (!element->isUpgradedCustomElement() || DOMWrapperWorld::world(context)-> isIsolatedWorld()) 98 if (!element->isUpgradedCustomElement() || DOMWrapperWorld::world(context).i sIsolatedWorld())
99 return createUpgradeCandidateWrapper(element.get(), creationContext, iso late, createSpecificWrapper); 99 return createUpgradeCandidateWrapper(element.get(), creationContext, iso late, createSpecificWrapper);
100 100
101 V8PerContextData* perContextData = V8PerContextData::from(context); 101 V8PerContextData* perContextData = V8PerContextData::from(context);
102 if (!perContextData) 102 if (!perContextData)
103 return v8::Handle<v8::Object>(); 103 return v8::Handle<v8::Object>();
104 104
105 CustomElementBinding* binding = perContextData->customElementBinding(element ->customElementDefinition()); 105 CustomElementBinding* binding = perContextData->customElementBinding(element ->customElementDefinition());
106 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , binding->wrapperType(), element.get(), isolate); 106 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , binding->wrapperType(), element.get(), isolate);
107 if (wrapper.IsEmpty()) 107 if (wrapper.IsEmpty())
108 return v8::Handle<v8::Object>(); 108 return v8::Handle<v8::Object>();
109 109
110 wrapper->SetPrototype(binding->prototype()); 110 wrapper->SetPrototype(binding->prototype());
111 111
112 V8DOMWrapper::associateObjectWithWrapper<WrapperType>(element, binding->wrap perType(), wrapper, isolate, WrapperConfiguration::Dependent); 112 V8DOMWrapper::associateObjectWithWrapper<WrapperType>(element, binding->wrap perType(), wrapper, isolate, WrapperConfiguration::Dependent);
113 return wrapper; 113 return wrapper;
114 } 114 }
115 115
116 template 116 template
117 class CustomElementWrapper<HTMLElement, V8HTMLElement>; 117 class CustomElementWrapper<HTMLElement, V8HTMLElement>;
118 118
119 template 119 template
120 class CustomElementWrapper<SVGElement, V8SVGElement>; 120 class CustomElementWrapper<SVGElement, V8SVGElement>;
121 121
122 } // namespace WebCore 122 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/CustomElementConstructorBuilder.cpp ('k') | Source/bindings/v8/DOMDataStore.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698