提交 84ccfde3 编写于 作者: A Adam Barth 提交者: GitHub

Teach flutter_runner about namespaces (#3707)

Rather than receiving an ApplicationEnvironment, we now receive a namespace.
Once we have FIDL2, we can plumb the namespace all the way through to Dart.
上级 6187779e
......@@ -44,9 +44,9 @@ ApplicationControllerImpl::ApplicationControllerImpl(
url_ = startup_info->launch_info->url;
runtime_holder_.reset(new RuntimeHolder());
runtime_holder_->Init(std::move(startup_info->environment),
fidl::GetProxy(&dart_service_provider_),
std::move(bundle));
runtime_holder_->Init(
app::ApplicationContext::CreateFrom(std::move(startup_info)),
fidl::GetProxy(&dart_service_provider_), std::move(bundle));
}
ApplicationControllerImpl::~ApplicationControllerImpl() = default;
......
......@@ -101,18 +101,18 @@ RuntimeHolder::~RuntimeHolder() {
}
void RuntimeHolder::Init(
fidl::InterfaceHandle<app::ApplicationEnvironment> environment,
std::unique_ptr<app::ApplicationContext> context,
fidl::InterfaceRequest<app::ServiceProvider> outgoing_services,
std::vector<char> bundle) {
FTL_DCHECK(!rasterizer_);
rasterizer_ = Rasterizer::Create();
FTL_DCHECK(rasterizer_);
environment_.Bind(std::move(environment));
environment_->GetServices(fidl::GetProxy(&environment_services_));
ConnectToService(environment_services_.get(), fidl::GetProxy(&view_manager_));
context_ = std::move(context);
outgoing_services_ = std::move(outgoing_services);
context_->ConnectToEnvironmentService(view_manager_.NewRequest());
InitRootBundle(std::move(bundle));
const uint8_t* vm_snapshot_data;
......@@ -301,7 +301,7 @@ void RuntimeHolder::DidCreateMainIsolate(Dart_Isolate isolate) {
void RuntimeHolder::InitFidlInternal() {
fidl::InterfaceHandle<app::ApplicationEnvironment> environment;
environment_->Duplicate(GetProxy(&environment));
context_->ConnectToEnvironmentService(environment.NewRequest());
Dart_Handle fidl_internal = Dart_LookupLibrary(ToDart("dart:fidl.internal"));
......@@ -324,8 +324,8 @@ void RuntimeHolder::InitMozartInternal() {
Dart_Handle mozart_internal =
Dart_LookupLibrary(ToDart("dart:mozart.internal"));
DART_CHECK_VALID(Dart_SetNativeResolver(
mozart_internal, mozart::NativeLookup, mozart::NativeSymbol));
DART_CHECK_VALID(Dart_SetNativeResolver(mozart_internal, mozart::NativeLookup,
mozart::NativeSymbol));
DART_CHECK_VALID(
Dart_SetField(mozart_internal, ToDart("_context"),
......
......@@ -9,6 +9,7 @@
#include <unordered_set>
#include "application/lib/app/application_context.h"
#include "application/services/application_environment.fidl.h"
#include "application/services/service_provider.fidl.h"
#include "apps/mozart/lib/flutter/sdk_ext/src/natives.h"
......@@ -38,7 +39,7 @@ class RuntimeHolder : public blink::RuntimeDelegate,
RuntimeHolder();
~RuntimeHolder();
void Init(fidl::InterfaceHandle<app::ApplicationEnvironment> environment,
void Init(std::unique_ptr<app::ApplicationContext> context,
fidl::InterfaceRequest<app::ServiceProvider> outgoing_services,
std::vector<char> bundle);
void CreateView(const std::string& script_uri,
......@@ -86,8 +87,7 @@ class RuntimeHolder : public blink::RuntimeDelegate,
void OnFrameComplete();
void Invalidate();
app::ApplicationEnvironmentPtr environment_;
app::ServiceProviderPtr environment_services_;
std::unique_ptr<app::ApplicationContext> context_;
fidl::InterfaceRequest<app::ServiceProvider> outgoing_services_;
std::vector<char> root_bundle_data_;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册