diff --git a/engine/src/flutter/runtime/BUILD.gn b/engine/src/flutter/runtime/BUILD.gn index 44ccfb8354..071c717b55 100644 --- a/engine/src/flutter/runtime/BUILD.gn +++ b/engine/src/flutter/runtime/BUILD.gn @@ -48,10 +48,14 @@ source_set("runtime") { "dart_service_isolate.h", "embedder_resources.cc", "embedder_resources.h", + "platform_impl.cc", + "platform_impl.h", "runtime_controller.cc", "runtime_controller.h", "runtime_delegate.cc", "runtime_delegate.h", + "runtime_init.cc", + "runtime_init.h", "start_up.cc", "start_up.h", ] diff --git a/engine/src/flutter/runtime/platform_impl.cc b/engine/src/flutter/runtime/platform_impl.cc new file mode 100644 index 0000000000..88428730cf --- /dev/null +++ b/engine/src/flutter/runtime/platform_impl.cc @@ -0,0 +1,17 @@ +// 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. + +#include "flutter/runtime/platform_impl.h" + +namespace blink { + +PlatformImpl::PlatformImpl() {} + +PlatformImpl::~PlatformImpl() {} + +std::string PlatformImpl::defaultLocale() { + return "en-US"; +} + +} // namespace blink diff --git a/engine/src/flutter/runtime/platform_impl.h b/engine/src/flutter/runtime/platform_impl.h new file mode 100644 index 0000000000..0a669c5e6b --- /dev/null +++ b/engine/src/flutter/runtime/platform_impl.h @@ -0,0 +1,27 @@ +// Copyright 2014 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_PLATFORM_IMPL_H_ +#define FLUTTER_RUNTIME_PLATFORM_IMPL_H_ + +#include "lib/ftl/macros.h" +#include "flutter/sky/engine/public/platform/Platform.h" + +namespace blink { + +class PlatformImpl : public Platform { + public: + explicit PlatformImpl(); + ~PlatformImpl() override; + + // blink::Platform methods: + std::string defaultLocale() override; + + private: + FTL_DISALLOW_COPY_AND_ASSIGN(PlatformImpl); +}; + +} // namespace blink + +#endif // FLUTTER_RUNTIME_PLATFORM_IMPL_H_ diff --git a/engine/src/flutter/runtime/runtime_init.cc b/engine/src/flutter/runtime/runtime_init.cc new file mode 100644 index 0000000000..0ae35a1957 --- /dev/null +++ b/engine/src/flutter/runtime/runtime_init.cc @@ -0,0 +1,29 @@ +// 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/ftl/logging.h" + +namespace blink { +namespace { + +PlatformImpl* g_platform_impl = nullptr; + +} // namespace + +void InitRuntime() { + TRACE_EVENT0("flutter", "InitRuntime"); + + FTL_CHECK(!g_platform_impl); + g_platform_impl = new PlatformImpl(); + InitEngine(g_platform_impl); + InitDartVM(); +} + +} // namespace blink diff --git a/engine/src/flutter/runtime/runtime_init.h b/engine/src/flutter/runtime/runtime_init.h new file mode 100644 index 0000000000..4986def32e --- /dev/null +++ b/engine/src/flutter/runtime/runtime_init.h @@ -0,0 +1,14 @@ +// 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. + +#ifndef FLUTTER_RUNTIME_RUNTIME_INIT_H_ +#define FLUTTER_RUNTIME_RUNTIME_INIT_H_ + +namespace blink { + +void InitRuntime(); + +} // namespace blink + +#endif // FLUTTER_RUNTIME_RUNTIME_INIT_H_