OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 #include "bin/isolate_data.h" |
| 6 #include "bin/snapshot_utils.h" |
| 7 |
| 8 namespace dart { |
| 9 namespace bin { |
| 10 |
| 11 IsolateData::IsolateData(const char* url, |
| 12 const char* package_root, |
| 13 const char* packages_file, |
| 14 AppSnapshot* app_snapshot) |
| 15 : script_url((url != NULL) ? strdup(url) : NULL), |
| 16 package_root(NULL), |
| 17 packages_file(NULL), |
| 18 udp_receive_buffer(NULL), |
| 19 builtin_lib_(NULL), |
| 20 loader_(NULL), |
| 21 app_snapshot_(app_snapshot) { |
| 22 if (package_root != NULL) { |
| 23 ASSERT(packages_file == NULL); |
| 24 this->package_root = strdup(package_root); |
| 25 } else if (packages_file != NULL) { |
| 26 this->packages_file = strdup(packages_file); |
| 27 } |
| 28 } |
| 29 |
| 30 |
| 31 IsolateData::~IsolateData() { |
| 32 free(script_url); |
| 33 script_url = NULL; |
| 34 free(package_root); |
| 35 package_root = NULL; |
| 36 free(packages_file); |
| 37 packages_file = NULL; |
| 38 free(udp_receive_buffer); |
| 39 udp_receive_buffer = NULL; |
| 40 if (builtin_lib_ != NULL) { |
| 41 Dart_DeletePersistentHandle(builtin_lib_); |
| 42 } |
| 43 delete app_snapshot_; |
| 44 app_snapshot_ = NULL; |
| 45 } |
| 46 |
| 47 } // namespace bin |
| 48 } // namespace dart |
OLD | NEW |