OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * |
| 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are |
| 6 * met: |
| 7 * |
| 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above |
| 11 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the |
| 13 * distribution. |
| 14 * * Neither the name of Google Inc. nor the names of its |
| 15 * contributors may be used to endorse or promote products derived from |
| 16 * this software without specific prior written permission. |
| 17 * |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ |
| 30 |
| 31 #ifndef V8Converter_h |
| 32 #define V8Converter_h |
| 33 |
| 34 #include <dart_api.h> |
| 35 #include <v8.h> |
| 36 |
| 37 namespace blink { |
| 38 |
| 39 class DartDOMData; |
| 40 class DartToV8Map; |
| 41 class V8ToDartMap; |
| 42 |
| 43 class V8Converter { |
| 44 public: |
| 45 static v8::Handle<v8::Value> toV8(Dart_Handle value, Dart_Handle& exception)
; |
| 46 static Dart_Handle toDart(v8::Handle<v8::Value> value, Dart_Handle& exceptio
n); |
| 47 |
| 48 static v8::Handle<v8::Value> toV8IfPrimitive(DartDOMData*, Dart_Handle value
, Dart_Handle& exception); |
| 49 static Dart_Handle toDartIfPrimitive(v8::Handle<v8::Value>); |
| 50 |
| 51 static v8::Handle<v8::Value> toV8IfBrowserNative(DartDOMData*, Dart_Handle v
alue, Dart_Handle& exception); |
| 52 static Dart_Handle toDartIfBrowserNative(v8::Handle<v8::Object>, v8::Isolate
*, Dart_Handle& exception); |
| 53 |
| 54 static v8::Handle<v8::String> stringToV8(Dart_Handle); |
| 55 static Dart_Handle stringToDart(v8::Handle<v8::Value>); |
| 56 |
| 57 static v8::Handle<v8::Value> booleanToV8(Dart_Handle); |
| 58 |
| 59 static v8::Handle<v8::Value> numberToV8(Dart_Handle); |
| 60 |
| 61 static v8::Handle<v8::Value> listToV8(Dart_Handle); |
| 62 |
| 63 static v8::Handle<v8::Value> dateToV8(Dart_Handle); |
| 64 static Dart_Handle dateToDart(v8::Handle<v8::Value>); |
| 65 |
| 66 private: |
| 67 static v8::Handle<v8::Value> toV8(Dart_Handle value, DartToV8Map&, Dart_Hand
le& exception); |
| 68 static Dart_Handle toDart(v8::Handle<v8::Value>, V8ToDartMap&, Dart_Handle&
exception); |
| 69 static v8::Handle<v8::Value> numberToV8(Dart_Handle, Dart_Handle& exception)
; |
| 70 static v8::Handle<v8::Value> listToV8(Dart_Handle, DartToV8Map&, Dart_Handle
& exception); |
| 71 static Dart_Handle listToDart(v8::Handle<v8::Array>, V8ToDartMap&, Dart_Hand
le& exception); |
| 72 static v8::Handle<v8::Value> mapToV8(Dart_Handle, DartToV8Map&, Dart_Handle&
exception); |
| 73 static Dart_Handle mapToDart(v8::Handle<v8::Object>, V8ToDartMap&, Dart_Hand
le& exception); |
| 74 static v8::Handle<v8::Value> arrayBufferToV8(Dart_Handle, Dart_Handle& excep
tion); |
| 75 static Dart_Handle arrayBufferToDart(v8::Handle<v8::Object>, Dart_Handle& ex
ception); |
| 76 static v8::Handle<v8::Value> arrayBufferViewToV8(Dart_Handle, Dart_Handle& e
xception); |
| 77 static Dart_Handle arrayBufferViewToDart(v8::Handle<v8::Object>, Dart_Handle
& exception); |
| 78 static v8::Handle<v8::Value> dateToV8(Dart_Handle, Dart_Handle& exception); |
| 79 static Dart_Handle idbFactoryToDart(v8::Handle<v8::Object>, Dart_Handle& exc
eption); |
| 80 }; |
| 81 |
| 82 } |
| 83 |
| 84 #endif // V8Converter_h |
OLD | NEW |