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

Side by Side Diff: Source/bindings/dart/DartUtilities.h

Issue 368663002: Restore interpretation of Dart null as undefined in dartToScriptValueWithNullCheck. (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1985
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011, Google Inc. 1 // Copyright 2011, Google Inc.
2 // All rights reserved. 2 // 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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 } 527 }
528 // NOTE: consider revisiting this once situation w/ optional arguments check s 528 // NOTE: consider revisiting this once situation w/ optional arguments check s
529 // in dart:html is clearer. 529 // in dart:html is clearer.
530 // The implementation below will convert null to undefined script value. Whi ch 530 // The implementation below will convert null to undefined script value. Whi ch
531 // is exactly what is desired if actual value wasn't specified at call site, 531 // is exactly what is desired if actual value wasn't specified at call site,
532 // but is most probably wrong if null was explicitly provided. On more posit ive 532 // but is most probably wrong if null was explicitly provided. On more posit ive
533 // side indexed db are converted to Dart null anyway, so it might be tricky 533 // side indexed db are converted to Dart null anyway, so it might be tricky
534 // to observe from user code. 534 // to observe from user code.
535 static ScriptValue dartToScriptValueWithNullCheck(Dart_Handle handle) 535 static ScriptValue dartToScriptValueWithNullCheck(Dart_Handle handle)
536 { 536 {
537 if (Dart_IsNull(handle)) {
538 V8ScriptState* scriptState = v8ScriptStateForCurrentIsolate();
539 return ScriptValue(scriptState, v8::Undefined(scriptState->isolate() ));
vsm 2014/07/01 17:12:52 Did you consider a DartScriptValue wrapping undefi
rmacnak 2014/07/01 17:20:02 Right now a DartScriptValue never has an empty han
540 }
537 return dartToScriptValue(handle); 541 return dartToScriptValue(handle);
538 } 542 }
539 static ScriptValue dartToScriptValueWithNullCheck(Dart_NativeArguments args, int index) 543 static ScriptValue dartToScriptValueWithNullCheck(Dart_NativeArguments args, int index)
540 { 544 {
541 Dart_Handle object = Dart_GetNativeArgument(args, index); 545 Dart_Handle object = Dart_GetNativeArgument(args, index);
542 return dartToScriptValueWithNullCheck(object); 546 return dartToScriptValueWithNullCheck(object);
543 } 547 }
544 static Dart_Handle scriptValueToDart(const ScriptValue&); 548 static Dart_Handle scriptValueToDart(const ScriptValue&);
545 static Dart_Handle scriptValueToDart(const ScriptPromise&); 549 static Dart_Handle scriptValueToDart(const ScriptPromise&);
546 550
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 timerStop = currentTimeMS(); \ 763 timerStop = currentTimeMS(); \
760 fprintf(stdout, "%s %.3f ms\n", msg, (timerStop - timerStart)); 764 fprintf(stdout, "%s %.3f ms\n", msg, (timerStop - timerStart));
761 #else 765 #else
762 #define DART_START_TIMER() 766 #define DART_START_TIMER()
763 #define DART_RECORD_TIMER(msg) 767 #define DART_RECORD_TIMER(msg)
764 #endif 768 #endif
765 769
766 } // namespace WebCore 770 } // namespace WebCore
767 771
768 #endif // DartUtilities_h 772 #endif // DartUtilities_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698