OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 "bin/isolate_data.h" | 5 #include "bin/isolate_data.h" |
6 #include "bin/snapshot_utils.h" | 6 #include "bin/snapshot_utils.h" |
7 | 7 |
| 8 #include "vm/kernel.h" |
| 9 |
8 namespace dart { | 10 namespace dart { |
9 namespace bin { | 11 namespace bin { |
10 | 12 |
11 IsolateData::IsolateData(const char* url, | 13 IsolateData::IsolateData(const char* url, |
12 const char* package_root, | 14 const char* package_root, |
13 const char* packages_file, | 15 const char* packages_file, |
14 AppSnapshot* app_snapshot) | 16 AppSnapshot* app_snapshot) |
15 : script_url((url != NULL) ? strdup(url) : NULL), | 17 : script_url((url != NULL) ? strdup(url) : NULL), |
16 package_root(NULL), | 18 package_root(NULL), |
17 packages_file(NULL), | 19 packages_file(NULL), |
18 udp_receive_buffer(NULL), | 20 udp_receive_buffer(NULL), |
| 21 kernel_program(NULL), |
19 builtin_lib_(NULL), | 22 builtin_lib_(NULL), |
20 loader_(NULL), | 23 loader_(NULL), |
21 app_snapshot_(app_snapshot), | 24 app_snapshot_(app_snapshot), |
22 dependencies_(NULL) { | 25 dependencies_(NULL) { |
23 if (package_root != NULL) { | 26 if (package_root != NULL) { |
24 ASSERT(packages_file == NULL); | 27 ASSERT(packages_file == NULL); |
25 this->package_root = strdup(package_root); | 28 this->package_root = strdup(package_root); |
26 } else if (packages_file != NULL) { | 29 } else if (packages_file != NULL) { |
27 this->packages_file = strdup(packages_file); | 30 this->packages_file = strdup(packages_file); |
28 } | 31 } |
(...skipping 10 matching lines...) Expand all Loading... |
39 | 42 |
40 IsolateData::~IsolateData() { | 43 IsolateData::~IsolateData() { |
41 free(script_url); | 44 free(script_url); |
42 script_url = NULL; | 45 script_url = NULL; |
43 free(package_root); | 46 free(package_root); |
44 package_root = NULL; | 47 package_root = NULL; |
45 free(packages_file); | 48 free(packages_file); |
46 packages_file = NULL; | 49 packages_file = NULL; |
47 free(udp_receive_buffer); | 50 free(udp_receive_buffer); |
48 udp_receive_buffer = NULL; | 51 udp_receive_buffer = NULL; |
| 52 if (kernel_program != NULL) { |
| 53 delete reinterpret_cast<kernel::Program*>(kernel_program); |
| 54 kernel_program = NULL; |
| 55 } |
49 delete app_snapshot_; | 56 delete app_snapshot_; |
50 app_snapshot_ = NULL; | 57 app_snapshot_ = NULL; |
51 } | 58 } |
52 | 59 |
53 } // namespace bin | 60 } // namespace bin |
54 } // namespace dart | 61 } // namespace dart |
OLD | NEW |