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 namespace dart { | 8 namespace dart { |
9 namespace bin { | 9 namespace bin { |
10 | 10 |
11 IsolateData::IsolateData(const char* url, | 11 IsolateData::IsolateData(const char* url, |
12 const char* package_root, | 12 const char* package_root, |
13 const char* packages_file, | 13 const char* packages_file, |
14 AppSnapshot* app_snapshot) | 14 AppSnapshot* app_snapshot) |
15 : script_url((url != NULL) ? strdup(url) : NULL), | 15 : script_url((url != NULL) ? strdup(url) : NULL), |
16 package_root(NULL), | 16 package_root(NULL), |
17 packages_file(NULL), | 17 packages_file(NULL), |
18 udp_receive_buffer(NULL), | 18 udp_receive_buffer(NULL), |
19 builtin_lib_(NULL), | 19 builtin_lib_(NULL), |
20 loader_(NULL), | 20 loader_(NULL), |
21 app_snapshot_(app_snapshot) { | 21 app_snapshot_(app_snapshot), |
| 22 dependencies_(NULL) { |
22 if (package_root != NULL) { | 23 if (package_root != NULL) { |
23 ASSERT(packages_file == NULL); | 24 ASSERT(packages_file == NULL); |
24 this->package_root = strdup(package_root); | 25 this->package_root = strdup(package_root); |
25 } else if (packages_file != NULL) { | 26 } else if (packages_file != NULL) { |
26 this->packages_file = strdup(packages_file); | 27 this->packages_file = strdup(packages_file); |
27 } | 28 } |
28 } | 29 } |
29 | 30 |
30 | 31 |
31 IsolateData::~IsolateData() { | 32 IsolateData::~IsolateData() { |
32 free(script_url); | 33 free(script_url); |
33 script_url = NULL; | 34 script_url = NULL; |
34 free(package_root); | 35 free(package_root); |
35 package_root = NULL; | 36 package_root = NULL; |
36 free(packages_file); | 37 free(packages_file); |
37 packages_file = NULL; | 38 packages_file = NULL; |
38 free(udp_receive_buffer); | 39 free(udp_receive_buffer); |
39 udp_receive_buffer = NULL; | 40 udp_receive_buffer = NULL; |
40 if (builtin_lib_ != NULL) { | 41 if (builtin_lib_ != NULL) { |
41 Dart_DeletePersistentHandle(builtin_lib_); | 42 Dart_DeletePersistentHandle(builtin_lib_); |
42 } | 43 } |
43 delete app_snapshot_; | 44 delete app_snapshot_; |
44 app_snapshot_ = NULL; | 45 app_snapshot_ = NULL; |
45 } | 46 } |
46 | 47 |
47 } // namespace bin | 48 } // namespace bin |
48 } // namespace dart | 49 } // namespace dart |
OLD | NEW |