From cc7a67da96153af3ea13c5cd7e8c06625aa3d169 Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Tue, 6 Feb 2018 10:08:24 -0800 Subject: [PATCH] Reland: [fuchsia] Enable running from source packages (flutter/engine#4634) This relands https://github.com/flutter/engine/pull/4629 with a tonic roll to fix the build. --- DEPS | 2 +- engine/src/flutter/lib/ui/ui_dart_state.cc | 6 ++++-- engine/src/flutter/lib/ui/ui_dart_state.h | 4 +++- engine/src/flutter/runtime/runtime_controller.cc | 6 ++++-- engine/src/flutter/runtime/runtime_controller.h | 3 ++- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/DEPS b/DEPS index 98572bcf1a..3974366ecd 100644 --- a/DEPS +++ b/DEPS @@ -127,7 +127,7 @@ deps = { Var('fuchsia_git') + '/garnet' + '@' + 'b3ba6b6d6ab8ef658278cc43c9f839a8a8d1718e', 'src/topaz': - Var('fuchsia_git') + '/topaz' + '@' + '1eb2e77be92ed968223b0cea19fe2108e689dcd5', + Var('fuchsia_git') + '/topaz' + '@' + '201335048e32db217493141a3ab61137aea60d78', 'src/third_party/benchmark': Var('fuchsia_git') + '/third_party/benchmark' + '@' + '296537bc48d380adf21567c5d736ab79f5363d22', diff --git a/engine/src/flutter/lib/ui/ui_dart_state.cc b/engine/src/flutter/lib/ui/ui_dart_state.cc index da1821641e..3bdf21e6a1 100644 --- a/engine/src/flutter/lib/ui/ui_dart_state.cc +++ b/engine/src/flutter/lib/ui/ui_dart_state.cc @@ -15,8 +15,10 @@ namespace blink { IsolateClient::~IsolateClient() {} UIDartState::UIDartState(IsolateClient* isolate_client, - std::unique_ptr window) - : isolate_client_(isolate_client), + std::unique_ptr window, + int dirfd) + : tonic::DartState(dirfd), + isolate_client_(isolate_client), main_port_(ILLEGAL_PORT), window_(std::move(window)) {} diff --git a/engine/src/flutter/lib/ui/ui_dart_state.h b/engine/src/flutter/lib/ui/ui_dart_state.h index f659fe33f5..0f7f9343d4 100644 --- a/engine/src/flutter/lib/ui/ui_dart_state.h +++ b/engine/src/flutter/lib/ui/ui_dart_state.h @@ -28,7 +28,9 @@ class IsolateClient { class UIDartState : public tonic::DartState { public: - UIDartState(IsolateClient* isolate_client, std::unique_ptr window); + UIDartState(IsolateClient* isolate_client, + std::unique_ptr window, + int dirfd = -1); ~UIDartState() override; static UIDartState* Current(); diff --git a/engine/src/flutter/runtime/runtime_controller.cc b/engine/src/flutter/runtime/runtime_controller.cc index 025e4917ac..75796cd686 100644 --- a/engine/src/flutter/runtime/runtime_controller.cc +++ b/engine/src/flutter/runtime/runtime_controller.cc @@ -29,13 +29,15 @@ RuntimeController::~RuntimeController() {} void RuntimeController::CreateDartController( const std::string& script_uri, const uint8_t* isolate_snapshot_data, - const uint8_t* isolate_snapshot_instr) { + const uint8_t* isolate_snapshot_instr, + int dirfd) { FXL_DCHECK(!dart_controller_); dart_controller_.reset(new DartController()); dart_controller_->CreateIsolateFor( script_uri, isolate_snapshot_data, isolate_snapshot_instr, - std::make_unique(this, std::make_unique(this))); + std::make_unique(this, std::make_unique(this), + dirfd)); UIDartState* dart_state = dart_controller_->dart_state(); DartState::Scope scope(dart_state); diff --git a/engine/src/flutter/runtime/runtime_controller.h b/engine/src/flutter/runtime/runtime_controller.h index d70bb177c8..628bc69939 100644 --- a/engine/src/flutter/runtime/runtime_controller.h +++ b/engine/src/flutter/runtime/runtime_controller.h @@ -28,7 +28,8 @@ class RuntimeController : public WindowClient, public IsolateClient { void CreateDartController(const std::string& script_uri, 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(); } void SetViewportMetrics(const ViewportMetrics& metrics);