Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (c) 2014, Opera Software ASA. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions | |
| 6 * are met: | |
| 7 * 1. Redistributions of source code must retain the above copyright | |
| 8 * notice, this list of conditions and the following disclaimer. | |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | |
| 10 * notice, this list of conditions and the following disclaimer in the | |
| 11 * documentation and/or other materials provided with the distribution. | |
| 12 * 3. Neither the name of Opera Software ASA nor the names of its | |
| 13 * contributors may be used to endorse or promote products derived | |
| 14 * from this software without specific prior written permission. | |
| 15 * | |
| 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | |
| 19 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |
| 20 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
| 21 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
| 23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
| 25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | |
| 27 * OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 28 */ | |
| 29 | |
| 30 #include "config.h" | |
| 31 #include "V8URLSearchParams.h" | |
| 32 | |
| 33 #include "V8HTMLAnchorElement.h" | |
| 34 #include "V8URL.h" | |
| 35 #include "bindings/v8/V8Binding.h" | |
| 36 #include "bindings/v8/V8DOMWrapper.h" | |
| 37 #include "bindings/v8/V8GCController.h" | |
| 38 #include "bindings/v8/V8Utilities.h" | |
| 39 #include "core/dom/DOMURL.h" | |
| 40 #include "core/dom/DOMURLSearchParams.h" | |
| 41 #include "core/dom/DOMURLUtils.h" | |
| 42 | |
| 43 namespace WebCore { | |
| 44 | |
| 45 void V8URLSearchParams::visitDOMWrapper(void* object, const v8::Persistent<v8::O bject>& wrapper, v8::Isolate* isolate) | |
| 46 { | |
| 47 DOMURLSearchParams* impl = fromInternalPointer(object); | |
| 48 v8::Local<v8::Object> creationContext = v8::Local<v8::Object>::New(isolate, wrapper); | |
| 49 V8WrapperInstantiationScope scope(creationContext, isolate); | |
| 50 if (DOMURLUtils* urlObject = impl->urlObject()) { | |
| 51 switch (urlObject->implementedBy()) { | |
| 52 case DOMURLUtils::Anchor: { | |
| 53 HTMLAnchorElement* anchor = static_cast<HTMLAnchorElement*>(urlObjec t); | |
| 54 if (!DOMDataStore::containsWrapper<V8HTMLAnchorElement>(anchor, isol ate)) | |
| 55 wrap(anchor, creationContext, isolate); | |
| 56 DOMDataStore::setWrapperReference<V8HTMLAnchorElement>(wrapper, anch or, isolate); | |
| 57 break; | |
| 58 } | |
| 59 case DOMURLUtils::DomURL: { | |
| 60 DOMURL* domURL = static_cast<DOMURL*>(urlObject); | |
|
arv (Not doing code reviews)
2014/01/21 14:40:33
Maybe extract to a template helper function so you
| |
| 61 if (!DOMDataStore::containsWrapper<V8URL>(domURL, isolate)) | |
| 62 wrap(domURL, creationContext, isolate); | |
| 63 DOMDataStore::setWrapperReference<V8URL>(wrapper, domURL, isolate); | |
| 64 break; | |
| 65 } | |
| 66 default: | |
| 67 // Either an entirely unexpected condition or you've forgotten to | |
| 68 // extend this switch to include handling for a new type. | |
| 69 ASSERT_NOT_REACHED(); | |
| 70 break; | |
| 71 } | |
| 72 } | |
| 73 setObjectGroup(object, wrapper, isolate); | |
| 74 } | |
| 75 | |
| 76 } // namespace WebCore | |
| OLD | NEW |