| 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_native_api.h" | 5 #include "include/dart_native_api.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
| 9 #include "vm/dart_api_message.h" | 9 #include "vm/dart_api_message.h" |
| 10 #include "vm/dart_api_state.h" | 10 #include "vm/dart_api_state.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // pprof profiling. Then these symbols should be removed. | 73 // pprof profiling. Then these symbols should be removed. |
| 74 | 74 |
| 75 DART_EXPORT void Dart_InitPprofSupport() { } | 75 DART_EXPORT void Dart_InitPprofSupport() { } |
| 76 | 76 |
| 77 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size) { | 77 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size) { |
| 78 *buffer = NULL; | 78 *buffer = NULL; |
| 79 *buffer_size = 0; | 79 *buffer_size = 0; |
| 80 } | 80 } |
| 81 | 81 |
| 82 | 82 |
| 83 // --- Heap Profiler --- | |
| 84 | |
| 85 DART_EXPORT Dart_Handle Dart_HeapProfile(Dart_FileWriteCallback callback, | |
| 86 void* stream) { | |
| 87 Isolate* isolate = Isolate::Current(); | |
| 88 CHECK_ISOLATE(isolate); | |
| 89 if (callback == NULL) { | |
| 90 RETURN_NULL_ERROR(callback); | |
| 91 } | |
| 92 isolate->heap()->Profile(callback, stream); | |
| 93 return Api::Success(); | |
| 94 } | |
| 95 | |
| 96 | |
| 97 // --- Verification tools --- | 83 // --- Verification tools --- |
| 98 | 84 |
| 99 static void CompileAll(Isolate* isolate, Dart_Handle* result) { | 85 static void CompileAll(Isolate* isolate, Dart_Handle* result) { |
| 100 ASSERT(isolate != NULL); | 86 ASSERT(isolate != NULL); |
| 101 const Error& error = Error::Handle(isolate, Library::CompileAll()); | 87 const Error& error = Error::Handle(isolate, Library::CompileAll()); |
| 102 if (error.IsNull()) { | 88 if (error.IsNull()) { |
| 103 *result = Api::Success(); | 89 *result = Api::Success(); |
| 104 } else { | 90 } else { |
| 105 *result = Api::NewHandle(isolate, error.raw()); | 91 *result = Api::NewHandle(isolate, error.raw()); |
| 106 } | 92 } |
| 107 } | 93 } |
| 108 | 94 |
| 109 | 95 |
| 110 DART_EXPORT Dart_Handle Dart_CompileAll() { | 96 DART_EXPORT Dart_Handle Dart_CompileAll() { |
| 111 Isolate* isolate = Isolate::Current(); | 97 Isolate* isolate = Isolate::Current(); |
| 112 DARTSCOPE(isolate); | 98 DARTSCOPE(isolate); |
| 113 Dart_Handle result = Api::CheckIsolateState(isolate); | 99 Dart_Handle result = Api::CheckIsolateState(isolate); |
| 114 if (::Dart_IsError(result)) { | 100 if (::Dart_IsError(result)) { |
| 115 return result; | 101 return result; |
| 116 } | 102 } |
| 117 CHECK_CALLBACK_STATE(isolate); | 103 CHECK_CALLBACK_STATE(isolate); |
| 118 CompileAll(isolate, &result); | 104 CompileAll(isolate, &result); |
| 119 return result; | 105 return result; |
| 120 } | 106 } |
| 121 | 107 |
| 122 } // namespace dart | 108 } // namespace dart |
| OLD | NEW |