未验证 提交 151bb374 编写于 作者: Z Zachary Anderson 提交者: GitHub

Revert "[fuchsia] Enable running from source packages (#4629)" (#4632)

This reverts commit 8f638591.
上级 8f638591
...@@ -64,7 +64,6 @@ ApplicationControllerImpl::ApplicationControllerImpl( ...@@ -64,7 +64,6 @@ ApplicationControllerImpl::ApplicationControllerImpl(
fdio_ns_t* fdio_ns = SetupNamespace(startup_info->flat_namespace); fdio_ns_t* fdio_ns = SetupNamespace(startup_info->flat_namespace);
if (fdio_ns == nullptr) { if (fdio_ns == nullptr) {
FXL_LOG(ERROR) << "Failed to initialize namespace"; FXL_LOG(ERROR) << "Failed to initialize namespace";
return;
} }
url_ = startup_info->launch_info->url; url_ = startup_info->launch_info->url;
......
...@@ -24,12 +24,10 @@ ...@@ -24,12 +24,10 @@
#include "flutter/runtime/runtime_init.h" #include "flutter/runtime/runtime_init.h"
#include "lib/app/cpp/connect.h" #include "lib/app/cpp/connect.h"
#include "lib/fsl/vmo/vector.h" #include "lib/fsl/vmo/vector.h"
#include "lib/fxl/files/path.h"
#include "lib/fxl/files/unique_fd.h" #include "lib/fxl/files/unique_fd.h"
#include "lib/fxl/functional/make_copyable.h" #include "lib/fxl/functional/make_copyable.h"
#include "lib/fxl/logging.h" #include "lib/fxl/logging.h"
#include "lib/fxl/time/time_delta.h" #include "lib/fxl/time/time_delta.h"
#include "lib/tonic/logging/dart_error.h"
#include "lib/zip/create_unzipper.h" #include "lib/zip/create_unzipper.h"
#include "third_party/dart/runtime/include/dart_api.h" #include "third_party/dart/runtime/include/dart_api.h"
#include "third_party/rapidjson/rapidjson/document.h" #include "third_party/rapidjson/rapidjson/document.h"
...@@ -117,11 +115,6 @@ void RuntimeHolder::Init( ...@@ -117,11 +115,6 @@ void RuntimeHolder::Init(
FXL_DCHECK(rasterizer_); FXL_DCHECK(rasterizer_);
namespc_ = namespc; namespc_ = namespc;
dirfd_ = fdio_ns_opendir(namespc);
if (dirfd_ == -1) {
FXL_LOG(ERROR) << "Failed to get fd for namespace";
return;
}
context_ = std::move(context); context_ = std::move(context);
outgoing_services_ = std::move(outgoing_services); outgoing_services_ = std::move(outgoing_services);
...@@ -203,12 +196,11 @@ void RuntimeHolder::CreateView( ...@@ -203,12 +196,11 @@ void RuntimeHolder::CreateView(
std::vector<uint8_t> kernel; std::vector<uint8_t> kernel;
std::vector<uint8_t> snapshot; std::vector<uint8_t> snapshot;
bool maybe_running_from_source = false;
if (!Dart_IsPrecompiledRuntime()) { if (!Dart_IsPrecompiledRuntime()) {
if (!GetAssetAsBuffer(kKernelKey, &kernel) && if (!GetAssetAsBuffer(kKernelKey, &kernel) &&
!GetAssetAsBuffer(kSnapshotKey, &snapshot)) { !GetAssetAsBuffer(kSnapshotKey, &snapshot)) {
maybe_running_from_source = true; FXL_LOG(ERROR) << "Unable to load kernel or snapshot from root bundle.";
FXL_LOG(INFO) << "No kernel or snapshot in root bundle."; return;
} }
} }
...@@ -281,7 +273,7 @@ void RuntimeHolder::CreateView( ...@@ -281,7 +273,7 @@ void RuntimeHolder::CreateView(
dlsym(dylib_handle_, "_kDartIsolateSnapshotInstructions")); dlsym(dylib_handle_, "_kDartIsolateSnapshotInstructions"));
} }
runtime_->CreateDartController(script_uri, isolate_snapshot_data, runtime_->CreateDartController(script_uri, isolate_snapshot_data,
isolate_snapshot_instr, dirfd_); isolate_snapshot_instr);
runtime_->SetViewportMetrics(viewport_metrics_); runtime_->SetViewportMetrics(viewport_metrics_);
...@@ -289,11 +281,6 @@ void RuntimeHolder::CreateView( ...@@ -289,11 +281,6 @@ void RuntimeHolder::CreateView(
runtime_->dart_controller()->RunFromPrecompiledSnapshot(); runtime_->dart_controller()->RunFromPrecompiledSnapshot();
} else if (!kernel.empty()) { } else if (!kernel.empty()) {
runtime_->dart_controller()->RunFromKernel(std::move(kernel)); runtime_->dart_controller()->RunFromKernel(std::move(kernel));
} else if (maybe_running_from_source) {
std::string basename = files::GetBaseName(script_uri);
std::string main_dart = "pkg/data/" + basename + "/lib/main.dart";
FXL_LOG(INFO) << "Running from source with entrypoint: '" << main_dart << "'";
runtime_->dart_controller()->RunFromSource(main_dart, "pkg/data/.packages");
} else { } else {
runtime_->dart_controller()->RunFromScriptSnapshot(snapshot.data(), runtime_->dart_controller()->RunFromScriptSnapshot(snapshot.data(),
snapshot.size()); snapshot.size());
......
...@@ -109,7 +109,6 @@ class RuntimeHolder : public blink::RuntimeDelegate, ...@@ -109,7 +109,6 @@ class RuntimeHolder : public blink::RuntimeDelegate,
void Invalidate(); void Invalidate();
fdio_ns_t* namespc_; fdio_ns_t* namespc_;
int dirfd_;
std::unique_ptr<app::ApplicationContext> context_; std::unique_ptr<app::ApplicationContext> context_;
fidl::InterfaceRequest<app::ServiceProvider> outgoing_services_; fidl::InterfaceRequest<app::ServiceProvider> outgoing_services_;
std::vector<char> root_bundle_data_; std::vector<char> root_bundle_data_;
......
...@@ -15,10 +15,8 @@ namespace blink { ...@@ -15,10 +15,8 @@ namespace blink {
IsolateClient::~IsolateClient() {} IsolateClient::~IsolateClient() {}
UIDartState::UIDartState(IsolateClient* isolate_client, UIDartState::UIDartState(IsolateClient* isolate_client,
std::unique_ptr<Window> window, std::unique_ptr<Window> window)
int dirfd) : isolate_client_(isolate_client),
: tonic::DartState(dirfd),
isolate_client_(isolate_client),
main_port_(ILLEGAL_PORT), main_port_(ILLEGAL_PORT),
window_(std::move(window)) {} window_(std::move(window)) {}
......
...@@ -28,9 +28,7 @@ class IsolateClient { ...@@ -28,9 +28,7 @@ class IsolateClient {
class UIDartState : public tonic::DartState { class UIDartState : public tonic::DartState {
public: public:
UIDartState(IsolateClient* isolate_client, UIDartState(IsolateClient* isolate_client, std::unique_ptr<Window> window);
std::unique_ptr<Window> window,
int dirfd = -1);
~UIDartState() override; ~UIDartState() override;
static UIDartState* Current(); static UIDartState* Current();
......
...@@ -29,14 +29,13 @@ RuntimeController::~RuntimeController() {} ...@@ -29,14 +29,13 @@ RuntimeController::~RuntimeController() {}
void RuntimeController::CreateDartController( void RuntimeController::CreateDartController(
const std::string& script_uri, const std::string& script_uri,
const uint8_t* isolate_snapshot_data, const uint8_t* isolate_snapshot_data,
const uint8_t* isolate_snapshot_instr, const uint8_t* isolate_snapshot_instr) {
int dirfd) {
FXL_DCHECK(!dart_controller_); FXL_DCHECK(!dart_controller_);
dart_controller_.reset(new DartController()); dart_controller_.reset(new DartController());
dart_controller_->CreateIsolateFor( dart_controller_->CreateIsolateFor(
script_uri, isolate_snapshot_data, isolate_snapshot_instr, script_uri, isolate_snapshot_data, isolate_snapshot_instr,
std::make_unique<UIDartState>(this, std::make_unique<Window>(this), dirfd)); std::make_unique<UIDartState>(this, std::make_unique<Window>(this)));
UIDartState* dart_state = dart_controller_->dart_state(); UIDartState* dart_state = dart_controller_->dart_state();
DartState::Scope scope(dart_state); DartState::Scope scope(dart_state);
......
...@@ -28,8 +28,7 @@ class RuntimeController : public WindowClient, public IsolateClient { ...@@ -28,8 +28,7 @@ class RuntimeController : public WindowClient, public IsolateClient {
void CreateDartController(const std::string& script_uri, void CreateDartController(const std::string& script_uri,
const uint8_t* isolate_snapshot_data, const uint8_t* isolate_snapshot_data,
const uint8_t* isolate_snapshot_instr, const uint8_t* isolate_snapshot_instr);
int dirfd = -1);
DartController* dart_controller() const { return dart_controller_.get(); } DartController* dart_controller() const { return dart_controller_.get(); }
void SetViewportMetrics(const ViewportMetrics& metrics); void SetViewportMetrics(const ViewportMetrics& metrics);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册