Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 2997243002: Move all the isolate reload code under !defined(DART_PRECOMPILED_RUNTIME) (Closed)
Patch Set: Address code review comments. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "lib/stacktrace.h" 9 #include "lib/stacktrace.h"
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 5770 matching lines...) Expand 10 before | Expand all | Expand 10 after
5781 NoSafepointScope no_safepoint; 5781 NoSafepointScope no_safepoint;
5782 RawObject* raw_obj = obj.raw(); 5782 RawObject* raw_obj = obj.raw();
5783 thread->isolate()->heap()->SetPeer(raw_obj, peer); 5783 thread->isolate()->heap()->SetPeer(raw_obj, peer);
5784 } 5784 }
5785 return Api::Success(); 5785 return Api::Success();
5786 } 5786 }
5787 5787
5788 // --- Dart Front-End (Kernel) support --- 5788 // --- Dart Front-End (Kernel) support ---
5789 5789
5790 DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate) { 5790 DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate) {
5791 #ifdef DART_PRECOMPILED_RUNTIME 5791 #if defined(DART_PRECOMPILED_RUNTIME)
5792 return false; 5792 return false;
5793 #else 5793 #else
5794 Isolate* iso = reinterpret_cast<Isolate*>(isolate); 5794 Isolate* iso = reinterpret_cast<Isolate*>(isolate);
5795 return KernelIsolate::IsKernelIsolate(iso); 5795 return KernelIsolate::IsKernelIsolate(iso);
5796 #endif 5796 #endif
5797 } 5797 }
5798 5798
5799 DART_EXPORT bool Dart_KernelIsolateIsRunning() { 5799 DART_EXPORT bool Dart_KernelIsolateIsRunning() {
5800 #ifdef DART_PRECOMPILED_RUNTIME 5800 #if defined(DART_PRECOMPILED_RUNTIME)
5801 return false; 5801 return false;
5802 #else 5802 #else
5803 return KernelIsolate::IsRunning(); 5803 return KernelIsolate::IsRunning();
5804 #endif 5804 #endif
5805 } 5805 }
5806 5806
5807 DART_EXPORT Dart_Port Dart_KernelPort() { 5807 DART_EXPORT Dart_Port Dart_KernelPort() {
5808 #ifdef DART_PRECOMPILED_RUNTIME 5808 #if defined(DART_PRECOMPILED_RUNTIME)
5809 return false; 5809 return false;
5810 #else 5810 #else
5811 return KernelIsolate::KernelPort(); 5811 return KernelIsolate::KernelPort();
5812 #endif 5812 #endif
5813 } 5813 }
5814 5814
5815 DART_EXPORT Dart_KernelCompilationResult 5815 DART_EXPORT Dart_KernelCompilationResult
5816 Dart_CompileToKernel(const char* script_uri, const char* platform_kernel) { 5816 Dart_CompileToKernel(const char* script_uri, const char* platform_kernel) {
5817 #ifdef DART_PRECOMPILED_RUNTIME 5817 #if defined(DART_PRECOMPILED_RUNTIME)
5818 Dart_KernelCompilationResult result; 5818 Dart_KernelCompilationResult result;
5819 result.status = Dart_KernelCompilationStatus_Unknown; 5819 result.status = Dart_KernelCompilationStatus_Unknown;
5820 result.error = strdup("Dart_CompileToKernel is unsupported."); 5820 result.error = strdup("Dart_CompileToKernel is unsupported.");
5821 return result; 5821 return result;
5822 #else 5822 #else
5823 return KernelIsolate::CompileToKernel(script_uri, platform_kernel); 5823 return KernelIsolate::CompileToKernel(script_uri, platform_kernel);
5824 #endif 5824 #endif
5825 } 5825 }
5826 5826
5827 DART_EXPORT Dart_KernelCompilationResult 5827 DART_EXPORT Dart_KernelCompilationResult
5828 Dart_CompileSourcesToKernel(const char* script_uri, 5828 Dart_CompileSourcesToKernel(const char* script_uri,
5829 const char* platform_kernel, 5829 const char* platform_kernel,
5830 int source_files_count, 5830 int source_files_count,
5831 Dart_SourceFile sources[], 5831 Dart_SourceFile sources[],
5832 bool incremental_compile) { 5832 bool incremental_compile) {
5833 #ifdef DART_PRECOMPILED_RUNTIME 5833 #if defined(DART_PRECOMPILED_RUNTIME)
5834 Dart_KernelCompilationResult result; 5834 Dart_KernelCompilationResult result;
5835 result.status = Dart_KernelCompilationStatus_Unknown; 5835 result.status = Dart_KernelCompilationStatus_Unknown;
5836 result.error = strdup("Dart_CompileSourcesToKernel is unsupported."); 5836 result.error = strdup("Dart_CompileSourcesToKernel is unsupported.");
5837 return result; 5837 return result;
5838 #else 5838 #else
5839 return KernelIsolate::CompileToKernel(script_uri, platform_kernel, 5839 return KernelIsolate::CompileToKernel(script_uri, platform_kernel,
5840 source_files_count, sources, 5840 source_files_count, sources,
5841 incremental_compile); 5841 incremental_compile);
5842 #endif 5842 #endif
5843 } 5843 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
6008 } 6008 }
6009 Service::SendEmbedderEvent(I, stream_id, event_kind, bytes, bytes_length); 6009 Service::SendEmbedderEvent(I, stream_id, event_kind, bytes, bytes_length);
6010 return Api::Success(); 6010 return Api::Success();
6011 } 6011 }
6012 6012
6013 DART_EXPORT Dart_Handle 6013 DART_EXPORT Dart_Handle
6014 Dart_SetFileModifiedCallback(Dart_FileModifiedCallback file_modified_callback) { 6014 Dart_SetFileModifiedCallback(Dart_FileModifiedCallback file_modified_callback) {
6015 if (!FLAG_support_service) { 6015 if (!FLAG_support_service) {
6016 return Api::Success(); 6016 return Api::Success();
6017 } 6017 }
6018 #if !defined(DART_PRECOMPILED_RUNTIME)
6018 if (file_modified_callback != NULL) { 6019 if (file_modified_callback != NULL) {
6019 if (IsolateReloadContext::file_modified_callback() != NULL) { 6020 if (IsolateReloadContext::file_modified_callback() != NULL) {
6020 return Api::NewError( 6021 return Api::NewError(
6021 "%s permits only one callback to be registered, please " 6022 "%s permits only one callback to be registered, please "
6022 "remove the existing callback and then add this callback", 6023 "remove the existing callback and then add this callback",
6023 CURRENT_FUNC); 6024 CURRENT_FUNC);
6024 } 6025 }
6025 } else { 6026 } else {
6026 if (IsolateReloadContext::file_modified_callback() == NULL) { 6027 if (IsolateReloadContext::file_modified_callback() == NULL) {
6027 return Api::NewError( 6028 return Api::NewError(
6028 "%s expects 'file_modified_callback' to be set before it is cleared.", 6029 "%s expects 'file_modified_callback' to be set before it is cleared.",
6029 CURRENT_FUNC); 6030 CURRENT_FUNC);
6030 } 6031 }
6031 } 6032 }
6032 IsolateReloadContext::SetFileModifiedCallback(file_modified_callback); 6033 IsolateReloadContext::SetFileModifiedCallback(file_modified_callback);
6034 #endif // !defined(DART_PRECOMPILED_RUNTIME)
6033 return Api::Success(); 6035 return Api::Success();
6034 } 6036 }
6035 6037
6036 DART_EXPORT bool Dart_IsReloading() { 6038 DART_EXPORT bool Dart_IsReloading() {
6037 Thread* thread = Thread::Current(); 6039 Thread* thread = Thread::Current();
6038 Isolate* isolate = thread->isolate(); 6040 Isolate* isolate = thread->isolate();
6039 CHECK_ISOLATE(isolate); 6041 CHECK_ISOLATE(isolate);
6040 return isolate->IsReloading(); 6042 return isolate->IsReloading();
6041 } 6043 }
6042 6044
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
6741 #endif 6743 #endif
6742 } 6744 }
6743 6745
6744 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { 6746 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) {
6745 #ifndef PRODUCT 6747 #ifndef PRODUCT
6746 Profiler::DumpStackTrace(context); 6748 Profiler::DumpStackTrace(context);
6747 #endif 6749 #endif
6748 } 6750 }
6749 6751
6750 } // namespace dart 6752 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698