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

Side by Side Diff: Source/bindings/core/v8/V8Binding.cpp

Issue 400493005: Make vector conversion more general in V8Bindings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: finished self review, PTAL Created 6 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) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 WTF::ArrayBufferContents::freeMemory(data, size); 140 WTF::ArrayBufferContents::freeMemory(data, size);
141 } 141 }
142 }; 142 };
143 143
144 v8::ArrayBuffer::Allocator* v8ArrayBufferAllocator() 144 v8::ArrayBuffer::Allocator* v8ArrayBufferAllocator()
145 { 145 {
146 DEFINE_STATIC_LOCAL(ArrayBufferAllocator, arrayBufferAllocator, ()); 146 DEFINE_STATIC_LOCAL(ArrayBufferAllocator, arrayBufferAllocator, ());
147 return &arrayBufferAllocator; 147 return &arrayBufferAllocator;
148 } 148 }
149 149
150 // These explicit specializations of toV8NoInline match up with the explicit spe cializations of V8ValueTraits in V8Binding.h; they permit
151 // vectors of these same types to be converted.
152 template <>
153 v8::Handle<v8::Value> toV8NoInline<const String>(const String* impl, v8::Handle< v8::Object> creationContext, v8::Isolate* isolate)
154 {
155 return V8ValueTraits<String>::toV8Value(*impl, creationContext, isolate);
156 }
157
158 template <>
159 v8::Handle<v8::Value> toV8NoInline<const AtomicString>(const AtomicString* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
160 {
161 return V8ValueTraits<AtomicString>::toV8Value(*impl, creationContext, isolat e);
162 }
163
164 template <>
165 v8::Handle<v8::Value> toV8NoInline<const int>(const int* impl, v8::Handle<v8::Ob ject> creationContext, v8::Isolate* isolate)
166 {
167 return V8ValueTraits<int>::toV8Value(*impl, creationContext, isolate);
168 }
169
170 template <>
171 v8::Handle<v8::Value> toV8NoInline<const long>(const long* impl, v8::Handle<v8:: Object> creationContext, v8::Isolate* isolate)
172 {
173 return V8ValueTraits<long>::toV8Value(*impl, creationContext, isolate);
174 }
175
176 template <>
177 v8::Handle<v8::Value> toV8NoInline<const unsigned>(const unsigned* impl, v8::Han dle<v8::Object> creationContext, v8::Isolate* isolate)
178 {
179 return V8ValueTraits<unsigned>::toV8Value(*impl, creationContext, isolate);
180 }
181
182 template <>
183 v8::Handle<v8::Value> toV8NoInline<const unsigned long>(const unsigned long* imp l, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
184 {
185 return V8ValueTraits<unsigned long>::toV8Value(*impl, creationContext, isola te);
186 }
187
188 template <>
189 v8::Handle<v8::Value> toV8NoInline<const float>(const float* impl, v8::Handle<v8 ::Object> creationContext, v8::Isolate* isolate)
190 {
191 return V8ValueTraits<float>::toV8Value(*impl, creationContext, isolate);
192 }
193
194 template <>
195 v8::Handle<v8::Value> toV8NoInline<const double>(const double* impl, v8::Handle< v8::Object> creationContext, v8::Isolate* isolate)
196 {
197 return V8ValueTraits<double>::toV8Value(*impl, creationContext, isolate);
198 }
199
200 template <>
201 v8::Handle<v8::Value> toV8NoInline<const bool>(const bool* impl, v8::Handle<v8:: Object> creationContext, v8::Isolate* isolate)
202 {
203 return V8ValueTraits<bool>::toV8Value(*impl, creationContext, isolate);
204 }
205
150 PassRefPtrWillBeRawPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value> callback, v8::Handle<v8::Object> creationContext, ScriptState* scriptState) 206 PassRefPtrWillBeRawPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value> callback, v8::Handle<v8::Object> creationContext, ScriptState* scriptState)
151 { 207 {
152 if (callback->IsNull()) 208 if (callback->IsNull())
153 return nullptr; 209 return nullptr;
154 RefPtrWillBeRawPtr<NodeFilter> filter = NodeFilter::create(); 210 RefPtrWillBeRawPtr<NodeFilter> filter = NodeFilter::create();
155 211
156 v8::Handle<v8::Object> filterWrapper = toV8(filter, creationContext, scriptS tate->isolate()).As<v8::Object>(); 212 v8::Handle<v8::Object> filterWrapper = toV8(filter, creationContext, scriptS tate->isolate()).As<v8::Object>();
157 213
158 RefPtrWillBeRawPtr<NodeFilterCondition> condition = V8NodeFilterCondition::c reate(callback, filterWrapper, scriptState); 214 RefPtrWillBeRawPtr<NodeFilterCondition> condition = V8NodeFilterCondition::c reate(callback, filterWrapper, scriptState);
159 filter->setCondition(condition.release()); 215 filter->setCondition(condition.release());
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(Executio nContext* context, v8::Handle<v8::Function> function, v8::Isolate* isolate) 984 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(Executio nContext* context, v8::Handle<v8::Function> function, v8::Isolate* isolate)
929 { 985 {
930 int scriptId = 0; 986 int scriptId = 0;
931 String resourceName; 987 String resourceName;
932 int lineNumber = 1; 988 int lineNumber = 1;
933 GetDevToolsFunctionInfo(function, isolate, scriptId, resourceName, lineNumbe r); 989 GetDevToolsFunctionInfo(function, isolate, scriptId, resourceName, lineNumbe r);
934 return InspectorFunctionCallEvent::data(context, scriptId, resourceName, lin eNumber); 990 return InspectorFunctionCallEvent::data(context, scriptId, resourceName, lin eNumber);
935 } 991 }
936 992
937 } // namespace WebCore 993 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698