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

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

Issue 125043004: Remove world type from hasInstance() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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) 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // These functions are custom to prevent a wrapper lookup of the return value wh ich is always 60 // These functions are custom to prevent a wrapper lookup of the return value wh ich is always
61 // part of the arguments. 61 // part of the arguments.
62 void V8Node::insertBeforeMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) 62 void V8Node::insertBeforeMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
63 { 63 {
64 v8::Handle<v8::Object> holder = info.Holder(); 64 v8::Handle<v8::Object> holder = info.Holder();
65 Node* imp = V8Node::toNative(holder); 65 Node* imp = V8Node::toNative(holder);
66 66
67 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 67 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
68 68
69 ExceptionState exceptionState(ExceptionState::ExecutionContext, "insertBefor e", "Node", info.Holder(), info.GetIsolate()); 69 ExceptionState exceptionState(ExceptionState::ExecutionContext, "insertBefor e", "Node", info.Holder(), info.GetIsolate());
70 Node* newChild = V8Node::hasInstance(info[0], info.GetIsolate(), worldType(i nfo.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0 ; 70 Node* newChild = V8Node::hasInstance(info[0], info.GetIsolate()) ? V8Node::t oNative(v8::Handle<v8::Object>::Cast(info[0])) : 0;
71 Node* refChild = V8Node::hasInstance(info[1], info.GetIsolate(), worldType(i nfo.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(info[1])) : 0 ; 71 Node* refChild = V8Node::hasInstance(info[1], info.GetIsolate()) ? V8Node::t oNative(v8::Handle<v8::Object>::Cast(info[1])) : 0;
72 imp->insertBefore(newChild, refChild, exceptionState); 72 imp->insertBefore(newChild, refChild, exceptionState);
73 if (exceptionState.throwIfNeeded()) 73 if (exceptionState.throwIfNeeded())
74 return; 74 return;
75 v8SetReturnValue(info, info[0]); 75 v8SetReturnValue(info, info[0]);
76 } 76 }
77 77
78 void V8Node::replaceChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) 78 void V8Node::replaceChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
79 { 79 {
80 v8::Handle<v8::Object> holder = info.Holder(); 80 v8::Handle<v8::Object> holder = info.Holder();
81 Node* imp = V8Node::toNative(holder); 81 Node* imp = V8Node::toNative(holder);
82 82
83 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 83 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
84 84
85 ExceptionState exceptionState(ExceptionState::ExecutionContext, "replaceChil d", "Node", info.Holder(), info.GetIsolate()); 85 ExceptionState exceptionState(ExceptionState::ExecutionContext, "replaceChil d", "Node", info.Holder(), info.GetIsolate());
86 Node* newChild = V8Node::hasInstance(info[0], info.GetIsolate(), worldType(i nfo.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0 ; 86 Node* newChild = V8Node::hasInstance(info[0], info.GetIsolate()) ? V8Node::t oNative(v8::Handle<v8::Object>::Cast(info[0])) : 0;
87 Node* oldChild = V8Node::hasInstance(info[1], info.GetIsolate(), worldType(i nfo.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(info[1])) : 0 ; 87 Node* oldChild = V8Node::hasInstance(info[1], info.GetIsolate()) ? V8Node::t oNative(v8::Handle<v8::Object>::Cast(info[1])) : 0;
88 imp->replaceChild(newChild, oldChild, exceptionState); 88 imp->replaceChild(newChild, oldChild, exceptionState);
89 if (exceptionState.throwIfNeeded()) 89 if (exceptionState.throwIfNeeded())
90 return; 90 return;
91 v8SetReturnValue(info, info[1]); 91 v8SetReturnValue(info, info[1]);
92 } 92 }
93 93
94 void V8Node::removeChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) 94 void V8Node::removeChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
95 { 95 {
96 v8::Handle<v8::Object> holder = info.Holder(); 96 v8::Handle<v8::Object> holder = info.Holder();
97 Node* imp = V8Node::toNative(holder); 97 Node* imp = V8Node::toNative(holder);
98 98
99 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 99 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
100 100
101 ExceptionState exceptionState(ExceptionState::ExecutionContext, "removeChild ", "Node", info.Holder(), info.GetIsolate()); 101 ExceptionState exceptionState(ExceptionState::ExecutionContext, "removeChild ", "Node", info.Holder(), info.GetIsolate());
102 Node* oldChild = V8Node::hasInstance(info[0], info.GetIsolate(), worldType(i nfo.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0 ; 102 Node* oldChild = V8Node::hasInstance(info[0], info.GetIsolate()) ? V8Node::t oNative(v8::Handle<v8::Object>::Cast(info[0])) : 0;
103 imp->removeChild(oldChild, exceptionState); 103 imp->removeChild(oldChild, exceptionState);
104 if (exceptionState.throwIfNeeded()) 104 if (exceptionState.throwIfNeeded())
105 return; 105 return;
106 v8SetReturnValue(info, info[0]); 106 v8SetReturnValue(info, info[0]);
107 } 107 }
108 108
109 void V8Node::appendChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) 109 void V8Node::appendChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
110 { 110 {
111 v8::Handle<v8::Object> holder = info.Holder(); 111 v8::Handle<v8::Object> holder = info.Holder();
112 Node* imp = V8Node::toNative(holder); 112 Node* imp = V8Node::toNative(holder);
113 113
114 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 114 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
115 115
116 ExceptionState exceptionState(ExceptionState::ExecutionContext, "appendChild ", "Node", info.Holder(), info.GetIsolate()); 116 ExceptionState exceptionState(ExceptionState::ExecutionContext, "appendChild ", "Node", info.Holder(), info.GetIsolate());
117 Node* newChild = V8Node::hasInstance(info[0], info.GetIsolate(), worldType(i nfo.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0 ; 117 Node* newChild = V8Node::hasInstance(info[0], info.GetIsolate()) ? V8Node::t oNative(v8::Handle<v8::Object>::Cast(info[0])) : 0;
118 imp->appendChild(newChild, exceptionState); 118 imp->appendChild(newChild, exceptionState);
119 if (exceptionState.throwIfNeeded()) 119 if (exceptionState.throwIfNeeded())
120 return; 120 return;
121 v8SetReturnValue(info, info[0]); 121 v8SetReturnValue(info, info[0]);
122 } 122 }
123 123
124 v8::Handle<v8::Object> wrap(Node* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 124 v8::Handle<v8::Object> wrap(Node* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
125 { 125 {
126 ASSERT(impl); 126 ASSERT(impl);
127 switch (impl->nodeType()) { 127 switch (impl->nodeType()) {
(...skipping 20 matching lines...) Expand all
148 return wrap(toDocumentType(impl), creationContext, isolate); 148 return wrap(toDocumentType(impl), creationContext, isolate);
149 case Node::DOCUMENT_FRAGMENT_NODE: 149 case Node::DOCUMENT_FRAGMENT_NODE:
150 if (impl->isShadowRoot()) 150 if (impl->isShadowRoot())
151 return wrap(toShadowRoot(impl), creationContext, isolate); 151 return wrap(toShadowRoot(impl), creationContext, isolate);
152 return wrap(toDocumentFragment(impl), creationContext, isolate); 152 return wrap(toDocumentFragment(impl), creationContext, isolate);
153 } 153 }
154 ASSERT_NOT_REACHED(); 154 ASSERT_NOT_REACHED();
155 return V8Node::createWrapper(impl, creationContext, isolate); 155 return V8Node::createWrapper(impl, creationContext, isolate);
156 } 156 }
157 } // namespace WebCore 157 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp ('k') | Source/bindings/v8/custom/V8TypedArrayCustom.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698