Turned on performance-unnecessary-value-param everywhere. (flutter/engine#37447)
* Turned on performance-unnecessary-value-param everywhere. * linux host additions * ios patch * reverted bad fix * revert bad fix * another ios patch * removed lint fix printer
This commit is contained in:
@@ -28,7 +28,8 @@ clang-analyzer-*,\
|
||||
readability-identifier-naming,\
|
||||
clang-diagnostic-*,\
|
||||
google-objc-*,\
|
||||
google-explicit-constructor"
|
||||
google-explicit-constructor,\
|
||||
performance-unnecessary-value-param"
|
||||
|
||||
CheckOptions:
|
||||
- key: modernize-use-default-member-init.UseAssignment
|
||||
|
||||
@@ -34,7 +34,7 @@ DART_BIN="${SRC_DIR}/third_party/dart/tools/sdks/dart-sdk/bin"
|
||||
DART="${DART_BIN}/dart"
|
||||
# TODO(https://github.com/flutter/flutter/issues/113848): Migrate all platforms
|
||||
# to have this as an error.
|
||||
MAC_HOST_WARNINGS_AS_ERRORS="performance-move-const-arg,performance-unnecessary-value-param"
|
||||
MAC_HOST_WARNINGS_AS_ERRORS="performance-move-const-arg"
|
||||
|
||||
# FLUTTER_LINT_PRINT_FIX will make it so that fix is executed and the generated
|
||||
# diff is printed to stdout if clang-tidy fails. This is helpful for enabling
|
||||
|
||||
@@ -54,12 +54,14 @@ ScopedJavaLocalRef<jobject> GetRealObject(JNIEnv* env, jweak obj) {
|
||||
}
|
||||
|
||||
void JavaObjectWeakGlobalRef::Assign(const JavaObjectWeakGlobalRef& other) {
|
||||
if (&other == this)
|
||||
if (&other == this) {
|
||||
return;
|
||||
}
|
||||
|
||||
JNIEnv* env = AttachCurrentThread();
|
||||
if (obj_)
|
||||
if (obj_) {
|
||||
env->DeleteWeakGlobalRef(obj_);
|
||||
}
|
||||
|
||||
obj_ = other.obj_ ? env->NewWeakGlobalRef(other.obj_) : NULL;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "impeller/renderer/backend/vulkan/command_buffer_vk.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "flutter/fml/logging.h"
|
||||
#include "impeller/base/validation.h"
|
||||
#include "impeller/renderer/backend/vulkan/context_vk.h"
|
||||
@@ -15,7 +17,7 @@
|
||||
namespace impeller {
|
||||
|
||||
std::shared_ptr<CommandBufferVK> CommandBufferVK::Create(
|
||||
std::weak_ptr<const Context> context,
|
||||
const std::weak_ptr<const Context>& context,
|
||||
vk::Device device,
|
||||
vk::CommandPool command_pool,
|
||||
SurfaceProducerVK* surface_producer) {
|
||||
@@ -41,7 +43,7 @@ CommandBufferVK::CommandBufferVK(std::weak_ptr<const Context> context,
|
||||
SurfaceProducerVK* surface_producer,
|
||||
vk::CommandPool command_pool,
|
||||
vk::UniqueCommandBuffer command_buffer)
|
||||
: CommandBuffer(context),
|
||||
: CommandBuffer(std::move(context)),
|
||||
device_(device),
|
||||
command_pool_(command_pool),
|
||||
command_buffer_(std::move(command_buffer)),
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace impeller {
|
||||
class CommandBufferVK final : public CommandBuffer {
|
||||
public:
|
||||
static std::shared_ptr<CommandBufferVK> Create(
|
||||
std::weak_ptr<const Context> context,
|
||||
const std::weak_ptr<const Context>& context,
|
||||
vk::Device device,
|
||||
vk::CommandPool command_pool,
|
||||
SurfaceProducerVK* surface_producer);
|
||||
|
||||
@@ -39,7 +39,7 @@ DeviceBufferVK::DeviceBufferVK(
|
||||
DeviceBufferDescriptor desc,
|
||||
ContextVK& context,
|
||||
std::unique_ptr<DeviceBufferAllocationVK> device_allocation)
|
||||
: DeviceBuffer(std::move(desc)),
|
||||
: DeviceBuffer(desc),
|
||||
context_(context),
|
||||
device_allocation_(std::move(device_allocation)) {}
|
||||
|
||||
|
||||
@@ -40,9 +40,9 @@ vk::DescriptorSetLayout PipelineCreateInfoVK::GetDescriptorSetLayout() const {
|
||||
}
|
||||
|
||||
PipelineVK::PipelineVK(std::weak_ptr<PipelineLibrary> library,
|
||||
PipelineDescriptor desc,
|
||||
const PipelineDescriptor& desc,
|
||||
std::unique_ptr<PipelineCreateInfoVK> create_info)
|
||||
: Pipeline(std::move(library), std::move(desc)),
|
||||
: Pipeline(std::move(library), desc),
|
||||
pipeline_info_(std::move(create_info)) {}
|
||||
|
||||
PipelineVK::~PipelineVK() = default;
|
||||
|
||||
@@ -43,7 +43,7 @@ class PipelineVK final
|
||||
public BackendCast<PipelineVK, Pipeline<PipelineDescriptor>> {
|
||||
public:
|
||||
PipelineVK(std::weak_ptr<PipelineLibrary> library,
|
||||
PipelineDescriptor desc,
|
||||
const PipelineDescriptor& desc,
|
||||
std::unique_ptr<PipelineCreateInfoVK> create_info);
|
||||
|
||||
// |Pipeline|
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "impeller/renderer/backend/vulkan/surface_producer_vk.h"
|
||||
|
||||
#include <array>
|
||||
#include <utility>
|
||||
|
||||
#include "impeller/base/validation.h"
|
||||
#include "impeller/renderer/backend/vulkan/surface_vk.h"
|
||||
@@ -13,7 +14,7 @@
|
||||
namespace impeller {
|
||||
|
||||
std::unique_ptr<SurfaceProducerVK> SurfaceProducerVK::Create(
|
||||
std::weak_ptr<Context> context,
|
||||
const std::weak_ptr<Context>& context,
|
||||
const SurfaceProducerCreateInfoVK& create_info) {
|
||||
auto surface_producer =
|
||||
std::make_unique<SurfaceProducerVK>(context, create_info);
|
||||
@@ -28,7 +29,7 @@ std::unique_ptr<SurfaceProducerVK> SurfaceProducerVK::Create(
|
||||
SurfaceProducerVK::SurfaceProducerVK(
|
||||
std::weak_ptr<Context> context,
|
||||
const SurfaceProducerCreateInfoVK& create_info)
|
||||
: context_(context), create_info_(create_info) {}
|
||||
: context_(std::move(context)), create_info_(create_info) {}
|
||||
|
||||
SurfaceProducerVK::~SurfaceProducerVK() = default;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class SurfaceSyncObjectsVK {
|
||||
class SurfaceProducerVK {
|
||||
public:
|
||||
static std::unique_ptr<SurfaceProducerVK> Create(
|
||||
std::weak_ptr<Context> context,
|
||||
const std::weak_ptr<Context>& context,
|
||||
const SurfaceProducerCreateInfoVK& create_info);
|
||||
|
||||
SurfaceProducerVK(std::weak_ptr<Context> context,
|
||||
|
||||
@@ -34,7 +34,7 @@ std::unique_ptr<SurfaceVK> SurfaceVK::WrapSwapchainImage(
|
||||
.frame_num = frame_num,
|
||||
},
|
||||
});
|
||||
color0.texture = std::make_shared<TextureVK>(std::move(color0_tex), context,
|
||||
color0.texture = std::make_shared<TextureVK>(color0_tex, context,
|
||||
std::move(color_texture_info));
|
||||
color0.clear_color = Color::DarkSlateGray();
|
||||
color0.load_action = LoadAction::kClear;
|
||||
@@ -59,19 +59,18 @@ std::unique_ptr<SurfaceVK> SurfaceVK::WrapSwapchainImage(
|
||||
},
|
||||
});
|
||||
stencil0.texture = std::make_shared<TextureVK>(
|
||||
std::move(stencil0_tex), context, std::move(stencil_texture_info));
|
||||
stencil0_tex, context, std::move(stencil_texture_info));
|
||||
stencil0.load_action = LoadAction::kClear;
|
||||
stencil0.store_action = StoreAction::kDontCare;
|
||||
|
||||
RenderTarget render_target_desc;
|
||||
render_target_desc.SetColorAttachment(color0, 0u);
|
||||
|
||||
return std::unique_ptr<SurfaceVK>(new SurfaceVK(std::move(render_target_desc),
|
||||
swapchain_image,
|
||||
std::move(swap_callback)));
|
||||
return std::unique_ptr<SurfaceVK>(new SurfaceVK(
|
||||
render_target_desc, swapchain_image, std::move(swap_callback)));
|
||||
}
|
||||
|
||||
SurfaceVK::SurfaceVK(RenderTarget target,
|
||||
SurfaceVK::SurfaceVK(const RenderTarget& target,
|
||||
SwapchainImageVK* swapchain_image,
|
||||
SwapCallback swap_callback)
|
||||
: Surface(target) {
|
||||
|
||||
@@ -23,7 +23,7 @@ class SurfaceVK final : public Surface {
|
||||
ContextVK* context,
|
||||
SwapCallback swap_callback);
|
||||
|
||||
SurfaceVK(RenderTarget target,
|
||||
SurfaceVK(const RenderTarget& target,
|
||||
SwapchainImageVK* swapchain_image,
|
||||
SwapCallback swap_callback);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace impeller {
|
||||
namespace egl {
|
||||
|
||||
Config::Config(ConfigDescriptor descriptor, EGLConfig config)
|
||||
: desc_(std::move(descriptor)), config_(config) {}
|
||||
: desc_(descriptor), config_(config) {}
|
||||
|
||||
Config::~Config() = default;
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ bool Context::ClearCurrent() const {
|
||||
}
|
||||
|
||||
std::optional<UniqueID> Context::AddLifecycleListener(
|
||||
LifecycleListener listener) {
|
||||
const LifecycleListener& listener) {
|
||||
if (!listener) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,8 @@ class Context {
|
||||
kWillClearCurrent,
|
||||
};
|
||||
using LifecycleListener = std::function<void(LifecycleEvent)>;
|
||||
std::optional<UniqueID> AddLifecycleListener(LifecycleListener listener);
|
||||
std::optional<UniqueID> AddLifecycleListener(
|
||||
const LifecycleListener& listener);
|
||||
|
||||
bool RemoveLifecycleListener(UniqueID id);
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ std::unique_ptr<Config> Display::ChooseConfig(ConfigDescriptor config) const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return std::make_unique<Config>(std::move(config), config_out);
|
||||
return std::make_unique<Config>(config, config_out);
|
||||
}
|
||||
|
||||
std::unique_ptr<Surface> Display::CreateWindowSurface(
|
||||
|
||||
@@ -215,7 +215,7 @@ void UIDartState::LogMessage(const std::string& tag,
|
||||
// Fall back to previous behavior if unspecified.
|
||||
#if defined(FML_OS_ANDROID)
|
||||
__android_log_print(ANDROID_LOG_INFO, tag.c_str(), "%.*s",
|
||||
(int)message.size(), message.c_str());
|
||||
static_cast<int>(message.size()), message.c_str());
|
||||
#elif defined(FML_OS_IOS)
|
||||
std::stringstream stream;
|
||||
if (!tag.empty()) {
|
||||
@@ -223,7 +223,8 @@ void UIDartState::LogMessage(const std::string& tag,
|
||||
}
|
||||
stream << message;
|
||||
std::string log = stream.str();
|
||||
syslog(1 /* LOG_ALERT */, "%.*s", (int)log.size(), log.c_str());
|
||||
syslog(1 /* LOG_ALERT */, "%.*s", static_cast<int>(log.size()),
|
||||
log.c_str());
|
||||
#else
|
||||
if (!tag.empty()) {
|
||||
std::cout << tag << ": ";
|
||||
|
||||
@@ -292,7 +292,7 @@ std::unique_ptr<Rasterizer::GpuImageResult> Rasterizer::MakeSkiaGpuImage(
|
||||
// I can't seem to get the GPU path working on it.
|
||||
// https://github.com/flutter/flutter/issues/108835
|
||||
#if FML_OS_LINUX
|
||||
return MakeBitmapImage(std::move(display_list), image_info);
|
||||
return MakeBitmapImage(display_list, image_info);
|
||||
#endif
|
||||
|
||||
std::unique_ptr<SnapshotDelegate::GpuImageResult> result;
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace flutter {
|
||||
|
||||
sk_sp<GrDirectContext> ShellIOManager::CreateCompatibleResourceLoadingContext(
|
||||
GrBackend backend,
|
||||
sk_sp<const GrGLInterface> gl_interface) {
|
||||
const sk_sp<const GrGLInterface>& gl_interface) {
|
||||
#if SK_GL
|
||||
if (backend != GrBackend::kOpenGL_GrBackend) {
|
||||
return nullptr;
|
||||
|
||||
@@ -22,7 +22,7 @@ class ShellIOManager final : public IOManager {
|
||||
// they so desire.
|
||||
static sk_sp<GrDirectContext> CreateCompatibleResourceLoadingContext(
|
||||
GrBackend backend,
|
||||
sk_sp<const GrGLInterface> gl_interface);
|
||||
const sk_sp<const GrGLInterface>& gl_interface);
|
||||
|
||||
ShellIOManager(
|
||||
sk_sp<GrDirectContext> resource_context,
|
||||
|
||||
@@ -70,7 +70,7 @@ AndroidContextGLSkia::AndroidContextGLSkia(
|
||||
const TaskRunners& task_runners,
|
||||
uint8_t msaa_samples)
|
||||
: AndroidContext(AndroidRenderingAPI::kOpenGLES),
|
||||
environment_(environment),
|
||||
environment_(std::move(environment)),
|
||||
config_(nullptr),
|
||||
task_runners_(task_runners) {
|
||||
if (!environment_->IsValid()) {
|
||||
@@ -146,7 +146,7 @@ AndroidContextGLSkia::~AndroidContextGLSkia() {
|
||||
}
|
||||
|
||||
std::unique_ptr<AndroidEGLSurface> AndroidContextGLSkia::CreateOnscreenSurface(
|
||||
fml::RefPtr<AndroidNativeWindow> window) const {
|
||||
const fml::RefPtr<AndroidNativeWindow>& window) const {
|
||||
if (window->IsFakeWindow()) {
|
||||
return CreatePbufferSurface();
|
||||
} else {
|
||||
|
||||
@@ -41,7 +41,7 @@ class AndroidContextGLSkia : public AndroidContext {
|
||||
/// @return The window surface.
|
||||
///
|
||||
std::unique_ptr<AndroidEGLSurface> CreateOnscreenSurface(
|
||||
fml::RefPtr<AndroidNativeWindow> window) const;
|
||||
const fml::RefPtr<AndroidNativeWindow>& window) const;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/// @brief Allocates an 1x1 pbuffer surface that is used for making the
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include <GLES/glext.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "third_party/skia/include/core/SkAlphaType.h"
|
||||
#include "third_party/skia/include/core/SkColorSpace.h"
|
||||
#include "third_party/skia/include/core/SkColorType.h"
|
||||
@@ -20,7 +22,7 @@ AndroidExternalTextureGL::AndroidExternalTextureGL(
|
||||
const fml::jni::ScopedJavaGlobalRef<jobject>& surface_texture,
|
||||
std::shared_ptr<PlatformViewAndroidJNI> jni_facade)
|
||||
: Texture(id),
|
||||
jni_facade_(jni_facade),
|
||||
jni_facade_(std::move(jni_facade)),
|
||||
surface_texture_(surface_texture),
|
||||
transform(SkMatrix::I()) {}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "flutter/shell/platform/android/android_image_generator.h"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include <android/bitmap.h>
|
||||
#include <android/hardware_buffer.h>
|
||||
@@ -21,7 +22,7 @@ static jmethodID g_decode_image_method = nullptr;
|
||||
AndroidImageGenerator::~AndroidImageGenerator() = default;
|
||||
|
||||
AndroidImageGenerator::AndroidImageGenerator(sk_sp<SkData> data)
|
||||
: data_(data), image_info_(SkImageInfo::MakeUnknown(-1, -1)) {}
|
||||
: data_(std::move(data)), image_info_(SkImageInfo::MakeUnknown(-1, -1)) {}
|
||||
|
||||
const SkImageInfo& AndroidImageGenerator::GetInfo() {
|
||||
header_decoded_latch_.Wait();
|
||||
@@ -173,7 +174,7 @@ bool AndroidImageGenerator::Register(JNIEnv* env) {
|
||||
|
||||
std::shared_ptr<ImageGenerator> AndroidImageGenerator::MakeFromData(
|
||||
sk_sp<SkData> data,
|
||||
fml::RefPtr<fml::TaskRunner> task_runner) {
|
||||
const fml::RefPtr<fml::TaskRunner>& task_runner) {
|
||||
std::shared_ptr<AndroidImageGenerator> generator(
|
||||
new AndroidImageGenerator(std::move(data)));
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class AndroidImageGenerator : public ImageGenerator {
|
||||
|
||||
static std::shared_ptr<ImageGenerator> MakeFromData(
|
||||
sk_sp<SkData> data,
|
||||
fml::RefPtr<fml::TaskRunner> task_runner);
|
||||
const fml::RefPtr<fml::TaskRunner>& task_runner);
|
||||
|
||||
static void NativeImageHeaderCallback(JNIEnv* env,
|
||||
jclass jcaller,
|
||||
|
||||
@@ -78,9 +78,9 @@ static PlatformData GetDefaultPlatformData() {
|
||||
}
|
||||
|
||||
AndroidShellHolder::AndroidShellHolder(
|
||||
flutter::Settings settings,
|
||||
const flutter::Settings& settings,
|
||||
std::shared_ptr<PlatformViewAndroidJNI> jni_facade)
|
||||
: settings_(std::move(settings)), jni_facade_(jni_facade) {
|
||||
: settings_(settings), jni_facade_(jni_facade) {
|
||||
static size_t thread_host_count = 1;
|
||||
auto thread_label = std::to_string(thread_host_count++);
|
||||
|
||||
@@ -164,7 +164,7 @@ AndroidShellHolder::AndroidShellHolder(
|
||||
|
||||
shell_->RegisterImageDecoder(
|
||||
[runner = task_runners.GetIOTaskRunner()](sk_sp<SkData> buffer) {
|
||||
return AndroidImageGenerator::MakeFromData(buffer, runner);
|
||||
return AndroidImageGenerator::MakeFromData(std::move(buffer), runner);
|
||||
},
|
||||
-1);
|
||||
FML_DLOG(INFO) << "Registered Android SDK image decoder (API level 28+)";
|
||||
@@ -181,7 +181,7 @@ AndroidShellHolder::AndroidShellHolder(
|
||||
const std::shared_ptr<ThreadHost>& thread_host,
|
||||
std::unique_ptr<Shell> shell,
|
||||
const fml::WeakPtr<PlatformViewAndroid>& platform_view)
|
||||
: settings_(std::move(settings)),
|
||||
: settings_(settings),
|
||||
jni_facade_(jni_facade),
|
||||
platform_view_(platform_view),
|
||||
thread_host_(thread_host),
|
||||
@@ -335,13 +335,12 @@ std::optional<RunConfiguration> AndroidShellHolder::BuildRunConfiguration(
|
||||
|
||||
{
|
||||
if (!entrypoint.empty() && !libraryUrl.empty()) {
|
||||
config.SetEntrypointAndLibrary(std::move(entrypoint),
|
||||
std::move(libraryUrl));
|
||||
config.SetEntrypointAndLibrary(entrypoint, libraryUrl);
|
||||
} else if (!entrypoint.empty()) {
|
||||
config.SetEntrypoint(std::move(entrypoint));
|
||||
config.SetEntrypoint(entrypoint);
|
||||
}
|
||||
if (!entrypoint_args.empty()) {
|
||||
config.SetEntrypointArgs(std::move(entrypoint_args));
|
||||
config.SetEntrypointArgs(entrypoint_args);
|
||||
}
|
||||
}
|
||||
return config;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace flutter {
|
||||
///
|
||||
class AndroidShellHolder {
|
||||
public:
|
||||
AndroidShellHolder(flutter::Settings settings,
|
||||
AndroidShellHolder(const flutter::Settings& settings,
|
||||
std::shared_ptr<PlatformViewAndroidJNI> jni_facade);
|
||||
|
||||
~AndroidShellHolder();
|
||||
|
||||
@@ -46,7 +46,7 @@ class AndroidSurfaceGLImpeller::ReactorWorker final
|
||||
};
|
||||
|
||||
static std::shared_ptr<impeller::Context> CreateImpellerContext(
|
||||
std::shared_ptr<impeller::ReactorGLES::Worker> worker) {
|
||||
const std::shared_ptr<impeller::ReactorGLES::Worker>& worker) {
|
||||
auto proc_table = std::make_unique<impeller::ProcTableGLES>(
|
||||
impeller::egl::CreateProcAddressResolver());
|
||||
|
||||
@@ -68,7 +68,7 @@ static std::shared_ptr<impeller::Context> CreateImpellerContext(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!context->AddReactorWorker(std::move(worker)).has_value()) {
|
||||
if (!context->AddReactorWorker(worker).has_value()) {
|
||||
FML_LOG(ERROR) << "Could not add reactor worker.";
|
||||
return nullptr;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ static std::shared_ptr<impeller::Context> CreateImpellerContext(
|
||||
|
||||
AndroidSurfaceGLImpeller::AndroidSurfaceGLImpeller(
|
||||
const std::shared_ptr<AndroidContext>& android_context,
|
||||
std::shared_ptr<PlatformViewAndroidJNI> jni_facade)
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
|
||||
: AndroidSurface(android_context),
|
||||
reactor_worker_(std::shared_ptr<ReactorWorker>(new ReactorWorker())) {
|
||||
auto display = std::make_unique<impeller::egl::Display>();
|
||||
|
||||
@@ -19,7 +19,7 @@ class AndroidSurfaceGLImpeller final : public GPUSurfaceGLDelegate,
|
||||
public:
|
||||
AndroidSurfaceGLImpeller(
|
||||
const std::shared_ptr<AndroidContext>& android_context,
|
||||
std::shared_ptr<PlatformViewAndroidJNI> jni_facade);
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade);
|
||||
|
||||
// |AndroidSurface|
|
||||
~AndroidSurfaceGLImpeller() override;
|
||||
|
||||
@@ -22,7 +22,7 @@ constexpr char kEmulatorRendererPrefix[] =
|
||||
|
||||
AndroidSurfaceGLSkia::AndroidSurfaceGLSkia(
|
||||
const std::shared_ptr<AndroidContext>& android_context,
|
||||
std::shared_ptr<PlatformViewAndroidJNI> jni_facade)
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
|
||||
: AndroidSurface(android_context),
|
||||
native_window_(nullptr),
|
||||
onscreen_surface_(nullptr),
|
||||
|
||||
@@ -21,8 +21,9 @@ namespace flutter {
|
||||
class AndroidSurfaceGLSkia final : public GPUSurfaceGLDelegate,
|
||||
public AndroidSurface {
|
||||
public:
|
||||
AndroidSurfaceGLSkia(const std::shared_ptr<AndroidContext>& android_context,
|
||||
std::shared_ptr<PlatformViewAndroidJNI> jni_facade);
|
||||
AndroidSurfaceGLSkia(
|
||||
const std::shared_ptr<AndroidContext>& android_context,
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade);
|
||||
|
||||
~AndroidSurfaceGLSkia() override;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ bool GetSkColorType(int32_t buffer_format,
|
||||
|
||||
AndroidSurfaceSoftware::AndroidSurfaceSoftware(
|
||||
const std::shared_ptr<AndroidContext>& android_context,
|
||||
std::shared_ptr<PlatformViewAndroidJNI> jni_facade)
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
|
||||
: AndroidSurface(android_context) {
|
||||
GetSkColorType(WINDOW_FORMAT_RGBA_8888, &target_color_type_,
|
||||
&target_alpha_type_);
|
||||
@@ -153,13 +153,17 @@ bool AndroidSurfaceSoftware::OnScreenSurfaceResize(const SkISize& size) {
|
||||
bool AndroidSurfaceSoftware::SetNativeWindow(
|
||||
fml::RefPtr<AndroidNativeWindow> window) {
|
||||
native_window_ = std::move(window);
|
||||
if (!(native_window_ && native_window_->IsValid()))
|
||||
if (!(native_window_ && native_window_->IsValid())) {
|
||||
return false;
|
||||
}
|
||||
int32_t window_format = ANativeWindow_getFormat(native_window_->handle());
|
||||
if (window_format < 0)
|
||||
if (window_format < 0) {
|
||||
return false;
|
||||
if (!GetSkColorType(window_format, &target_color_type_, &target_alpha_type_))
|
||||
}
|
||||
if (!GetSkColorType(window_format, &target_color_type_,
|
||||
&target_alpha_type_)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,9 @@ namespace flutter {
|
||||
class AndroidSurfaceSoftware final : public AndroidSurface,
|
||||
public GPUSurfaceSoftwareDelegate {
|
||||
public:
|
||||
AndroidSurfaceSoftware(const std::shared_ptr<AndroidContext>& android_context,
|
||||
std::shared_ptr<PlatformViewAndroidJNI> jni_facade);
|
||||
AndroidSurfaceSoftware(
|
||||
const std::shared_ptr<AndroidContext>& android_context,
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade);
|
||||
|
||||
~AndroidSurfaceSoftware() override;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
#include "flutter/fml/logging.h"
|
||||
|
||||
@@ -75,7 +76,7 @@ APKAssetProvider::APKAssetProvider(JNIEnv* env,
|
||||
|
||||
APKAssetProvider::APKAssetProvider(
|
||||
std::shared_ptr<APKAssetProviderInternal> impl)
|
||||
: impl_(impl) {}
|
||||
: impl_(std::move(impl)) {}
|
||||
|
||||
// |AssetResolver|
|
||||
bool APKAssetProvider::IsValid() const {
|
||||
|
||||
@@ -58,8 +58,8 @@ fml::jni::ScopedJavaGlobalRef<jclass>* g_flutter_jni_class = nullptr;
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
FlutterMain::FlutterMain(flutter::Settings settings)
|
||||
: settings_(std::move(settings)), observatory_uri_callback_() {}
|
||||
FlutterMain::FlutterMain(const flutter::Settings& settings)
|
||||
: settings_(settings), observatory_uri_callback_() {}
|
||||
|
||||
FlutterMain::~FlutterMain() = default;
|
||||
|
||||
@@ -133,8 +133,8 @@ void FlutterMain::Init(JNIEnv* env,
|
||||
}
|
||||
}
|
||||
|
||||
settings.task_observer_add = [](intptr_t key, fml::closure callback) {
|
||||
fml::MessageLoop::GetCurrent().AddTaskObserver(key, std::move(callback));
|
||||
settings.task_observer_add = [](intptr_t key, const fml::closure& callback) {
|
||||
fml::MessageLoop::GetCurrent().AddTaskObserver(key, callback);
|
||||
};
|
||||
|
||||
settings.task_observer_remove = [](intptr_t key) {
|
||||
@@ -144,7 +144,7 @@ void FlutterMain::Init(JNIEnv* env,
|
||||
settings.log_message_callback = [](const std::string& tag,
|
||||
const std::string& message) {
|
||||
__android_log_print(ANDROID_LOG_INFO, tag.c_str(), "%.*s",
|
||||
(int)message.size(), message.c_str());
|
||||
static_cast<int>(message.size()), message.c_str());
|
||||
};
|
||||
|
||||
#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG
|
||||
@@ -162,7 +162,7 @@ void FlutterMain::Init(JNIEnv* env,
|
||||
|
||||
// Not thread safe. Will be removed when FlutterMain is refactored to no
|
||||
// longer be a singleton.
|
||||
g_flutter_main.reset(new FlutterMain(std::move(settings)));
|
||||
g_flutter_main.reset(new FlutterMain(settings));
|
||||
|
||||
g_flutter_main->SetupObservatoryUriCallback(env);
|
||||
}
|
||||
@@ -179,7 +179,7 @@ void FlutterMain::SetupObservatoryUriCallback(JNIEnv* env) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto set_uri = [env, uri_field](std::string uri) {
|
||||
auto set_uri = [env, uri_field](const std::string& uri) {
|
||||
fml::jni::ScopedJavaLocalRef<jstring> java_uri =
|
||||
fml::jni::StringToJavaString(env, uri);
|
||||
env->SetStaticObjectField(g_flutter_jni_class->obj(), uri_field,
|
||||
@@ -191,7 +191,7 @@ void FlutterMain::SetupObservatoryUriCallback(JNIEnv* env) {
|
||||
fml::MessageLoop::GetCurrent().GetTaskRunner();
|
||||
|
||||
observatory_uri_callback_ = DartServiceIsolate::AddServerStatusCallback(
|
||||
[platform_runner, set_uri](std::string uri) {
|
||||
[platform_runner, set_uri](const std::string& uri) {
|
||||
platform_runner->PostTask([uri, set_uri] { set_uri(uri); });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class FlutterMain {
|
||||
const flutter::Settings settings_;
|
||||
DartServiceIsolate::CallbackHandle observatory_uri_callback_;
|
||||
|
||||
explicit FlutterMain(flutter::Settings settings);
|
||||
explicit FlutterMain(const flutter::Settings& settings);
|
||||
|
||||
static void Init(JNIEnv* env,
|
||||
jclass clazz,
|
||||
|
||||
@@ -20,8 +20,9 @@ void PlatformMessageHandlerAndroid::InvokePlatformMessageResponseCallback(
|
||||
{
|
||||
std::lock_guard lock(pending_responses_mutex_);
|
||||
auto it = pending_responses_.find(response_id);
|
||||
if (it == pending_responses_.end())
|
||||
if (it == pending_responses_.end()) {
|
||||
return;
|
||||
}
|
||||
message_response = std::move(it->second);
|
||||
pending_responses_.erase(it);
|
||||
}
|
||||
@@ -39,8 +40,9 @@ void PlatformMessageHandlerAndroid::InvokePlatformMessageEmptyResponseCallback(
|
||||
{
|
||||
std::lock_guard lock(pending_responses_mutex_);
|
||||
auto it = pending_responses_.find(response_id);
|
||||
if (it == pending_responses_.end())
|
||||
if (it == pending_responses_.end()) {
|
||||
return;
|
||||
}
|
||||
message_response = std::move(it->second);
|
||||
pending_responses_.erase(it);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "flutter/shell/platform/android/platform_message_response_android.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "flutter/fml/make_copyable.h"
|
||||
#include "flutter/shell/platform/android/jni/platform_view_android_jni.h"
|
||||
|
||||
@@ -14,7 +16,7 @@ PlatformMessageResponseAndroid::PlatformMessageResponseAndroid(
|
||||
std::shared_ptr<PlatformViewAndroidJNI> jni_facade,
|
||||
fml::RefPtr<fml::TaskRunner> platform_task_runner)
|
||||
: response_id_(response_id),
|
||||
jni_facade_(jni_facade),
|
||||
jni_facade_(std::move(jni_facade)),
|
||||
platform_task_runner_(std::move(platform_task_runner)) {}
|
||||
|
||||
PlatformMessageResponseAndroid::~PlatformMessageResponseAndroid() = default;
|
||||
|
||||
@@ -32,7 +32,7 @@ AndroidSurfaceFactoryImpl::AndroidSurfaceFactoryImpl(
|
||||
std::shared_ptr<PlatformViewAndroidJNI> jni_facade,
|
||||
bool enable_impeller)
|
||||
: android_context_(context),
|
||||
jni_facade_(jni_facade),
|
||||
jni_facade_(std::move(jni_facade)),
|
||||
enable_impeller_(enable_impeller) {}
|
||||
|
||||
AndroidSurfaceFactoryImpl::~AndroidSurfaceFactoryImpl() = default;
|
||||
@@ -65,7 +65,7 @@ std::unique_ptr<AndroidSurface> AndroidSurfaceFactoryImpl::CreateSurface() {
|
||||
|
||||
static std::shared_ptr<flutter::AndroidContext> CreateAndroidContext(
|
||||
bool use_software_rendering,
|
||||
const flutter::TaskRunners task_runners,
|
||||
const flutter::TaskRunners& task_runners,
|
||||
uint8_t msaa_samples,
|
||||
bool enable_impeller) {
|
||||
if (use_software_rendering) {
|
||||
@@ -84,14 +84,14 @@ static std::shared_ptr<flutter::AndroidContext> CreateAndroidContext(
|
||||
|
||||
PlatformViewAndroid::PlatformViewAndroid(
|
||||
PlatformView::Delegate& delegate,
|
||||
flutter::TaskRunners task_runners,
|
||||
std::shared_ptr<PlatformViewAndroidJNI> jni_facade,
|
||||
const flutter::TaskRunners& task_runners,
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade,
|
||||
bool use_software_rendering,
|
||||
uint8_t msaa_samples)
|
||||
: PlatformViewAndroid(
|
||||
delegate,
|
||||
std::move(task_runners),
|
||||
std::move(jni_facade),
|
||||
task_runners,
|
||||
jni_facade,
|
||||
CreateAndroidContext(
|
||||
use_software_rendering,
|
||||
task_runners,
|
||||
@@ -100,12 +100,12 @@ PlatformViewAndroid::PlatformViewAndroid(
|
||||
|
||||
PlatformViewAndroid::PlatformViewAndroid(
|
||||
PlatformView::Delegate& delegate,
|
||||
flutter::TaskRunners task_runners,
|
||||
const flutter::TaskRunners& task_runners,
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade,
|
||||
const std::shared_ptr<flutter::AndroidContext>& android_context)
|
||||
: PlatformView(delegate, std::move(task_runners)),
|
||||
: PlatformView(delegate, task_runners),
|
||||
jni_facade_(jni_facade),
|
||||
android_context_(std::move(android_context)),
|
||||
android_context_(android_context),
|
||||
platform_view_android_delegate_(jni_facade),
|
||||
platform_message_handler_(new PlatformMessageHandlerAndroid(jni_facade)) {
|
||||
if (android_context_) {
|
||||
@@ -267,7 +267,7 @@ void PlatformViewAndroid::RegisterExternalTexture(
|
||||
const fml::jni::ScopedJavaGlobalRef<jobject>& surface_texture) {
|
||||
if (android_context_->RenderingApi() == AndroidRenderingAPI::kOpenGLES) {
|
||||
RegisterTexture(std::make_shared<AndroidExternalTextureGL>(
|
||||
texture_id, surface_texture, std::move(jni_facade_)));
|
||||
texture_id, surface_texture, jni_facade_));
|
||||
} else {
|
||||
FML_LOG(INFO) << "Attempted to use a GL texture in a non GL context.";
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ class PlatformViewAndroid final : public PlatformView {
|
||||
static bool Register(JNIEnv* env);
|
||||
|
||||
PlatformViewAndroid(PlatformView::Delegate& delegate,
|
||||
flutter::TaskRunners task_runners,
|
||||
std::shared_ptr<PlatformViewAndroidJNI> jni_facade,
|
||||
const flutter::TaskRunners& task_runners,
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade,
|
||||
bool use_software_rendering,
|
||||
uint8_t msaa_samples);
|
||||
|
||||
@@ -57,7 +57,7 @@ class PlatformViewAndroid final : public PlatformView {
|
||||
///
|
||||
PlatformViewAndroid(
|
||||
PlatformView::Delegate& delegate,
|
||||
flutter::TaskRunners task_runners,
|
||||
const flutter::TaskRunners& task_runners,
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade,
|
||||
const std::shared_ptr<flutter::AndroidContext>& android_context);
|
||||
|
||||
|
||||
@@ -541,7 +541,7 @@ static jboolean FlutterTextUtilsIsRegionalIndicator(JNIEnv* env,
|
||||
}
|
||||
|
||||
static void LoadLoadingUnitFailure(intptr_t loading_unit_id,
|
||||
std::string message,
|
||||
const std::string& message,
|
||||
bool transient) {
|
||||
// TODO(garyq): Implement
|
||||
}
|
||||
@@ -1140,7 +1140,7 @@ bool PlatformViewAndroid::Register(JNIEnv* env) {
|
||||
}
|
||||
|
||||
PlatformViewAndroidJNIImpl::PlatformViewAndroidJNIImpl(
|
||||
fml::jni::JavaObjectWeakGlobalRef java_object)
|
||||
const fml::jni::JavaObjectWeakGlobalRef& java_object)
|
||||
: java_object_(java_object) {}
|
||||
|
||||
PlatformViewAndroidJNIImpl::~PlatformViewAndroidJNIImpl() = default;
|
||||
@@ -1464,8 +1464,9 @@ void PlatformViewAndroidJNIImpl::FlutterViewOnDisplayPlatformView(
|
||||
env->SetFloatArrayRegion(radiisArray.obj(), 0, 8, radiis);
|
||||
env->CallVoidMethod(
|
||||
mutatorsStack, g_mutators_stack_push_cliprrect_method,
|
||||
(int)rect.left(), (int)rect.top(), (int)rect.right(),
|
||||
(int)rect.bottom(), radiisArray.obj());
|
||||
static_cast<int>(rect.left()), static_cast<int>(rect.top()),
|
||||
static_cast<int>(rect.right()), static_cast<int>(rect.bottom()),
|
||||
radiisArray.obj());
|
||||
break;
|
||||
}
|
||||
// TODO(cyanglaz): Implement other mutators.
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace flutter {
|
||||
class PlatformViewAndroidJNIImpl final : public PlatformViewAndroidJNI {
|
||||
public:
|
||||
explicit PlatformViewAndroidJNIImpl(
|
||||
fml::jni::JavaObjectWeakGlobalRef java_object);
|
||||
const fml::jni::JavaObjectWeakGlobalRef& java_object);
|
||||
|
||||
~PlatformViewAndroidJNIImpl() override;
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ static fml::jni::ScopedJavaGlobalRef<jclass>* g_vsync_waiter_class = nullptr;
|
||||
static jmethodID g_async_wait_for_vsync_method_ = nullptr;
|
||||
static std::atomic_uint g_refresh_rate_ = 60;
|
||||
|
||||
VsyncWaiterAndroid::VsyncWaiterAndroid(flutter::TaskRunners task_runners)
|
||||
: VsyncWaiter(std::move(task_runners)),
|
||||
VsyncWaiterAndroid::VsyncWaiterAndroid(const flutter::TaskRunners& task_runners)
|
||||
: VsyncWaiter(task_runners),
|
||||
use_ndk_choreographer_(
|
||||
AndroidChoreographer::ShouldUseNDKChoreographer()) {}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class VsyncWaiterAndroid final : public VsyncWaiter {
|
||||
public:
|
||||
static bool Register(JNIEnv* env);
|
||||
|
||||
explicit VsyncWaiterAndroid(flutter::TaskRunners task_runners);
|
||||
explicit VsyncWaiterAndroid(const flutter::TaskRunners& task_runners);
|
||||
|
||||
~VsyncWaiterAndroid() override;
|
||||
|
||||
|
||||
@@ -54,8 +54,8 @@ flutter::Settings FLTDefaultSettingsForBundle(NSBundle* bundle) {
|
||||
|
||||
auto settings = flutter::SettingsFromCommandLine(command_line);
|
||||
|
||||
settings.task_observer_add = [](intptr_t key, fml::closure callback) {
|
||||
fml::MessageLoop::GetCurrent().AddTaskObserver(key, std::move(callback));
|
||||
settings.task_observer_add = [](intptr_t key, const fml::closure& callback) {
|
||||
fml::MessageLoop::GetCurrent().AddTaskObserver(key, callback);
|
||||
};
|
||||
|
||||
settings.task_observer_remove = [](intptr_t key) {
|
||||
|
||||
@@ -287,7 +287,7 @@ static constexpr int kNumProfilerSamplesPerSec = 5;
|
||||
if (!self.platformView) {
|
||||
return;
|
||||
}
|
||||
self.platformView->SetViewportMetrics(std::move(viewportMetrics));
|
||||
self.platformView->SetViewportMetrics(viewportMetrics);
|
||||
}
|
||||
|
||||
- (void)dispatchPointerDataPacket:(std::unique_ptr<flutter::PointerDataPacket>)packet {
|
||||
@@ -797,9 +797,9 @@ static void SetEntryPoint(flutter::Settings* settings, NSString* entrypoint, NSS
|
||||
[UIApplication sharedApplication].applicationState == UIApplicationStateBackground;
|
||||
// Create the shell. This is a blocking operation.
|
||||
std::unique_ptr<flutter::Shell> shell = flutter::Shell::Create(
|
||||
/*platform_data=*/std::move(platformData),
|
||||
/*task_runners=*/std::move(task_runners),
|
||||
/*settings=*/std::move(settings),
|
||||
/*platform_data=*/platformData,
|
||||
/*task_runners=*/task_runners,
|
||||
/*settings=*/settings,
|
||||
/*on_create_platform_view=*/on_create_platform_view,
|
||||
/*on_create_rasterizer=*/on_create_rasterizer,
|
||||
/*is_gpu_disabled=*/_isGpuDisabled);
|
||||
|
||||
@@ -194,7 +194,7 @@ static void DNSSD_API RegistrationCallback(DNSServiceRef sdRef,
|
||||
[_delegate stopService];
|
||||
[_url release];
|
||||
|
||||
flutter::DartServiceIsolate::RemoveServerStatusCallback(std::move(_callbackHandle));
|
||||
flutter::DartServiceIsolate::RemoveServerStatusCallback(_callbackHandle);
|
||||
[super dealloc];
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -38,7 +38,7 @@ BOOL canApplyBlurBackdrop = YES;
|
||||
|
||||
std::shared_ptr<FlutterPlatformViewLayer> FlutterPlatformViewLayerPool::GetLayer(
|
||||
GrDirectContext* gr_context,
|
||||
std::shared_ptr<IOSContext> ios_context) {
|
||||
const std::shared_ptr<IOSContext>& ios_context) {
|
||||
if (available_layer_index_ >= layers_.size()) {
|
||||
std::shared_ptr<FlutterPlatformViewLayer> layer;
|
||||
fml::scoped_nsobject<FlutterOverlayView> overlay_view;
|
||||
@@ -285,7 +285,7 @@ bool FlutterPlatformViewsController::HasPlatformViewThisOrNextFrame() {
|
||||
const int FlutterPlatformViewsController::kDefaultMergedLeaseDuration;
|
||||
|
||||
PostPrerollResult FlutterPlatformViewsController::PostPrerollAction(
|
||||
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger) {
|
||||
const fml::RefPtr<fml::RasterThreadMerger>& raster_thread_merger) {
|
||||
// TODO(cyanglaz): https://github.com/flutter/flutter/issues/56474
|
||||
// Rename `has_platform_view` to `view_mutated` when the above issue is resolved.
|
||||
if (!HasPlatformViewThisOrNextFrame()) {
|
||||
@@ -314,14 +314,14 @@ PostPrerollResult FlutterPlatformViewsController::PostPrerollAction(
|
||||
|
||||
void FlutterPlatformViewsController::EndFrame(
|
||||
bool should_resubmit_frame,
|
||||
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger) {
|
||||
const fml::RefPtr<fml::RasterThreadMerger>& raster_thread_merger) {
|
||||
if (should_resubmit_frame) {
|
||||
raster_thread_merger->MergeWithLease(kDefaultMergedLeaseDuration);
|
||||
}
|
||||
}
|
||||
|
||||
void FlutterPlatformViewsController::PushFilterToVisitedPlatformViews(
|
||||
std::shared_ptr<const DlImageFilter> filter,
|
||||
const std::shared_ptr<const DlImageFilter>& filter,
|
||||
const SkRect& filter_rect) {
|
||||
for (int64_t id : visited_platform_views_) {
|
||||
EmbeddedViewParams params = current_composition_params_[id];
|
||||
@@ -584,7 +584,7 @@ SkRect FlutterPlatformViewsController::GetPlatformViewRect(int view_id) {
|
||||
}
|
||||
|
||||
bool FlutterPlatformViewsController::SubmitFrame(GrDirectContext* gr_context,
|
||||
std::shared_ptr<IOSContext> ios_context,
|
||||
const std::shared_ptr<IOSContext>& ios_context,
|
||||
std::unique_ptr<SurfaceFrame> frame) {
|
||||
// Any UIKit related code has to run on main thread.
|
||||
FML_DCHECK([[NSThread currentThread] isMainThread]);
|
||||
@@ -728,13 +728,14 @@ void FlutterPlatformViewsController::BringLayersIntoView(LayersMap layer_map) {
|
||||
|
||||
std::shared_ptr<FlutterPlatformViewLayer> FlutterPlatformViewsController::GetLayer(
|
||||
GrDirectContext* gr_context,
|
||||
std::shared_ptr<IOSContext> ios_context,
|
||||
const std::shared_ptr<IOSContext>& ios_context,
|
||||
EmbedderViewSlice* slice,
|
||||
SkRect rect,
|
||||
int64_t view_id,
|
||||
int64_t overlay_id) {
|
||||
FML_DCHECK(flutter_view_);
|
||||
std::shared_ptr<FlutterPlatformViewLayer> layer = layer_pool_->GetLayer(gr_context, ios_context);
|
||||
std::shared_ptr<FlutterPlatformViewLayer> layer =
|
||||
layer_pool_->GetLayer(gr_context, std::move(ios_context));
|
||||
|
||||
UIView* overlay_view_wrapper = layer->overlay_view_wrapper.get();
|
||||
auto screenScale = [UIScreen mainScreen].scale;
|
||||
|
||||
@@ -112,8 +112,8 @@ class IOSContextGL;
|
||||
class IOSSurface;
|
||||
|
||||
struct FlutterPlatformViewLayer {
|
||||
FlutterPlatformViewLayer(fml::scoped_nsobject<UIView> overlay_view,
|
||||
fml::scoped_nsobject<UIView> overlay_view_wrapper,
|
||||
FlutterPlatformViewLayer(const fml::scoped_nsobject<UIView>& overlay_view,
|
||||
const fml::scoped_nsobject<UIView>& overlay_view_wrapper,
|
||||
std::unique_ptr<IOSSurface> ios_surface,
|
||||
std::unique_ptr<Surface> surface);
|
||||
|
||||
@@ -142,8 +142,9 @@ class FlutterPlatformViewLayerPool {
|
||||
|
||||
// Gets a layer from the pool if available, or allocates a new one.
|
||||
// Finally, it marks the layer as used. That is, it increments `available_layer_index_`.
|
||||
std::shared_ptr<FlutterPlatformViewLayer> GetLayer(GrDirectContext* gr_context,
|
||||
std::shared_ptr<IOSContext> ios_context);
|
||||
std::shared_ptr<FlutterPlatformViewLayer> GetLayer(
|
||||
GrDirectContext* gr_context,
|
||||
const std::shared_ptr<IOSContext>& ios_context);
|
||||
|
||||
// Gets the layers in the pool that aren't currently used.
|
||||
// This method doesn't mark the layers as unused.
|
||||
@@ -207,10 +208,11 @@ class FlutterPlatformViewsController {
|
||||
// returns nil.
|
||||
UIView* GetPlatformViewByID(int view_id);
|
||||
|
||||
PostPrerollResult PostPrerollAction(fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger);
|
||||
PostPrerollResult PostPrerollAction(
|
||||
const fml::RefPtr<fml::RasterThreadMerger>& raster_thread_merger);
|
||||
|
||||
void EndFrame(bool should_resubmit_frame,
|
||||
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger);
|
||||
const fml::RefPtr<fml::RasterThreadMerger>& raster_thread_merger);
|
||||
|
||||
std::vector<SkCanvas*> GetCurrentCanvases();
|
||||
|
||||
@@ -226,7 +228,7 @@ class FlutterPlatformViewsController {
|
||||
void Reset();
|
||||
|
||||
bool SubmitFrame(GrDirectContext* gr_context,
|
||||
std::shared_ptr<IOSContext> ios_context,
|
||||
const std::shared_ptr<IOSContext>& ios_context,
|
||||
std::unique_ptr<SurfaceFrame> frame);
|
||||
|
||||
void OnMethodCall(FlutterMethodCall* call, FlutterResult& result);
|
||||
@@ -236,7 +238,7 @@ class FlutterPlatformViewsController {
|
||||
long FindFirstResponderPlatformViewId();
|
||||
|
||||
// Pushes backdrop filter mutation to the mutator stack of each visited platform view.
|
||||
void PushFilterToVisitedPlatformViews(std::shared_ptr<const DlImageFilter> filter,
|
||||
void PushFilterToVisitedPlatformViews(const std::shared_ptr<const DlImageFilter>& filter,
|
||||
const SkRect& filter_rect);
|
||||
|
||||
// Pushes the view id of a visted platform view to the list of visied platform views.
|
||||
@@ -284,7 +286,7 @@ class FlutterPlatformViewsController {
|
||||
// Allocates a new FlutterPlatformViewLayer if needed, draws the pixels within the rect from
|
||||
// the picture on the layer's canvas.
|
||||
std::shared_ptr<FlutterPlatformViewLayer> GetLayer(GrDirectContext* gr_context,
|
||||
std::shared_ptr<IOSContext> ios_context,
|
||||
const std::shared_ptr<IOSContext>& ios_context,
|
||||
EmbedderViewSlice* slice,
|
||||
SkRect rect,
|
||||
int64_t view_id,
|
||||
|
||||
@@ -13,12 +13,12 @@ static int kMaxPointsInVerb = 4;
|
||||
namespace flutter {
|
||||
|
||||
FlutterPlatformViewLayer::FlutterPlatformViewLayer(
|
||||
fml::scoped_nsobject<UIView> overlay_view,
|
||||
fml::scoped_nsobject<UIView> overlay_view_wrapper,
|
||||
const fml::scoped_nsobject<UIView>& overlay_view,
|
||||
const fml::scoped_nsobject<UIView>& overlay_view_wrapper,
|
||||
std::unique_ptr<IOSSurface> ios_surface,
|
||||
std::unique_ptr<Surface> surface)
|
||||
: overlay_view(std::move(overlay_view)),
|
||||
overlay_view_wrapper(std::move(overlay_view_wrapper)),
|
||||
: overlay_view(overlay_view),
|
||||
overlay_view_wrapper(overlay_view_wrapper),
|
||||
ios_surface(std::move(ios_surface)),
|
||||
surface(std::move(surface)){};
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ typedef struct MouseState {
|
||||
}
|
||||
|
||||
_viewOpaque = YES;
|
||||
_engine = std::move(engine);
|
||||
_engine = engine;
|
||||
_flutterView.reset([[FlutterView alloc] initWithDelegate:_engine opaque:self.isViewOpaque]);
|
||||
[_engine.get() createShell:nil libraryURI:nil initialRoute:initialRoute];
|
||||
_engineNeedsLaunch = YES;
|
||||
|
||||
@@ -56,7 +56,7 @@ class AccessibilityBridge final : public AccessibilityBridgeIos {
|
||||
~AccessibilityBridge();
|
||||
|
||||
void UpdateSemantics(flutter::SemanticsNodeUpdates nodes,
|
||||
flutter::CustomAccessibilityActionUpdates actions);
|
||||
const flutter::CustomAccessibilityActionUpdates& actions);
|
||||
void DispatchSemanticsAction(int32_t id, flutter::SemanticsAction action) override;
|
||||
void DispatchSemanticsAction(int32_t id,
|
||||
flutter::SemanticsAction action,
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <utility>
|
||||
|
||||
#import "flutter/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h"
|
||||
|
||||
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h"
|
||||
@@ -43,7 +45,7 @@ AccessibilityBridge::AccessibilityBridge(
|
||||
std::unique_ptr<IosDelegate> ios_delegate)
|
||||
: view_controller_(view_controller),
|
||||
platform_view_(platform_view),
|
||||
platform_views_controller_(platform_views_controller),
|
||||
platform_views_controller_(std::move(platform_views_controller)),
|
||||
last_focused_semantics_object_id_(kSemanticObjectIdInvalid),
|
||||
objects_([[NSMutableDictionary alloc] init]),
|
||||
previous_route_id_(0),
|
||||
@@ -80,8 +82,9 @@ void AccessibilityBridge::AccessibilityObjectDidLoseFocus(int32_t id) {
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilityBridge::UpdateSemantics(flutter::SemanticsNodeUpdates nodes,
|
||||
flutter::CustomAccessibilityActionUpdates actions) {
|
||||
void AccessibilityBridge::UpdateSemantics(
|
||||
flutter::SemanticsNodeUpdates nodes,
|
||||
const flutter::CustomAccessibilityActionUpdates& actions) {
|
||||
BOOL layoutChanged = NO;
|
||||
BOOL scrollOccured = NO;
|
||||
BOOL needsAnnouncement = NO;
|
||||
@@ -251,7 +254,7 @@ static void ReplaceSemanticsObject(SemanticsObject* oldObject,
|
||||
}
|
||||
|
||||
static SemanticsObject* CreateObject(const flutter::SemanticsNode& node,
|
||||
fml::WeakPtr<AccessibilityBridge> weak_ptr) {
|
||||
const fml::WeakPtr<AccessibilityBridge>& weak_ptr) {
|
||||
if (node.HasFlag(flutter::SemanticsFlags::kIsTextField) &&
|
||||
!node.HasFlag(flutter::SemanticsFlags::kIsReadOnly)) {
|
||||
// Text fields are backed by objects that implement UITextInput.
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace flutter {
|
||||
|
||||
class VsyncWaiterIOS final : public VsyncWaiter, public VariableRefreshRateReporter {
|
||||
public:
|
||||
explicit VsyncWaiterIOS(flutter::TaskRunners task_runners);
|
||||
explicit VsyncWaiterIOS(const flutter::TaskRunners& task_runners);
|
||||
|
||||
~VsyncWaiterIOS() override;
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
namespace flutter {
|
||||
|
||||
VsyncWaiterIOS::VsyncWaiterIOS(flutter::TaskRunners task_runners)
|
||||
: VsyncWaiter(std::move(task_runners)) {
|
||||
VsyncWaiterIOS::VsyncWaiterIOS(const flutter::TaskRunners& task_runners)
|
||||
: VsyncWaiter(task_runners) {
|
||||
auto callback = [this](std::unique_ptr<flutter::FrameTimingsRecorder> recorder) {
|
||||
const fml::TimePoint start_time = recorder->GetVsyncStartTime();
|
||||
const fml::TimePoint target_time = recorder->GetVsyncTargetTime();
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace flutter {
|
||||
class IOSExternalTextureMetal final : public Texture {
|
||||
public:
|
||||
explicit IOSExternalTextureMetal(
|
||||
fml::scoped_nsobject<FlutterDarwinExternalTextureMetal>
|
||||
const fml::scoped_nsobject<FlutterDarwinExternalTextureMetal>&
|
||||
darwin_external_texture_metal);
|
||||
|
||||
// |Texture|
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
namespace flutter {
|
||||
|
||||
IOSExternalTextureMetal::IOSExternalTextureMetal(
|
||||
fml::scoped_nsobject<FlutterDarwinExternalTextureMetal> darwin_external_texture_metal)
|
||||
const fml::scoped_nsobject<FlutterDarwinExternalTextureMetal>& darwin_external_texture_metal)
|
||||
: Texture([darwin_external_texture_metal textureID]),
|
||||
darwin_external_texture_metal_(darwin_external_texture_metal) {}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace flutter {
|
||||
IOSExternalViewEmbedder::IOSExternalViewEmbedder(
|
||||
const std::shared_ptr<FlutterPlatformViewsController>& platform_views_controller,
|
||||
std::shared_ptr<IOSContext> context)
|
||||
: platform_views_controller_(platform_views_controller), ios_context_(context) {
|
||||
: platform_views_controller_(platform_views_controller), ios_context_(std::move(context)) {
|
||||
FML_CHECK(ios_context_);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ void IOSExternalViewEmbedder::SubmitFrame(GrDirectContext* context,
|
||||
std::unique_ptr<SurfaceFrame> frame) {
|
||||
TRACE_EVENT0("flutter", "IOSExternalViewEmbedder::SubmitFrame");
|
||||
FML_CHECK(platform_views_controller_);
|
||||
platform_views_controller_->SubmitFrame(std::move(context), ios_context_, std::move(frame));
|
||||
platform_views_controller_->SubmitFrame(context, ios_context_, std::move(frame));
|
||||
TRACE_EVENT0("flutter", "IOSExternalViewEmbedder::DidSubmitFrame");
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ bool IsIosEmbeddedViewsPreviewEnabled();
|
||||
class IOSSurface {
|
||||
public:
|
||||
static std::unique_ptr<IOSSurface> Create(std::shared_ptr<IOSContext> context,
|
||||
fml::scoped_nsobject<CALayer> layer);
|
||||
const fml::scoped_nsobject<CALayer>& layer);
|
||||
|
||||
std::shared_ptr<IOSContext> GetContext() const;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
namespace flutter {
|
||||
|
||||
std::unique_ptr<IOSSurface> IOSSurface::Create(std::shared_ptr<IOSContext> context,
|
||||
fml::scoped_nsobject<CALayer> layer) {
|
||||
const fml::scoped_nsobject<CALayer>& layer) {
|
||||
FML_DCHECK(layer);
|
||||
FML_DCHECK(context);
|
||||
|
||||
@@ -42,7 +42,7 @@ std::unique_ptr<IOSSurface> IOSSurface::Create(std::shared_ptr<IOSContext> conte
|
||||
}
|
||||
#endif // SHELL_ENABLE_METAL
|
||||
|
||||
return std::make_unique<IOSSurfaceSoftware>(std::move(layer), // layer
|
||||
return std::make_unique<IOSSurfaceSoftware>(layer, // layer
|
||||
std::move(context) // context
|
||||
);
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ class SK_API_AVAILABLE_CA_METAL_LAYER IOSSurfaceMetalImpeller final
|
||||
: public IOSSurface,
|
||||
public GPUSurfaceMetalDelegate {
|
||||
public:
|
||||
IOSSurfaceMetalImpeller(fml::scoped_nsobject<CAMetalLayer> layer,
|
||||
std::shared_ptr<IOSContext> context);
|
||||
IOSSurfaceMetalImpeller(const fml::scoped_nsobject<CAMetalLayer>& layer,
|
||||
const std::shared_ptr<IOSContext>& context);
|
||||
|
||||
// |IOSSurface|
|
||||
~IOSSurfaceMetalImpeller();
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
|
||||
namespace flutter {
|
||||
|
||||
IOSSurfaceMetalImpeller::IOSSurfaceMetalImpeller(fml::scoped_nsobject<CAMetalLayer> layer,
|
||||
std::shared_ptr<IOSContext> context)
|
||||
IOSSurfaceMetalImpeller::IOSSurfaceMetalImpeller(const fml::scoped_nsobject<CAMetalLayer>& layer,
|
||||
const std::shared_ptr<IOSContext>& context)
|
||||
: IOSSurface(context),
|
||||
GPUSurfaceMetalDelegate(MTLRenderTargetType::kCAMetalLayer),
|
||||
layer_(std::move(layer)),
|
||||
layer_(layer),
|
||||
impeller_context_(context ? context->GetImpellerContext() : nullptr) {
|
||||
if (!impeller_context_) {
|
||||
return;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace flutter {
|
||||
class SK_API_AVAILABLE_CA_METAL_LAYER IOSSurfaceMetalSkia final : public IOSSurface,
|
||||
public GPUSurfaceMetalDelegate {
|
||||
public:
|
||||
IOSSurfaceMetalSkia(fml::scoped_nsobject<CAMetalLayer> layer,
|
||||
IOSSurfaceMetalSkia(const fml::scoped_nsobject<CAMetalLayer>& layer,
|
||||
std::shared_ptr<IOSContext> context);
|
||||
|
||||
// |IOSSurface|
|
||||
|
||||
@@ -14,11 +14,11 @@ static IOSContextMetalSkia* CastToMetalContext(const std::shared_ptr<IOSContext>
|
||||
return reinterpret_cast<IOSContextMetalSkia*>(context.get());
|
||||
}
|
||||
|
||||
IOSSurfaceMetalSkia::IOSSurfaceMetalSkia(fml::scoped_nsobject<CAMetalLayer> layer,
|
||||
IOSSurfaceMetalSkia::IOSSurfaceMetalSkia(const fml::scoped_nsobject<CAMetalLayer>& layer,
|
||||
std::shared_ptr<IOSContext> context)
|
||||
: IOSSurface(std::move(context)),
|
||||
GPUSurfaceMetalDelegate(MTLRenderTargetType::kCAMetalLayer),
|
||||
layer_(std::move(layer)) {
|
||||
layer_(layer) {
|
||||
is_valid_ = layer_;
|
||||
auto metal_context = CastToMetalContext(GetContext());
|
||||
auto darwin_context = metal_context->GetDarwinContext().get();
|
||||
|
||||
@@ -18,7 +18,8 @@ namespace flutter {
|
||||
|
||||
class IOSSurfaceSoftware final : public IOSSurface, public GPUSurfaceSoftwareDelegate {
|
||||
public:
|
||||
IOSSurfaceSoftware(fml::scoped_nsobject<CALayer> layer, std::shared_ptr<IOSContext> context);
|
||||
IOSSurfaceSoftware(const fml::scoped_nsobject<CALayer>& layer,
|
||||
std::shared_ptr<IOSContext> context);
|
||||
|
||||
~IOSSurfaceSoftware() override;
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
|
||||
namespace flutter {
|
||||
|
||||
IOSSurfaceSoftware::IOSSurfaceSoftware(fml::scoped_nsobject<CALayer> layer,
|
||||
IOSSurfaceSoftware::IOSSurfaceSoftware(const fml::scoped_nsobject<CALayer>& layer,
|
||||
std::shared_ptr<IOSContext> context)
|
||||
: IOSSurface(std::move(context)), layer_(std::move(layer)) {}
|
||||
: IOSSurface(std::move(context)), layer_(layer) {}
|
||||
|
||||
IOSSurfaceSoftware::~IOSSurfaceSoftware() = default;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class PlatformMessageHandlerIos : public PlatformMessageHandler {
|
||||
public:
|
||||
static NSObject<FlutterTaskQueue>* MakeBackgroundTaskQueue();
|
||||
|
||||
PlatformMessageHandlerIos(TaskRunners task_runners);
|
||||
PlatformMessageHandlerIos(const TaskRunners& task_runners);
|
||||
|
||||
void HandlePlatformMessage(std::unique_ptr<PlatformMessage> message) override;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ NSObject<FlutterTaskQueue>* PlatformMessageHandlerIos::MakeBackgroundTaskQueue()
|
||||
return [[[FLTSerialTaskQueue alloc] init] autorelease];
|
||||
}
|
||||
|
||||
PlatformMessageHandlerIos::PlatformMessageHandlerIos(TaskRunners task_runners)
|
||||
PlatformMessageHandlerIos::PlatformMessageHandlerIos(const TaskRunners& task_runners)
|
||||
: task_runners_(task_runners) {}
|
||||
|
||||
void PlatformMessageHandlerIos::HandlePlatformMessage(std::unique_ptr<PlatformMessage> message) {
|
||||
|
||||
@@ -43,13 +43,13 @@ class PlatformViewIOS final : public PlatformView {
|
||||
PlatformViewIOS(PlatformView::Delegate& delegate,
|
||||
const std::shared_ptr<IOSContext>& context,
|
||||
const std::shared_ptr<FlutterPlatformViewsController>& platform_views_controller,
|
||||
flutter::TaskRunners task_runners);
|
||||
const flutter::TaskRunners& task_runners);
|
||||
|
||||
explicit PlatformViewIOS(
|
||||
PlatformView::Delegate& delegate,
|
||||
IOSRenderingAPI rendering_api,
|
||||
const std::shared_ptr<FlutterPlatformViewsController>& platform_views_controller,
|
||||
flutter::TaskRunners task_runners);
|
||||
const flutter::TaskRunners& task_runners);
|
||||
|
||||
~PlatformViewIOS() override;
|
||||
|
||||
@@ -64,7 +64,7 @@ class PlatformViewIOS final : public PlatformView {
|
||||
* this PlatformViewIOS. This should be updated when the `FlutterEngine`
|
||||
* is given a new `FlutterViewController`.
|
||||
*/
|
||||
void SetOwnerViewController(fml::WeakPtr<FlutterViewController> owner_controller);
|
||||
void SetOwnerViewController(const fml::WeakPtr<FlutterViewController>& owner_controller);
|
||||
|
||||
/**
|
||||
* Called one time per `FlutterViewController` when the `FlutterViewController`'s
|
||||
|
||||
@@ -43,8 +43,8 @@ PlatformViewIOS::PlatformViewIOS(
|
||||
PlatformView::Delegate& delegate,
|
||||
const std::shared_ptr<IOSContext>& context,
|
||||
const std::shared_ptr<FlutterPlatformViewsController>& platform_views_controller,
|
||||
flutter::TaskRunners task_runners)
|
||||
: PlatformView(delegate, std::move(task_runners)),
|
||||
const flutter::TaskRunners& task_runners)
|
||||
: PlatformView(delegate, task_runners),
|
||||
ios_context_(context),
|
||||
platform_views_controller_(platform_views_controller),
|
||||
accessibility_bridge_([this](bool enabled) { PlatformView::SetSemanticsEnabled(enabled); }),
|
||||
@@ -54,7 +54,7 @@ PlatformViewIOS::PlatformViewIOS(
|
||||
PlatformView::Delegate& delegate,
|
||||
IOSRenderingAPI rendering_api,
|
||||
const std::shared_ptr<FlutterPlatformViewsController>& platform_views_controller,
|
||||
flutter::TaskRunners task_runners)
|
||||
const flutter::TaskRunners& task_runners)
|
||||
: PlatformViewIOS(
|
||||
delegate,
|
||||
IOSContext::Create(
|
||||
@@ -76,7 +76,8 @@ fml::WeakPtr<FlutterViewController> PlatformViewIOS::GetOwnerViewController() co
|
||||
return owner_controller_;
|
||||
}
|
||||
|
||||
void PlatformViewIOS::SetOwnerViewController(fml::WeakPtr<FlutterViewController> owner_controller) {
|
||||
void PlatformViewIOS::SetOwnerViewController(
|
||||
const fml::WeakPtr<FlutterViewController>& owner_controller) {
|
||||
FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread());
|
||||
std::lock_guard<std::mutex> guard(ios_surface_mutex_);
|
||||
if (ios_surface_ || !owner_controller) {
|
||||
@@ -189,7 +190,7 @@ void PlatformViewIOS::UpdateSemantics(flutter::SemanticsNodeUpdates update,
|
||||
flutter::CustomAccessibilityActionUpdates actions) {
|
||||
FML_DCHECK(owner_controller_);
|
||||
if (accessibility_bridge_) {
|
||||
accessibility_bridge_.get()->UpdateSemantics(std::move(update), std::move(actions));
|
||||
accessibility_bridge_.get()->UpdateSemantics(std::move(update), actions);
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:FlutterSemanticsUpdateNotification
|
||||
object:owner_controller_.get()];
|
||||
}
|
||||
|
||||
@@ -11,8 +11,7 @@ namespace flutter {
|
||||
|
||||
EventLoop::EventLoop(std::thread::id main_thread_id,
|
||||
const TaskExpiredCallback& on_task_expired)
|
||||
: main_thread_id_(main_thread_id),
|
||||
on_task_expired_(std::move(on_task_expired)) {}
|
||||
: main_thread_id_(main_thread_id), on_task_expired_(on_task_expired) {}
|
||||
|
||||
EventLoop::~EventLoop() = default;
|
||||
|
||||
|
||||
@@ -424,8 +424,8 @@ static void GLFWScrollCallback(GLFWwindow* window,
|
||||
auto* controller = GetWindowController(window);
|
||||
SetEventPhaseFromCursorButtonState(window, &event, controller->buttons);
|
||||
event.signal_kind = FlutterPointerSignalKind::kFlutterPointerSignalKindScroll;
|
||||
// TODO: See if this can be queried from the OS; this value is chosen
|
||||
// arbitrarily to get something that feels reasonable.
|
||||
// TODO(chrome-bot): See if this can be queried from the OS; this value is
|
||||
// chosen arbitrarily to get something that feels reasonable.
|
||||
const int kScrollOffsetMultiplier = 20;
|
||||
event.scroll_delta_x = delta_x * kScrollOffsetMultiplier;
|
||||
event.scroll_delta_y = -delta_y * kScrollOffsetMultiplier;
|
||||
@@ -596,7 +596,7 @@ static void GLFWErrorCallback(int error_code, const char* description) {
|
||||
|
||||
// Attempts to load AOT data from the given path, which must be absolute and
|
||||
// non-empty. Logs and returns nullptr on failure.
|
||||
UniqueAotDataPtr LoadAotData(std::filesystem::path aot_data_path) {
|
||||
UniqueAotDataPtr LoadAotData(const std::filesystem::path& aot_data_path) {
|
||||
if (aot_data_path.empty()) {
|
||||
std::cerr
|
||||
<< "Attempted to load AOT data, but no aot_data_path was provided."
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace flutter {
|
||||
|
||||
GLFWEventLoop::GLFWEventLoop(std::thread::id main_thread_id,
|
||||
const TaskExpiredCallback& on_task_expired)
|
||||
: EventLoop(main_thread_id, std::move(on_task_expired)) {}
|
||||
: EventLoop(main_thread_id, on_task_expired) {}
|
||||
|
||||
GLFWEventLoop::~GLFWEventLoop() = default;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace flutter {
|
||||
|
||||
HeadlessEventLoop::HeadlessEventLoop(std::thread::id main_thread_id,
|
||||
const TaskExpiredCallback& on_task_expired)
|
||||
: EventLoop(main_thread_id, std::move(on_task_expired)) {}
|
||||
: EventLoop(main_thread_id, on_task_expired) {}
|
||||
|
||||
HeadlessEventLoop::~HeadlessEventLoop() = default;
|
||||
|
||||
|
||||
@@ -117,8 +117,8 @@ void KeyEventHandler::KeyboardHook(GLFWwindow* window,
|
||||
int scancode,
|
||||
int action,
|
||||
int mods) {
|
||||
// TODO: Translate to a cross-platform key code system rather than passing
|
||||
// the native key code.
|
||||
// TODO(chrome-bot): Translate to a cross-platform key code system rather than
|
||||
// passing the native key code.
|
||||
// NOLINTNEXTLINE(clang-analyzer-core.NullDereference)
|
||||
rapidjson::Document event(rapidjson::kObjectType);
|
||||
auto& allocator = event.GetAllocator();
|
||||
|
||||
@@ -59,7 +59,7 @@ int ComputeVariantMask(const LanguageInfo& info) {
|
||||
// For example, "de_DE@euro" would append "de_DE@euro", "de@euro", "de_DE",
|
||||
// and "de".
|
||||
void AppendLocaleVariants(std::vector<LanguageInfo>& languages,
|
||||
LanguageInfo info) {
|
||||
const LanguageInfo& info) {
|
||||
int mask = ComputeVariantMask(info);
|
||||
for (int i = mask; i >= 0; --i) {
|
||||
if ((i & ~mask) == 0) {
|
||||
|
||||
@@ -410,7 +410,7 @@ TEST(FlKeyEmbedderResponderTest, TapNumPadKeysBetweenNumLockEvents) {
|
||||
EXPECT_EQ(record->event->type, kFlutterKeyEventTypeDown);
|
||||
EXPECT_EQ(record->event->physical, kPhysicalNumpad1);
|
||||
EXPECT_EQ(record->event->logical, kLogicalNumpad1);
|
||||
EXPECT_STREQ(record->event->character, nullptr); // TODO
|
||||
EXPECT_STREQ(record->event->character, nullptr); // TODO(chrome-bot):
|
||||
EXPECT_EQ(record->event->synthesized, false);
|
||||
|
||||
invoke_record_callback_and_verify(record, TRUE, &user_data);
|
||||
@@ -482,7 +482,7 @@ TEST(FlKeyEmbedderResponderTest, TapNumPadKeysBetweenNumLockEvents) {
|
||||
EXPECT_EQ(record->event->type, kFlutterKeyEventTypeDown);
|
||||
EXPECT_EQ(record->event->physical, kPhysicalNumpad1);
|
||||
EXPECT_EQ(record->event->logical, kLogicalNumpad1);
|
||||
EXPECT_STREQ(record->event->character, nullptr); // TODO
|
||||
EXPECT_STREQ(record->event->character, nullptr); // TODO(chrome-bot):
|
||||
EXPECT_EQ(record->event->synthesized, false);
|
||||
|
||||
invoke_record_callback_and_verify(record, TRUE, &user_data);
|
||||
|
||||
@@ -449,7 +449,7 @@ class KeyboardTester {
|
||||
void respondToEmbedderCallsWith(bool response) {
|
||||
fl_mock_view_set_embedder_handler(
|
||||
view_, [response, this](const FlutterKeyEvent* event,
|
||||
AsyncKeyCallback callback) {
|
||||
const AsyncKeyCallback& callback) {
|
||||
EXPECT_FALSE(during_redispatch_);
|
||||
callback(response);
|
||||
});
|
||||
@@ -477,7 +477,7 @@ class KeyboardTester {
|
||||
std::vector<CallRecord>& storage) {
|
||||
fl_mock_view_set_embedder_handler(
|
||||
view_, [&storage, response, this](const FlutterKeyEvent* event,
|
||||
AsyncKeyCallback callback) {
|
||||
const AsyncKeyCallback& callback) {
|
||||
EXPECT_FALSE(during_redispatch_);
|
||||
auto new_event = std::make_unique<FlutterKeyEvent>(*event);
|
||||
char* new_event_character = cloneString(event->character);
|
||||
@@ -493,7 +493,7 @@ class KeyboardTester {
|
||||
|
||||
void respondToChannelCallsWith(bool response) {
|
||||
fl_mock_key_binary_messenger_set_callback_handler(
|
||||
view_->messenger, [response, this](AsyncKeyCallback callback) {
|
||||
view_->messenger, [response, this](const AsyncKeyCallback& callback) {
|
||||
EXPECT_FALSE(during_redispatch_);
|
||||
callback(response);
|
||||
});
|
||||
|
||||
@@ -87,8 +87,8 @@ void fl_scrolling_manager_handle_scroll_event(FlScrollingManager* self,
|
||||
scroll_delta_x *= kScrollOffsetMultiplier * scale_factor;
|
||||
scroll_delta_y *= kScrollOffsetMultiplier * scale_factor;
|
||||
|
||||
if (gdk_device_get_source(gdk_event_get_source_device((GdkEvent*)event)) ==
|
||||
GDK_SOURCE_TOUCHPAD) {
|
||||
if (gdk_device_get_source(gdk_event_get_source_device(
|
||||
reinterpret_cast<GdkEvent*>(event))) == GDK_SOURCE_TOUCHPAD) {
|
||||
scroll_delta_x *= -1;
|
||||
scroll_delta_y *= -1;
|
||||
if (event->is_stop) {
|
||||
|
||||
@@ -222,13 +222,14 @@ struct _FakeGdkDevice {
|
||||
GdkInputSource source;
|
||||
};
|
||||
GdkDevice* makeFakeDevice(GdkInputSource source) {
|
||||
_FakeGdkDevice* device = (_FakeGdkDevice*)g_malloc0(sizeof(_FakeGdkDevice));
|
||||
_FakeGdkDevice* device =
|
||||
static_cast<_FakeGdkDevice*>(g_malloc0(sizeof(_FakeGdkDevice)));
|
||||
device->source = source;
|
||||
// Bully the type checker
|
||||
((GTypeInstance*)device)->g_class =
|
||||
(GTypeClass*)g_malloc0(sizeof(GTypeClass));
|
||||
((GTypeInstance*)device)->g_class->g_type = GDK_TYPE_DEVICE;
|
||||
return (GdkDevice*)device;
|
||||
(reinterpret_cast<GTypeInstance*>(device))->g_class =
|
||||
static_cast<GTypeClass*>(g_malloc0(sizeof(GTypeClass)));
|
||||
(reinterpret_cast<GTypeInstance*>(device))->g_class->g_type = GDK_TYPE_DEVICE;
|
||||
return reinterpret_cast<GdkDevice*>(device);
|
||||
}
|
||||
|
||||
TEST(FlScrollingManagerTest, DiscreteDirectionional) {
|
||||
@@ -238,7 +239,8 @@ TEST(FlScrollingManagerTest, DiscreteDirectionional) {
|
||||
tester.recordMousePointerCallsTo(mouse_records);
|
||||
tester.recordPointerPanZoomCallsTo(pan_zoom_records);
|
||||
GdkDevice* mouse = makeFakeDevice(GDK_SOURCE_MOUSE);
|
||||
GdkEventScroll* event = (GdkEventScroll*)gdk_event_new(GDK_SCROLL);
|
||||
GdkEventScroll* event =
|
||||
reinterpret_cast<GdkEventScroll*>(gdk_event_new(GDK_SCROLL));
|
||||
event->time = 1;
|
||||
event->x = 4.0;
|
||||
event->y = 8.0;
|
||||
@@ -292,7 +294,8 @@ TEST(FlScrollingManagerTest, DiscreteScrolling) {
|
||||
tester.recordMousePointerCallsTo(mouse_records);
|
||||
tester.recordPointerPanZoomCallsTo(pan_zoom_records);
|
||||
GdkDevice* mouse = makeFakeDevice(GDK_SOURCE_MOUSE);
|
||||
GdkEventScroll* event = (GdkEventScroll*)gdk_event_new(GDK_SCROLL);
|
||||
GdkEventScroll* event =
|
||||
reinterpret_cast<GdkEventScroll*>(gdk_event_new(GDK_SCROLL));
|
||||
event->time = 1;
|
||||
event->x = 4.0;
|
||||
event->y = 8.0;
|
||||
@@ -318,7 +321,8 @@ TEST(FlScrollingManagerTest, Panning) {
|
||||
tester.recordMousePointerCallsTo(mouse_records);
|
||||
tester.recordPointerPanZoomCallsTo(pan_zoom_records);
|
||||
GdkDevice* touchpad = makeFakeDevice(GDK_SOURCE_TOUCHPAD);
|
||||
GdkEventScroll* event = (GdkEventScroll*)gdk_event_new(GDK_SCROLL);
|
||||
GdkEventScroll* event =
|
||||
reinterpret_cast<GdkEventScroll*>(gdk_event_new(GDK_SCROLL));
|
||||
event->time = 1;
|
||||
event->x = 4.0;
|
||||
event->y = 8.0;
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "flutter/shell/platform/linux/fl_text_input_plugin.h"
|
||||
#include <utility>
|
||||
|
||||
#include "flutter/shell/platform/linux/fl_method_codec_private.h"
|
||||
#include "flutter/shell/platform/linux/fl_text_input_plugin.h"
|
||||
#include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h"
|
||||
#include "flutter/shell/platform/linux/public/flutter_linux/fl_json_method_codec.h"
|
||||
#include "flutter/shell/platform/linux/public/flutter_linux/fl_value.h"
|
||||
@@ -44,7 +46,7 @@ class MethodCallMatcher {
|
||||
|
||||
explicit MethodCallMatcher(::testing::Matcher<std::string> name,
|
||||
::testing::Matcher<FlValue*> args)
|
||||
: name_(name), args_(args) {}
|
||||
: name_(std::move(name)), args_(std::move(args)) {}
|
||||
|
||||
bool MatchAndExplain(GBytes* method_call,
|
||||
::testing::MatchResultListener* result_listener) const {
|
||||
@@ -89,9 +91,9 @@ class MethodCallMatcher {
|
||||
::testing::Matcher<FlValue*> args_;
|
||||
};
|
||||
|
||||
::testing::Matcher<GBytes*> MethodCall(std::string name,
|
||||
::testing::Matcher<GBytes*> MethodCall(const std::string& name,
|
||||
::testing::Matcher<FlValue*> args) {
|
||||
return MethodCallMatcher(::testing::StrEq(name), args);
|
||||
return MethodCallMatcher(::testing::StrEq(name), std::move(args));
|
||||
}
|
||||
|
||||
static FlValue* build_map(std::map<const gchar*, FlValue*> args) {
|
||||
|
||||
@@ -222,8 +222,9 @@ static void add_pending_child(FlView* self,
|
||||
static GList* find_child(GList* list, GtkWidget* widget) {
|
||||
for (GList* i = list; i; i = i->next) {
|
||||
FlViewChild* child = reinterpret_cast<FlViewChild*>(i->data);
|
||||
if (child && child->widget == widget)
|
||||
if (child && child->widget == widget) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <cstring>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
#include "flutter/shell/platform/embedder/embedder.h"
|
||||
#include "flutter/shell/platform/linux/fl_method_codec_private.h"
|
||||
@@ -27,7 +28,7 @@ struct _FlutterEngineTexture {
|
||||
};
|
||||
|
||||
struct _FlutterEngine {
|
||||
bool running;
|
||||
bool running = false;
|
||||
FlutterPlatformMessageCallback platform_message_callback;
|
||||
FlutterTaskRunnerPostTaskCallback platform_post_task_callback;
|
||||
void* user_data;
|
||||
@@ -36,8 +37,7 @@ struct _FlutterEngine {
|
||||
_FlutterEngine(FlutterPlatformMessageCallback platform_message_callback,
|
||||
FlutterTaskRunnerPostTaskCallback platform_post_task_callback,
|
||||
void* user_data)
|
||||
: running(false),
|
||||
platform_message_callback(platform_message_callback),
|
||||
: platform_message_callback(platform_message_callback),
|
||||
platform_post_task_callback(platform_post_task_callback),
|
||||
user_data(user_data) {}
|
||||
};
|
||||
@@ -52,7 +52,7 @@ struct _FlutterPlatformMessageResponseHandle {
|
||||
explicit _FlutterPlatformMessageResponseHandle(std::string channel)
|
||||
: data_callback(nullptr),
|
||||
user_data(nullptr),
|
||||
channel(channel),
|
||||
channel(std::move(channel)),
|
||||
released(false) {}
|
||||
|
||||
// Constructor for a response handle generated by the shell.
|
||||
|
||||
@@ -254,10 +254,11 @@ sk_sp<SkSurface> VulkanSwapchain::CreateSkiaSurface(
|
||||
);
|
||||
}
|
||||
|
||||
bool VulkanSwapchain::CreateSwapchainImages(GrDirectContext* skia_context,
|
||||
SkColorType color_type,
|
||||
sk_sp<SkColorSpace> color_space,
|
||||
VkImageUsageFlags usage_flags) {
|
||||
bool VulkanSwapchain::CreateSwapchainImages(
|
||||
GrDirectContext* skia_context,
|
||||
SkColorType color_type,
|
||||
const sk_sp<SkColorSpace>& color_space,
|
||||
VkImageUsageFlags usage_flags) {
|
||||
std::vector<VkImage> images = GetImages();
|
||||
|
||||
if (images.empty()) {
|
||||
|
||||
@@ -79,7 +79,7 @@ class VulkanSwapchain {
|
||||
|
||||
bool CreateSwapchainImages(GrDirectContext* skia_context,
|
||||
SkColorType color_type,
|
||||
sk_sp<SkColorSpace> color_space,
|
||||
const sk_sp<SkColorSpace>& color_space,
|
||||
VkImageUsageFlags usage_flags);
|
||||
|
||||
sk_sp<SkSurface> CreateSkiaSurface(GrDirectContext* skia_context,
|
||||
|
||||
Reference in New Issue
Block a user