Skip to content

Commit

Permalink
[fuchsia] Update FIDL1 C++ bindings to match FIDL2 interface (flutter…
Browse files Browse the repository at this point in the history
…#4620)

This change will make it easier to transition to FIDL2.
  • Loading branch information
abarth authored Jan 30, 2018
1 parent dbc071a commit 0818d8c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions content_handler/application_controller_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ ApplicationControllerImpl::ApplicationControllerImpl(
app::ApplicationStartupInfoPtr startup_info,
fidl::InterfaceRequest<app::ApplicationController> controller)
: app_(app), binding_(this) {
if (controller.is_pending()) {
if (controller.is_valid()) {
binding_.Bind(std::move(controller));
binding_.set_connection_error_handler([this] {
binding_.set_error_handler([this] {
app_->Destroy(this);
// |this| has been deleted at this point.
});
Expand Down Expand Up @@ -113,7 +113,7 @@ void ApplicationControllerImpl::Kill() {
}

void ApplicationControllerImpl::Detach() {
binding_.set_connection_error_handler(fxl::Closure());
binding_.set_error_handler(fxl::Closure());
}

void ApplicationControllerImpl::Wait(const WaitCallback& callback) {
Expand Down
14 changes: 7 additions & 7 deletions content_handler/runtime_holder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ void RuntimeHolder::CreateView(
view_->GetServiceProvider(view_services.NewRequest());

// Listen for input events.
ConnectToService(view_services.get(), fidl::GetProxy(&input_connection_));
ConnectToService(view_services.get(), input_connection_.NewRequest());
mozart::InputListenerPtr input_listener;
input_listener_binding_.Bind(GetProxy(&input_listener));
input_listener_binding_.Bind(input_listener.NewRequest());
input_connection_->SetEventListener(std::move(input_listener));

// Setup the session.
Expand Down Expand Up @@ -436,7 +436,7 @@ void RuntimeHolder::InitFuchsia() {

void RuntimeHolder::InitMozartInternal() {
fidl::InterfaceHandle<mozart::ViewContainer> view_container;
view_->GetContainer(fidl::GetProxy(&view_container));
view_->GetContainer(view_container.NewRequest());

Dart_Handle mozart_internal =
Dart_LookupLibrary(ToDart("dart:mozart.internal"));
Expand All @@ -451,7 +451,7 @@ void RuntimeHolder::InitMozartInternal() {

DART_CHECK_VALID(Dart_SetField(mozart_internal, ToDart("_viewContainer"),
ToDart(zircon::dart::Handle::Create(
view_container.PassHandle().release()))));
view_container.TakeChannel().release()))));
}

void RuntimeHolder::InitRootBundle(std::vector<char> bundle) {
Expand Down Expand Up @@ -569,7 +569,7 @@ bool RuntimeHolder::HandleTextInputPlatformMessage(
} else if (method->value == "TextInput.setClient") {
current_text_input_client_ = 0;
if (text_input_binding_.is_bound())
text_input_binding_.Close();
text_input_binding_.Unbind();
input_method_editor_ = nullptr;

auto args = root.FindMember("args");
Expand All @@ -588,7 +588,7 @@ bool RuntimeHolder::HandleTextInputPlatformMessage(
input_connection_->GetInputMethodEditor(
mozart::KeyboardType::TEXT, mozart::InputMethodAction::DONE,
std::move(state), text_input_binding_.NewBinding(),
fidl::GetProxy(&input_method_editor_));
input_method_editor_.NewRequest());
} else if (method->value == "TextInput.setEditingState") {
if (input_method_editor_) {
auto args_it = root.FindMember("args");
Expand Down Expand Up @@ -630,7 +630,7 @@ bool RuntimeHolder::HandleTextInputPlatformMessage(
} else if (method->value == "TextInput.clearClient") {
current_text_input_client_ = 0;
if (text_input_binding_.is_bound())
text_input_binding_.Close();
text_input_binding_.Unbind();
input_method_editor_ = nullptr;
} else {
FXL_DLOG(ERROR) << "Unknown " << kTextInputChannel << " method "
Expand Down
2 changes: 1 addition & 1 deletion content_handler/session_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ SessionConnection::SessionConnection(scenic::SceneManagerPtr scene_manager,
scene_update_context_(&session_, surface_producer_.get()) {
ASSERT_IS_GPU_THREAD;

session_.set_connection_error_handler(
session_.set_error_handler(
std::bind(&SessionConnection::OnSessionError, this));
session_.set_event_handler(std::bind(&SessionConnection::OnSessionEvents,
this, std::placeholders::_1));
Expand Down
2 changes: 1 addition & 1 deletion content_handler/vulkan_rasterizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void VulkanRasterizer::SetScene(
ASSERT_IS_GPU_THREAD;
FXL_DCHECK(valid_ && !session_connection_);
session_connection_ = std::make_unique<SessionConnection>(
scenic::SceneManagerPtr::Create(std::move(scene_manager)),
scene_manager.Bind(),
std::move(import_token));
session_connection_->set_metrics_changed_callback(
std::move(metrics_changed_callback));
Expand Down
2 changes: 1 addition & 1 deletion sky/engine/platform/fonts/fuchsia/FontCacheFuchsia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ sk_sp<SkTypeface> FontCache::createTypeface(
font_provider->GetFont(
std::move(request),
[&response](fonts::FontResponsePtr r) { response = std::move(r); });
font_provider.WaitForIncomingResponse();
font_provider.WaitForResponse();

FXL_DCHECK(response)
<< "Unable to contact the font provider. Did you run "
Expand Down

0 comments on commit 0818d8c

Please sign in to comment.