| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006-2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2006-2011 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 26 matching lines...) Expand all Loading... |
| 37 #include <dart_api.h> | 37 #include <dart_api.h> |
| 38 | 38 |
| 39 namespace WebCore { | 39 namespace WebCore { |
| 40 | 40 |
| 41 class DartCallback { | 41 class DartCallback { |
| 42 public: | 42 public: |
| 43 DartCallback(Dart_Handle object, Dart_Handle& exception); | 43 DartCallback(Dart_Handle object, Dart_Handle& exception); |
| 44 | 44 |
| 45 ~DartCallback(); | 45 ~DartCallback(); |
| 46 | 46 |
| 47 bool handleEvent() |
| 48 { |
| 49 DartIsolateState::Scope scope(m_isolate); |
| 50 DartApiScope apiScope; |
| 51 |
| 52 return handleEventInternal(0, 0); |
| 53 } |
| 54 |
| 47 template <class WebKitType> | 55 template <class WebKitType> |
| 48 bool handleEvent(WebKitType argument) | 56 bool handleEvent(WebKitType argument) |
| 49 { | 57 { |
| 50 DartIsolateState::Scope scope(m_isolate); | 58 DartIsolateState::Scope scope(m_isolate); |
| 51 DartApiScope apiScope; | 59 DartApiScope apiScope; |
| 52 | 60 |
| 53 Dart_Handle arguments[] = { | 61 Dart_Handle arguments[] = { |
| 54 toDartValue(argument) | 62 toDartValue(argument) |
| 55 }; | 63 }; |
| 56 return handleEventInternal(arguments, 1); | 64 return handleEventInternal(arguments, 1); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 86 private: | 94 private: |
| 87 bool handleEventInternal(Dart_Handle* argv, int argc); | 95 bool handleEventInternal(Dart_Handle* argv, int argc); |
| 88 | 96 |
| 89 Dart_Isolate m_isolate; | 97 Dart_Isolate m_isolate; |
| 90 Dart_Handle m_callback; | 98 Dart_Handle m_callback; |
| 91 }; | 99 }; |
| 92 | 100 |
| 93 } | 101 } |
| 94 | 102 |
| 95 #endif // DartCallback_h | 103 #endif // DartCallback_h |
| OLD | NEW |