| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "lib/stacktrace.h" | 10 #include "lib/stacktrace.h" |
| 11 #include "vm/class_finalizer.h" | 11 #include "vm/class_finalizer.h" |
| 12 #include "vm/clustered_snapshot.h" | 12 #include "vm/clustered_snapshot.h" |
| 13 #include "vm/compiler.h" | 13 #include "vm/compiler.h" |
| 14 #include "vm/dart.h" | 14 #include "vm/dart.h" |
| 15 #include "vm/dart_api_impl.h" | 15 #include "vm/dart_api_impl.h" |
| 16 #include "vm/dart_api_message.h" | 16 #include "vm/dart_api_message.h" |
| 17 #include "vm/dart_api_state.h" | 17 #include "vm/dart_api_state.h" |
| 18 #include "vm/dart_entry.h" | 18 #include "vm/dart_entry.h" |
| 19 #include "vm/debugger.h" | 19 #include "vm/debugger.h" |
| 20 #include "vm/exceptions.h" | 20 #include "vm/exceptions.h" |
| 21 #include "vm/flags.h" | 21 #include "vm/flags.h" |
| 22 #include "vm/growable_array.h" | 22 #include "vm/growable_array.h" |
| 23 #include "vm/lockers.h" | 23 #include "vm/lockers.h" |
| 24 #include "vm/isolate_reload.h" |
| 24 #include "vm/message.h" | 25 #include "vm/message.h" |
| 25 #include "vm/message_handler.h" | 26 #include "vm/message_handler.h" |
| 26 #include "vm/native_entry.h" | 27 #include "vm/native_entry.h" |
| 27 #include "vm/object.h" | 28 #include "vm/object.h" |
| 28 #include "vm/object_store.h" | 29 #include "vm/object_store.h" |
| 29 #include "vm/os_thread.h" | 30 #include "vm/os_thread.h" |
| 30 #include "vm/os.h" | 31 #include "vm/os.h" |
| 31 #include "vm/port.h" | 32 #include "vm/port.h" |
| 32 #include "vm/precompiler.h" | 33 #include "vm/precompiler.h" |
| 33 #include "vm/profiler.h" | 34 #include "vm/profiler.h" |
| (...skipping 5180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5214 } else { | 5215 } else { |
| 5215 *result = Api::NewHandle(thread, error.raw()); | 5216 *result = Api::NewHandle(thread, error.raw()); |
| 5216 // Compilation errors are not Dart instances, so just mark the library | 5217 // Compilation errors are not Dart instances, so just mark the library |
| 5217 // as having failed to load without providing an error instance. | 5218 // as having failed to load without providing an error instance. |
| 5218 lib.SetLoadError(Object::null_instance()); | 5219 lib.SetLoadError(Object::null_instance()); |
| 5219 } | 5220 } |
| 5220 } | 5221 } |
| 5221 | 5222 |
| 5222 | 5223 |
| 5223 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url, | 5224 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url, |
| 5225 Dart_Handle resolved_url, |
| 5224 Dart_Handle source, | 5226 Dart_Handle source, |
| 5225 intptr_t line_offset, | 5227 intptr_t line_offset, |
| 5226 intptr_t column_offset) { | 5228 intptr_t column_offset) { |
| 5227 API_TIMELINE_DURATION; | 5229 API_TIMELINE_DURATION; |
| 5228 DARTSCOPE(Thread::Current()); | 5230 DARTSCOPE(Thread::Current()); |
| 5229 Isolate* I = T->isolate(); | 5231 Isolate* I = T->isolate(); |
| 5230 const String& url_str = Api::UnwrapStringHandle(Z, url); | 5232 const String& url_str = Api::UnwrapStringHandle(Z, url); |
| 5231 if (url_str.IsNull()) { | 5233 if (url_str.IsNull()) { |
| 5232 RETURN_TYPE_ERROR(Z, url, String); | 5234 RETURN_TYPE_ERROR(Z, url, String); |
| 5233 } | 5235 } |
| 5236 if (Dart_IsNull(resolved_url)) { |
| 5237 resolved_url = url; |
| 5238 } |
| 5239 const String& resolved_url_str = Api::UnwrapStringHandle(Z, resolved_url); |
| 5240 if (resolved_url_str.IsNull()) { |
| 5241 RETURN_TYPE_ERROR(Z, resolved_url, String); |
| 5242 } |
| 5234 const String& source_str = Api::UnwrapStringHandle(Z, source); | 5243 const String& source_str = Api::UnwrapStringHandle(Z, source); |
| 5235 if (source_str.IsNull()) { | 5244 if (source_str.IsNull()) { |
| 5236 RETURN_TYPE_ERROR(Z, source, String); | 5245 RETURN_TYPE_ERROR(Z, source, String); |
| 5237 } | 5246 } |
| 5238 Library& library = Library::Handle(Z, I->object_store()->root_library()); | 5247 Library& library = Library::Handle(Z, I->object_store()->root_library()); |
| 5239 if (!library.IsNull()) { | 5248 if (!library.IsNull()) { |
| 5240 const String& library_url = String::Handle(Z, library.url()); | 5249 const String& library_url = String::Handle(Z, library.url()); |
| 5241 return Api::NewError("%s: A script has already been loaded from '%s'.", | 5250 return Api::NewError("%s: A script has already been loaded from '%s'.", |
| 5242 CURRENT_FUNC, library_url.ToCString()); | 5251 CURRENT_FUNC, library_url.ToCString()); |
| 5243 } | 5252 } |
| 5244 if (line_offset < 0) { | 5253 if (line_offset < 0) { |
| 5245 return Api::NewError("%s: argument 'line_offset' must be positive number", | 5254 return Api::NewError("%s: argument 'line_offset' must be positive number", |
| 5246 CURRENT_FUNC); | 5255 CURRENT_FUNC); |
| 5247 } | 5256 } |
| 5248 if (column_offset < 0) { | 5257 if (column_offset < 0) { |
| 5249 return Api::NewError("%s: argument 'column_offset' must be positive number", | 5258 return Api::NewError("%s: argument 'column_offset' must be positive number", |
| 5250 CURRENT_FUNC); | 5259 CURRENT_FUNC); |
| 5251 } | 5260 } |
| 5252 CHECK_CALLBACK_STATE(T); | 5261 CHECK_CALLBACK_STATE(T); |
| 5253 CHECK_COMPILATION_ALLOWED(I); | 5262 CHECK_COMPILATION_ALLOWED(I); |
| 5254 | 5263 |
| 5255 NoHeapGrowthControlScope no_growth_control; | 5264 NoHeapGrowthControlScope no_growth_control; |
| 5256 | 5265 |
| 5257 library = Library::New(url_str); | 5266 library = Library::New(url_str); |
| 5258 library.set_debuggable(true); | 5267 library.set_debuggable(true); |
| 5259 library.Register(T); | 5268 library.Register(T); |
| 5260 I->object_store()->set_root_library(library); | 5269 I->object_store()->set_root_library(library); |
| 5261 | 5270 |
| 5262 const Script& script = Script::Handle(Z, | 5271 const Script& script = |
| 5263 Script::New(url_str, source_str, RawScript::kScriptTag)); | 5272 Script::Handle(Z, Script::New(url_str, resolved_url_str, source_str, |
| 5273 RawScript::kScriptTag)); |
| 5264 script.SetLocationOffset(line_offset, column_offset); | 5274 script.SetLocationOffset(line_offset, column_offset); |
| 5265 Dart_Handle result; | 5275 Dart_Handle result; |
| 5266 CompileSource(T, library, script, &result); | 5276 CompileSource(T, library, script, &result); |
| 5267 return result; | 5277 return result; |
| 5268 } | 5278 } |
| 5269 | 5279 |
| 5270 | 5280 |
| 5271 DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer, | 5281 DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer, |
| 5272 intptr_t buffer_len) { | 5282 intptr_t buffer_len) { |
| 5273 API_TIMELINE_DURATION; | 5283 API_TIMELINE_DURATION; |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5491 if (pending_deferred_loads.At(i) == lib.raw()) { | 5501 if (pending_deferred_loads.At(i) == lib.raw()) { |
| 5492 lib.SetLoadError(err); | 5502 lib.SetLoadError(err); |
| 5493 return Api::Null(); | 5503 return Api::Null(); |
| 5494 } | 5504 } |
| 5495 } | 5505 } |
| 5496 return error_in; | 5506 return error_in; |
| 5497 } | 5507 } |
| 5498 | 5508 |
| 5499 | 5509 |
| 5500 DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url, | 5510 DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url, |
| 5511 Dart_Handle resolved_url, |
| 5501 Dart_Handle source, | 5512 Dart_Handle source, |
| 5502 intptr_t line_offset, | 5513 intptr_t line_offset, |
| 5503 intptr_t column_offset) { | 5514 intptr_t column_offset) { |
| 5504 API_TIMELINE_DURATION; | 5515 API_TIMELINE_DURATION; |
| 5505 DARTSCOPE(Thread::Current()); | 5516 DARTSCOPE(Thread::Current()); |
| 5506 Isolate* I = T->isolate(); | 5517 Isolate* I = T->isolate(); |
| 5507 const String& url_str = Api::UnwrapStringHandle(Z, url); | 5518 const String& url_str = Api::UnwrapStringHandle(Z, url); |
| 5508 if (url_str.IsNull()) { | 5519 if (url_str.IsNull()) { |
| 5509 RETURN_TYPE_ERROR(Z, url, String); | 5520 RETURN_TYPE_ERROR(Z, url, String); |
| 5510 } | 5521 } |
| 5522 if (Dart_IsNull(resolved_url)) { |
| 5523 resolved_url = url; |
| 5524 } |
| 5525 const String& resolved_url_str = Api::UnwrapStringHandle(Z, resolved_url); |
| 5526 if (resolved_url_str.IsNull()) { |
| 5527 RETURN_TYPE_ERROR(Z, resolved_url, String); |
| 5528 } |
| 5511 const String& source_str = Api::UnwrapStringHandle(Z, source); | 5529 const String& source_str = Api::UnwrapStringHandle(Z, source); |
| 5512 if (source_str.IsNull()) { | 5530 if (source_str.IsNull()) { |
| 5513 RETURN_TYPE_ERROR(Z, source, String); | 5531 RETURN_TYPE_ERROR(Z, source, String); |
| 5514 } | 5532 } |
| 5515 if (line_offset < 0) { | 5533 if (line_offset < 0) { |
| 5516 return Api::NewError("%s: argument 'line_offset' must be positive number", | 5534 return Api::NewError("%s: argument 'line_offset' must be positive number", |
| 5517 CURRENT_FUNC); | 5535 CURRENT_FUNC); |
| 5518 } | 5536 } |
| 5519 if (column_offset < 0) { | 5537 if (column_offset < 0) { |
| 5520 return Api::NewError("%s: argument 'column_offset' must be positive number", | 5538 return Api::NewError("%s: argument 'column_offset' must be positive number", |
| 5521 CURRENT_FUNC); | 5539 CURRENT_FUNC); |
| 5522 } | 5540 } |
| 5523 CHECK_CALLBACK_STATE(T); | 5541 CHECK_CALLBACK_STATE(T); |
| 5524 CHECK_COMPILATION_ALLOWED(I); | 5542 CHECK_COMPILATION_ALLOWED(I); |
| 5525 | 5543 |
| 5526 NoHeapGrowthControlScope no_growth_control; | 5544 NoHeapGrowthControlScope no_growth_control; |
| 5527 | 5545 |
| 5528 Library& library = Library::Handle(Z, Library::LookupLibrary(T, url_str)); | 5546 Library& library = Library::Handle(Z, Library::LookupLibrary(T, url_str)); |
| 5529 if (library.IsNull()) { | 5547 if (library.IsNull()) { |
| 5530 library = Library::New(url_str); | 5548 library = Library::New(url_str); |
| 5531 library.Register(T); | 5549 library.Register(T); |
| 5532 } else if (library.LoadInProgress() || | 5550 } else if (library.LoadInProgress() || |
| 5533 library.Loaded() || | 5551 library.Loaded() || |
| 5534 library.LoadFailed()) { | 5552 library.LoadFailed()) { |
| 5535 // The source for this library has either been loaded or is in the | 5553 // The source for this library has either been loaded or is in the |
| 5536 // process of loading. Return an error. | 5554 // process of loading. Return an error. |
| 5537 return Api::NewError("%s: library '%s' has already been loaded.", | 5555 return Api::NewError("%s: library '%s' has already been loaded.", |
| 5538 CURRENT_FUNC, url_str.ToCString()); | 5556 CURRENT_FUNC, url_str.ToCString()); |
| 5539 } | 5557 } |
| 5540 const Script& script = Script::Handle(Z, | 5558 const Script& script = |
| 5541 Script::New(url_str, source_str, RawScript::kLibraryTag)); | 5559 Script::Handle(Z, Script::New(url_str, resolved_url_str, source_str, |
| 5560 RawScript::kLibraryTag)); |
| 5542 script.SetLocationOffset(line_offset, column_offset); | 5561 script.SetLocationOffset(line_offset, column_offset); |
| 5543 Dart_Handle result; | 5562 Dart_Handle result; |
| 5544 CompileSource(T, library, script, &result); | 5563 CompileSource(T, library, script, &result); |
| 5545 // Propagate the error out right now. | 5564 // Propagate the error out right now. |
| 5546 if (::Dart_IsError(result)) { | 5565 if (::Dart_IsError(result)) { |
| 5547 return result; | 5566 return result; |
| 5548 } | 5567 } |
| 5549 | 5568 |
| 5550 // If this is the dart:_builtin library, register it with the VM. | 5569 // If this is the dart:_builtin library, register it with the VM. |
| 5551 if (url_str.Equals("dart:_builtin")) { | 5570 if (url_str.Equals("dart:_builtin")) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5597 LibraryPrefix::New(prefix_symbol, import_ns, false, library_vm); | 5616 LibraryPrefix::New(prefix_symbol, import_ns, false, library_vm); |
| 5598 library_vm.AddObject(library_prefix, prefix_symbol); | 5617 library_vm.AddObject(library_prefix, prefix_symbol); |
| 5599 } | 5618 } |
| 5600 } | 5619 } |
| 5601 return Api::Success(); | 5620 return Api::Success(); |
| 5602 } | 5621 } |
| 5603 | 5622 |
| 5604 | 5623 |
| 5605 DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library, | 5624 DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library, |
| 5606 Dart_Handle url, | 5625 Dart_Handle url, |
| 5626 Dart_Handle resolved_url, |
| 5607 Dart_Handle source, | 5627 Dart_Handle source, |
| 5608 intptr_t line_offset, | 5628 intptr_t line_offset, |
| 5609 intptr_t column_offset) { | 5629 intptr_t column_offset) { |
| 5610 API_TIMELINE_DURATION; | 5630 API_TIMELINE_DURATION; |
| 5611 DARTSCOPE(Thread::Current()); | 5631 DARTSCOPE(Thread::Current()); |
| 5612 Isolate* I = T->isolate(); | 5632 Isolate* I = T->isolate(); |
| 5613 const Library& lib = Api::UnwrapLibraryHandle(Z, library); | 5633 const Library& lib = Api::UnwrapLibraryHandle(Z, library); |
| 5614 if (lib.IsNull()) { | 5634 if (lib.IsNull()) { |
| 5615 RETURN_TYPE_ERROR(Z, library, Library); | 5635 RETURN_TYPE_ERROR(Z, library, Library); |
| 5616 } | 5636 } |
| 5617 const String& url_str = Api::UnwrapStringHandle(Z, url); | 5637 const String& url_str = Api::UnwrapStringHandle(Z, url); |
| 5618 if (url_str.IsNull()) { | 5638 if (url_str.IsNull()) { |
| 5619 RETURN_TYPE_ERROR(Z, url, String); | 5639 RETURN_TYPE_ERROR(Z, url, String); |
| 5620 } | 5640 } |
| 5641 if (Dart_IsNull(resolved_url)) { |
| 5642 resolved_url = url; |
| 5643 } |
| 5644 const String& resolved_url_str = Api::UnwrapStringHandle(Z, resolved_url); |
| 5645 if (resolved_url_str.IsNull()) { |
| 5646 RETURN_TYPE_ERROR(Z, resolved_url, String); |
| 5647 } |
| 5621 const String& source_str = Api::UnwrapStringHandle(Z, source); | 5648 const String& source_str = Api::UnwrapStringHandle(Z, source); |
| 5622 if (source_str.IsNull()) { | 5649 if (source_str.IsNull()) { |
| 5623 RETURN_TYPE_ERROR(Z, source, String); | 5650 RETURN_TYPE_ERROR(Z, source, String); |
| 5624 } | 5651 } |
| 5625 if (line_offset < 0) { | 5652 if (line_offset < 0) { |
| 5626 return Api::NewError("%s: argument 'line_offset' must be positive number", | 5653 return Api::NewError("%s: argument 'line_offset' must be positive number", |
| 5627 CURRENT_FUNC); | 5654 CURRENT_FUNC); |
| 5628 } | 5655 } |
| 5629 if (column_offset < 0) { | 5656 if (column_offset < 0) { |
| 5630 return Api::NewError("%s: argument 'column_offset' must be positive number", | 5657 return Api::NewError("%s: argument 'column_offset' must be positive number", |
| 5631 CURRENT_FUNC); | 5658 CURRENT_FUNC); |
| 5632 } | 5659 } |
| 5633 CHECK_CALLBACK_STATE(T); | 5660 CHECK_CALLBACK_STATE(T); |
| 5634 CHECK_COMPILATION_ALLOWED(I); | 5661 CHECK_COMPILATION_ALLOWED(I); |
| 5635 | 5662 |
| 5636 NoHeapGrowthControlScope no_growth_control; | 5663 NoHeapGrowthControlScope no_growth_control; |
| 5637 | 5664 |
| 5638 const Script& script = Script::Handle(Z, | 5665 const Script& script = |
| 5639 Script::New(url_str, source_str, RawScript::kSourceTag)); | 5666 Script::Handle(Z, Script::New(url_str, resolved_url_str, source_str, |
| 5667 RawScript::kSourceTag)); |
| 5640 script.SetLocationOffset(line_offset, column_offset); | 5668 script.SetLocationOffset(line_offset, column_offset); |
| 5641 Dart_Handle result; | 5669 Dart_Handle result; |
| 5642 CompileSource(T, lib, script, &result); | 5670 CompileSource(T, lib, script, &result); |
| 5643 return result; | 5671 return result; |
| 5644 } | 5672 } |
| 5645 | 5673 |
| 5646 | 5674 |
| 5647 DART_EXPORT Dart_Handle Dart_LibraryLoadPatch(Dart_Handle library, | 5675 DART_EXPORT Dart_Handle Dart_LibraryLoadPatch(Dart_Handle library, |
| 5648 Dart_Handle url, | 5676 Dart_Handle url, |
| 5649 Dart_Handle patch_source) { | 5677 Dart_Handle patch_source) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 5660 } | 5688 } |
| 5661 const String& source_str = Api::UnwrapStringHandle(Z, patch_source); | 5689 const String& source_str = Api::UnwrapStringHandle(Z, patch_source); |
| 5662 if (source_str.IsNull()) { | 5690 if (source_str.IsNull()) { |
| 5663 RETURN_TYPE_ERROR(Z, patch_source, String); | 5691 RETURN_TYPE_ERROR(Z, patch_source, String); |
| 5664 } | 5692 } |
| 5665 CHECK_CALLBACK_STATE(T); | 5693 CHECK_CALLBACK_STATE(T); |
| 5666 CHECK_COMPILATION_ALLOWED(I); | 5694 CHECK_COMPILATION_ALLOWED(I); |
| 5667 | 5695 |
| 5668 NoHeapGrowthControlScope no_growth_control; | 5696 NoHeapGrowthControlScope no_growth_control; |
| 5669 | 5697 |
| 5670 const Script& script = Script::Handle(Z, | 5698 const Script& script = |
| 5671 Script::New(url_str, source_str, RawScript::kPatchTag)); | 5699 Script::Handle(Z, Script::New(url_str, url_str, source_str, |
| 5700 RawScript::kPatchTag)); |
| 5672 Dart_Handle result; | 5701 Dart_Handle result; |
| 5673 CompileSource(T, lib, script, &result); | 5702 CompileSource(T, lib, script, &result); |
| 5674 return result; | 5703 return result; |
| 5675 } | 5704 } |
| 5676 | 5705 |
| 5677 | 5706 |
| 5678 // Finalizes classes and invokes Dart core library function that completes | 5707 // Finalizes classes and invokes Dart core library function that completes |
| 5679 // futures of loadLibrary calls (deferred library loading). | 5708 // futures of loadLibrary calls (deferred library loading). |
| 5680 DART_EXPORT Dart_Handle Dart_FinalizeLoading(bool complete_futures) { | 5709 DART_EXPORT Dart_Handle Dart_FinalizeLoading(bool complete_futures) { |
| 5681 API_TIMELINE_DURATION; | 5710 API_TIMELINE_DURATION; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5837 | 5866 |
| 5838 | 5867 |
| 5839 DART_EXPORT Dart_Handle Dart_ServiceSendDataEvent(const char* stream_id, | 5868 DART_EXPORT Dart_Handle Dart_ServiceSendDataEvent(const char* stream_id, |
| 5840 const char* event_kind, | 5869 const char* event_kind, |
| 5841 const uint8_t* bytes, | 5870 const uint8_t* bytes, |
| 5842 intptr_t bytes_length) { | 5871 intptr_t bytes_length) { |
| 5843 return Api::Success(); | 5872 return Api::Success(); |
| 5844 } | 5873 } |
| 5845 | 5874 |
| 5846 | 5875 |
| 5876 DART_EXPORT Dart_Handle Dart_SetFileModifiedCallback( |
| 5877 Dart_FileModifiedCallback file_mod_callback) { |
| 5878 return Api::Success(); |
| 5879 } |
| 5880 |
| 5881 |
| 5847 DART_EXPORT void Dart_GlobalTimelineSetRecordedStreams(int64_t stream_mask) { | 5882 DART_EXPORT void Dart_GlobalTimelineSetRecordedStreams(int64_t stream_mask) { |
| 5848 return; | 5883 return; |
| 5849 } | 5884 } |
| 5850 | 5885 |
| 5851 | 5886 |
| 5852 DART_EXPORT void Dart_SetEmbedderTimelineCallbacks( | 5887 DART_EXPORT void Dart_SetEmbedderTimelineCallbacks( |
| 5853 Dart_EmbedderTimelineStartRecording start_recording, | 5888 Dart_EmbedderTimelineStartRecording start_recording, |
| 5854 Dart_EmbedderTimelineStopRecording stop_recording) { | 5889 Dart_EmbedderTimelineStopRecording stop_recording) { |
| 5855 return; | 5890 return; |
| 5856 } | 5891 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5949 if (bytes_length < 0) { | 5984 if (bytes_length < 0) { |
| 5950 return Api::NewError("%s expects argument 'bytes_length' to be >= 0.", | 5985 return Api::NewError("%s expects argument 'bytes_length' to be >= 0.", |
| 5951 CURRENT_FUNC); | 5986 CURRENT_FUNC); |
| 5952 } | 5987 } |
| 5953 Service::SendEmbedderEvent(I, stream_id, event_kind, | 5988 Service::SendEmbedderEvent(I, stream_id, event_kind, |
| 5954 bytes, bytes_length); | 5989 bytes, bytes_length); |
| 5955 return Api::Success(); | 5990 return Api::Success(); |
| 5956 } | 5991 } |
| 5957 | 5992 |
| 5958 | 5993 |
| 5994 DART_EXPORT Dart_Handle Dart_SetFileModifiedCallback( |
| 5995 Dart_FileModifiedCallback file_modified_callback) { |
| 5996 if (!FLAG_support_service) { |
| 5997 return Api::Success(); |
| 5998 } |
| 5999 if (file_modified_callback != NULL) { |
| 6000 if (IsolateReloadContext::file_modified_callback() != NULL) { |
| 6001 return Api::NewError( |
| 6002 "%s permits only one callback to be registered, please " |
| 6003 "remove the existing callback and then add this callback", |
| 6004 CURRENT_FUNC); |
| 6005 } |
| 6006 } else { |
| 6007 if (IsolateReloadContext::file_modified_callback() == NULL) { |
| 6008 return Api::NewError( |
| 6009 "%s expects 'file_modified_callback' to be set before it is cleared.", |
| 6010 CURRENT_FUNC); |
| 6011 } |
| 6012 } |
| 6013 IsolateReloadContext::SetFileModifiedCallback(file_modified_callback); |
| 6014 return Api::Success(); |
| 6015 } |
| 6016 |
| 6017 |
| 5959 DART_EXPORT void Dart_GlobalTimelineSetRecordedStreams(int64_t stream_mask) { | 6018 DART_EXPORT void Dart_GlobalTimelineSetRecordedStreams(int64_t stream_mask) { |
| 5960 if (!FLAG_support_timeline) { | 6019 if (!FLAG_support_timeline) { |
| 5961 return; | 6020 return; |
| 5962 } | 6021 } |
| 5963 const bool api_enabled = (stream_mask & DART_TIMELINE_STREAM_API) != 0; | 6022 const bool api_enabled = (stream_mask & DART_TIMELINE_STREAM_API) != 0; |
| 5964 const bool compiler_enabled = | 6023 const bool compiler_enabled = |
| 5965 (stream_mask & DART_TIMELINE_STREAM_COMPILER) != 0; | 6024 (stream_mask & DART_TIMELINE_STREAM_COMPILER) != 0; |
| 5966 const bool dart_enabled = | 6025 const bool dart_enabled = |
| 5967 (stream_mask & DART_TIMELINE_STREAM_DART) != 0; | 6026 (stream_mask & DART_TIMELINE_STREAM_DART) != 0; |
| 5968 const bool debugger_enabled = | 6027 const bool debugger_enabled = |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6496 | 6555 |
| 6497 DART_EXPORT bool Dart_IsPrecompiledRuntime() { | 6556 DART_EXPORT bool Dart_IsPrecompiledRuntime() { |
| 6498 #if defined(DART_PRECOMPILED_RUNTIME) | 6557 #if defined(DART_PRECOMPILED_RUNTIME) |
| 6499 return true; | 6558 return true; |
| 6500 #else | 6559 #else |
| 6501 return false; | 6560 return false; |
| 6502 #endif | 6561 #endif |
| 6503 } | 6562 } |
| 6504 | 6563 |
| 6505 } // namespace dart | 6564 } // namespace dart |
| OLD | NEW |