flutter_flutter/runtime/dart_init.h
Chris Bracken fb69728f33 Roll Dart SDK to ed00447138f95ea4ba612509a244ca8205735372 (#3364)
* Roll Dart SDK to ed00447138f95ea4ba612509a244ca8205735372

Make the VM happy with a spurious instruction snapshot.

* Revert "Snapshots: Don't use an empty array where a NULL array is expected. (#3361)"

This reverts commit 275ffdcef80ffb85f4be62b9e8d1b17b5c0fdacf.

Broke iOS simulator builds; should no longer be necessary after rolling
the Dart SDK to ed00447138f95ea4ba612509a244ca8205735372.

On iOS simulator builds, we were seeing DartLookupSymbolInLibrary return
a pointer to a address of the snapshot data rather than the address of
the snapshot buffer itself. On simulator builds we don't build the
snapshot data into a buffer in app.dylib (kDartVmSnapshotData) but link
it statically into the engine itself.
2017-01-25 19:08:33 -08:00

78 lines
2.1 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 "dart/runtime/include/dart_api.h"
#include "lib/ftl/functional/closure.h"
#include "lib/ftl/build_config.h"
#include <memory>
#include <string>
namespace blink {
#define DART_ALLOW_DYNAMIC_RESOLUTION (OS_IOS || FLUTTER_AOT)
#if DART_ALLOW_DYNAMIC_RESOLUTION
extern const char kDartVmSnapshotDataName[];
extern const char kDartVmSnapshotInstructionsName[];
extern const char kDartIsolateSnapshotDataName[];
extern const char kDartIsolateSnapshotInstructionsName[];
void* _DartSymbolLookup(const char* symbol_name);
#define DART_SYMBOL(symbol) _DartSymbolLookup(symbol##Name)
#else // DART_ALLOW_DYNAMIC_RESOLUTION
extern "C" {
extern void* kDartVmSnapshotData;
extern void* kDartVmSnapshotInstructions;
extern void* kDartIsolateSnapshotData;
extern void* kDartIsolateSnapshotInstructions;
}
#define DART_SYMBOL(symbol) (&symbol)
#endif // DART_ALLOW_DYNAMIC_RESOLUTION
// Name of the snapshot blob asset within the FLX bundle.
extern const char kSnapshotAssetKey[];
bool IsRunningPrecompiledCode();
using EmbedderTracingCallback = ftl::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();
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_