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

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

Issue 398673003: Rename WebCore namespace to blink in bindings and web (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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) 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 27 matching lines...) Expand all
38 #include "bindings/core/v8/V8Path2D.h" 38 #include "bindings/core/v8/V8Path2D.h"
39 #include "bindings/core/v8/V8Storage.h" 39 #include "bindings/core/v8/V8Storage.h"
40 #include "bindings/core/v8/V8TextTrack.h" 40 #include "bindings/core/v8/V8TextTrack.h"
41 #include "bindings/core/v8/V8VoidCallback.h" 41 #include "bindings/core/v8/V8VoidCallback.h"
42 #include "bindings/core/v8/V8Window.h" 42 #include "bindings/core/v8/V8Window.h"
43 #include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" 43 #include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h"
44 #include "bindings/core/v8/custom/V8Uint8ArrayCustom.h" 44 #include "bindings/core/v8/custom/V8Uint8ArrayCustom.h"
45 #include "core/html/track/TrackBase.h" 45 #include "core/html/track/TrackBase.h"
46 #include "wtf/MathExtras.h" 46 #include "wtf/MathExtras.h"
47 47
48 namespace WebCore { 48 namespace blink {
49 49
50 template <> 50 template <>
51 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, v8:: Local<v8::Value>& value) 51 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, v8:: Local<v8::Value>& value)
52 { 52 {
53 return dictionary.get(key, value); 53 return dictionary.get(key, value);
54 } 54 }
55 55
56 template <> 56 template <>
57 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, Dict ionary& value) 57 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, Dict ionary& value)
58 { 58 {
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 266
267 template <> 267 template <>
268 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, Mess agePortArray& value) 268 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, Mess agePortArray& value)
269 { 269 {
270 v8::Local<v8::Value> v8Value; 270 v8::Local<v8::Value> v8Value;
271 if (!dictionary.get(key, v8Value)) 271 if (!dictionary.get(key, v8Value))
272 return false; 272 return false;
273 273
274 ASSERT(dictionary.isolate()); 274 ASSERT(dictionary.isolate());
275 ASSERT(dictionary.isolate() == v8::Isolate::GetCurrent()); 275 ASSERT(dictionary.isolate() == v8::Isolate::GetCurrent());
276 if (WebCore::isUndefinedOrNull(v8Value)) 276 if (blink::isUndefinedOrNull(v8Value))
277 return true; 277 return true;
278 bool success = false; 278 bool success = false;
279 value = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort>(v8Value, key, dictionary.isolate(), &success); 279 value = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort>(v8Value, key, dictionary.isolate(), &success);
280 return success; 280 return success;
281 } 281 }
282 282
283 template <> 283 template <>
284 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, Hash Set<AtomicString>& value) 284 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, Hash Set<AtomicString>& value)
285 { 285 {
286 v8::Local<v8::Value> v8Value; 286 v8::Local<v8::Value> v8Value;
(...skipping 18 matching lines...) Expand all
305 305
306 template <> 306 template <>
307 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers ionContext& context, const String& key, HashSet<AtomicString>& value) 307 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers ionContext& context, const String& key, HashSet<AtomicString>& value)
308 { 308 {
309 Dictionary::ConversionContextScope scope(context); 309 Dictionary::ConversionContextScope scope(context);
310 310
311 v8::Local<v8::Value> v8Value; 311 v8::Local<v8::Value> v8Value;
312 if (!dictionary.get(key, v8Value)) 312 if (!dictionary.get(key, v8Value))
313 return true; 313 return true;
314 314
315 if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value)) 315 if (context.isNullable() && blink::isUndefinedOrNull(v8Value))
316 return true; 316 return true;
317 317
318 if (!v8Value->IsArray()) { 318 if (!v8Value->IsArray()) {
319 context.throwTypeError(ExceptionMessages::notASequenceTypeProperty(key)) ; 319 context.throwTypeError(ExceptionMessages::notASequenceTypeProperty(key)) ;
320 return false; 320 return false;
321 } 321 }
322 322
323 return DictionaryHelper::get(dictionary, key, value); 323 return DictionaryHelper::get(dictionary, key, value);
324 } 324 }
325 325
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 392
393 template <> 393 template <>
394 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers ionContext& context, const String& key, Vector<String>& value) 394 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers ionContext& context, const String& key, Vector<String>& value)
395 { 395 {
396 Dictionary::ConversionContextScope scope(context); 396 Dictionary::ConversionContextScope scope(context);
397 397
398 v8::Local<v8::Value> v8Value; 398 v8::Local<v8::Value> v8Value;
399 if (!dictionary.get(key, v8Value)) 399 if (!dictionary.get(key, v8Value))
400 return true; 400 return true;
401 401
402 if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value)) 402 if (context.isNullable() && blink::isUndefinedOrNull(v8Value))
403 return true; 403 return true;
404 404
405 if (!v8Value->IsArray()) { 405 if (!v8Value->IsArray()) {
406 context.throwTypeError(ExceptionMessages::notASequenceTypeProperty(key)) ; 406 context.throwTypeError(ExceptionMessages::notASequenceTypeProperty(key)) ;
407 return false; 407 return false;
408 } 408 }
409 409
410 return DictionaryHelper::get(dictionary, key, value); 410 return DictionaryHelper::get(dictionary, key, value);
411 } 411 }
412 412
(...skipping 15 matching lines...) Expand all
428 428
429 template <> 429 template <>
430 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers ionContext& context, const String& key, ArrayValue& value) 430 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers ionContext& context, const String& key, ArrayValue& value)
431 { 431 {
432 Dictionary::ConversionContextScope scope(context); 432 Dictionary::ConversionContextScope scope(context);
433 433
434 v8::Local<v8::Value> v8Value; 434 v8::Local<v8::Value> v8Value;
435 if (!dictionary.get(key, v8Value)) 435 if (!dictionary.get(key, v8Value))
436 return true; 436 return true;
437 437
438 if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value)) 438 if (context.isNullable() && blink::isUndefinedOrNull(v8Value))
439 return true; 439 return true;
440 440
441 if (!v8Value->IsArray()) { 441 if (!v8Value->IsArray()) {
442 context.throwTypeError(ExceptionMessages::notASequenceTypeProperty(key)) ; 442 context.throwTypeError(ExceptionMessages::notASequenceTypeProperty(key)) ;
443 return false; 443 return false;
444 } 444 }
445 445
446 return DictionaryHelper::get(dictionary, key, value); 446 return DictionaryHelper::get(dictionary, key, value);
447 } 447 }
448 448
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 600
601 template<typename T> 601 template<typename T>
602 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers ionContext& context, const String& key, Nullable<T>& value) 602 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers ionContext& context, const String& key, Nullable<T>& value)
603 { 603 {
604 Dictionary::ConversionContextScope scope(context); 604 Dictionary::ConversionContextScope scope(context);
605 605
606 v8::Local<v8::Value> v8Value; 606 v8::Local<v8::Value> v8Value;
607 if (!dictionary.get(key, v8Value)) 607 if (!dictionary.get(key, v8Value))
608 return true; 608 return true;
609 609
610 if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value)) { 610 if (context.isNullable() && blink::isUndefinedOrNull(v8Value)) {
611 value = Nullable<T>(); 611 value = Nullable<T>();
612 return true; 612 return true;
613 } 613 }
614 614
615 T converted = IntegralTypeTraits<T>::toIntegral(v8Value, NormalConversion, c ontext.exceptionState()); 615 T converted = IntegralTypeTraits<T>::toIntegral(v8Value, NormalConversion, c ontext.exceptionState());
616 616
617 if (context.exceptionState().throwIfNeeded()) 617 if (context.exceptionState().throwIfNeeded())
618 return false; 618 return false;
619 619
620 value = Nullable<T>(converted); 620 value = Nullable<T>(converted);
(...skipping 24 matching lines...) Expand all
645 { 645 {
646 Dictionary::ConversionContextScope scope(context); 646 Dictionary::ConversionContextScope scope(context);
647 647
648 v8::Local<v8::Value> v8Value; 648 v8::Local<v8::Value> v8Value;
649 if (!dictionary.get(key, v8Value)) 649 if (!dictionary.get(key, v8Value))
650 return true; 650 return true;
651 651
652 return DictionaryHelper::get(dictionary, key, value); 652 return DictionaryHelper::get(dictionary, key, value);
653 } 653 }
654 654
655 } // namespace WebCore 655 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/DictionaryHelperForBindings.h ('k') | Source/bindings/core/v8/ExceptionMessages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698