Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 383 v8::Local<v8::Array> v8Array = v8::Local<v8::Array>::Cast(v8Value); | 383 v8::Local<v8::Array> v8Array = v8::Local<v8::Array>::Cast(v8Value); |
| 384 for (size_t i = 0; i < v8Array->Length(); ++i) { | 384 for (size_t i = 0; i < v8Array->Length(); ++i) { |
| 385 v8::Local<v8::Value> indexedValue = v8Array->Get(v8::Uint32::New(diction ary.isolate(), i)); | 385 v8::Local<v8::Value> indexedValue = v8Array->Get(v8::Uint32::New(diction ary.isolate(), i)); |
| 386 TOSTRING_DEFAULT(V8StringResource<>, stringValue, indexedValue, false); | 386 TOSTRING_DEFAULT(V8StringResource<>, stringValue, indexedValue, false); |
| 387 value.append(stringValue); | 387 value.append(stringValue); |
| 388 } | 388 } |
| 389 | 389 |
| 390 return true; | 390 return true; |
| 391 } | 391 } |
| 392 | 392 |
| 393 // FIXME: remove | |
|
haraken
2014/07/21 16:11:59
Would you elaborate on this comment?
bashi
2014/07/22 02:33:56
Done.
| |
| 394 template <> | |
| 395 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, RefP trWillBeMember<Element>& value) | |
| 396 { | |
| 397 v8::Local<v8::Value> v8Value; | |
| 398 if (!dictionary.get(key, v8Value)) | |
| 399 return false; | |
| 400 | |
| 401 value = V8Element::toNativeWithTypeCheck(dictionary.isolate(), v8Value); | |
| 402 return true; | |
| 403 } | |
| 404 | |
| 393 template <> | 405 template <> |
| 394 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers ionContext& context, const String& key, Vector<String>& value) | 406 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers ionContext& context, const String& key, Vector<String>& value) |
| 395 { | 407 { |
| 396 Dictionary::ConversionContextScope scope(context); | 408 Dictionary::ConversionContextScope scope(context); |
| 397 | 409 |
| 398 v8::Local<v8::Value> v8Value; | 410 v8::Local<v8::Value> v8Value; |
| 399 if (!dictionary.get(key, v8Value)) | 411 if (!dictionary.get(key, v8Value)) |
| 400 return true; | 412 return true; |
| 401 | 413 |
| 402 if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value)) | 414 if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value)) |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 646 Dictionary::ConversionContextScope scope(context); | 658 Dictionary::ConversionContextScope scope(context); |
| 647 | 659 |
| 648 v8::Local<v8::Value> v8Value; | 660 v8::Local<v8::Value> v8Value; |
| 649 if (!dictionary.get(key, v8Value)) | 661 if (!dictionary.get(key, v8Value)) |
| 650 return true; | 662 return true; |
| 651 | 663 |
| 652 return DictionaryHelper::get(dictionary, key, value); | 664 return DictionaryHelper::get(dictionary, key, value); |
| 653 } | 665 } |
| 654 | 666 |
| 655 } // namespace WebCore | 667 } // namespace WebCore |
| OLD | NEW |