| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef DartHandleProxy_h | 31 #ifndef DartHandleProxy_h |
| 32 #define DartHandleProxy_h | 32 #define DartHandleProxy_h |
| 33 | 33 |
| 34 #include "bindings/dart/DartUtilities.h" |
| 35 |
| 34 #include <dart_api.h> | 36 #include <dart_api.h> |
| 37 #include <dart_debugger_api.h> |
| 35 #include <dart_mirrors_api.h> | 38 #include <dart_mirrors_api.h> |
| 36 #include <v8.h> | 39 #include <v8.h> |
| 37 | 40 |
| 38 namespace WebCore { | 41 namespace WebCore { |
| 39 | 42 |
| 40 class Node; | 43 class Node; |
| 44 class DartScriptValue; |
| 41 | 45 |
| 42 class DartHandleProxy { | 46 class DartHandleProxy { |
| 43 public: | 47 public: |
| 44 static v8::Handle<v8::Value> create(Dart_Handle value); | 48 static v8::Handle<v8::Value> create(Dart_Handle value); |
| 45 static v8::Handle<v8::Value> createTypeProxy(Dart_Handle value, bool showSta
tics); | 49 static v8::Handle<v8::Value> createTypeProxy(Dart_Handle value, bool showSta
tics); |
| 46 static v8::Handle<v8::Value> createLibraryProxy(Dart_Handle value, int32_t l
ibraryId, Dart_Handle prefix); | 50 static v8::Handle<v8::Value> createLibraryProxy(Dart_Handle value, int32_t l
ibraryId, Dart_Handle prefix); |
| 47 static v8::Handle<v8::Value> createLocalScopeProxy(Dart_Handle localVariable
s); | 51 static v8::Handle<v8::Value> createLocalScopeProxy(Dart_Handle localVariable
s); |
| 48 | 52 |
| 49 static bool isDartProxy(v8::Handle<v8::Value>); | 53 static bool isDartProxy(v8::Handle<v8::Value>); |
| 50 static const char* getJavaScriptType(v8::Handle<v8::Value>); | 54 static const char* getJavaScriptType(v8::Handle<v8::Value>); |
| 51 static Node* toNativeNode(v8::Handle<v8::Value>); | 55 static Node* toNativeNode(v8::Handle<v8::Value>); |
| 56 static Dart_Handle unwrapValue(v8::Handle<v8::Value>); |
| 57 |
| 58 }; |
| 59 |
| 60 /** |
| 61 * Helper class to manage all scopes that must be entered to safely invoke Dart |
| 62 * code. |
| 63 */ |
| 64 class DartScopes { |
| 65 private: |
| 66 DartScriptValue* scriptValue; |
| 67 DartIsolateScope scope; |
| 68 DartApiScope apiScope; |
| 69 Dart_ExceptionPauseInfo previousPauseInfo; |
| 70 |
| 71 public: |
| 72 Dart_Handle handle; |
| 73 |
| 74 DartScopes(v8::Local<v8::Object> v8Handle); |
| 75 ~DartScopes(); |
| 52 }; | 76 }; |
| 53 | 77 |
| 54 } | 78 } |
| 55 | 79 |
| 56 #endif // DartHandleProxy_h | 80 #endif // DartHandleProxy_h |
| OLD | NEW |