OLD | NEW |
1 // Copyright (c) 2009, Google Inc. | 1 // Copyright (c) 2009, 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 // Setup configuration closures | 194 // Setup configuration closures |
195 char forwardingProp[DartUtilities::PROP_VALUE_MAX_LEN]; | 195 char forwardingProp[DartUtilities::PROP_VALUE_MAX_LEN]; |
196 int propLen = DartUtilities::getProp("DART_FORWARDING_PRINT", | 196 int propLen = DartUtilities::getProp("DART_FORWARDING_PRINT", |
197 forwardingProp, DartUtilities::PROP_VALUE_MAX_LEN); | 197 forwardingProp, DartUtilities::PROP_VALUE_MAX_LEN); |
198 bool forwardPrint = propLen > 0; | 198 bool forwardPrint = propLen > 0; |
199 const char * const printClosure = forwardPrint ? | 199 const char * const printClosure = forwardPrint ? |
200 "_forwardingPrintClosure" : | 200 "_forwardingPrintClosure" : |
201 (isDOMEnabled ? "_printClosure" : "_pureIsolatePrintClosure"); | 201 (isDOMEnabled ? "_printClosure" : "_pureIsolatePrintClosure"); |
202 copyValue(html, printClosure, "dart:_collection-dev", 0, "_printClosure"); | 202 copyValue(html, printClosure, "dart:_collection-dev", 0, "_printClosure"); |
203 copyValue(html, isDOMEnabled ? "_timerFactoryClosure" : "_pureIsolateTimerFa
ctoryClosure", "dart:async", "_TimerFactory", "_factory"); | 203 copyValue(html, isDOMEnabled ? "_timerFactoryClosure" : "_pureIsolateTimerFa
ctoryClosure", "dart:async", "_TimerFactory", "_factory"); |
204 copyValue(html, isDOMEnabled ? "_scheduleImmediateClosure" : "_pureIsolateSc
heduleImmediateClosure", "dart:async", "_ScheduleImmediate", "_closure"); | 204 if (isDOMEnabled) { |
| 205 copyValue(html, "_scheduleImmediateClosure", "dart:async", "_ScheduleImm
ediate", "_closure"); |
| 206 } else { |
| 207 // Use the VM implementation (from dart:isolate) for scheduleImmediate. |
| 208 Dart_Handle isolateLibrary = Dart_LookupLibrary(Dart_NewStringFromCStrin
g("dart:isolate")); |
| 209 ASSERT(!Dart_IsError(isolateLibrary)); |
| 210 |
| 211 Dart_Handle value = Dart_Invoke(isolateLibrary, Dart_NewStringFromCStrin
g("_getIsolateScheduleImmediateClosure"), 0, 0); |
| 212 ASSERT(!Dart_IsError(value)); |
| 213 |
| 214 Dart_Handle library = Dart_LookupLibrary(Dart_NewStringFromCString("dart
:async")); |
| 215 ASSERT(!Dart_IsError(library)); |
| 216 |
| 217 Dart_Handle target = Dart_GetType(library, Dart_NewStringFromCString("_S
cheduleImmediate"), 0, 0); |
| 218 ASSERT(!Dart_IsError(target)); |
| 219 |
| 220 Dart_SetField(target, Dart_NewStringFromCString("_closure"), value); |
| 221 } |
205 copyValue(html, isDOMEnabled ? "_uriBaseClosure" : "_pureIsolateUriBaseClosu
re", "dart:core", 0, "_uriBaseClosure"); | 222 copyValue(html, isDOMEnabled ? "_uriBaseClosure" : "_pureIsolateUriBaseClosu
re", "dart:core", 0, "_uriBaseClosure"); |
206 | 223 |
207 if (isDOMEnabled) { | 224 if (isDOMEnabled) { |
208 // Create strongly reachable document wrapper. Document wrapper acts as
a | 225 // Create strongly reachable document wrapper. Document wrapper acts as
a |
209 // retainer for in-document node wrappers group. There is no need to des
troy | 226 // retainer for in-document node wrappers group. There is no need to des
troy |
210 // this persistent handle explicitly because we will shutdown the isolat
e on | 227 // this persistent handle explicitly because we will shutdown the isolat
e on |
211 // navigation. | 228 // navigation. |
212 Dart_Handle localHandle = DartDocument::toDart(document); | 229 Dart_Handle localHandle = DartDocument::toDart(document); |
213 Dart_PersistentHandle strongHandle = Dart_NewPersistentHandle(localHandl
e); | 230 Dart_PersistentHandle strongHandle = Dart_NewPersistentHandle(localHandl
e); |
214 // We need a weak handle to always reachable object to temporary render | 231 // We need a weak handle to always reachable object to temporary render |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 Dart_Handle libraryIdHandle = Dart_ListGetAt(libraryIdList, i); | 853 Dart_Handle libraryIdHandle = Dart_ListGetAt(libraryIdList, i); |
837 Dart_Handle exception = 0; | 854 Dart_Handle exception = 0; |
838 intptr_t libraryId = DartUtilities::toInteger(libraryIdHandle, exception
); | 855 intptr_t libraryId = DartUtilities::toInteger(libraryIdHandle, exception
); |
839 ASSERT(!exception); | 856 ASSERT(!exception); |
840 DartScriptState* scriptState = lookupScriptStateFromLibraryIdMap(isolate
, v8Context, libraryIdMap, libraryId); | 857 DartScriptState* scriptState = lookupScriptStateFromLibraryIdMap(isolate
, v8Context, libraryIdMap, libraryId); |
841 result.append(scriptState); | 858 result.append(scriptState); |
842 } | 859 } |
843 } | 860 } |
844 | 861 |
845 } | 862 } |
OLD | NEW |