Migrate ViewportMetrics away from Mojo (flutter/engine#3180)
Now we just pass the data directly.
This commit is contained in:
@@ -66,6 +66,7 @@ source_set("ui") {
|
||||
"window/pointer_data.h",
|
||||
"window/pointer_data_packet.cc",
|
||||
"window/pointer_data_packet.h",
|
||||
"window/viewport_metrics.h",
|
||||
"window/window.cc",
|
||||
"window/window.h",
|
||||
]
|
||||
|
||||
24
engine/src/flutter/lib/ui/window/viewport_metrics.h
Normal file
24
engine/src/flutter/lib/ui/window/viewport_metrics.h
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright 2016 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef FLUTTER_LIB_UI_WINDOW_VIEWPORT_METRICS_H_
|
||||
#define FLUTTER_LIB_UI_WINDOW_VIEWPORT_METRICS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace blink {
|
||||
|
||||
struct ViewportMetrics {
|
||||
float device_pixel_ratio = 1.0;
|
||||
int32_t physical_width = 0;
|
||||
int32_t physical_height = 0;
|
||||
int32_t physical_padding_top = 0;
|
||||
int32_t physical_padding_right = 0;
|
||||
int32_t physical_padding_bottom = 0;
|
||||
int32_t physical_padding_left = 0;
|
||||
};
|
||||
|
||||
} // namespace blink
|
||||
|
||||
#endif // FLUTTER_LIB_UI_WINDOW_VIEWPORT_METRICS_H_
|
||||
@@ -115,7 +115,7 @@ void Window::DidCreateIsolate() {
|
||||
library_.Set(DartState::Current(), Dart_LookupLibrary(ToDart("dart:ui")));
|
||||
}
|
||||
|
||||
void Window::UpdateWindowMetrics(const sky::ViewportMetricsPtr& metrics) {
|
||||
void Window::UpdateWindowMetrics(const ViewportMetrics& metrics) {
|
||||
tonic::DartState* dart_state = library_.dart_state().get();
|
||||
if (!dart_state)
|
||||
return;
|
||||
@@ -123,13 +123,13 @@ void Window::UpdateWindowMetrics(const sky::ViewportMetricsPtr& metrics) {
|
||||
DartInvokeField(
|
||||
library_.value(), "_updateWindowMetrics",
|
||||
{
|
||||
ToDart(metrics->device_pixel_ratio),
|
||||
ToDart(static_cast<double>(metrics->physical_width)),
|
||||
ToDart(static_cast<double>(metrics->physical_height)),
|
||||
ToDart(static_cast<double>(metrics->physical_padding_top)),
|
||||
ToDart(static_cast<double>(metrics->physical_padding_right)),
|
||||
ToDart(static_cast<double>(metrics->physical_padding_bottom)),
|
||||
ToDart(static_cast<double>(metrics->physical_padding_left)),
|
||||
ToDart(metrics.device_pixel_ratio),
|
||||
ToDart(static_cast<double>(metrics.physical_width)),
|
||||
ToDart(static_cast<double>(metrics.physical_height)),
|
||||
ToDart(static_cast<double>(metrics.physical_padding_top)),
|
||||
ToDart(static_cast<double>(metrics.physical_padding_right)),
|
||||
ToDart(static_cast<double>(metrics.physical_padding_bottom)),
|
||||
ToDart(static_cast<double>(metrics.physical_padding_left)),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "flutter/lib/ui/semantics/semantics_update.h"
|
||||
#include "flutter/lib/ui/window/platform_message.h"
|
||||
#include "flutter/lib/ui/window/pointer_data_packet.h"
|
||||
#include "flutter/services/engine/sky_engine.mojom.h"
|
||||
#include "flutter/lib/ui/window/viewport_metrics.h"
|
||||
#include "lib/ftl/time/time_point.h"
|
||||
#include "lib/tonic/dart_persistent_value.h"
|
||||
|
||||
@@ -40,7 +40,7 @@ class Window {
|
||||
WindowClient* client() const { return client_; }
|
||||
|
||||
void DidCreateIsolate();
|
||||
void UpdateWindowMetrics(const sky::ViewportMetricsPtr& metrics);
|
||||
void UpdateWindowMetrics(const ViewportMetrics& metrics);
|
||||
void UpdateLocale(const std::string& language_code,
|
||||
const std::string& country_code);
|
||||
void UpdateSemanticsEnabled(bool enabled);
|
||||
|
||||
@@ -40,23 +40,16 @@ void RuntimeController::CreateDartController(const std::string& script_uri) {
|
||||
|
||||
Window* window = GetWindow();
|
||||
|
||||
if (viewport_metrics_)
|
||||
window->UpdateWindowMetrics(viewport_metrics_);
|
||||
|
||||
window->UpdateWindowMetrics(viewport_metrics_);
|
||||
window->UpdateLocale(language_code_, country_code_);
|
||||
|
||||
if (semantics_enabled_)
|
||||
window->UpdateSemanticsEnabled(semantics_enabled_);
|
||||
}
|
||||
|
||||
void RuntimeController::SetViewportMetrics(
|
||||
const sky::ViewportMetricsPtr& metrics) {
|
||||
if (metrics) {
|
||||
viewport_metrics_ = metrics->Clone();
|
||||
GetWindow()->UpdateWindowMetrics(viewport_metrics_);
|
||||
} else {
|
||||
viewport_metrics_ = nullptr;
|
||||
}
|
||||
void RuntimeController::SetViewportMetrics(const ViewportMetrics& metrics) {
|
||||
viewport_metrics_ = metrics;
|
||||
GetWindow()->UpdateWindowMetrics(viewport_metrics_);
|
||||
}
|
||||
|
||||
void RuntimeController::SetLocale(const std::string& language_code,
|
||||
|
||||
@@ -30,7 +30,7 @@ class RuntimeController : public WindowClient, public IsolateClient {
|
||||
void CreateDartController(const std::string& script_uri);
|
||||
DartController* dart_controller() const { return dart_controller_.get(); }
|
||||
|
||||
void SetViewportMetrics(const sky::ViewportMetricsPtr& metrics);
|
||||
void SetViewportMetrics(const ViewportMetrics& metrics);
|
||||
void SetLocale(const std::string& language_code,
|
||||
const std::string& country_code);
|
||||
void SetSemanticsEnabled(bool enabled);
|
||||
@@ -58,7 +58,7 @@ class RuntimeController : public WindowClient, public IsolateClient {
|
||||
void DidCreateSecondaryIsolate(Dart_Isolate isolate) override;
|
||||
|
||||
RuntimeDelegate* client_;
|
||||
sky::ViewportMetricsPtr viewport_metrics_;
|
||||
ViewportMetrics viewport_metrics_;
|
||||
std::string language_code_;
|
||||
std::string country_code_;
|
||||
bool semantics_enabled_ = false;
|
||||
|
||||
@@ -125,8 +125,8 @@ void Engine::OnOutputSurfaceDestroyed(const ftl::Closure& gpu_continuation) {
|
||||
blink::Threads::Gpu()->PostTask(gpu_continuation);
|
||||
}
|
||||
|
||||
void Engine::OnViewportMetricsChanged(sky::ViewportMetricsPtr metrics) {
|
||||
viewport_metrics_ = metrics.Pass();
|
||||
void Engine::SetViewportMetrics(const blink::ViewportMetrics& metrics) {
|
||||
viewport_metrics_ = metrics;
|
||||
if (runtime_)
|
||||
runtime_->SetViewportMetrics(viewport_metrics_);
|
||||
}
|
||||
@@ -341,15 +341,12 @@ void Engine::ScheduleFrame() {
|
||||
void Engine::Render(std::unique_ptr<flow::LayerTree> layer_tree) {
|
||||
if (!layer_tree)
|
||||
return;
|
||||
if (!viewport_metrics_)
|
||||
return;
|
||||
|
||||
SkISize frame_size = SkISize::Make(viewport_metrics_->physical_width,
|
||||
viewport_metrics_->physical_height);
|
||||
SkISize frame_size = SkISize::Make(viewport_metrics_.physical_width,
|
||||
viewport_metrics_.physical_height);
|
||||
if (frame_size.isEmpty())
|
||||
return;
|
||||
|
||||
layer_tree->set_scene_version(viewport_metrics_->scene_version);
|
||||
layer_tree->set_frame_size(frame_size);
|
||||
animator_->Render(std::move(layer_tree));
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "flutter/assets/zip_asset_store.h"
|
||||
#include "flutter/glue/drain_data_pipe_job.h"
|
||||
#include "flutter/lib/ui/window/platform_message.h"
|
||||
#include "flutter/lib/ui/window/viewport_metrics.h"
|
||||
#include "flutter/runtime/runtime_controller.h"
|
||||
#include "flutter/runtime/runtime_delegate.h"
|
||||
#include "flutter/services/engine/sky_engine.mojom.h"
|
||||
@@ -56,6 +57,7 @@ class Engine : public sky::SkyEngine, public blink::RuntimeDelegate {
|
||||
void ConnectToEngine(mojo::InterfaceRequest<SkyEngine> request);
|
||||
void OnOutputSurfaceCreated(const ftl::Closure& gpu_continuation);
|
||||
void OnOutputSurfaceDestroyed(const ftl::Closure& gpu_continuation);
|
||||
void SetViewportMetrics(const blink::ViewportMetrics& metrics);
|
||||
void DispatchPlatformMessage(ftl::RefPtr<blink::PlatformMessage> message);
|
||||
void DispatchPointerDataPacket(const PointerDataPacket& packet);
|
||||
void DispatchSemanticsAction(int id, blink::SemanticsAction action);
|
||||
@@ -63,7 +65,6 @@ class Engine : public sky::SkyEngine, public blink::RuntimeDelegate {
|
||||
|
||||
private:
|
||||
// SkyEngine implementation:
|
||||
void OnViewportMetricsChanged(sky::ViewportMetricsPtr metrics) override;
|
||||
void RunFromFile(const mojo::String& main,
|
||||
const mojo::String& packages,
|
||||
const mojo::String& bundle) override;
|
||||
@@ -109,7 +110,7 @@ class Engine : public sky::SkyEngine, public blink::RuntimeDelegate {
|
||||
std::unique_ptr<glue::DrainDataPipeJob> snapshot_drainer_;
|
||||
|
||||
ftl::RefPtr<blink::PlatformMessage> pending_push_route_message_;
|
||||
sky::ViewportMetricsPtr viewport_metrics_;
|
||||
blink::ViewportMetrics viewport_metrics_;
|
||||
std::string language_code_;
|
||||
std::string country_code_;
|
||||
bool semantics_enabled_ = false;
|
||||
|
||||
@@ -44,7 +44,6 @@ import org.chromium.mojo.system.MojoException;
|
||||
import org.chromium.mojo.system.Pair;
|
||||
import org.chromium.mojo.system.impl.CoreImpl;
|
||||
import org.chromium.mojom.sky.SkyEngine;
|
||||
import org.chromium.mojom.sky.ViewportMetrics;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
@@ -69,6 +68,16 @@ public class FlutterView extends SurfaceView
|
||||
|
||||
private static final String ACTION_DISCOVER = "io.flutter.view.DISCOVER";
|
||||
|
||||
class ViewportMetrics {
|
||||
float devicePixelRatio = 1.0f;
|
||||
int physicalWidth = 0;
|
||||
int physicalHeight = 0;
|
||||
int physicalPaddingTop = 0;
|
||||
int physicalPaddingRight = 0;
|
||||
int physicalPaddingBottom = 0;
|
||||
int physicalPaddingLeft = 0;
|
||||
}
|
||||
|
||||
private long mNativePlatformView;
|
||||
private TextInputPlugin mTextInputPlugin;
|
||||
|
||||
@@ -433,7 +442,7 @@ public class FlutterView extends SurfaceView
|
||||
protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
|
||||
mMetrics.physicalWidth = width;
|
||||
mMetrics.physicalHeight = height;
|
||||
mSkyEngine.onViewportMetricsChanged(mMetrics);
|
||||
updateViewportMetrics();
|
||||
super.onSizeChanged(width, height, oldWidth, oldHeight);
|
||||
}
|
||||
|
||||
@@ -443,7 +452,7 @@ public class FlutterView extends SurfaceView
|
||||
mMetrics.physicalPaddingRight = insets.getSystemWindowInsetRight();
|
||||
mMetrics.physicalPaddingBottom = insets.getSystemWindowInsetBottom();
|
||||
mMetrics.physicalPaddingLeft = insets.getSystemWindowInsetLeft();
|
||||
mSkyEngine.onViewportMetricsChanged(mMetrics);
|
||||
updateViewportMetrics();
|
||||
return super.onApplyWindowInsets(insets);
|
||||
}
|
||||
|
||||
@@ -525,6 +534,14 @@ public class FlutterView extends SurfaceView
|
||||
int width,
|
||||
int height);
|
||||
private static native void nativeSurfaceDestroyed(long nativePlatformViewAndroid);
|
||||
private static native void nativeSetViewportMetrics(long nativePlatformViewAndroid,
|
||||
float devicePixelRatio,
|
||||
int physicalWidth,
|
||||
int physicalHeight,
|
||||
int physicalPaddingTop,
|
||||
int physicalPaddingRight,
|
||||
int physicalPaddingBottom,
|
||||
int physicalPaddingLeft);
|
||||
private static native Bitmap nativeGetBitmap(long nativePlatformViewAndroid);
|
||||
|
||||
// Send a platform message to Dart.
|
||||
@@ -536,6 +553,17 @@ public class FlutterView extends SurfaceView
|
||||
// Send a response to a platform message received from Dart.
|
||||
private static native void nativeInvokePlatformMessageResponseCallback(long nativePlatformViewAndroid, int responseId, String message);
|
||||
|
||||
private void updateViewportMetrics() {
|
||||
nativeSetViewportMetrics(mNativePlatformView,
|
||||
mMetrics.devicePixelRatio,
|
||||
mMetrics.physicalWidth,
|
||||
mMetrics.physicalHeight,
|
||||
mMetrics.physicalPaddingTop,
|
||||
mMetrics.physicalPaddingRight,
|
||||
mMetrics.physicalPaddingBottom,
|
||||
mMetrics.physicalPaddingLeft);
|
||||
}
|
||||
|
||||
// Called by native to send us a platform message.
|
||||
@CalledByNative
|
||||
private void handlePlatformMessage(String channel, String message, final int responseId) {
|
||||
|
||||
@@ -138,6 +138,30 @@ void PlatformViewAndroid::SurfaceDestroyed(JNIEnv* env, jobject obj) {
|
||||
ReleaseSurface();
|
||||
}
|
||||
|
||||
void PlatformViewAndroid::SetViewportMetrics(JNIEnv* env,
|
||||
jobject obj,
|
||||
jfloat device_pixel_ratio,
|
||||
jint physical_width,
|
||||
jint physical_height,
|
||||
jint physical_padding_top,
|
||||
jint physical_padding_right,
|
||||
jint physical_padding_bottom,
|
||||
jint physical_padding_left) {
|
||||
blink::ViewportMetrics metrics;
|
||||
metrics.device_pixel_ratio = device_pixel_ratio;
|
||||
metrics.physical_width = physical_width;
|
||||
metrics.physical_height = physical_height;
|
||||
metrics.physical_padding_top = physical_padding_top;
|
||||
metrics.physical_padding_right = physical_padding_right;
|
||||
metrics.physical_padding_bottom = physical_padding_bottom;
|
||||
metrics.physical_padding_left = physical_padding_left;
|
||||
|
||||
blink::Threads::UI()->PostTask([ engine = engine_->GetWeakPtr(), metrics ] {
|
||||
if (engine.get())
|
||||
engine->SetViewportMetrics(metrics);
|
||||
});
|
||||
}
|
||||
|
||||
void PlatformViewAndroid::DispatchPlatformMessage(JNIEnv* env,
|
||||
jobject obj,
|
||||
jstring java_name,
|
||||
|
||||
@@ -37,6 +37,16 @@ class PlatformViewAndroid : public PlatformView {
|
||||
|
||||
void SurfaceDestroyed(JNIEnv* env, jobject obj);
|
||||
|
||||
void SetViewportMetrics(JNIEnv* env,
|
||||
jobject obj,
|
||||
jfloat device_pixel_ratio,
|
||||
jint physical_width,
|
||||
jint physical_height,
|
||||
jint physical_padding_top,
|
||||
jint physical_padding_right,
|
||||
jint physical_padding_bottom,
|
||||
jint physical_padding_left);
|
||||
|
||||
void DispatchPlatformMessage(JNIEnv* env,
|
||||
jobject obj,
|
||||
jstring name,
|
||||
|
||||
@@ -75,13 +75,17 @@ static inline blink::PointerData::Change PointerChangeFromNSEventPhase(
|
||||
- (void)updateWindowSize {
|
||||
[self setupSurfaceIfNecessary];
|
||||
|
||||
auto metrics = sky::ViewportMetrics::New();
|
||||
blink::ViewportMetrics metrics;
|
||||
auto size = self.renderSurface.frame.size;
|
||||
metrics->physical_width = size.width;
|
||||
metrics->physical_height = size.height;
|
||||
metrics->device_pixel_ratio = 1.0;
|
||||
metrics.physical_width = size.width;
|
||||
metrics.physical_height = size.height;
|
||||
|
||||
_platformView->engineProxy()->OnViewportMetricsChanged(metrics.Pass());
|
||||
blink::Threads::UI()->PostTask(
|
||||
[ engine = _platformView->engine().GetWeakPtr(), metrics ] {
|
||||
if (engine.get()) {
|
||||
engine->SetViewportMetrics(metrics);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
- (void)setupSurfaceIfNecessary {
|
||||
|
||||
@@ -65,7 +65,7 @@ void FlutterInit(int argc, const char* argv[]) {
|
||||
base::scoped_nsprotocol<FlutterDartProject*> _dartProject;
|
||||
UIInterfaceOrientationMask _orientationPreferences;
|
||||
UIStatusBarStyle _statusBarStyle;
|
||||
sky::ViewportMetricsPtr _viewportMetrics;
|
||||
blink::ViewportMetrics _viewportMetrics;
|
||||
shell::TouchMapper _touchMapper;
|
||||
std::unique_ptr<shell::PlatformViewIOS> _platformView;
|
||||
base::scoped_nsprotocol<FlutterPlatformPlugin*> _platformPlugin;
|
||||
@@ -112,7 +112,6 @@ void FlutterInit(int argc, const char* argv[]) {
|
||||
|
||||
_orientationPreferences = UIInterfaceOrientationMaskAll;
|
||||
_statusBarStyle = UIStatusBarStyleDefault;
|
||||
_viewportMetrics = sky::ViewportMetrics::New();
|
||||
_platformView = std::make_unique<shell::PlatformViewIOS>(
|
||||
reinterpret_cast<CAEAGLLayer*>(self.view.layer));
|
||||
_platformView->SetupResourceContextOnIOThread();
|
||||
@@ -329,18 +328,25 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(
|
||||
|
||||
#pragma mark - Handle view resizing
|
||||
|
||||
- (void)updateViewportMetrics {
|
||||
blink::Threads::UI()->PostTask([
|
||||
engine = _platformView->engine().GetWeakPtr(), metrics = _viewportMetrics
|
||||
] {
|
||||
if (engine.get())
|
||||
engine->SetViewportMetrics(metrics);
|
||||
});
|
||||
}
|
||||
|
||||
- (void)viewDidLayoutSubviews {
|
||||
CGSize size = self.view.bounds.size;
|
||||
CGFloat scale = [UIScreen mainScreen].scale;
|
||||
|
||||
_viewportMetrics->device_pixel_ratio = scale;
|
||||
_viewportMetrics->physical_width = size.width * scale;
|
||||
_viewportMetrics->physical_height = size.height * scale;
|
||||
_viewportMetrics->physical_padding_top =
|
||||
_viewportMetrics.device_pixel_ratio = scale;
|
||||
_viewportMetrics.physical_width = size.width * scale;
|
||||
_viewportMetrics.physical_height = size.height * scale;
|
||||
_viewportMetrics.physical_padding_top =
|
||||
[UIApplication sharedApplication].statusBarFrame.size.height * scale;
|
||||
|
||||
_platformView->engineProxy()->OnViewportMetricsChanged(
|
||||
_viewportMetrics.Clone());
|
||||
[self updateViewportMetrics];
|
||||
}
|
||||
|
||||
#pragma mark - Keyboard events
|
||||
@@ -350,15 +356,13 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(
|
||||
CGFloat bottom = CGRectGetHeight(
|
||||
[[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue]);
|
||||
CGFloat scale = [UIScreen mainScreen].scale;
|
||||
_viewportMetrics->physical_padding_bottom = bottom * scale;
|
||||
_platformView->engineProxy()->OnViewportMetricsChanged(
|
||||
_viewportMetrics.Clone());
|
||||
_viewportMetrics.physical_padding_bottom = bottom * scale;
|
||||
[self updateViewportMetrics];
|
||||
}
|
||||
|
||||
- (void)keyboardWillBeHidden:(NSNotification*)notification {
|
||||
_viewportMetrics->physical_padding_bottom = 0.0;
|
||||
_platformView->engineProxy()->OnViewportMetricsChanged(
|
||||
_viewportMetrics.Clone());
|
||||
_viewportMetrics.physical_padding_bottom = 0;
|
||||
[self updateViewportMetrics];
|
||||
}
|
||||
|
||||
#pragma mark - Text input delegate
|
||||
|
||||
@@ -102,11 +102,14 @@ void PlatformViewGLFW::RunFromSource(const std::string& main,
|
||||
const std::string& assets_directory) {}
|
||||
|
||||
void PlatformViewGLFW::OnWindowSizeChanged(int width, int height) {
|
||||
auto metrics = sky::ViewportMetrics::New();
|
||||
metrics->physical_width = width;
|
||||
metrics->physical_height = height;
|
||||
metrics->device_pixel_ratio = 1.0;
|
||||
engine_->OnViewportMetricsChanged(metrics.Pass());
|
||||
blink::ViewportMetrics metrics;
|
||||
metrics.physical_width = width;
|
||||
metrics.physical_height = height;
|
||||
|
||||
blink::Threads::UI()->PostTask([ engine = engine().GetWeakPtr(), metrics ] {
|
||||
if (engine.get())
|
||||
engine->SetViewportMetrics(metrics);
|
||||
});
|
||||
}
|
||||
|
||||
void PlatformViewGLFW::OnMouseButtonChanged(int button, int action, int mods) {
|
||||
|
||||
@@ -13,9 +13,10 @@ source_set("testing") {
|
||||
]
|
||||
|
||||
deps = [
|
||||
"../common",
|
||||
"//base",
|
||||
"//flutter/common",
|
||||
"//flutter/services/engine:interfaces",
|
||||
"//flutter/shell/common",
|
||||
"//flutter/skia",
|
||||
"//lib/ftl",
|
||||
"//mojo/public/cpp/bindings",
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "flutter/common/threads.h"
|
||||
#include "flutter/shell/common/platform_view.h"
|
||||
#include "flutter/shell/common/shell.h"
|
||||
#include "flutter/shell/testing/platform_view_test.h"
|
||||
@@ -18,12 +17,15 @@ TestRunner::TestRunner()
|
||||
: platform_view_(new PlatformViewTest()), weak_ptr_factory_(this) {
|
||||
platform_view_->ConnectToEngine(GetProxy(&sky_engine_));
|
||||
|
||||
sky::ViewportMetricsPtr metrics = sky::ViewportMetrics::New();
|
||||
blink::ViewportMetrics metrics;
|
||||
metrics.physical_width = 800;
|
||||
metrics.physical_height = 600;
|
||||
|
||||
metrics->physical_width = 800;
|
||||
metrics->physical_height = 600;
|
||||
|
||||
sky_engine_->OnViewportMetricsChanged(metrics.Pass());
|
||||
blink::Threads::UI()->PostTask(
|
||||
[ engine = platform_view_->engine().GetWeakPtr(), metrics ] {
|
||||
if (engine.get())
|
||||
engine->SetViewportMetrics(metrics);
|
||||
});
|
||||
}
|
||||
|
||||
TestRunner::~TestRunner() = default;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "flutter/services/engine/sky_engine.mojom.h"
|
||||
#include "lib/ftl/macros.h"
|
||||
#include "lib/ftl/memory/weak_ptr.h"
|
||||
#include "mojo/public/cpp/bindings/binding_set.h"
|
||||
|
||||
namespace shell {
|
||||
|
||||
@@ -34,6 +33,7 @@ class TestRunner {
|
||||
|
||||
std::unique_ptr<PlatformView> platform_view_;
|
||||
sky::SkyEnginePtr sky_engine_;
|
||||
|
||||
ftl::WeakPtrFactory<TestRunner> weak_ptr_factory_;
|
||||
|
||||
FTL_DISALLOW_COPY_AND_ASSIGN(TestRunner);
|
||||
|
||||
Reference in New Issue
Block a user