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

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

Issue 289083003: [dartium] Dart half of ScriptValue refactoring. (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1916
Patch Set: Created 6 years, 7 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 | « Source/bindings/dart/DartScriptValue.cpp ('k') | Source/bindings/dart/DartUtilities.cpp » ('j') | 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 19 matching lines...) Expand all
30 #ifndef DartUtilities_h 30 #ifndef DartUtilities_h
31 #define DartUtilities_h 31 #define DartUtilities_h
32 32
33 #if OS(ANDROID) 33 #if OS(ANDROID)
34 #include <sys/system_properties.h> 34 #include <sys/system_properties.h>
35 #endif 35 #endif
36 36
37 #include "DartWebkitClassIds.h" 37 #include "DartWebkitClassIds.h"
38 38
39 #include "bindings/common/Dictionary.h" 39 #include "bindings/common/Dictionary.h"
40 #include "bindings/common/ScriptValue.h"
41 #include "bindings/dart/DartDOMData.h" 40 #include "bindings/dart/DartDOMData.h"
41 #include "bindings/dart/DartScriptValue.h"
42 #include "bindings/dart/DartStringCache.h" 42 #include "bindings/dart/DartStringCache.h"
43 #include "bindings/v8/ScriptPromise.h" 43 #include "bindings/v8/ScriptPromise.h"
44 #include "bindings/v8/SerializedScriptValue.h" 44 #include "bindings/v8/SerializedScriptValue.h"
45 #include "bindings/v8/V8RecursionScope.h" 45 #include "bindings/v8/V8RecursionScope.h"
46 #include "core/dom/DOMStringList.h" 46 #include "core/dom/DOMStringList.h"
47 #include "core/dom/MessagePort.h" 47 #include "core/dom/MessagePort.h"
48 #include "modules/mediastream/MediaStreamTrack.h" 48 #include "modules/mediastream/MediaStreamTrack.h"
49 49
50 #include "wtf/ArrayBufferView.h" 50 #include "wtf/ArrayBufferView.h"
51 #include "wtf/HashMap.h" 51 #include "wtf/HashMap.h"
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 } 511 }
512 // NOTE: consider revisiting this once situation w/ optional arguments check s 512 // NOTE: consider revisiting this once situation w/ optional arguments check s
513 // in dart:html is clearer. 513 // in dart:html is clearer.
514 // The implementation below will convert null to undefined script value. Whi ch 514 // The implementation below will convert null to undefined script value. Whi ch
515 // is exactly what is desired if actual value wasn't specified at call site, 515 // is exactly what is desired if actual value wasn't specified at call site,
516 // but is most probably wrong if null was explicitly provided. On more posit ive 516 // but is most probably wrong if null was explicitly provided. On more posit ive
517 // side indexed db are converted to Dart null anyway, so it might be tricky 517 // side indexed db are converted to Dart null anyway, so it might be tricky
518 // to observe from user code. 518 // to observe from user code.
519 static ScriptValue dartToScriptValueWithNullCheck(Dart_Handle handle, Dart_H andle& exception) 519 static ScriptValue dartToScriptValueWithNullCheck(Dart_Handle handle, Dart_H andle& exception)
520 { 520 {
521 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 521 return dartToScriptValue(handle, exception);
522 return Dart_IsNull(handle) ? ScriptValue(v8::Undefined(isolate), isolate ) : dartToScriptValue(handle, exception);
523 } 522 }
524 static ScriptValue dartToScriptValueWithNullCheck(Dart_NativeArguments args, int index, Dart_Handle& exception) 523 static ScriptValue dartToScriptValueWithNullCheck(Dart_NativeArguments args, int index, Dart_Handle& exception)
525 { 524 {
526 Dart_Handle object = Dart_GetNativeArgument(args, index); 525 Dart_Handle object = Dart_GetNativeArgument(args, index);
527 return dartToScriptValueWithNullCheck(object, exception); 526 return dartToScriptValueWithNullCheck(object, exception);
528 } 527 }
529 static Dart_Handle scriptValueToDart(const ScriptValue&); 528 static Dart_Handle scriptValueToDart(const ScriptValue&);
530 static Dart_Handle scriptValueToDart(const ScriptPromise&); 529 static Dart_Handle scriptValueToDart(const ScriptPromise&);
531 530
532 static PassRefPtr<SerializedScriptValue> dartToSerializedScriptValue(Dart_Ha ndle, Dart_Handle& exception); 531 static PassRefPtr<SerializedScriptValue> dartToSerializedScriptValue(Dart_Ha ndle, Dart_Handle& exception);
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 timerStop = currentTimeMS(); \ 734 timerStop = currentTimeMS(); \
736 fprintf(stdout, "%s %.3f ms\n", msg, (timerStop - timerStart)); 735 fprintf(stdout, "%s %.3f ms\n", msg, (timerStop - timerStart));
737 #else 736 #else
738 #define DART_START_TIMER() 737 #define DART_START_TIMER()
739 #define DART_RECORD_TIMER(msg) 738 #define DART_RECORD_TIMER(msg)
740 #endif 739 #endif
741 740
742 } // namespace WebCore 741 } // namespace WebCore
743 742
744 #endif // DartUtilities_h 743 #endif // DartUtilities_h
OLDNEW
« no previous file with comments | « Source/bindings/dart/DartScriptValue.cpp ('k') | Source/bindings/dart/DartUtilities.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698