OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 v8SetReturnValue(info, ret); | 71 v8SetReturnValue(info, ret); |
72 } | 72 } |
73 } | 73 } |
74 | 74 |
75 static void functionInvocationCallback(const v8::FunctionCallbackInfo<v8::Value>
& args) | 75 static void functionInvocationCallback(const v8::FunctionCallbackInfo<v8::Value>
& args) |
76 { | 76 { |
77 DartScopes scopes(args.Holder()); | 77 DartScopes scopes(args.Holder()); |
78 Dart_Handle handle = scopes.handle; | 78 Dart_Handle handle = scopes.handle; |
79 DartDOMData* domData = DartDOMData::current(); | 79 DartDOMData* domData = DartDOMData::current(); |
| 80 // We need to call V8Scope to properly track the stack depth and timestamp |
| 81 // for the transition between V8 and Dart. |
| 82 V8Scope v8scope(domData); |
80 ASSERT(domData); | 83 ASSERT(domData); |
81 ASSERT(DartUtilities::isFunction(domData, handle)); | 84 ASSERT(DartUtilities::isFunction(domData, handle)); |
82 | 85 |
83 Vector<Dart_Handle> dartFunctionArgs; | 86 Vector<Dart_Handle> dartFunctionArgs; |
84 ASSERT(args.Length() == 1 || args.Length() == 2); | 87 ASSERT(args.Length() == 1 || args.Length() == 2); |
85 // If there is 1 argument, we assume it is a v8:Array or arguments, if | 88 // If there is 1 argument, we assume it is a v8:Array or arguments, if |
86 // there are 2 arguments, the first argument is "this" and the second | 89 // there are 2 arguments, the first argument is "this" and the second |
87 // argument is an array of arguments. | 90 // argument is an array of arguments. |
88 if (args.Length() > 1) { | 91 if (args.Length() > 1) { |
89 dartFunctionArgs.append(JsInterop::toDart(args[0])); | 92 dartFunctionArgs.append(JsInterop::toDart(args[0])); |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 { | 1047 { |
1045 for (intptr_t i = 0; nativeEntries[i].nativeFunction != 0; i++) { | 1048 for (intptr_t i = 0; nativeEntries[i].nativeFunction != 0; i++) { |
1046 if (nf == nativeEntries[i].nativeFunction) { | 1049 if (nf == nativeEntries[i].nativeFunction) { |
1047 return reinterpret_cast<const uint8_t*>(nativeEntries[i].name); | 1050 return reinterpret_cast<const uint8_t*>(nativeEntries[i].name); |
1048 } | 1051 } |
1049 } | 1052 } |
1050 return 0; | 1053 return 0; |
1051 } | 1054 } |
1052 | 1055 |
1053 } | 1056 } |
OLD | NEW |