2012-06-29 14:40:17 +00:00
|
|
|
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
|
2016-10-26 07:26:03 +00:00
|
|
|
#ifndef RUNTIME_BIN_ISOLATE_DATA_H_
|
|
|
|
#define RUNTIME_BIN_ISOLATE_DATA_H_
|
2012-06-29 14:40:17 +00:00
|
|
|
|
2012-09-28 11:08:38 +00:00
|
|
|
#include "include/dart_api.h"
|
2015-07-29 18:30:33 +00:00
|
|
|
#include "platform/assert.h"
|
2012-06-29 14:40:17 +00:00
|
|
|
#include "platform/globals.h"
|
|
|
|
|
2017-02-23 20:40:48 +00:00
|
|
|
namespace dart {
|
|
|
|
|
|
|
|
// Forward declaration.
|
|
|
|
template <typename T>
|
|
|
|
class MallocGrowableArray;
|
|
|
|
|
|
|
|
} // namespace dart
|
|
|
|
|
2013-04-25 14:22:30 +00:00
|
|
|
namespace dart {
|
|
|
|
namespace bin {
|
|
|
|
|
2012-06-29 14:40:17 +00:00
|
|
|
// Forward declaration.
|
2017-02-16 21:54:57 +00:00
|
|
|
class AppSnapshot;
|
2012-06-29 14:40:17 +00:00
|
|
|
class EventHandler;
|
2016-06-06 21:15:01 +00:00
|
|
|
class Loader;
|
2012-06-29 14:40:17 +00:00
|
|
|
|
|
|
|
// Data associated with every isolate in the standalone VM
|
|
|
|
// embedding. This is used to free external resources for each isolate
|
|
|
|
// when the isolate shuts down.
|
|
|
|
class IsolateData {
|
|
|
|
public:
|
2016-01-13 18:12:49 +00:00
|
|
|
IsolateData(const char* url,
|
|
|
|
const char* package_root,
|
2017-02-16 21:54:57 +00:00
|
|
|
const char* packages_file,
|
|
|
|
AppSnapshot* app_snapshot);
|
|
|
|
~IsolateData();
|
2016-02-04 17:18:31 +00:00
|
|
|
|
|
|
|
Dart_Handle builtin_lib() const {
|
|
|
|
ASSERT(builtin_lib_ != NULL);
|
|
|
|
ASSERT(!Dart_IsError(builtin_lib_));
|
|
|
|
return builtin_lib_;
|
|
|
|
}
|
|
|
|
void set_builtin_lib(Dart_Handle lib) {
|
|
|
|
ASSERT(builtin_lib_ == NULL);
|
|
|
|
ASSERT(lib != NULL);
|
|
|
|
ASSERT(!Dart_IsError(lib));
|
|
|
|
builtin_lib_ = Dart_NewPersistentHandle(lib);
|
2012-09-28 11:08:38 +00:00
|
|
|
}
|
2012-06-29 14:40:17 +00:00
|
|
|
|
2013-10-24 16:41:22 +00:00
|
|
|
char* script_url;
|
2014-09-23 05:46:14 +00:00
|
|
|
char* package_root;
|
2015-07-29 18:30:33 +00:00
|
|
|
char* packages_file;
|
2013-12-12 15:45:25 +00:00
|
|
|
uint8_t* udp_receive_buffer;
|
2012-06-29 14:40:17 +00:00
|
|
|
|
2016-06-06 21:15:01 +00:00
|
|
|
// While loading a loader is associated with the isolate.
|
|
|
|
bool HasLoader() const { return loader_ != NULL; }
|
|
|
|
Loader* loader() const {
|
|
|
|
ASSERT(loader_ != NULL);
|
|
|
|
return loader_;
|
|
|
|
}
|
|
|
|
void set_loader(Loader* loader) {
|
|
|
|
ASSERT((loader_ == NULL) || (loader == NULL));
|
|
|
|
loader_ = loader;
|
|
|
|
}
|
2017-02-23 20:40:48 +00:00
|
|
|
MallocGrowableArray<char*>* dependencies() const { return dependencies_; }
|
|
|
|
void set_dependencies(MallocGrowableArray<char*>* deps) {
|
|
|
|
dependencies_ = deps;
|
|
|
|
}
|
2016-06-06 21:15:01 +00:00
|
|
|
|
2017-02-28 20:10:04 +00:00
|
|
|
void OnIsolateShutdown();
|
|
|
|
|
2012-06-29 14:40:17 +00:00
|
|
|
private:
|
2016-02-04 17:18:31 +00:00
|
|
|
Dart_Handle builtin_lib_;
|
2016-06-06 21:15:01 +00:00
|
|
|
Loader* loader_;
|
2017-02-16 21:54:57 +00:00
|
|
|
AppSnapshot* app_snapshot_;
|
2017-02-23 20:40:48 +00:00
|
|
|
MallocGrowableArray<char*>* dependencies_;
|
2016-02-04 17:18:31 +00:00
|
|
|
|
2012-06-29 14:40:17 +00:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(IsolateData);
|
|
|
|
};
|
|
|
|
|
2013-04-25 14:22:30 +00:00
|
|
|
} // namespace bin
|
|
|
|
} // namespace dart
|
|
|
|
|
2016-10-26 07:26:03 +00:00
|
|
|
#endif // RUNTIME_BIN_ISOLATE_DATA_H_
|