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/dart/V8Converter.cpp

Issue 27767003: Convert serialized values to ints if they are whole and less than 53 bits. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Created 7 years, 2 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
« no previous file with comments | « Source/bindings/dart/DartUtilities.cpp ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 Dart_Handle result = map.get(value); 163 Dart_Handle result = map.get(value);
164 if (result) 164 if (result)
165 return result; 165 return result;
166 166
167 if (value->IsUndefined()) 167 if (value->IsUndefined())
168 return Dart_Null(); 168 return Dart_Null();
169 if (value->IsNull()) 169 if (value->IsNull())
170 return Dart_Null(); 170 return Dart_Null();
171 if (value->IsString()) 171 if (value->IsString())
172 return map.put(value, stringToDart(value)); 172 return map.put(value, stringToDart(value));
173 if (value->IsInt32()) 173 if (value->IsNumber())
174 return Dart_NewInteger(value->Int32Value()); 174 return DartUtilities::numberToDart(value->NumberValue());
175 if (value->IsBoolean()) 175 if (value->IsBoolean())
176 return Dart_NewBoolean(value->BooleanValue()); 176 return Dart_NewBoolean(value->BooleanValue());
177 if (value->IsNumber())
178 return Dart_NewDouble(value->NumberValue());
179 if (value->IsArray()) 177 if (value->IsArray())
180 return listToDart(value.As<v8::Array>(), map, exception); 178 return listToDart(value.As<v8::Array>(), map, exception);
181 if (value->IsDate()) 179 if (value->IsDate())
182 return dateToDart(value); 180 return dateToDart(value);
183 if (value->IsObject()) { 181 if (value->IsObject()) {
184 v8::Handle<v8::Object> object = value.As<v8::Object>(); 182 v8::Handle<v8::Object> object = value.As<v8::Object>();
185 v8::Isolate* isolate = object->CreationContext()->GetIsolate(); 183 v8::Isolate* isolate = object->CreationContext()->GetIsolate();
186 184
187 if (V8ArrayBuffer::HasInstance(object, isolate, worldType(isolate))) 185 if (V8ArrayBuffer::HasInstance(object, isolate, worldType(isolate)))
188 return arrayBufferToDart(object, map, exception); 186 return arrayBufferToDart(object, map, exception);
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 } 494 }
497 495
498 Dart_Handle V8Converter::arrayBufferViewToDart(v8::Handle<v8::Object> object, V8 ToDartMap& map, Dart_Handle& exception) 496 Dart_Handle V8Converter::arrayBufferViewToDart(v8::Handle<v8::Object> object, V8 ToDartMap& map, Dart_Handle& exception)
499 { 497 {
500 RefPtr<ArrayBufferView> view = V8ArrayBufferView::toNative(object); 498 RefPtr<ArrayBufferView> view = V8ArrayBufferView::toNative(object);
501 Dart_Handle result = DartUtilities::arrayBufferViewToDart(view.get()); 499 Dart_Handle result = DartUtilities::arrayBufferViewToDart(view.get());
502 return map.put(object, result); 500 return map.put(object, result);
503 } 501 }
504 502
505 } // namespace WebCore 503 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/dart/DartUtilities.cpp ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698