| 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/assert.h" |
| 10 #include "platform/globals.h" | 10 #include "platform/globals.h" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 namespace bin { | 13 namespace bin { |
| 14 | 14 |
| 15 // Forward declaration. | 15 // Forward declaration. |
| 16 class EventHandler; | 16 class EventHandler; |
| 17 | 17 |
| 18 // Data associated with every isolate in the standalone VM | 18 // Data associated with every isolate in the standalone VM |
| 19 // embedding. This is used to free external resources for each isolate | 19 // embedding. This is used to free external resources for each isolate |
| 20 // when the isolate shuts down. | 20 // when the isolate shuts down. |
| 21 class IsolateData { | 21 class IsolateData { |
| 22 public: | 22 public: |
| 23 IsolateData(const char* url, | 23 IsolateData(const char* url, |
| 24 const char* package_root, | 24 const char* package_root, |
| 25 const char* packages_file) | 25 const char* packages_file) |
| 26 : script_url((url != NULL) ? strdup(url) : NULL), | 26 : script_url((url != NULL) ? strdup(url) : NULL), |
| 27 package_root(NULL), | 27 package_root(NULL), |
| 28 packages_file(NULL), | 28 packages_file(NULL), |
| 29 udp_receive_buffer(NULL), | 29 udp_receive_buffer(NULL), |
| 30 load_async_id(-1), | |
| 31 builtin_lib_(NULL) { | 30 builtin_lib_(NULL) { |
| 32 if (package_root != NULL) { | 31 if (package_root != NULL) { |
| 33 ASSERT(packages_file == NULL); | 32 ASSERT(packages_file == NULL); |
| 34 this->package_root = strdup(package_root); | 33 this->package_root = strdup(package_root); |
| 35 } else if (packages_file != NULL) { | 34 } else if (packages_file != NULL) { |
| 36 this->packages_file = strdup(packages_file); | 35 this->packages_file = strdup(packages_file); |
| 37 } | 36 } |
| 38 } | 37 } |
| 39 | 38 |
| 40 ~IsolateData() { | 39 ~IsolateData() { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 60 ASSERT(builtin_lib_ == NULL); | 59 ASSERT(builtin_lib_ == NULL); |
| 61 ASSERT(lib != NULL); | 60 ASSERT(lib != NULL); |
| 62 ASSERT(!Dart_IsError(lib)); | 61 ASSERT(!Dart_IsError(lib)); |
| 63 builtin_lib_ = Dart_NewPersistentHandle(lib); | 62 builtin_lib_ = Dart_NewPersistentHandle(lib); |
| 64 } | 63 } |
| 65 | 64 |
| 66 char* script_url; | 65 char* script_url; |
| 67 char* package_root; | 66 char* package_root; |
| 68 char* packages_file; | 67 char* packages_file; |
| 69 uint8_t* udp_receive_buffer; | 68 uint8_t* udp_receive_buffer; |
| 70 int64_t load_async_id; | |
| 71 | 69 |
| 72 private: | 70 private: |
| 73 Dart_Handle builtin_lib_; | 71 Dart_Handle builtin_lib_; |
| 74 | 72 |
| 75 DISALLOW_COPY_AND_ASSIGN(IsolateData); | 73 DISALLOW_COPY_AND_ASSIGN(IsolateData); |
| 76 }; | 74 }; |
| 77 | 75 |
| 78 } // namespace bin | 76 } // namespace bin |
| 79 } // namespace dart | 77 } // namespace dart |
| 80 | 78 |
| 81 #endif // BIN_ISOLATE_DATA_H_ | 79 #endif // BIN_ISOLATE_DATA_H_ |
| OLD | NEW |