Alexander Aprelev 2fa0c790d1 Initialize service isolate from kernel file, rather than from embedded sources. (flutter/engine#4263)
* 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.
2017-10-24 19:37:24 -07:00

36 lines
1.1 KiB
C++

// Copyright 2016 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.
#include "flutter/runtime/runtime_init.h"
#include "flutter/glue/trace_event.h"
#include "flutter/runtime/dart_init.h"
#include "flutter/runtime/platform_impl.h"
#include "flutter/sky/engine/public/web/Sky.h"
#include "lib/fxl/logging.h"
namespace blink {
namespace {
PlatformImpl* g_platform_impl = nullptr;
} // namespace
void InitRuntime(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) {
TRACE_EVENT0("flutter", "InitRuntime");
FXL_CHECK(!g_platform_impl);
g_platform_impl = new PlatformImpl();
InitEngine(g_platform_impl);
InitDartVM(vm_snapshot_data, vm_snapshot_instructions,
default_isolate_snapshot_data,
default_isolate_snapshot_instructions, bundle_path);
}
} // namespace blink