mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
* Read core platform kernel file during Dart initialization. Currently service isolate is initialized from the source code parsed by VM. This CL changes it so service isolate created during Dart initialization is created from the kernel platform.dill file if it is present in the application bundle. Then this platform kernel file is kept in dart_init module and reused for application sciprt isolates. * Reformat and merge * Use accessor method * Avoid passing running_from_kernel param. Add TODO for cleanup. Rename param.
65 lines
2.0 KiB
C++
65 lines
2.0 KiB
C++
// Copyright 2015 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef FLUTTER_RUNTIME_DART_INIT_H_
|
|
#define FLUTTER_RUNTIME_DART_INIT_H_
|
|
|
|
#include "lib/fxl/build_config.h"
|
|
#include "lib/fxl/functional/closure.h"
|
|
#include "third_party/dart/runtime/include/dart_api.h"
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace blink {
|
|
|
|
// Name of the kernel blob asset within the FLX bundle.
|
|
extern const char kKernelAssetKey[];
|
|
|
|
// Name of the snapshot blob asset within the FLX bundle.
|
|
extern const char kSnapshotAssetKey[];
|
|
|
|
// Name of the platform kernel blob asset within the FLX bundle.
|
|
extern const char kPlatformKernelAssetKey[];
|
|
|
|
bool IsRunningPrecompiledCode();
|
|
|
|
using EmbedderTracingCallback = fxl::Closure;
|
|
|
|
typedef void (*ServiceIsolateHook)(bool);
|
|
typedef void (*RegisterNativeServiceProtocolExtensionHook)(bool);
|
|
|
|
struct EmbedderTracingCallbacks {
|
|
EmbedderTracingCallback start_tracing_callback;
|
|
EmbedderTracingCallback stop_tracing_callback;
|
|
|
|
EmbedderTracingCallbacks(EmbedderTracingCallback start,
|
|
EmbedderTracingCallback stop);
|
|
};
|
|
|
|
void InitDartVM(const uint8_t* vm_snapshot_data,
|
|
const uint8_t* vm_snapshot_instructions,
|
|
const uint8_t* default_isolate_snapshot_data,
|
|
const uint8_t* default_isolate_snapshot_instructions,
|
|
const std::string& bundle_path);
|
|
|
|
void* GetKernelPlatformBinary();
|
|
|
|
void SetEmbedderTracingCallbacks(
|
|
std::unique_ptr<EmbedderTracingCallbacks> callbacks);
|
|
|
|
// Provide a function that will be called during initialization of the
|
|
// service isolate.
|
|
void SetServiceIsolateHook(ServiceIsolateHook hook);
|
|
|
|
// Provide a function that will be called to register native service protocol
|
|
// extensions.
|
|
void SetRegisterNativeServiceProtocolExtensionHook(
|
|
RegisterNativeServiceProtocolExtensionHook hook);
|
|
|
|
} // namespace blink
|
|
|
|
#endif // FLUTTER_RUNTIME_DART_INIT_H_
|