Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Side by Side Diff: runtime/bin/isolate_data.h

Issue 1998963003: Rework standalone to use a synchronous loader that does not invoke Dart code (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/bin/dartutils.cc ('k') | runtime/bin/loader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 class Loader;
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 IsolateData(const char* url, 24 IsolateData(const char* url,
24 const char* package_root, 25 const char* package_root,
25 const char* packages_file) 26 const char* packages_file)
26 : script_url((url != NULL) ? strdup(url) : NULL), 27 : script_url((url != NULL) ? strdup(url) : NULL),
27 package_root(NULL), 28 package_root(NULL),
28 packages_file(NULL), 29 packages_file(NULL),
29 udp_receive_buffer(NULL), 30 udp_receive_buffer(NULL),
30 builtin_lib_(NULL) { 31 builtin_lib_(NULL),
32 loader_(NULL) {
31 if (package_root != NULL) { 33 if (package_root != NULL) {
32 ASSERT(packages_file == NULL); 34 ASSERT(packages_file == NULL);
33 this->package_root = strdup(package_root); 35 this->package_root = strdup(package_root);
34 } else if (packages_file != NULL) { 36 } else if (packages_file != NULL) {
35 this->packages_file = strdup(packages_file); 37 this->packages_file = strdup(packages_file);
36 } 38 }
37 } 39 }
38 40
39 ~IsolateData() { 41 ~IsolateData() {
40 free(script_url); 42 free(script_url);
(...skipping 19 matching lines...) Expand all
60 ASSERT(lib != NULL); 62 ASSERT(lib != NULL);
61 ASSERT(!Dart_IsError(lib)); 63 ASSERT(!Dart_IsError(lib));
62 builtin_lib_ = Dart_NewPersistentHandle(lib); 64 builtin_lib_ = Dart_NewPersistentHandle(lib);
63 } 65 }
64 66
65 char* script_url; 67 char* script_url;
66 char* package_root; 68 char* package_root;
67 char* packages_file; 69 char* packages_file;
68 uint8_t* udp_receive_buffer; 70 uint8_t* udp_receive_buffer;
69 71
72 // While loading a loader is associated with the isolate.
73 bool HasLoader() const { return loader_ != NULL; }
74 Loader* loader() const {
75 ASSERT(loader_ != NULL);
76 return loader_;
77 }
78 void set_loader(Loader* loader) {
79 ASSERT((loader_ == NULL) || (loader == NULL));
80 loader_ = loader;
81 }
82
70 private: 83 private:
71 Dart_Handle builtin_lib_; 84 Dart_Handle builtin_lib_;
85 Loader* loader_;
72 86
73 DISALLOW_COPY_AND_ASSIGN(IsolateData); 87 DISALLOW_COPY_AND_ASSIGN(IsolateData);
74 }; 88 };
75 89
76 } // namespace bin 90 } // namespace bin
77 } // namespace dart 91 } // namespace dart
78 92
79 #endif // BIN_ISOLATE_DATA_H_ 93 #endif // BIN_ISOLATE_DATA_H_
OLDNEW
« no previous file with comments | « runtime/bin/dartutils.cc ('k') | runtime/bin/loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698