Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 601 if (!callbacks.Contains(callback)) { | 601 if (!callbacks.Contains(callback)) { |
| 602 return Api::NewError( | 602 return Api::NewError( |
| 603 "%s expects 'callback' to be present in the epilogue callback list.", | 603 "%s expects 'callback' to be present in the epilogue callback list.", |
| 604 CURRENT_FUNC); | 604 CURRENT_FUNC); |
| 605 } | 605 } |
| 606 callbacks.Remove(callback); | 606 callbacks.Remove(callback); |
| 607 return Api::Success(isolate); | 607 return Api::Success(isolate); |
| 608 } | 608 } |
| 609 | 609 |
| 610 | 610 |
| 611 DART_EXPORT Dart_Handle Dart_HeapProfile(Dart_HeapProfileWriteCallback callback, | |
| 612 void* stream) { | |
| 613 if (callback == NULL) { | |
| 614 return Api::NewError("%s expects argument 'callback' to be non-null.", | |
| 615 CURRENT_FUNC); | |
| 616 } | |
| 617 Isolate* isolate = Isolate::Current(); | |
| 618 CHECK_ISOLATE(isolate); | |
|
turnidge
2012/05/29 17:50:01
I would move the CHECK_ISOLATE above your callback
cshapiro
2012/06/01 04:27:02
I should have noticed that. Done.
| |
| 619 isolate->heap()->Profile(callback, stream); | |
| 620 return Api::Success(isolate); | |
| 621 } | |
| 622 | |
| 611 // --- Initialization and Globals --- | 623 // --- Initialization and Globals --- |
| 612 | 624 |
| 613 | 625 |
| 614 DART_EXPORT bool Dart_Initialize(Dart_IsolateCreateCallback create, | 626 DART_EXPORT bool Dart_Initialize(Dart_IsolateCreateCallback create, |
| 615 Dart_IsolateInterruptCallback interrupt) { | 627 Dart_IsolateInterruptCallback interrupt) { |
| 616 return Dart::InitOnce(create, interrupt); | 628 return Dart::InitOnce(create, interrupt); |
| 617 } | 629 } |
| 618 | 630 |
| 619 DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv) { | 631 DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv) { |
| 620 return Flags::ProcessCommandLineFlags(argc, argv); | 632 return Flags::ProcessCommandLineFlags(argc, argv); |
| (...skipping 2692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3313 *buffer = NULL; | 3325 *buffer = NULL; |
| 3314 } | 3326 } |
| 3315 delete debug_region; | 3327 delete debug_region; |
| 3316 } else { | 3328 } else { |
| 3317 *buffer = NULL; | 3329 *buffer = NULL; |
| 3318 *buffer_size = 0; | 3330 *buffer_size = 0; |
| 3319 } | 3331 } |
| 3320 } | 3332 } |
| 3321 | 3333 |
| 3322 } // namespace dart | 3334 } // namespace dart |
| OLD | NEW |