| 1 | // Copyright (c) 2016, 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 | #ifndef RUNTIME_BIN_LOADER_H_ |
| 6 | #define RUNTIME_BIN_LOADER_H_ |
| 7 | |
| 8 | #include "bin/isolate_data.h" |
| 9 | #include "bin/thread.h" |
| 10 | #include "include/dart_api.h" |
| 11 | #include "include/dart_native_api.h" |
| 12 | #include "platform/assert.h" |
| 13 | #include "platform/globals.h" |
| 14 | |
| 15 | namespace dart { |
| 16 | namespace bin { |
| 17 | |
| 18 | class Loader { |
| 19 | public: |
| 20 | static Dart_Handle InitForSnapshot(const char* snapshot_uri, |
| 21 | IsolateData* isolate_data); |
| 22 | |
| 23 | static Dart_Handle ReloadNativeExtensions(); |
| 24 | |
| 25 | // A static tag handler that hides all usage of a loader for an isolate. |
| 26 | static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, |
| 27 | Dart_Handle library, |
| 28 | Dart_Handle url); |
| 29 | static Dart_Handle DeferredLoadHandler(intptr_t loading_unit_id); |
| 30 | |
| 31 | static void InitOnce(); |
| 32 | |
| 33 | private: |
| 34 | static Dart_Handle Init(const char* packages_file, |
| 35 | const char* working_directory, |
| 36 | const char* root_script_uri); |
| 37 | |
| 38 | static Dart_Handle LoadImportExtension(const char* url_string, |
| 39 | Dart_Handle library); |
| 40 | |
| 41 | DISALLOW_ALLOCATION(); |
| 42 | DISALLOW_IMPLICIT_CONSTRUCTORS(Loader); |
| 43 | }; |
| 44 | |
| 45 | } // namespace bin |
| 46 | } // namespace dart |
| 47 | |
| 48 | #endif // RUNTIME_BIN_LOADER_H_ |
| 49 |