Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Ericsson AB. All rights reserved. | 3 * Copyright (C) 2012 Ericsson AB. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 { | 387 { |
| 388 ASSERT(startIndex <= args.Length()); | 388 ASSERT(startIndex <= args.Length()); |
| 389 Vector<T> result; | 389 Vector<T> result; |
| 390 typedef NativeValueTraits<T> TraitsType; | 390 typedef NativeValueTraits<T> TraitsType; |
| 391 int length = args.Length(); | 391 int length = args.Length(); |
| 392 for (int i = startIndex; i < length; ++i) | 392 for (int i = startIndex; i < length; ++i) |
| 393 result.append(TraitsType::nativeValue(args[i])); | 393 result.append(TraitsType::nativeValue(args[i])); |
| 394 return result; | 394 return result; |
| 395 } | 395 } |
| 396 | 396 |
| 397 template <class T> | |
| 398 Vector<T> toVectorOfArguments(const v8::Arguments& args) | |
|
haraken
2013/04/11 00:59:16
This doesn't need to be a template, since a type o
ulfar
2013/04/11 03:25:15
Inlining this might lead to some code size increas
| |
| 399 { | |
| 400 Vector<T> result; | |
| 401 int length = args.Length(); | |
|
haraken
2013/04/11 00:59:16
Nit: int => size_t
ulfar
2013/04/11 03:25:15
Done.
| |
| 402 for (int i = 0; i < length; ++i) | |
|
haraken
2013/04/11 00:59:16
Nit: int => size_t
ulfar
2013/04/11 03:25:15
Done.
| |
| 403 result.append(args[i]); | |
| 404 return result; | |
| 405 } | |
| 406 | |
| 397 // Validates that the passed object is a sequence type per WebIDL spec | 407 // Validates that the passed object is a sequence type per WebIDL spec |
| 398 // http://www.w3.org/TR/2012/WD-WebIDL-20120207/#es-sequence | 408 // http://www.w3.org/TR/2012/WD-WebIDL-20120207/#es-sequence |
| 399 inline v8::Handle<v8::Value> toV8Sequence(v8::Handle<v8::Value> value, uint3 2_t& length, v8::Isolate* isolate) | 409 inline v8::Handle<v8::Value> toV8Sequence(v8::Handle<v8::Value> value, uint3 2_t& length, v8::Isolate* isolate) |
| 400 { | 410 { |
| 401 if (!value->IsObject()) { | 411 if (!value->IsObject()) { |
| 402 throwTypeError(0, isolate); | 412 throwTypeError(0, isolate); |
| 403 return v8Undefined(); | 413 return v8Undefined(); |
| 404 } | 414 } |
| 405 | 415 |
| 406 v8::Local<v8::Value> v8Value(v8::Local<v8::Value>::New(value)); | 416 v8::Local<v8::Value> v8Value(v8::Local<v8::Value>::New(value)); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 496 // is disabled and it returns true. | 506 // is disabled and it returns true. |
| 497 bool handleOutOfMemory(); | 507 bool handleOutOfMemory(); |
| 498 // FIXME: This should receive an Isolate. | 508 // FIXME: This should receive an Isolate. |
| 499 v8::Local<v8::Value> handleMaxRecursionDepthExceeded(); | 509 v8::Local<v8::Value> handleMaxRecursionDepthExceeded(); |
| 500 | 510 |
| 501 void crashIfV8IsDead(); | 511 void crashIfV8IsDead(); |
| 502 | 512 |
| 503 } // namespace WebCore | 513 } // namespace WebCore |
| 504 | 514 |
| 505 #endif // V8Binding_h | 515 #endif // V8Binding_h |
| OLD | NEW |