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

Side by Side Diff: Source/bindings/v8/Dictionary.cpp

Issue 125043004: Remove world type from hasInstance() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 return true; 330 return true;
331 } 331 }
332 332
333 bool Dictionary::get(const String& key, RefPtr<Storage>& value) const 333 bool Dictionary::get(const String& key, RefPtr<Storage>& value) const
334 { 334 {
335 v8::Local<v8::Value> v8Value; 335 v8::Local<v8::Value> v8Value;
336 if (!getKey(key, v8Value)) 336 if (!getKey(key, v8Value))
337 return false; 337 return false;
338 338
339 value = 0; 339 value = 0;
340 if (V8Storage::hasInstance(v8Value, m_isolate, worldType(m_isolate))) 340 if (V8Storage::hasInstance(v8Value, m_isolate))
341 value = V8Storage::toNative(v8::Handle<v8::Object>::Cast(v8Value)); 341 value = V8Storage::toNative(v8::Handle<v8::Object>::Cast(v8Value));
342 return true; 342 return true;
343 } 343 }
344 344
345 bool Dictionary::get(const String& key, MessagePortArray& value) const 345 bool Dictionary::get(const String& key, MessagePortArray& value) const
346 { 346 {
347 v8::Local<v8::Value> v8Value; 347 v8::Local<v8::Value> v8Value;
348 if (!getKey(key, v8Value)) 348 if (!getKey(key, v8Value))
349 return false; 349 return false;
350 350
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 return true; 416 return true;
417 } 417 }
418 418
419 bool Dictionary::get(const String& key, RefPtr<Uint8Array>& value) const 419 bool Dictionary::get(const String& key, RefPtr<Uint8Array>& value) const
420 { 420 {
421 v8::Local<v8::Value> v8Value; 421 v8::Local<v8::Value> v8Value;
422 if (!getKey(key, v8Value)) 422 if (!getKey(key, v8Value))
423 return false; 423 return false;
424 424
425 value = 0; 425 value = 0;
426 if (V8Uint8Array::hasInstance(v8Value, m_isolate, worldType(m_isolate))) 426 if (V8Uint8Array::hasInstance(v8Value, m_isolate))
427 value = V8Uint8Array::toNative(v8::Handle<v8::Object>::Cast(v8Value)); 427 value = V8Uint8Array::toNative(v8::Handle<v8::Object>::Cast(v8Value));
428 return true; 428 return true;
429 } 429 }
430 430
431 bool Dictionary::get(const String& key, RefPtr<ArrayBufferView>& value) const 431 bool Dictionary::get(const String& key, RefPtr<ArrayBufferView>& value) const
432 { 432 {
433 v8::Local<v8::Value> v8Value; 433 v8::Local<v8::Value> v8Value;
434 if (!getKey(key, v8Value)) 434 if (!getKey(key, v8Value))
435 return false; 435 return false;
436 436
437 value = 0; 437 value = 0;
438 if (V8ArrayBufferView::hasInstance(v8Value, m_isolate, worldType(m_isolate)) ) 438 if (V8ArrayBufferView::hasInstance(v8Value, m_isolate))
439 value = V8ArrayBufferView::toNative(v8::Handle<v8::Object>::Cast(v8Value )); 439 value = V8ArrayBufferView::toNative(v8::Handle<v8::Object>::Cast(v8Value ));
440 return true; 440 return true;
441 } 441 }
442 442
443 bool Dictionary::get(const String& key, RefPtr<MIDIPort>& value) const 443 bool Dictionary::get(const String& key, RefPtr<MIDIPort>& value) const
444 { 444 {
445 v8::Local<v8::Value> v8Value; 445 v8::Local<v8::Value> v8Value;
446 if (!getKey(key, v8Value)) 446 if (!getKey(key, v8Value))
447 return false; 447 return false;
448 448
449 value = 0; 449 value = 0;
450 if (V8MIDIPort::hasInstance(v8Value, m_isolate, worldType(m_isolate))) 450 if (V8MIDIPort::hasInstance(v8Value, m_isolate))
451 value = V8MIDIPort::toNative(v8::Handle<v8::Object>::Cast(v8Value)); 451 value = V8MIDIPort::toNative(v8::Handle<v8::Object>::Cast(v8Value));
452 return true; 452 return true;
453 } 453 }
454 454
455 bool Dictionary::get(const String& key, RefPtr<MediaKeyError>& value) const 455 bool Dictionary::get(const String& key, RefPtr<MediaKeyError>& value) const
456 { 456 {
457 v8::Local<v8::Value> v8Value; 457 v8::Local<v8::Value> v8Value;
458 if (!getKey(key, v8Value)) 458 if (!getKey(key, v8Value))
459 return false; 459 return false;
460 460
461 value = 0; 461 value = 0;
462 if (V8MediaKeyError::hasInstance(v8Value, m_isolate, worldType(m_isolate))) 462 if (V8MediaKeyError::hasInstance(v8Value, m_isolate))
463 value = V8MediaKeyError::toNative(v8::Handle<v8::Object>::Cast(v8Value)) ; 463 value = V8MediaKeyError::toNative(v8::Handle<v8::Object>::Cast(v8Value)) ;
464 return true; 464 return true;
465 } 465 }
466 466
467 bool Dictionary::get(const String& key, RefPtr<TrackBase>& value) const 467 bool Dictionary::get(const String& key, RefPtr<TrackBase>& value) const
468 { 468 {
469 v8::Local<v8::Value> v8Value; 469 v8::Local<v8::Value> v8Value;
470 if (!getKey(key, v8Value)) 470 if (!getKey(key, v8Value))
471 return false; 471 return false;
472 472
(...skipping 11 matching lines...) Expand all
484 return true; 484 return true;
485 } 485 }
486 486
487 bool Dictionary::get(const String& key, RefPtr<SpeechRecognitionError>& value) c onst 487 bool Dictionary::get(const String& key, RefPtr<SpeechRecognitionError>& value) c onst
488 { 488 {
489 v8::Local<v8::Value> v8Value; 489 v8::Local<v8::Value> v8Value;
490 if (!getKey(key, v8Value)) 490 if (!getKey(key, v8Value))
491 return false; 491 return false;
492 492
493 value = 0; 493 value = 0;
494 if (V8SpeechRecognitionError::hasInstance(v8Value, m_isolate, worldType(m_is olate))) 494 if (V8SpeechRecognitionError::hasInstance(v8Value, m_isolate))
495 value = V8SpeechRecognitionError::toNative(v8::Handle<v8::Object>::Cast( v8Value)); 495 value = V8SpeechRecognitionError::toNative(v8::Handle<v8::Object>::Cast( v8Value));
496 return true; 496 return true;
497 } 497 }
498 498
499 bool Dictionary::get(const String& key, RefPtr<SpeechRecognitionResult>& value) const 499 bool Dictionary::get(const String& key, RefPtr<SpeechRecognitionResult>& value) const
500 { 500 {
501 v8::Local<v8::Value> v8Value; 501 v8::Local<v8::Value> v8Value;
502 if (!getKey(key, v8Value)) 502 if (!getKey(key, v8Value))
503 return false; 503 return false;
504 504
505 value = 0; 505 value = 0;
506 if (V8SpeechRecognitionResult::hasInstance(v8Value, m_isolate, worldType(m_i solate))) 506 if (V8SpeechRecognitionResult::hasInstance(v8Value, m_isolate))
507 value = V8SpeechRecognitionResult::toNative(v8::Handle<v8::Object>::Cast (v8Value)); 507 value = V8SpeechRecognitionResult::toNative(v8::Handle<v8::Object>::Cast (v8Value));
508 return true; 508 return true;
509 } 509 }
510 510
511 bool Dictionary::get(const String& key, RefPtr<SpeechRecognitionResultList>& val ue) const 511 bool Dictionary::get(const String& key, RefPtr<SpeechRecognitionResultList>& val ue) const
512 { 512 {
513 v8::Local<v8::Value> v8Value; 513 v8::Local<v8::Value> v8Value;
514 if (!getKey(key, v8Value)) 514 if (!getKey(key, v8Value))
515 return false; 515 return false;
516 516
517 value = 0; 517 value = 0;
518 if (V8SpeechRecognitionResultList::hasInstance(v8Value, m_isolate, worldType (m_isolate))) 518 if (V8SpeechRecognitionResultList::hasInstance(v8Value, m_isolate))
519 value = V8SpeechRecognitionResultList::toNative(v8::Handle<v8::Object>:: Cast(v8Value)); 519 value = V8SpeechRecognitionResultList::toNative(v8::Handle<v8::Object>:: Cast(v8Value));
520 return true; 520 return true;
521 } 521 }
522 522
523 bool Dictionary::get(const String& key, RefPtr<MediaStream>& value) const 523 bool Dictionary::get(const String& key, RefPtr<MediaStream>& value) const
524 { 524 {
525 v8::Local<v8::Value> v8Value; 525 v8::Local<v8::Value> v8Value;
526 if (!getKey(key, v8Value)) 526 if (!getKey(key, v8Value))
527 return false; 527 return false;
528 528
529 value = 0; 529 value = 0;
530 if (V8MediaStream::hasInstance(v8Value, m_isolate, worldType(m_isolate))) 530 if (V8MediaStream::hasInstance(v8Value, m_isolate))
531 value = V8MediaStream::toNative(v8::Handle<v8::Object>::Cast(v8Value)); 531 value = V8MediaStream::toNative(v8::Handle<v8::Object>::Cast(v8Value));
532 return true; 532 return true;
533 } 533 }
534 534
535 bool Dictionary::get(const String& key, RefPtr<EventTarget>& value) const 535 bool Dictionary::get(const String& key, RefPtr<EventTarget>& value) const
536 { 536 {
537 v8::Local<v8::Value> v8Value; 537 v8::Local<v8::Value> v8Value;
538 if (!getKey(key, v8Value)) 538 if (!getKey(key, v8Value))
539 return false; 539 return false;
540 540
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 { 765 {
766 if (forConstructor()) { 766 if (forConstructor()) {
767 exceptionState().throwTypeError(detail); 767 exceptionState().throwTypeError(detail);
768 } else { 768 } else {
769 ASSERT(!methodName().isEmpty()); 769 ASSERT(!methodName().isEmpty());
770 exceptionState().throwTypeError(ExceptionMessages::failedToExecute(inter faceName(), methodName(), detail)); 770 exceptionState().throwTypeError(ExceptionMessages::failedToExecute(inter faceName(), methodName(), detail));
771 } 771 }
772 } 772 }
773 773
774 } // namespace WebCore 774 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestTypedefs.cpp ('k') | Source/bindings/v8/IDBBindingUtilities.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698