| 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 #ifndef BIN_ISOLATE_DATA_H_ | 5 #ifndef BIN_ISOLATE_DATA_H_ |
| 6 #define BIN_ISOLATE_DATA_H_ | 6 #define BIN_ISOLATE_DATA_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" |
| 9 #include "platform/globals.h" | 10 #include "platform/globals.h" |
| 10 | 11 |
| 11 | 12 |
| 12 namespace dart { | 13 namespace dart { |
| 13 namespace bin { | 14 namespace bin { |
| 14 | 15 |
| 15 // Forward declaration. | 16 // Forward declaration. |
| 16 class EventHandler; | 17 class EventHandler; |
| 17 | 18 |
| 18 // Data associated with every isolate in the standalone VM | 19 // Data associated with every isolate in the standalone VM |
| 19 // embedding. This is used to free external resources for each isolate | 20 // embedding. This is used to free external resources for each isolate |
| 20 // when the isolate shuts down. | 21 // when the isolate shuts down. |
| 21 class IsolateData { | 22 class IsolateData { |
| 22 public: | 23 public: |
| 23 explicit IsolateData(const char* url, const char* package_root) | 24 explicit IsolateData(const char* url, |
| 25 const char* package_root, |
| 26 const char* packages_file) |
| 24 : script_url(strdup(url)), | 27 : script_url(strdup(url)), |
| 25 package_root(NULL), | 28 package_root(NULL), |
| 29 packages_file(NULL), |
| 26 udp_receive_buffer(NULL), | 30 udp_receive_buffer(NULL), |
| 27 load_async_id(-1) { | 31 load_async_id(-1) { |
| 28 if (package_root != NULL) { | 32 if (package_root != NULL) { |
| 33 ASSERT(packages_file == NULL); |
| 29 this->package_root = strdup(package_root); | 34 this->package_root = strdup(package_root); |
| 35 } else if (packages_file != NULL) { |
| 36 this->packages_file = strdup(packages_file); |
| 30 } | 37 } |
| 31 } | 38 } |
| 32 ~IsolateData() { | 39 ~IsolateData() { |
| 33 free(script_url); | 40 free(script_url); |
| 34 free(package_root); | 41 free(package_root); |
| 42 free(packages_file); |
| 35 free(udp_receive_buffer); | 43 free(udp_receive_buffer); |
| 36 } | 44 } |
| 37 | 45 |
| 38 char* script_url; | 46 char* script_url; |
| 39 char* package_root; | 47 char* package_root; |
| 48 char* packages_file; |
| 40 uint8_t* udp_receive_buffer; | 49 uint8_t* udp_receive_buffer; |
| 41 int64_t load_async_id; | 50 int64_t load_async_id; |
| 42 | 51 |
| 43 private: | 52 private: |
| 44 DISALLOW_COPY_AND_ASSIGN(IsolateData); | 53 DISALLOW_COPY_AND_ASSIGN(IsolateData); |
| 45 }; | 54 }; |
| 46 | 55 |
| 47 } // namespace bin | 56 } // namespace bin |
| 48 } // namespace dart | 57 } // namespace dart |
| 49 | 58 |
| 50 #endif // BIN_ISOLATE_DATA_H_ | 59 #endif // BIN_ISOLATE_DATA_H_ |
| OLD | NEW |