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

Side by Side Diff: Source/bindings/v8/custom/V8NodeListCustom.cpp

Issue 15724005: [Binding] Support primitive type for union member (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: do not inherit getter. rename DoNotCheckJSProperty to OverrideBuiltins Created 7 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007-2009 Google Inc. All rights reserved. 2 * Copyright (C) 2007-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 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 24 matching lines...) Expand all
35 #include "bindings/v8/V8Binding.h" 35 #include "bindings/v8/V8Binding.h"
36 #include "bindings/v8/V8GCController.h" 36 #include "bindings/v8/V8GCController.h"
37 #include "core/dom/LiveNodeList.h" 37 #include "core/dom/LiveNodeList.h"
38 #include "core/dom/NodeList.h" 38 #include "core/dom/NodeList.h"
39 39
40 #include "wtf/RefPtr.h" 40 #include "wtf/RefPtr.h"
41 #include "wtf/StdLibExtras.h" 41 #include "wtf/StdLibExtras.h"
42 42
43 namespace WebCore { 43 namespace WebCore {
44 44
45 v8::Handle<v8::Value> V8NodeList::namedPropertyGetter(v8::Local<v8::String> name , const v8::AccessorInfo& info)
46 {
47 NodeList* list = V8NodeList::toNative(info.Holder());
48 AtomicString key = toWebCoreAtomicString(name);
49
50 // Length property cannot be overridden.
51 DEFINE_STATIC_LOCAL(const AtomicString, length, ("length", AtomicString::Con structFromLiteral));
52 if (key == length)
53 return v8Integer(list->length(), info.GetIsolate());
54
55 RefPtr<Node> result = list->namedItem(key);
56 if (!result)
57 return v8Undefined();
58
59 return toV8Fast(result.release(), info, list);
60 }
61
62 void* V8NodeList::opaqueRootForGC(void* object, v8::Persistent<v8::Object> wrapp er, v8::Isolate* isolate) 45 void* V8NodeList::opaqueRootForGC(void* object, v8::Persistent<v8::Object> wrapp er, v8::Isolate* isolate)
63 { 46 {
64 ASSERT(V8NodeList::HasInstanceInAnyWorld(wrapper, isolate)); 47 ASSERT(V8NodeList::HasInstanceInAnyWorld(wrapper, isolate));
65 NodeList* impl = static_cast<NodeList*>(object); 48 NodeList* impl = static_cast<NodeList*>(object);
66 if (!impl->isLiveNodeList()) 49 if (!impl->isLiveNodeList())
67 return object; 50 return object;
68 Node* owner = static_cast<LiveNodeList*>(impl)->ownerNode(); 51 Node* owner = static_cast<LiveNodeList*>(impl)->ownerNode();
69 if (!owner) 52 if (!owner)
70 return object; 53 return object;
71 return V8GCController::opaqueRootForGC(owner, isolate); 54 return V8GCController::opaqueRootForGC(owner, isolate);
72 } 55 }
73 56
74 } // namespace WebCore 57 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698