Commit 0f3a6a9f authored by David Worsham's avatar David Worsham Committed by Commit Bot

[fuchsia] Update to new PresentView API

Multiple presentations are deprecated, and all Fuchsia clients should
move to this API.

We also use the updated ViewTokenPair::New() API while in the
neighborhood. :)

Bug: 41929
Test: fx test root_presenter_tests; manual launch of Chromium
Change-Id: I989a0c50b26aa8eedef3acc03f6ac2660f04dbad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2203222Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Commit-Queue: David Worsham <dworsham@google.com>
Cr-Commit-Position: refs/heads/master@{#769890}
parent da700fea
...@@ -253,9 +253,9 @@ IN_PROC_BROWSER_TEST_F(FrameImplTest, ContextDeletedBeforeFrameWithView) { ...@@ -253,9 +253,9 @@ IN_PROC_BROWSER_TEST_F(FrameImplTest, ContextDeletedBeforeFrameWithView) {
fuchsia::web::FramePtr frame = CreateFrame(); fuchsia::web::FramePtr frame = CreateFrame();
EXPECT_TRUE(frame); EXPECT_TRUE(frame);
auto view_tokens = scenic::NewViewTokenPair(); auto view_tokens = scenic::ViewTokenPair::New();
frame->CreateView(std::move(view_tokens.first)); frame->CreateView(std::move(view_tokens.view_token));
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
base::RunLoop run_loop; base::RunLoop run_loop;
......
...@@ -5,11 +5,12 @@ ...@@ -5,11 +5,12 @@
#include "ui/platform_window/fuchsia/initialize_presenter_api_view.h" #include "ui/platform_window/fuchsia/initialize_presenter_api_view.h"
#include <fuchsia/ui/policy/cpp/fidl.h> #include <fuchsia/ui/policy/cpp/fidl.h>
#include <fuchsia/ui/views/cpp/fidl.h>
#include <lib/sys/cpp/component_context.h> #include <lib/sys/cpp/component_context.h>
#include <lib/ui/scenic/cpp/view_ref_pair.h> #include <lib/ui/scenic/cpp/view_ref_pair.h>
#include <lib/ui/scenic/cpp/view_token_pair.h> #include <lib/ui/scenic/cpp/view_token_pair.h>
#include <utility>
#include "base/fuchsia/default_context.h" #include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h" #include "base/fuchsia/fuchsia_logging.h"
...@@ -21,9 +22,8 @@ void InitializeViewTokenAndPresentView( ...@@ -21,9 +22,8 @@ void InitializeViewTokenAndPresentView(
DCHECK(window_properties_out); DCHECK(window_properties_out);
// Generate ViewToken and ViewHolderToken for the new view. // Generate ViewToken and ViewHolderToken for the new view.
::fuchsia::ui::views::ViewHolderToken view_holder_token; auto view_tokens = scenic::ViewTokenPair::New();
std::tie(window_properties_out->view_token, view_holder_token) = window_properties_out->view_token = std::move(view_tokens.view_token);
scenic::NewViewTokenPair();
// Create a ViewRefPair so the view can be registered to the SemanticsManager. // Create a ViewRefPair so the view can be registered to the SemanticsManager.
window_properties_out->view_ref_pair = scenic::ViewRefPair::New(); window_properties_out->view_ref_pair = scenic::ViewRefPair::New();
...@@ -33,7 +33,8 @@ void InitializeViewTokenAndPresentView( ...@@ -33,7 +33,8 @@ void InitializeViewTokenAndPresentView(
->svc() ->svc()
->Connect<::fuchsia::ui::policy::Presenter>(); ->Connect<::fuchsia::ui::policy::Presenter>();
presenter->PresentView(std::move(view_holder_token), nullptr); presenter->PresentOrReplaceView(std::move(view_tokens.view_holder_token),
nullptr);
} }
} // namespace fuchsia } // namespace fuchsia
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment