提交 9eb446e0 编写于 作者: C Chinmay Garde 提交者: GitHub

Move shell to //flutter and split shell/BUILD.gn into smaller pieces for each subcomponent. (#3053)

* Namespaces have been updated to reflect the move from //flutter/sky/shell to //flutter/shell.
* shell/BUILD.gn file has been split into smaller GN files for each subcomponent of the shell (common, GPU, diagnostic, testing).
* GN dependencies have been rewritten to stop exposing common shell dependencies as public. Duplicates have also been removed.
* GPU subcomponent has been updated make it more suitable for Vulkan integration.
* The GLFW backend has been resurrected.
上级 52c1243f
......@@ -24,7 +24,6 @@ group("flutter") {
if (is_ios) {
deps += [
"//flutter/services/dynamic:sdk_lib_archive",
"//flutter/sky/shell:flutter_framework",
]
}
}
......
......@@ -45,7 +45,7 @@ allowed_hosts = [
]
deps = {
'src': 'https://github.com/flutter/buildroot.git' + '@' + '7b77c0acedf708749b68304cc5f0ac469c9d7136',
'src': 'https://github.com/flutter/buildroot.git' + '@' + '1c9494e60378bd119d910d530344077fc091b3a5',
# Fuchsia compatibility
#
......
# Copyright 2015 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.
group("shell") {
deps = [ "platform" ]
}
# 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.
import("//mojo/dart/embedder/embedder.gni")
dart_embedder_resources("generate_embedder_diagnostic_server_resources_cc") {
inputs = [
"//flutter/shell/common/diagnostic/diagnostic_server.dart"
]
root_prefix = "//flutter/shell/common/diagnostic/"
output = "$target_gen_dir/embedder_diagnostic_server_resources.cc"
table_name = "sky_embedder_diagnostic_server"
}
source_set("common") {
sources = [
"$target_gen_dir/embedder_diagnostic_server_resources.cc",
"animator.cc",
"animator.h",
"diagnostic/diagnostic_server.cc",
"diagnostic/diagnostic_server.h",
"engine.cc",
"engine.h",
"picture_serializer.cc",
"picture_serializer.h",
"platform_view.cc",
"platform_view.h",
"platform_view_service_protocol.cc",
"platform_view_service_protocol.h",
"rasterizer.cc",
"rasterizer.h",
"shell.cc",
"shell.h",
"switches.cc",
"switches.h",
"systrace_logger.cc",
"systrace_logger.h",
"tracing_controller.cc",
"tracing_controller.h",
"ui_delegate.cc",
"ui_delegate.h",
]
deps = [
"//base",
"//base:i18n",
"//dart/runtime/vm:libdart_platform",
"//dart/runtime:libdart",
"//flutter/assets",
"//flutter/common",
"//flutter/flow",
"//flutter/glue",
"//flutter/lib/ui",
"//flutter/runtime",
"//flutter/services/engine:interfaces",
"//flutter/services/vsync",
"//flutter/skia",
"//flutter/sky/engine/wtf",
"//flutter/synchronization",
"//lib/ftl",
"//lib/tonic",
"//mojo/application",
"//mojo/message_pump",
"//mojo/public/cpp/bindings:utility",
"//mojo/public/interfaces/application",
"//mojo/services/vsync/interfaces",
":generate_embedder_diagnostic_server_resources_cc",
]
}
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/ui/animator.h"
#include "flutter/shell/common/animator.h"
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
......@@ -10,7 +10,6 @@
#include "flutter/common/threads.h"
#include "lib/ftl/time/stopwatch.h"
namespace sky {
namespace shell {
Animator::Animator(Rasterizer* rasterizer, Engine* engine)
......@@ -20,7 +19,7 @@ Animator::Animator(Rasterizer* rasterizer, Engine* engine)
pending_frame_semaphore_(1),
paused_(false),
weak_factory_(this) {
new services::vsync::VsyncProviderFallbackImpl(
new sky::services::vsync::VsyncProviderFallbackImpl(
mojo::InterfaceRequest<::vsync::VSyncProvider>(
mojo::GetProxy(&fallback_vsync_provider_)));
}
......@@ -144,4 +143,3 @@ void Animator::AwaitVSync(
}
} // namespace shell
} // namespace sky
......@@ -2,20 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_UI_ANIMATOR_H_
#define SKY_SHELL_UI_ANIMATOR_H_
#ifndef SHELL_COMMON_ANIMATOR_H_
#define SHELL_COMMON_ANIMATOR_H_
#include "base/memory/weak_ptr.h"
#include "flutter/sky/shell/rasterizer.h"
#include "flutter/sky/shell/ui/engine.h"
#include "flutter/services/vsync/fallback/vsync_provider_fallback_impl.h"
#include "flutter/shell/common/engine.h"
#include "flutter/shell/common/rasterizer.h"
#include "flutter/synchronization/pipeline.h"
#include "flutter/synchronization/semaphore.h"
#include "lib/ftl/memory/ref_ptr.h"
#include "lib/ftl/time/time_point.h"
#include "mojo/services/vsync/interfaces/vsync.mojom.h"
#include "flutter/services/vsync/fallback/vsync_provider_fallback_impl.h"
namespace sky {
namespace shell {
class Animator {
......@@ -57,6 +56,5 @@ class Animator {
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_UI_ANIMATOR_H_
#endif // SHELL_COMMON_ANIMATOR_H_
......@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/diagnostic/diagnostic_server.h"
#include "flutter/shell/common/diagnostic/diagnostic_server.h"
#include "dart/runtime/include/dart_api.h"
#include "dart/runtime/include/dart_native_api.h"
#include "flutter/common/threads.h"
#include "flutter/flow/compositor_context.h"
#include "flutter/runtime/embedder_resources.h"
#include "flutter/sky/shell/gpu/picture_serializer.h"
#include "flutter/sky/shell/rasterizer.h"
#include "flutter/sky/shell/shell.h"
#include "flutter/sky/shell/ui/engine.h"
#include "flutter/shell/common/engine.h"
#include "flutter/shell/common/rasterizer.h"
#include "flutter/shell/common/shell.h"
#include "flutter/shell/common/picture_serializer.h"
#include "lib/ftl/logging.h"
#include "lib/tonic/dart_binding_macros.h"
#include "lib/tonic/dart_library_natives.h"
......@@ -25,7 +25,6 @@ extern ResourcesEntry __sky_embedder_diagnostic_server_resources_[];
}
}
namespace sky {
namespace shell {
using tonic::DartLibraryNatives;
......@@ -134,7 +133,7 @@ void DiagnosticServer::SkiaPictureTask(Dart_Port port_id) {
sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture();
SkDynamicMemoryWStream stream;
sky::PngPixelSerializer serializer;
PngPixelSerializer serializer;
picture->serialize(&stream, &serializer);
SkAutoTUnref<SkData> picture_data(stream.copyToData());
......@@ -149,4 +148,3 @@ void DiagnosticServer::SkiaPictureTask(Dart_Port port_id) {
}
} // namespace shell
} // namespace sky
......@@ -7,7 +7,6 @@
#include "dart/runtime/include/dart_api.h"
namespace sky {
namespace shell {
class DiagnosticServer {
......@@ -20,6 +19,5 @@ class DiagnosticServer {
};
} // namespace shell
} // namespace sky
#endif // SKY_ENGINE_CORE_DIAGNOSTIC_DIAGNOSTIC_SERVER_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/ui/engine.h"
#include "flutter/shell/common/engine.h"
#include <sys/stat.h>
#include <unistd.h>
......@@ -19,14 +19,13 @@
#include "flutter/runtime/dart_controller.h"
#include "flutter/runtime/dart_init.h"
#include "flutter/runtime/runtime_init.h"
#include "flutter/shell/common/animator.h"
#include "flutter/sky/engine/public/web/Sky.h"
#include "flutter/sky/shell/ui/animator.h"
#include "lib/ftl/files/path.h"
#include "mojo/public/cpp/application/connect.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPictureRecorder.h"
namespace sky {
namespace shell {
namespace {
......@@ -115,7 +114,7 @@ void Engine::OnOutputSurfaceDestroyed(const ftl::Closure& gpu_continuation) {
blink::Threads::Gpu()->PostTask(gpu_continuation);
}
void Engine::SetServices(ServicesDataPtr services) {
void Engine::SetServices(sky::ServicesDataPtr services) {
services_ = services.Pass();
if (services_->incoming_services) {
......@@ -140,7 +139,7 @@ void Engine::SetServices(ServicesDataPtr services) {
animator_->set_vsync_provider(vsync_provider.Pass());
}
void Engine::OnViewportMetricsChanged(ViewportMetricsPtr metrics) {
void Engine::OnViewportMetricsChanged(sky::ViewportMetricsPtr metrics) {
viewport_metrics_ = metrics.Pass();
if (runtime_)
runtime_->SetViewportMetrics(viewport_metrics_);
......@@ -335,4 +334,3 @@ void Engine::Render(std::unique_ptr<flow::LayerTree> layer_tree) {
}
} // namespace shell
} // namespace sky
......@@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_UI_ENGINE_H_
#define SKY_SHELL_UI_ENGINE_H_
#ifndef SHELL_COMMON_ENGINE_H_
#define SHELL_COMMON_ENGINE_H_
#include "flutter/assets/zip_asset_store.h"
#include "flutter/glue/drain_data_pipe_job.h"
#include "flutter/runtime/runtime_controller.h"
#include "flutter/runtime/runtime_delegate.h"
#include "flutter/services/engine/sky_engine.mojom.h"
#include "flutter/sky/shell/rasterizer.h"
#include "flutter/sky/shell/ui_delegate.h"
#include "flutter/shell/common/rasterizer.h"
#include "flutter/shell/common/ui_delegate.h"
#include "lib/ftl/macros.h"
#include "lib/ftl/memory/weak_ptr.h"
#include "mojo/public/cpp/application/service_provider_impl.h"
......@@ -23,13 +23,11 @@
#include "mojo/services/asset_bundle/interfaces/asset_bundle.mojom.h"
#include "third_party/skia/include/core/SkPicture.h"
namespace sky {
class PlatformImpl;
namespace shell {
class Animator;
class Engine : public UIDelegate,
public SkyEngine,
public sky::SkyEngine,
public blink::RuntimeDelegate {
public:
explicit Engine(Rasterizer* rasterizer);
......@@ -57,8 +55,8 @@ class Engine : public UIDelegate,
void OnOutputSurfaceDestroyed(const ftl::Closure& gpu_continuation) override;
// SkyEngine implementation:
void SetServices(ServicesDataPtr services) override;
void OnViewportMetricsChanged(ViewportMetricsPtr metrics) override;
void SetServices(sky::ServicesDataPtr services) override;
void OnViewportMetricsChanged(sky::ViewportMetricsPtr metrics) override;
void OnLocaleChanged(const mojo::String& language_code,
const mojo::String& country_code) override;
void OnPointerPacket(pointer::PointerPacketPtr packet) override;
......@@ -96,7 +94,7 @@ class Engine : public UIDelegate,
std::unique_ptr<Animator> animator_;
ServicesDataPtr services_;
sky::ServicesDataPtr services_;
mojo::ServiceProviderImpl service_provider_impl_;
mojo::ServiceProviderPtr incoming_services_;
mojo::BindingSet<mojo::ServiceProvider> service_provider_bindings_;
......@@ -107,7 +105,7 @@ class Engine : public UIDelegate,
std::unique_ptr<glue::DrainDataPipeJob> snapshot_drainer_;
std::string initial_route_;
ViewportMetricsPtr viewport_metrics_;
sky::ViewportMetricsPtr viewport_metrics_;
std::string language_code_;
std::string country_code_;
mojo::Binding<SkyEngine> binding_;
......@@ -123,6 +121,5 @@ class Engine : public UIDelegate,
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_UI_ENGINE_H_
#endif // SHELL_COMMON_ENGINE_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/gpu/picture_serializer.h"
#include "flutter/shell/common/picture_serializer.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkData.h"
......@@ -10,7 +10,7 @@
#include "third_party/skia/include/core/SkPixelSerializer.h"
#include "third_party/skia/include/core/SkStream.h"
namespace sky {
namespace shell {
bool PngPixelSerializer::onUseEncodedData(const void*, size_t) {
return true;
......@@ -33,4 +33,4 @@ void SerializePicture(const std::string& path, SkPicture* picture) {
picture->serialize(&stream, &serializer);
}
} // namespace sky
} // namespace shell
......@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_GPU_PICTURE_SERIALIZER_H_
#define SKY_SHELL_GPU_PICTURE_SERIALIZER_H_
#ifndef SHELL_GPU_PICTURE_SERIALIZER_H_
#define SHELL_GPU_PICTURE_SERIALIZER_H_
#include <string>
#include "third_party/skia/include/core/SkPicture.h"
#include "third_party/skia/include/core/SkPixelSerializer.h"
namespace sky {
namespace shell {
class PngPixelSerializer : public SkPixelSerializer {
public:
......@@ -20,6 +20,6 @@ class PngPixelSerializer : public SkPixelSerializer {
void SerializePicture(const std::string& path, SkPicture* picture);
} // namespace sky
} // namespace shell
#endif // SKY_SHELL_GPU_PICTURE_SERIALIZER_H_
#endif // SHELL_GPU_PICTURE_SERIALIZER_H_
......@@ -2,17 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/platform_view.h"
#include "flutter/shell/common/platform_view.h"
#include <utility>
#include "flutter/common/threads.h"
#include "flutter/glue/movable_wrapper.h"
#include "flutter/lib/ui/painting/resource_context.h"
#include "flutter/sky/shell/rasterizer.h"
#include "flutter/shell/common/rasterizer.h"
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
namespace sky {
namespace shell {
PlatformView::Config::Config() : rasterizer(nullptr) {}
......@@ -39,7 +38,8 @@ PlatformView::~PlatformView() {
blink::Threads::UI()->PostTask([engine]() { delete engine; });
}
void PlatformView::ConnectToEngine(mojo::InterfaceRequest<SkyEngine> request) {
void PlatformView::ConnectToEngine(
mojo::InterfaceRequest<sky::SkyEngine> request) {
ftl::WeakPtr<UIDelegate> ui_delegate = config_.ui_delegate;
auto wrapped_request = glue::WrapMovable(std::move(request));
blink::Threads::UI()->PostTask([ui_delegate, wrapped_request]() mutable {
......@@ -138,4 +138,3 @@ void PlatformView::SetupResourceContextOnIOThreadPerform(
}
} // namespace shell
} // namespace sky
......@@ -2,21 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_PLATFORM_VIEW_H_
#define SKY_SHELL_PLATFORM_VIEW_H_
#ifndef COMMON_PLATFORM_VIEW_H_
#define COMMON_PLATFORM_VIEW_H_
#include <memory>
#include "flutter/shell/common/engine.h"
#include "flutter/shell/common/shell.h"
#include "flutter/shell/common/ui_delegate.h"
#include "lib/ftl/macros.h"
#include "lib/ftl/memory/weak_ptr.h"
#include "lib/ftl/synchronization/waitable_event.h"
#include "flutter/sky/shell/shell.h"
#include "flutter/sky/shell/ui_delegate.h"
#include "flutter/sky/shell/ui/engine.h"
#include "third_party/skia/include/core/SkSize.h"
#include "third_party/skia/include/gpu/GrContext.h"
namespace sky {
namespace shell {
class Rasterizer;
......@@ -45,7 +44,7 @@ class PlatformView {
virtual ~PlatformView();
void ConnectToEngine(mojo::InterfaceRequest<SkyEngine> request);
void ConnectToEngine(mojo::InterfaceRequest<sky::SkyEngine> request);
void NotifyCreated();
......@@ -53,7 +52,7 @@ class PlatformView {
void NotifyDestroyed();
virtual ftl::WeakPtr<sky::shell::PlatformView> GetWeakViewPtr() = 0;
virtual ftl::WeakPtr<PlatformView> GetWeakViewPtr() = 0;
virtual uint64_t DefaultFramebuffer() const = 0;
......@@ -92,6 +91,5 @@ class PlatformView {
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_PLATFORM_VIEW_H_
#endif // COMMON_PLATFORM_VIEW_H_
......@@ -2,15 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/platform_view_service_protocol.h"
#include "flutter/shell/common/platform_view_service_protocol.h"
#include <string.h>
#include <string>
#include "flutter/sky/shell/shell.h"
#include "flutter/shell/common/shell.h"
namespace sky {
namespace shell {
namespace {
......@@ -90,9 +89,10 @@ static void AppendFlutterView(std::stringstream* stream,
*stream << "{\"type\":\"FlutterView\", \"id\": \"" << kViewIdPrefx << "0x"
<< std::hex << view_id << std::dec;
if (isolate_id != ILLEGAL_PORT) {
// Append the isolate (if it exists).
*stream << "\"," << "\"isolate\":";
AppendIsolateRef(stream, isolate_id, isolate_name);
// Append the isolate (if it exists).
*stream << "\","
<< "\"isolate\":";
AppendIsolateRef(stream, isolate_id, isolate_name);
}
*stream << "}";
}
......@@ -155,9 +155,7 @@ bool PlatformViewServiceProtocol::RunInView(const char* method,
Dart_Port main_port = ILLEGAL_PORT;
std::string isolate_name;
shell.RunInPlatformView(view_id_as_num, main_script, packages_file,
asset_directory,
&view_existed,
&main_port,
asset_directory, &view_existed, &main_port,
&isolate_name);
if (!view_existed) {
......@@ -216,4 +214,3 @@ bool PlatformViewServiceProtocol::ListViews(const char* method,
}
} // namespace shell
} // namespace sky
......@@ -2,15 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_PLATFORM_VIEW_SERVICE_PROTOCOL_H_
#define SKY_SHELL_PLATFORM_VIEW_SERVICE_PROTOCOL_H_
#ifndef SHELL_COMMON_VIEW_SERVICE_PROTOCOL_H_
#define SHELL_COMMON_VIEW_SERVICE_PROTOCOL_H_
#include <memory>
#include "flutter/sky/shell/platform_view.h"
#include "dart/runtime/include/dart_tools_api.h"
#include "flutter/shell/common/platform_view.h"
namespace sky {
namespace shell {
class PlatformViewServiceProtocol {
......@@ -36,6 +35,5 @@ class PlatformViewServiceProtocol {
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_PLATFORM_VIEW_SERVICE_PROTOCOL_H_
#endif // SHELL_COMMON_VIEW_SERVICE_PROTOCOL_H_
......@@ -2,13 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/rasterizer.h"
#include "flutter/shell/common/rasterizer.h"
namespace sky {
namespace shell {
Rasterizer::~Rasterizer() {
}
Rasterizer::~Rasterizer() {}
} // namespace shell
} // namespace sky
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_RASTERIZER_H_
#define SKY_SHELL_RASTERIZER_H_
#ifndef SHELL_COMMON_RASTERIZER_H_
#define SHELL_COMMON_RASTERIZER_H_
#include <memory>
......@@ -14,7 +14,6 @@
#include "lib/ftl/synchronization/waitable_event.h"
#include "mojo/public/cpp/bindings/binding.h"
namespace sky {
namespace shell {
class PlatformView;
......@@ -44,6 +43,5 @@ class Rasterizer {
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_RASTERIZER_H_
#endif // SHELL_COMMON_RASTERIZER_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/shell.h"
#include "flutter/shell/common/shell.h"
#include <fcntl.h>
#include <memory>
......@@ -12,8 +12,8 @@
#include "base/command_line.h"
#include "base/i18n/icu_util.h"
#include "base/lazy_instance.h"
#include "base/memory/discardable_memory_allocator.h"
#include "base/memory/discardable_memory.h"
#include "base/memory/discardable_memory_allocator.h"
#include "base/posix/eintr_wrapper.h"
#include "base/single_thread_task_runner.h"
#include "base/trace_event/trace_event.h"
......@@ -22,15 +22,14 @@
#include "flutter/common/threads.h"
#include "flutter/glue/task_runner_adaptor.h"
#include "flutter/runtime/dart_init.h"
#include "flutter/shell/common/engine.h"
#include "flutter/shell/common/platform_view_service_protocol.h"
#include "flutter/shell/common/switches.h"
#include "flutter/shell/common/diagnostic/diagnostic_server.h"
#include "flutter/skia/ext/event_tracer_impl.h"
#include "flutter/sky/shell/diagnostic/diagnostic_server.h"
#include "flutter/sky/shell/platform_view_service_protocol.h"
#include "flutter/sky/shell/switches.h"
#include "flutter/sky/shell/ui/engine.h"
#include "lib/ftl/files/unique_fd.h"
#include "mojo/message_pump/message_pump_mojo.h"
namespace sky {
namespace shell {
namespace {
......@@ -326,4 +325,3 @@ void Shell::RunInPlatformViewUIThread(uintptr_t view_id,
}
} // namespace shell
} // namespace sky
......@@ -2,18 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_SHELL_H_
#define SKY_SHELL_SHELL_H_
#ifndef SHELL_COMMON_SHELL_H_
#define SHELL_COMMON_SHELL_H_
#include "base/threading/thread.h"
#include "flutter/shell/common/tracing_controller.h"
#include "lib/ftl/macros.h"
#include "lib/ftl/memory/ref_ptr.h"
#include "lib/ftl/memory/weak_ptr.h"
#include "lib/ftl/synchronization/waitable_event.h"
#include "lib/ftl/tasks/task_runner.h"
#include "flutter/sky/shell/tracing_controller.h"
namespace sky {
namespace shell {
class PlatformView;
......@@ -102,6 +101,5 @@ class Shell {
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_SHELL_H_
#endif // SHELL_COMMON_SHELL_H_
......@@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/switches.h"
#include "flutter/shell/common/switches.h"
#include <iostream>
namespace sky {
namespace shell {
namespace switches {
......@@ -44,4 +43,3 @@ void PrintUsage(const std::string& executable_name) {
} // namespace switches
} // namespace shell
} // namespace sky
......@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_SWITCHES_H_
#define SKY_SHELL_SWITCHES_H_
#ifndef SHELL_COMMON_SWITCHES_H_
#define SHELL_COMMON_SWITCHES_H_
#include <string>
namespace sky {
namespace shell {
namespace switches {
......@@ -34,6 +33,5 @@ void PrintUsage(const std::string& executable_name);
} // namespace switches
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_SWITCHES_H_
#endif // SHELL_COMMON_SWITCHES_H_
......@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/systrace_logger.h"
#include "flutter/shell/common/systrace_logger.h"
#include "lib/ftl/files/eintr_wrapper.h"
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
namespace sky {
namespace shell {
static const int kBufferSize = 256;
......@@ -53,4 +53,3 @@ void SystraceLogger::TraceCount(const char* label, int count) const {
}
} // namespace shell
} // namespace sky
......@@ -2,14 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_SKY_SHELL_SYSTRACE_LOGGER_H_
#define FLUTTER_SKY_SHELL_SYSTRACE_LOGGER_H_
#ifndef SHELL_COMMON_SYSTRACE_LOGGER_H_
#define SHELL_COMMON_SYSTRACE_LOGGER_H_
#include "lib/ftl/macros.h"
#include <sys/types.h>
namespace sky {
namespace shell {
class SystraceLogger {
......@@ -32,6 +31,5 @@ class SystraceLogger {
};
} // namespace shell
} // namespace sky
#endif // FLUTTER_SKY_SHELL_SYSTRACE_LOGGER_H_
#endif // SHELL_COMMON_SYSTRACE_LOGGER_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/tracing_controller.h"
#include "flutter/shell/common/tracing_controller.h"
#include <string>
......@@ -10,10 +10,9 @@
#include "dart/runtime/include/dart_tools_api.h"
#include "flutter/common/threads.h"
#include "flutter/runtime/dart_init.h"
#include "flutter/sky/shell/shell.h"
#include "flutter/shell/common/shell.h"
#include "lib/ftl/logging.h"
namespace sky {
namespace shell {
TracingController::TracingController()
......@@ -211,4 +210,3 @@ std::string TracingController::PictureTracingPathForCurrentTime(
}
} // namespace shell
} // namespace sky
......@@ -2,14 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef __SKY_SHELL_TRACING_CONTROLLER__
#define __SKY_SHELL_TRACING_CONTROLLER__
#ifndef SHELL_COMMON_TRACING_CONTROLLER_H_
#define SHELL_COMMON_TRACING_CONTROLLER_H_
#include <string>
#include "lib/ftl/macros.h"
namespace sky {
namespace shell {
class TracingController {
......@@ -57,6 +56,5 @@ class TracingController {
};
} // namespace shell
} // namespace sky
#endif /* defined(__SKY_SHELL_TRACING_CONTROLLER__) */
#endif // SHELL_COMMON_TRACING_CONTROLLER_H_
......@@ -2,13 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/ui_delegate.h"
#include "flutter/shell/common/ui_delegate.h"
namespace sky {
namespace shell {
UIDelegate::~UIDelegate() {
}
UIDelegate::~UIDelegate() = default;
} // namespace shell
} // namespace sky
......@@ -2,19 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_UI_DELEGATE_H_
#define SKY_SHELL_UI_DELEGATE_H_
#ifndef SHELL_COMMON_DELEGATE_H_
#define SHELL_COMMON_DELEGATE_H_
#include "flutter/services/engine/sky_engine.mojom.h"
#include "lib/ftl/functional/closure.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "flutter/services/engine/sky_engine.mojom.h"
namespace sky {
namespace shell {
class UIDelegate {
public:
virtual void ConnectToEngine(mojo::InterfaceRequest<SkyEngine> request) = 0;
virtual void ConnectToEngine(
mojo::InterfaceRequest<sky::SkyEngine> request) = 0;
virtual void OnOutputSurfaceCreated(const ftl::Closure& gpu_continuation) = 0;
......@@ -26,6 +26,5 @@ class UIDelegate {
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_UI_DELEGATE_H_
#endif // SHELL_COMMON_DELEGATE_H_
# 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.
source_set("gpu") {
sources = [
"ganesh_canvas.cc",
"ganesh_canvas.h",
"gpu_canvas.cc",
"gpu_canvas.h",
"gpu_canvas_gl.cc",
"gpu_canvas_gl.h",
"gpu_canvas_vulkan.cc",
"gpu_canvas_vulkan.h",
"gpu_rasterizer.cc",
"gpu_rasterizer.h",
]
deps = [
"../common",
"//lib/ftl",
"//flutter/skia",
"//flutter/flow",
"//flutter/common",
"//flutter/glue",
"//mojo/public/cpp/system",
]
}
......@@ -2,14 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/gpu/direct/ganesh_canvas.h"
#include "flutter/shell/gpu/ganesh_canvas.h"
#include "flutter/flow/gl_connection.h"
#include "lib/ftl/arraysize.h"
#include "lib/ftl/logging.h"
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
#include "flutter/flow/gl_connection.h"
namespace sky {
namespace shell {
namespace {
......@@ -88,4 +87,3 @@ bool GaneshCanvas::IsValid() {
}
} // namespace shell
} // namespace sky
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_GPU_DIRECT_GANESH_CANVAS_H_
#define SKY_SHELL_GPU_DIRECT_GANESH_CANVAS_H_
#ifndef SHELL_GPU_DIRECT_GANESH_CANVAS_H_
#define SHELL_GPU_DIRECT_GANESH_CANVAS_H_
#include "lib/ftl/macros.h"
#include "third_party/skia/include/core/SkSize.h"
......@@ -12,7 +12,6 @@
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
#include "third_party/skia/include/gpu/GrContext.h"
namespace sky {
namespace shell {
class GaneshCanvas {
......@@ -38,6 +37,5 @@ class GaneshCanvas {
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_GPU_DIRECT_GANESH_CANVAS_H_
#endif // SHELL_GPU_DIRECT_GANESH_CANVAS_H_
// 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.
#include "gpu_canvas.h"
namespace shell {
//
} // namespace shell
......@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_PLATFORM_GLFW_INIT_GLFW_H_
#define SKY_SHELL_PLATFORM_GLFW_INIT_GLFW_H_
#ifndef SHELL_GPU_GPU_CANVAS_H_
#define SHELL_GPU_GPU_CANVAS_H_
#include "lib/ftl/macros.h"
namespace sky {
namespace shell {
bool InitInteractive();
//
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_PLATFORM_GLFW_INIT_GLFW_H_
#endif // SHELL_GPU_GPU_CANVAS_H_
// 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.
#include "gpu_canvas_gl.h"
namespace shell {
//
} // namespace shell
// 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 SHELL_GPU_GPU_CANVAS_GL_H_
#define SHELL_GPU_GPU_CANVAS_GL_H_
#include "lib/ftl/macros.h"
namespace shell {
//
} // namespace shell
#endif // SHELL_GPU_GPU_CANVAS_GL_H_
// 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.
#include "gpu_canvas_vulkan.h"
namespace shell {
//
} // namespace shell
// 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 SHELL_GPU_GPU_CANVAS_VULKAN_H_
#define SHELL_GPU_GPU_CANVAS_VULKAN_H_
#include "lib/ftl/macros.h"
namespace shell {
//
} // namespace shell
#endif // SHELL_GPU_GPU_CANVAS_VULKAN_H_
......@@ -2,52 +2,44 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/gpu/direct/rasterizer_direct.h"
#include "gpu_rasterizer.h"
#include <string>
#include <utility>
#include "flutter/common/threads.h"
#include "flutter/glue/trace_event.h"
#include "flutter/sky/engine/wtf/PassRefPtr.h"
#include "flutter/sky/engine/wtf/RefPtr.h"
#include "flutter/sky/shell/gpu/picture_serializer.h"
#include "flutter/sky/shell/platform_view.h"
#include "flutter/sky/shell/shell.h"
#include "flutter/shell/common/platform_view.h"
#include "flutter/shell/common/shell.h"
#include "flutter/shell/common/picture_serializer.h"
#include "mojo/public/cpp/system/data_pipe.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPicture.h"
namespace sky {
namespace shell {
RasterizerDirect::RasterizerDirect()
: platform_view_(nullptr), weak_factory_(this) {
GPURasterizer::GPURasterizer() : platform_view_(nullptr), weak_factory_(this) {
auto weak_ptr = weak_factory_.GetWeakPtr();
blink::Threads::Gpu()->PostTask(
[weak_ptr]() { Shell::Shared().AddRasterizer(weak_ptr); });
}
RasterizerDirect::~RasterizerDirect() {
GPURasterizer::~GPURasterizer() {
weak_factory_.InvalidateWeakPtrs();
Shell::Shared().PurgeRasterizers();
}
// Implementation of declaration in sky/shell/rasterizer.h.
std::unique_ptr<Rasterizer> Rasterizer::Create() {
return std::unique_ptr<Rasterizer>(new RasterizerDirect());
return std::unique_ptr<GPURasterizer>(new GPURasterizer());
}
// sky::shell::Rasterizer override.
ftl::WeakPtr<Rasterizer> RasterizerDirect::GetWeakRasterizerPtr() {
ftl::WeakPtr<Rasterizer> GPURasterizer::GetWeakRasterizerPtr() {
return weak_factory_.GetWeakPtr();
}
// sky::shell::Rasterizer override.
void RasterizerDirect::Setup(
PlatformView* platform_view,
ftl::Closure continuation,
ftl::AutoResetWaitableEvent* setup_completion_event) {
void GPURasterizer::Setup(PlatformView* platform_view,
ftl::Closure continuation,
ftl::AutoResetWaitableEvent* setup_completion_event) {
FTL_CHECK(platform_view) << "Must be able to acquire the view.";
// The context needs to be made current before the GrGL interface can be
......@@ -73,7 +65,7 @@ void RasterizerDirect::Setup(
setup_completion_event->Signal();
}
void RasterizerDirect::Clear(SkColor color) {
void GPURasterizer::Clear(SkColor color) {
SkCanvas* canvas = ganesh_canvas_.GetCanvas(
platform_view_->DefaultFramebuffer(), platform_view_->GetSize());
canvas->clear(color);
......@@ -81,8 +73,7 @@ void RasterizerDirect::Clear(SkColor color) {
platform_view_->SwapBuffers();
}
// sky::shell::Rasterizer override.
void RasterizerDirect::Teardown(
void GPURasterizer::Teardown(
ftl::AutoResetWaitableEvent* teardown_completion_event) {
platform_view_ = nullptr;
last_layer_tree_.reset();
......@@ -90,20 +81,19 @@ void RasterizerDirect::Teardown(
teardown_completion_event->Signal();
}
// sky::shell::Rasterizer override.
flow::LayerTree* RasterizerDirect::GetLastLayerTree() {
flow::LayerTree* GPURasterizer::GetLastLayerTree() {
return last_layer_tree_.get();
}
void RasterizerDirect::Draw(
void GPURasterizer::Draw(
ftl::RefPtr<flutter::Pipeline<flow::LayerTree>> pipeline) {
TRACE_EVENT0("flutter", "RasterizerDirect::Draw");
TRACE_EVENT0("flutter", "GPURasterizer::Draw");
if (!platform_view_)
return;
flutter::Pipeline<flow::LayerTree>::Consumer consumer =
std::bind(&RasterizerDirect::DoDraw, this, std::placeholders::_1);
std::bind(&GPURasterizer::DoDraw, this, std::placeholders::_1);
// Consume as many pipeline items as possible. But yield the event loop
// between successive tries.
......@@ -122,7 +112,7 @@ void RasterizerDirect::Draw(
}
}
void RasterizerDirect::DoDraw(std::unique_ptr<flow::LayerTree> layer_tree) {
void GPURasterizer::DoDraw(std::unique_ptr<flow::LayerTree> layer_tree) {
if (!layer_tree) {
return;
}
......@@ -192,4 +182,3 @@ void RasterizerDirect::DoDraw(std::unique_ptr<flow::LayerTree> layer_tree) {
}
} // namespace shell
} // namespace sky
......@@ -2,23 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_GPU_DIRECT_RASTERIZER_DIRECT_H_
#define SKY_SHELL_GPU_DIRECT_RASTERIZER_DIRECT_H_
#ifndef SHELL_GPU_DIRECT_GPU_RASTERIZER_H_
#define SHELL_GPU_DIRECT_GPU_RASTERIZER_H_
#include "flutter/flow/compositor_context.h"
#include "flutter/shell/common/rasterizer.h"
#include "flutter/shell/gpu/ganesh_canvas.h"
#include "lib/ftl/memory/weak_ptr.h"
#include "lib/ftl/synchronization/waitable_event.h"
#include "flutter/sky/shell/gpu/direct/ganesh_canvas.h"
#include "flutter/sky/shell/rasterizer.h"
namespace sky {
namespace shell {
class RasterizerDirect : public Rasterizer {
class GPURasterizer : public Rasterizer {
public:
RasterizerDirect();
GPURasterizer();
~RasterizerDirect() override;
~GPURasterizer() override;
void Setup(PlatformView* platform_view,
ftl::Closure continuation,
......@@ -29,7 +28,7 @@ class RasterizerDirect : public Rasterizer {
void Teardown(
ftl::AutoResetWaitableEvent* teardown_completion_event) override;
ftl::WeakPtr<sky::shell::Rasterizer> GetWeakRasterizerPtr() override;
ftl::WeakPtr<Rasterizer> GetWeakRasterizerPtr() override;
flow::LayerTree* GetLastLayerTree() override;
......@@ -40,14 +39,13 @@ class RasterizerDirect : public Rasterizer {
flow::CompositorContext compositor_context_;
std::unique_ptr<flow::LayerTree> last_layer_tree_;
PlatformView* platform_view_;
ftl::WeakPtrFactory<RasterizerDirect> weak_factory_;
ftl::WeakPtrFactory<GPURasterizer> weak_factory_;
void DoDraw(std::unique_ptr<flow::LayerTree> tree);
FTL_DISALLOW_COPY_AND_ASSIGN(RasterizerDirect);
FTL_DISALLOW_COPY_AND_ASSIGN(GPURasterizer);
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_GPU_DIRECT_RASTERIZER_DIRECT_H_
#endif // SHELL_GPU_DIRECT_GPU_RASTERIZER_H_
# 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.
group("platform") {
if (is_mac || is_ios) {
deps = [ "darwin" ]
} else if (is_android) {
deps = [ "android" ]
} else if (is_linux) {
deps = [ "linux" ]
} else {
assert(false, "Unknown/Unsupported platform.")
}
}
# 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.
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
generate_jni("jni_headers") {
visibility = [ ":*" ]
sources = [
"io/flutter/view/FlutterMain.java",
"io/flutter/view/FlutterView.java",
]
jni_package = "shell"
}
shared_library("sky_shell") {
visibility = [ ":*" ]
sources = [
"flutter_main.cc",
"flutter_main.h",
"library_loader.cc",
"platform_view_android.cc",
"platform_view_android.h",
]
deps = [
"//base",
"//dart/runtime:libdart",
"//flutter/common",
"//flutter/flow",
"//flutter/lib/jni",
"//flutter/runtime",
"//flutter/shell/common",
"//flutter/shell/gpu",
"//flutter/skia",
"//flutter/vulkan",
"//lib/ftl",
"//mojo/android:libsystem_java",
"//mojo/edk/base_edk",
"//mojo/edk/system",
":jni_headers",
]
ldflags = [
"-landroid",
"-lEGL",
"-lGLESv2",
]
}
android_library("java") {
visibility = [ ":*" ]
java_files = [
"io/flutter/view/AccessibilityBridge.java",
"io/flutter/view/FlutterMain.java",
"io/flutter/view/FlutterView.java",
"io/flutter/view/ResourceCleaner.java",
"io/flutter/view/ResourceExtractor.java",
"io/flutter/view/ServiceFactory.java",
"io/flutter/view/ServiceProviderImpl.java",
"io/flutter/view/ServiceRegistry.java",
"org/domokit/sky/shell/SkyActivity.java",
"org/domokit/sky/shell/SkyApplication.java",
]
deps = [
"//base:base_java",
"//flutter/services/activity:activity_lib",
"//flutter/services/activity:interfaces_java",
"//flutter/services/common:common_lib",
"//flutter/services/editing:editing_lib",
"//flutter/services/editing:interfaces_java",
"//flutter/services/engine:interfaces_java",
"//flutter/services/media:interfaces_java",
"//flutter/services/media:media_lib",
"//flutter/services/platform:interfaces_java",
"//flutter/services/platform:platform_lib",
"//flutter/services/pointer:interfaces_java",
"//flutter/services/raw_keyboard:interfaces_java",
"//flutter/services/raw_keyboard:raw_keyboard_lib",
"//flutter/services/semantics:interfaces_java",
"//flutter/services/sensors:sensors_lib",
"//flutter/services/vsync:vsync_lib",
"//mojo/android:system_java",
"//mojo/public/interfaces/application:application_java",
"//mojo/public/java:bindings",
"//mojo/public/java:system",
"//mojo/services/sensors/interfaces:interfaces_java",
"//mojo/services/vsync/interfaces:interfaces_java",
]
}
copy_ex("assets") {
visibility = [ ":*" ]
clear_dir = true
dest = "$root_build_dir/sky_shell/assets"
sources = [
"$root_build_dir/icudtl.dat",
]
deps = [
"//third_party/icu:icudata",
]
}
android_apk("android") {
apk_name = "SkyShell"
android_manifest = "AndroidManifest.xml"
native_libs = [ "libsky_shell.so" ]
asset_location = "$root_build_dir/sky_shell/assets"
extensions_to_not_compress = ".flx"
flutter_dist_jar = "$root_build_dir/flutter.jar"
deps = [
"//base:base_java",
":assets",
":java",
":sky_shell",
]
}
......@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/platform/android/flutter_main.h"
#include "flutter/shell/platform/android/flutter_main.h"
#include <vector>
#include "base/android/jni_android.h"
#include "base/android/jni_array.h"
......@@ -19,7 +21,7 @@
#include "base/threading/simple_thread.h"
#include "dart/runtime/include/dart_tools_api.h"
#include "flutter/runtime/start_up.h"
#include "flutter/sky/shell/shell.h"
#include "flutter/shell/common/shell.h"
#include "jni/FlutterMain_jni.h"
#include "lib/ftl/macros.h"
#include "mojo/edk/embedder/embedder.h"
......@@ -27,7 +29,6 @@
using base::LazyInstance;
namespace sky {
namespace shell {
namespace {
......@@ -50,7 +51,7 @@ void InitializeTracing() {
base::FilePath path;
bool result = ::PathService::Get(base::DIR_ANDROID_APP_DATA, &path);
DCHECK(result);
sky::shell::Shell::Shared().tracing_controller().set_traces_base_path(
shell::Shell::Shared().tracing_controller().set_traces_base_path(
path.AsUTF8Unsafe());
}
......@@ -95,5 +96,4 @@ bool RegisterFlutterMain(JNIEnv* env) {
return RegisterNativesImpl(env);
}
} // namespace sky
} // namespace mojo
} // namespace shell
......@@ -2,17 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_PLATFORM_ANDROID_FLUTTER_MAIN_H_
#define SKY_SHELL_PLATFORM_ANDROID_FLUTTER_MAIN_H_
#ifndef SHELL_PLATFORM_ANDROID_FLUTTER_MAIN_H_
#define SHELL_PLATFORM_ANDROID_FLUTTER_MAIN_H_
#include <jni.h>
namespace sky {
namespace shell {
bool RegisterFlutterMain(JNIEnv* env);
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_PLATFORM_ANDROID_FLUTTER_MAIN_H_
#endif // SHELL_PLATFORM_ANDROID_FLUTTER_MAIN_H_
......@@ -58,7 +58,7 @@ import org.domokit.vsync.VSyncProviderImpl;
/**
* A class to intialize the Flutter engine.
*/
@JNINamespace("sky::shell")
@JNINamespace("shell")
public class FlutterMain {
private static final String TAG = "FlutterMain";
......
......@@ -71,7 +71,7 @@ import org.domokit.raw_keyboard.RawKeyboardServiceState;
/**
* An Android view containing a Flutter app.
*/
@JNINamespace("sky::shell")
@JNINamespace("shell")
public class FlutterView extends SurfaceView
implements AccessibilityManager.AccessibilityStateChangeListener,
AccessibilityManager.TouchExplorationStateChangeListener {
......
......@@ -12,16 +12,16 @@
#include "flutter/lib/jni/dart_jni.h"
#include "mojo/android/system/base_run_loop.h"
#include "mojo/android/system/core_impl.h"
#include "flutter/sky/shell/platform/android/flutter_main.h"
#include "flutter/sky/shell/platform/android/platform_view_android.h"
#include "flutter/shell/platform/android/flutter_main.h"
#include "flutter/shell/platform/android/platform_view_android.h"
namespace {
base::android::RegistrationMethod kSkyRegisteredMethods[] = {
{"CoreImpl", mojo::android::RegisterCoreImpl},
{"BaseRunLoop", mojo::android::RegisterBaseRunLoop},
{"FlutterView", sky::shell::PlatformViewAndroid::Register},
{"FlutterMain", sky::shell::RegisterFlutterMain},
{"FlutterView", shell::PlatformViewAndroid::Register},
{"FlutterMain", shell::RegisterFlutterMain},
};
bool RegisterJNI(JNIEnv* env) {
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/platform/android/platform_view_android.h"
#include "flutter/shell/platform/android/platform_view_android.h"
#include <android/input.h>
#include <android/native_window_jni.h>
......@@ -20,11 +20,10 @@
#include "flutter/common/threads.h"
#include "flutter/flow/compositor_context.h"
#include "flutter/runtime/dart_service_isolate.h"
#include "flutter/sky/shell/shell.h"
#include "flutter/shell/common/shell.h"
#include "jni/FlutterView_jni.h"
#include "third_party/skia/include/core/SkSurface.h"
namespace sky {
namespace shell {
namespace {
......@@ -352,7 +351,7 @@ static jlong Attach(JNIEnv* env,
jint skyEngineHandle,
jobject flutterView) {
PlatformViewAndroid* view = new PlatformViewAndroid();
view->ConnectToEngine(mojo::InterfaceRequest<SkyEngine>(
view->ConnectToEngine(mojo::InterfaceRequest<sky::SkyEngine>(
mojo::ScopedMessagePipeHandle(mojo::MessagePipeHandle(skyEngineHandle))));
// Create a weak reference to the flutterView Java object so that we can make
......@@ -430,7 +429,7 @@ void PlatformViewAndroid::ReleaseSurface() {
}
}
ftl::WeakPtr<sky::shell::PlatformView> PlatformViewAndroid::GetWeakViewPtr() {
ftl::WeakPtr<shell::PlatformView> PlatformViewAndroid::GetWeakViewPtr() {
return weak_factory_.GetWeakPtr();
}
......@@ -507,7 +506,8 @@ void PlatformViewAndroid::RunFromSource(const std::string& main,
}
base::android::ScopedJavaLocalRef<jobject> PlatformViewAndroid::GetBitmap(
JNIEnv* env, jobject obj) {
JNIEnv* env,
jobject obj) {
// Render the last frame to an array of pixels on the GPU thread.
// The pixels will be returned as a global JNI reference to an int array.
ftl::AutoResetWaitableEvent latch;
......@@ -549,16 +549,15 @@ base::android::ScopedJavaLocalRef<jobject> PlatformViewAndroid::GetBitmap(
FTL_CHECK(bitmap_config);
jobject bitmap = env->CallStaticObjectMethod(
bitmap_class, create_bitmap,
pixels.obj(), frame_size.width(), frame_size.height(), bitmap_config);
bitmap_class, create_bitmap, pixels.obj(), frame_size.width(),
frame_size.height(), bitmap_config);
return base::android::ScopedJavaLocalRef<jobject>(env, bitmap);
}
void PlatformViewAndroid::GetBitmapGpuTask(
ftl::AutoResetWaitableEvent* latch,
jobject* pixels_out,
SkISize* size_out) {
void PlatformViewAndroid::GetBitmapGpuTask(ftl::AutoResetWaitableEvent* latch,
jobject* pixels_out,
SkISize* size_out) {
flow::LayerTree* layer_tree = rasterizer_->GetLastLayerTree();
if (layer_tree == nullptr)
return;
......@@ -574,9 +573,9 @@ void PlatformViewAndroid::GetBitmapGpuTask(
jint* pixels = env->GetIntArrayElements(pixels_array, nullptr);
FTL_CHECK(pixels);
SkImageInfo image_info = SkImageInfo::Make(
frame_size.width(), frame_size.height(), kRGBA_8888_SkColorType,
kPremul_SkAlphaType);
SkImageInfo image_info =
SkImageInfo::Make(frame_size.width(), frame_size.height(),
kRGBA_8888_SkColorType, kPremul_SkAlphaType);
sk_sp<SkSurface> surface = SkSurface::MakeRasterDirect(
image_info, pixels, frame_size.width() * sizeof(jint));
......@@ -609,4 +608,3 @@ void PlatformViewAndroid::GetBitmapGpuTask(
}
} // namespace shell
} // namespace sky
......@@ -2,16 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_PLATFORM_ANDROID_PLATFORM_VIEW_ANDROID_H_
#define SKY_SHELL_PLATFORM_ANDROID_PLATFORM_VIEW_ANDROID_H_
#ifndef SHELL_PLATFORM_ANDROID_PLATFORM_VIEW_ANDROID_H_
#define SHELL_PLATFORM_ANDROID_PLATFORM_VIEW_ANDROID_H_
#include <string>
#include "base/android/jni_android.h"
#include "base/android/jni_weak_ref.h"
#include "lib/ftl/memory/weak_ptr.h"
#include "lib/ftl/synchronization/waitable_event.h"
#include "flutter/sky/shell/platform_view.h"
#include "flutter/shell/common/platform_view.h"
namespace sky {
namespace shell {
class AndroidGLContext;
......@@ -20,45 +21,33 @@ class PlatformViewAndroid : public PlatformView {
public:
static bool Register(JNIEnv* env);
explicit PlatformViewAndroid();
PlatformViewAndroid();
~PlatformViewAndroid() override;
// Called from Java
void Detach(JNIEnv* env, jobject obj);
// Called from Java
void SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface);
// Called from Java
void SurfaceChanged(JNIEnv* env, jobject obj, jint backgroundColor);
// Called from Java
void SurfaceDestroyed(JNIEnv* env, jobject obj);
// Called from Java
base::android::ScopedJavaLocalRef<jobject> GetBitmap(JNIEnv* env,
jobject obj);
// sky::shell::PlatformView override
ftl::WeakPtr<sky::shell::PlatformView> GetWeakViewPtr() override;
ftl::WeakPtr<shell::PlatformView> GetWeakViewPtr() override;
// sky::shell::PlatformView override
uint64_t DefaultFramebuffer() const override;
// sky::shell::PlatformView override
bool ContextMakeCurrent() override;
// sky::shell::PlatformView override
bool ResourceContextMakeCurrent() override;
// sky::shell::PlatformView override
bool SwapBuffers() override;
// sky::shell::PlatformView override
virtual SkISize GetSize();
// sky::shell::PlatformView override
virtual void Resize(const SkISize& size);
virtual void RunFromSource(const std::string& main,
......@@ -86,6 +75,5 @@ class PlatformViewAndroid : public PlatformView {
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_PLATFORM_ANDROID_PLATFORM_VIEW_ANDROID_H_
#endif // SHELL_PLATFORM_ANDROID_PLATFORM_VIEW_ANDROID_H_
# 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.
assert(is_mac || is_ios)
group("darwin") {
if (is_mac) {
deps = [
"desktop:shell_application_bundle",
"desktop:shell_standalone",
]
} else if (is_ios) {
deps = [
"ios:flutter_framework",
]
} else {
assert(false, "Unknown darwin platform type.")
}
}
# 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.
source_set("common") {
# Disable the assignment filter because the files will be used on iOS as well
# as Mac.
set_sources_assignment_filter([])
sources = [
"platform_mac.h",
"platform_mac.mm",
"platform_service_provider.cc",
"platform_service_provider.h",
"view_service_provider.cc",
"view_service_provider.h",
]
set_sources_assignment_filter(sources_assignment_filter)
deps = [
"//base",
"//base:i18n",
"//dart/runtime:libdart",
"//flutter/runtime",
"//flutter/services/activity",
"//flutter/services/editing",
"//flutter/services/engine:interfaces",
"//flutter/services/media",
"//flutter/services/platform",
"//flutter/services/pointer:interfaces",
"//flutter/services/vsync",
"//flutter/shell/common",
"//flutter/shell/gpu",
"//flutter/shell/testing",
"//flutter/skia",
"//flutter/sky/engine/wtf",
"//lib/ftl",
"//mojo/common",
"//mojo/edk/base_edk",
"//mojo/edk/system",
"//mojo/public/cpp/bindings:utility",
"//mojo/public/interfaces/application",
]
}
......@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_PLATFORM_MAC_PLATFORM_MAC_H_
#define SKY_SHELL_PLATFORM_MAC_PLATFORM_MAC_H_
#ifndef SHELL_PLATFORM_MAC_PLATFORM_MAC_H_
#define SHELL_PLATFORM_MAC_PLATFORM_MAC_H_
#include "flutter/services/engine/sky_engine.mojom.h"
namespace sky {
namespace shell {
void PlatformMacMain(int argc, const char* argv[], std::string icu_data_path);
......@@ -15,6 +14,5 @@ void PlatformMacMain(int argc, const char* argv[], std::string icu_data_path);
bool AttemptLaunchFromCommandLineSwitches(sky::SkyEnginePtr& engine);
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_PLATFORM_MAC_PLATFORM_MAC_H_
#endif // SHELL_PLATFORM_MAC_PLATFORM_MAC_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/platform/mac/platform_mac.h"
#include "flutter/shell/platform/darwin/common/platform_mac.h"
#include <Foundation/Foundation.h>
......@@ -18,15 +18,14 @@
#include "base/trace_event/trace_event.h"
#include "dart/runtime/include/dart_tools_api.h"
#include "flutter/runtime/start_up.h"
#include "flutter/shell/common/shell.h"
#include "flutter/shell/common/switches.h"
#include "flutter/shell/common/tracing_controller.h"
#include "flutter/shell/common/ui_delegate.h"
#include "flutter/sky/engine/wtf/MakeUnique.h"
#include "flutter/sky/shell/shell.h"
#include "flutter/sky/shell/switches.h"
#include "flutter/sky/shell/tracing_controller.h"
#include "flutter/sky/shell/ui_delegate.h"
#include "mojo/edk/embedder/embedder.h"
#include "mojo/edk/embedder/simple_platform_support.h"
namespace sky {
namespace shell {
static void InitializeLogging() {
......@@ -42,7 +41,7 @@ static void InitializeLogging() {
static void RedirectIOConnectionsToSyslog() {
#if TARGET_OS_IPHONE
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
sky::shell::switches::kNoRedirectToSyslog)) {
shell::switches::kNoRedirectToSyslog)) {
return;
}
......@@ -71,14 +70,14 @@ class EmbedderState {
InitializeLogging();
base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(sky::shell::switches::kTraceStartup)) {
if (command_line.HasSwitch(shell::switches::kTraceStartup)) {
// Usually, all tracing within flutter is managed via the tracing
// controller
// The tracing controller is accessed via the shell instance. This means
// that tracing can only be enabled once that instance is created. Traces
// early in startup are lost. This enables tracing only in base manually
// till the tracing controller takes over.
sky::shell::TracingController::StartBaseTracing();
shell::TracingController::StartBaseTracing();
}
// This is about as early as tracing of any kind can start. Add an instant
......@@ -95,7 +94,7 @@ class EmbedderState {
mojo::embedder::Init(mojo::embedder::CreateSimplePlatformSupport());
sky::shell::Shell::InitStandalone(icu_data_path);
shell::Shell::InitStandalone(icu_data_path);
}
~EmbedderState() {
......@@ -168,28 +167,27 @@ static std::string ResolveCommandLineLaunchFlag(const char* name) {
bool AttemptLaunchFromCommandLineSwitches(sky::SkyEnginePtr& engine) {
base::mac::ScopedNSAutoreleasePool pool;
using namespace sky::shell::switches;
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
auto command_line = *base::CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(kMainDartFile) ||
command_line.HasSwitch(kPackages) || command_line.HasSwitch(kFLX)) {
if (command_line.HasSwitch(switches::kMainDartFile) ||
command_line.HasSwitch(switches::kPackages) ||
command_line.HasSwitch(switches::kFLX)) {
// The main dart file, flx bundle and the package root must be specified in
// one go. We dont want to end up in a situation where we take one value
// from the command line and the others from user defaults. In case, any
// new flags are specified, forget about all the old ones.
[defaults removeObjectForKey:@(kMainDartFile)];
[defaults removeObjectForKey:@(kPackages)];
[defaults removeObjectForKey:@(kFLX)];
[defaults removeObjectForKey:@(switches::kMainDartFile)];
[defaults removeObjectForKey:@(switches::kPackages)];
[defaults removeObjectForKey:@(switches::kFLX)];
[defaults synchronize];
}
std::string dart_main = ResolveCommandLineLaunchFlag(kMainDartFile);
std::string packages = ResolveCommandLineLaunchFlag(kPackages);
std::string bundle = ResolveCommandLineLaunchFlag(kFLX);
std::string dart_main = ResolveCommandLineLaunchFlag(switches::kMainDartFile);
std::string packages = ResolveCommandLineLaunchFlag(switches::kPackages);
std::string bundle = ResolveCommandLineLaunchFlag(switches::kFLX);
if (!FlagsValidForCommandLineLaunch(dart_main, packages, bundle)) {
return false;
......@@ -198,9 +196,9 @@ bool AttemptLaunchFromCommandLineSwitches(sky::SkyEnginePtr& engine) {
// Save the newly resolved dart main file and the package root to user
// defaults so that the next time the user launches the application in the
// simulator without the tooling, the application boots up.
[defaults setObject:@(dart_main.c_str()) forKey:@(kMainDartFile)];
[defaults setObject:@(packages.c_str()) forKey:@(kPackages)];
[defaults setObject:@(bundle.c_str()) forKey:@(kFLX)];
[defaults setObject:@(dart_main.c_str()) forKey:@(switches::kMainDartFile)];
[defaults setObject:@(packages.c_str()) forKey:@(switches::kPackages)];
[defaults setObject:@(bundle.c_str()) forKey:@(switches::kFLX)];
[defaults synchronize];
......@@ -210,4 +208,3 @@ bool AttemptLaunchFromCommandLineSwitches(sky::SkyEnginePtr& engine) {
}
} // namespace shell
} // namespace sky
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/platform/mac/platform_service_provider.h"
#include "flutter/shell/platform/darwin/common/platform_service_provider.h"
#if TARGET_OS_IPHONE
#include "flutter/services/activity/ios/activity_impl.h"
......@@ -19,7 +19,6 @@
#include "flutter/services/vsync/mac/vsync_provider_mac_impl.h"
#endif // TARGET_OS_IPHONE
namespace sky {
namespace shell {
PlatformServiceProvider::PlatformServiceProvider(
......@@ -100,4 +99,3 @@ void PlatformServiceProvider::ConnectToService(
}
} // namespace shell
} // namespace sky
......@@ -2,15 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_PLATFORM_MAC_PLATFORM_SERVICE_PROVIDER_H_
#define SKY_SHELL_PLATFORM_MAC_PLATFORM_SERVICE_PROVIDER_H_
#ifndef SHELL_PLATFORM_MAC_PLATFORM_SERVICE_PROVIDER_H_
#define SHELL_PLATFORM_MAC_PLATFORM_SERVICE_PROVIDER_H_
#include "lib/ftl/macros.h"
#include "base/callback.h"
#include "lib/ftl/macros.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/interfaces/application/service_provider.mojom.h"
namespace sky {
namespace shell {
class PlatformServiceProvider : public mojo::ServiceProvider {
......@@ -21,6 +20,7 @@ class PlatformServiceProvider : public mojo::ServiceProvider {
PlatformServiceProvider(mojo::InterfaceRequest<mojo::ServiceProvider> request,
DynamicServiceProviderCallback callback);
~PlatformServiceProvider() override;
void ConnectToService(const mojo::String& service_name,
......@@ -34,6 +34,5 @@ class PlatformServiceProvider : public mojo::ServiceProvider {
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_PLATFORM_MAC_PLATFORM_SERVICE_PROVIDER_H_
#endif // SHELL_PLATFORM_MAC_PLATFORM_SERVICE_PROVIDER_H_
......@@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/platform/mac/view_service_provider.h"
#include "flutter/shell/platform/darwin/common/view_service_provider.h"
#include <utility>
namespace sky {
namespace shell {
ViewServiceProvider::ViewServiceProvider(
......@@ -36,4 +35,3 @@ void ViewServiceProvider::ConnectToService(
}
} // namespace shell
} // namespace sky
......@@ -2,22 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_PLATFORM_MAC_VIEW_SERVICE_PROVIDER_H_
#define SKY_SHELL_PLATFORM_MAC_VIEW_SERVICE_PROVIDER_H_
#ifndef SHELL_PLATFORM_MAC_VIEW_SERVICE_PROVIDER_H_
#define SHELL_PLATFORM_MAC_VIEW_SERVICE_PROVIDER_H_
#include <functional>
#include "flutter/services/platform/app_messages.mojom.h"
#include "flutter/sky/engine/wtf/Assertions.h"
#include "lib/ftl/macros.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/interfaces/application/service_provider.mojom.h"
#include "flutter/sky/engine/wtf/Assertions.h"
#include "flutter/services/platform/app_messages.mojom.h"
#if TARGET_OS_IPHONE
#include "flutter/services/editing/ios/keyboard_impl.h"
#endif
namespace sky {
namespace shell {
typedef std::function<void(
......@@ -41,6 +40,5 @@ class ViewServiceProvider : public mojo::ServiceProvider {
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_PLATFORM_MAC_VIEW_SERVICE_PROVIDER_H_
#endif // SHELL_PLATFORM_MAC_VIEW_SERVICE_PROVIDER_H_
# 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.
import("//build/config/mac/rules.gni")
assert(is_mac)
source_set("mac_desktop_platform") {
visibility = [ ":*" ]
sources = [
"main_mac.mm",
"platform_view_mac.h",
"platform_view_mac.mm",
"sky_app_delegate.h",
"sky_app_delegate.m",
"sky_application.h",
"sky_application.mm",
"sky_window.h",
"sky_window.mm",
]
deps = [
"//base",
"//flutter/services/pointer:interfaces",
"//flutter/shell/common",
"//flutter/shell/platform/darwin/common",
"//flutter/shell/testing",
"//flutter/skia",
"//flutter/synchronization",
"//lib/ftl",
]
}
executable("shell_standalone") {
output_name = "sky_shell"
deps = [
":mac_desktop_platform",
]
}
mac_app("shell_application_bundle") {
app_name = "SkyShell"
info_plist = "Info.plist"
xibs = [ "sky_mac.xib" ]
resource_copy_mac("mac_desktop_resources") {
resources = [
"//third_party/icu/android/icudtl.dat",
]
bundle_directory = "."
}
deps = [
":mac_desktop_platform",
":mac_desktop_resources",
]
}
......@@ -3,16 +3,17 @@
// found in the LICENSE file.
#import <Cocoa/Cocoa.h>
#include <iostream>
#include "base/bind.h"
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "flutter/sky/shell/platform/mac/platform_mac.h"
#include "flutter/sky/shell/platform/mac/sky_application.h"
#include "flutter/sky/shell/switches.h"
#include "flutter/sky/shell/testing/testing.h"
#include "flutter/shell/common/switches.h"
#include "flutter/shell/platform/darwin/common/platform_mac.h"
#include "flutter/shell/platform/darwin/desktop/sky_application.h"
#include "flutter/shell/testing/testing.h"
namespace sky {
namespace shell {
namespace {
......@@ -27,26 +28,25 @@ void AttachMessageLoopToMainRunLoop(void) {
} // namespace
} // namespace shell
} // namespace sky
int main(int argc, const char* argv[]) {
[SkyApplication sharedApplication];
sky::shell::PlatformMacMain(argc, argv, "");
shell::PlatformMacMain(argc, argv, "");
base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(sky::shell::switches::kHelp)) {
sky::shell::switches::PrintUsage("SkyShell");
if (command_line.HasSwitch(shell::switches::kHelp)) {
shell::switches::PrintUsage("SkyShell");
return EXIT_SUCCESS;
}
if (command_line.HasSwitch(sky::shell::switches::kNonInteractive)) {
if (!sky::shell::InitForTesting())
if (command_line.HasSwitch(shell::switches::kNonInteractive)) {
if (!shell::InitForTesting())
return 1;
base::MessageLoop::current()->Run();
return EXIT_SUCCESS;
}
sky::shell::AttachMessageLoopToMainRunLoop();
shell::AttachMessageLoopToMainRunLoop();
return NSApplicationMain(argc, argv);
}
......@@ -2,17 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_PLATFORM_MAC_PLATFORM_VIEW_MAC_H_
#define SKY_SHELL_PLATFORM_MAC_PLATFORM_VIEW_MAC_H_
#ifndef SHELL_PLATFORM_MAC_PLATFORM_VIEW_MAC_H_
#define SHELL_PLATFORM_MAC_PLATFORM_VIEW_MAC_H_
#include "base/mac/scoped_nsobject.h"
#include "flutter/shell/common/platform_view.h"
#include "lib/ftl/memory/weak_ptr.h"
#include "flutter/sky/shell/platform_view.h"
@class NSOpenGLView;
@class NSOpenGLContext;
namespace sky {
namespace shell {
class PlatformViewMac : public PlatformView {
......@@ -23,7 +22,7 @@ class PlatformViewMac : public PlatformView {
void SetupAndLoadDart();
SkyEnginePtr& engineProxy();
sky::SkyEnginePtr& engineProxy();
ftl::WeakPtr<PlatformView> GetWeakViewPtr() override;
......@@ -57,6 +56,5 @@ class PlatformViewMac : public PlatformView {
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_PLATFORM_MAC_PLATFORM_VIEW_MAC_H_
#endif // SHELL_PLATFORM_MAC_PLATFORM_VIEW_MAC_H_
......@@ -2,28 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/platform/mac/platform_view_mac.h"
#include "flutter/shell/platform/darwin/desktop/platform_view_mac.h"
#include <Foundation/Foundation.h>
#include <AppKit/AppKit.h>
#include "base/command_line.h"
#include "base/trace_event/trace_event.h"
#include "flutter/sky/shell/switches.h"
#include "flutter/sky/shell/platform/mac/view_service_provider.h"
#include "flutter/sky/shell/platform/mac/platform_mac.h"
#include "flutter/sky/shell/platform/mac/platform_service_provider.h"
#include "flutter/shell/common/switches.h"
#include "flutter/shell/platform/darwin/common/platform_mac.h"
#include "flutter/shell/platform/darwin/common/platform_service_provider.h"
#include "flutter/shell/platform/darwin/common/view_service_provider.h"
#include "lib/ftl/synchronization/waitable_event.h"
namespace sky {
namespace shell {
static void IgnoreRequest(
mojo::InterfaceRequest<flutter::platform::ApplicationMessages>) {}
static void DynamicServiceResolve(const mojo::String& service_name,
mojo::ScopedMessagePipeHandle handle) {}
PlatformViewMac::PlatformViewMac(NSOpenGLView* gl_view)
: opengl_view_([gl_view retain]),
resource_loading_context_([[NSOpenGLContext alloc]
......@@ -33,13 +26,21 @@ PlatformViewMac::PlatformViewMac(NSOpenGLView* gl_view)
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
if (paths.count > 0) {
sky::shell::Shell::Shared().tracing_controller().set_traces_base_path(
shell::Shell::Shared().tracing_controller().set_traces_base_path(
[[paths objectAtIndex:0] UTF8String]);
}
}
PlatformViewMac::~PlatformViewMac() = default;
static void DynamicServiceResolve(const mojo::String& service_name,
mojo::ScopedMessagePipeHandle handle) {
// This platform does not support dynamic service loading.
}
static void IgnoreRequest(
mojo::InterfaceRequest<flutter::platform::ApplicationMessages>) {}
void PlatformViewMac::ConnectToEngineAndSetupServices() {
ConnectToEngine(mojo::GetProxy(&sky_engine_));
......@@ -92,7 +93,7 @@ void PlatformViewMac::SetupAndLoadFromSource(
sky_engine_->RunFromFile(main, packages, assets_directory);
}
SkyEnginePtr& PlatformViewMac::engineProxy() {
sky::SkyEnginePtr& PlatformViewMac::engineProxy() {
return sky_engine_;
}
......@@ -165,4 +166,3 @@ void PlatformViewMac::RunFromSource(const std::string& main,
}
} // namespace shell
} // namespace sky
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef __SKY_SHELL_MAC_SKY_APPLICATION__
#define __SKY_SHELL_MAC_SKY_APPLICATION__
#ifndef __SHELL_MAC_SKY_APPLICATION__
#define __SHELL_MAC_SKY_APPLICATION__
#import <AppKit/AppKit.h>
......@@ -15,4 +15,4 @@
@interface SkyApplication : NSApplication<CrAppProtocol, CrAppControlProtocol>
@end
#endif /* defined(__SKY_SHELL_MAC_SKY_APPLICATION__) */
#endif /* defined(__SHELL_MAC_SKY_APPLICATION__) */
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/platform/mac/sky_application.h"
#include "flutter/shell/platform/darwin/desktop/sky_application.h"
#include "base/auto_reset.h"
#include "base/logging.h"
......
......@@ -6,7 +6,7 @@
#include "base/time/time.h"
#include "flutter/services/pointer/pointer.mojom.h"
#include "flutter/sky/shell/platform/mac/platform_view_mac.h"
#include "flutter/shell/platform/darwin/desktop/platform_view_mac.h"
@interface SkyWindow ()<NSWindowDelegate>
......@@ -38,7 +38,7 @@ static inline pointer::PointerType EventTypeFromNSEventPhase(
}
@implementation SkyWindow {
std::unique_ptr<sky::shell::PlatformViewMac> _platform_view;
std::unique_ptr<shell::PlatformViewMac> _platform_view;
}
@synthesize renderSurface = _renderSurface;
......@@ -56,7 +56,7 @@ static inline pointer::PointerType EventTypeFromNSEventPhase(
DCHECK(_platform_view == nullptr)
<< "The platform view must not already be set.";
_platform_view.reset(new sky::shell::PlatformViewMac(self.renderSurface));
_platform_view.reset(new shell::PlatformViewMac(self.renderSurface));
_platform_view->SetupResourceContextOnIOThread();
_platform_view->NotifyCreated();
}
......
# 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.
assert(is_ios)
import("//build/config/ios/rules.gni")
import("//build/config/ios/ios_sdk.gni")
shared_library("flutter_framework_dylib") {
visibility = [ ":*" ]
output_name = "Flutter"
sources = [
"framework/Headers/Flutter.h",
"framework/Headers/FlutterAppDelegate.h",
"framework/Headers/FlutterAsyncMessageListener.h",
"framework/Headers/FlutterDartProject.h",
"framework/Headers/FlutterMacros.h",
"framework/Headers/FlutterMessageListener.h",
"framework/Headers/FlutterViewController.h",
"framework/Source/accessibility_bridge.h",
"framework/Source/accessibility_bridge.mm",
"framework/Source/application_messages_impl.h",
"framework/Source/application_messages_impl.mm",
"framework/Source/flutter_touch_mapper.h",
"framework/Source/flutter_touch_mapper.mm",
"framework/Source/FlutterAppDelegate.mm",
"framework/Source/FlutterDartProject.mm",
"framework/Source/FlutterDartProject_Internal.h",
"framework/Source/FlutterDartSource.h",
"framework/Source/FlutterDartSource.mm",
"framework/Source/FlutterDynamicServiceLoader.h",
"framework/Source/FlutterDynamicServiceLoader.mm",
"framework/Source/FlutterView.h",
"framework/Source/FlutterView.mm",
"framework/Source/FlutterViewController.mm",
"platform_view_ios.h",
"platform_view_ios.mm",
]
deps = [
"//base:base",
"//dart/runtime:libdart",
"//flutter/services/activity",
"//flutter/services/dynamic:embedder",
"//flutter/services/editing",
"//flutter/services/engine:interfaces",
"//flutter/services/media",
"//flutter/services/platform",
"//flutter/services/semantics",
"//flutter/services/vsync",
"//flutter/shell/common",
"//flutter/shell/gpu",
"//flutter/shell/platform/darwin/common",
"//flutter/skia",
"//flutter/sky/engine/platform",
"//flutter/sky/engine/wtf",
"//lib/ftl",
"//mojo/edk/base_edk",
"//mojo/edk/system",
"//mojo/public/cpp/application",
"//mojo/public/cpp/bindings",
"//mojo/public/interfaces/application",
]
defines = [
"FLUTTER_FRAMEWORK"
]
libs = [
"UIKit.framework",
"OpenGLES.framework",
"AVFoundation.framework",
"AudioToolbox.framework",
"QuartzCore.framework",
]
}
group("flutter_framework") {
framework_dir = "$root_out_dir/Flutter.framework"
copy("framework_dylib") {
visibility = [ ":*" ]
sources = [ "$root_out_dir/libFlutter.dylib" ]
outputs = [ "$framework_dir/Flutter" ]
deps = [
":flutter_framework_dylib",
]
}
action("framework_install_name") {
visibility = [ ":*" ]
stamp_file = "$root_out_dir/flutter_install_name_stamp"
script = "//flutter/sky/tools/change_install_name.py"
inputs = [ "$framework_dir/Flutter" ]
outputs = [ stamp_file ]
args = [
"--dylib",
rebase_path("$framework_dir/Flutter"),
"--install_name",
"@rpath/Flutter.framework/Flutter",
"--stamp",
rebase_path(stamp_file),
]
deps = [
":framework_dylib"
]
}
copy("framework_info_plist") {
visibility = [ ":*" ]
sources = [ "framework/Info.plist" ]
outputs = [ "$framework_dir/Info.plist" ]
}
copy("framework_module_map") {
visibility = [ ":*" ]
sources = [ "framework/module.modulemap" ]
outputs = [ "$framework_dir/Modules/module.modulemap" ]
}
copy("framework_headers") {
visibility = [ ":*" ]
sources = [
"framework/Headers/Flutter.h",
"framework/Headers/FlutterAppDelegate.h",
"framework/Headers/FlutterAsyncMessageListener.h",
"framework/Headers/FlutterDartProject.h",
"framework/Headers/FlutterMacros.h",
"framework/Headers/FlutterMessageListener.h",
"framework/Headers/FlutterViewController.h",
]
outputs = [ "$framework_dir/Headers/{{source_file_part}}" ]
}
copy("framework_icu") {
visibility = [ ":*" ]
set_sources_assignment_filter([])
sources = [
"//third_party/icu/android/icudtl.dat",
]
set_sources_assignment_filter(sources_assignment_filter)
outputs = [ "$framework_dir/{{source_file_part}}" ]
}
public_deps = [
":framework_dylib",
":framework_headers",
":framework_icu",
":framework_info_plist",
":framework_install_name",
":framework_module_map",
]
}
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/platform/ios/framework/Headers/FlutterAppDelegate.h"
#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterAppDelegate.h"
@implementation FlutterAppDelegate
......
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/platform/ios/framework/Source/FlutterDartProject_Internal.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h"
#include "base/command_line.h"
#include "dart/runtime/include/dart_api.h"
#include "flutter/sky/shell/platform/ios/framework/Source/FlutterDartSource.h"
#include "flutter/sky/shell/switches.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartSource.h"
#include "flutter/shell/common/switches.h"
static NSURL* URLForSwitch(const char* name) {
auto cmd = *base::CommandLine::ForCurrentProcess();
......@@ -91,7 +91,7 @@ static NSURL* URLForSwitch(const char* name) {
// Load directly from sources if the appropriate command line flags are
// specified. If not, try loading from a script snapshot in the framework
// bundle.
NSURL* flxURL = URLForSwitch(sky::shell::switches::kFLX);
NSURL* flxURL = URLForSwitch(shell::switches::kFLX);
if (flxURL == nil) {
// If the URL was not specified on the command line, look inside the
......@@ -101,8 +101,8 @@ static NSURL* URLForSwitch(const char* name) {
isDirectory:NO];
}
NSURL* dartMainURL = URLForSwitch(sky::shell::switches::kMainDartFile);
NSURL* dartPackagesURL = URLForSwitch(sky::shell::switches::kPackages);
NSURL* dartMainURL = URLForSwitch(shell::switches::kMainDartFile);
NSURL* dartPackagesURL = URLForSwitch(shell::switches::kPackages);
return [self initWithFLXArchive:flxURL
dartMain:dartMainURL
......
......@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERDARTPROJECT_INTERNAL_H_
#define SKY_SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERDARTPROJECT_INTERNAL_H_
#ifndef SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERDARTPROJECT_INTERNAL_H_
#define SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERDARTPROJECT_INTERNAL_H_
#include "flutter/sky/shell/platform/ios/framework/Headers/FlutterDartProject.h"
#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterDartProject.h"
#include "flutter/services/engine/sky_engine.mojom.h"
......@@ -28,4 +28,4 @@ typedef void (^LaunchResult)(BOOL success, NSString* message);
@end
#endif // SKY_SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERDARTPROJECT_INTERNAL_H_
#endif // SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERDARTPROJECT_INTERNAL_H_
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERDARTSOURCE_H_
#define SKY_SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERDARTSOURCE_H_
#ifndef SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERDARTSOURCE_H_
#define SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERDARTSOURCE_H_
#import <Foundation/Foundation.h>
......@@ -27,4 +27,4 @@ typedef void (^ValidationResult)(BOOL result, NSString* message);
@end
#endif // SKY_SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERDARTSOURCE_H_
#endif // SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERDARTSOURCE_H_
......@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/platform/ios/framework/Source/FlutterDartSource.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartSource.h"
@implementation FlutterDartSource
@synthesize dartMain=_dartMain;
@synthesize packages=_packages;
@synthesize flxArchive=_flxArchive;
@synthesize archiveContainsScriptSnapshot=_archiveContainsScriptSnapshot;
@synthesize dartMain = _dartMain;
@synthesize packages = _packages;
@synthesize flxArchive = _flxArchive;
@synthesize archiveContainsScriptSnapshot = _archiveContainsScriptSnapshot;
#pragma mark - Convenience Initializers
......@@ -17,7 +17,6 @@
return [self initWithDartMain:nil packages:nil flxArchive:nil];
}
#pragma mark - Designated Initializers
- (instancetype)initWithDartMain:(NSURL*)dartMain
......
......@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTER_DYNAMIC_SERVICE_LOADER_H_
#define SKY_SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTER_DYNAMIC_SERVICE_LOADER_H_
#ifndef SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTER_DYNAMIC_SERVICE_LOADER_H_
#define SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTER_DYNAMIC_SERVICE_LOADER_H_
#import <Foundation/Foundation.h>
#include "flutter/sky/shell/platform/mac/platform_service_provider.h"
#include "flutter/shell/platform/darwin/common/platform_service_provider.h"
@interface FlutterDynamicServiceLoader : NSObject
......@@ -15,4 +15,4 @@
@end
#endif // SKY_SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTER_DYNAMIC_SERVICE_LOADER_H_
#endif // SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTER_DYNAMIC_SERVICE_LOADER_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/platform/ios/framework/Source/FlutterDynamicServiceLoader.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterDynamicServiceLoader.h"
#include "base/logging.h"
#include "flutter/services/dynamic/dynamic_service_embedder.h"
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTER_VIEW_H_
#define SKY_SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTER_VIEW_H_
#ifndef SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTER_VIEW_H_
#define SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTER_VIEW_H_
#include <UIKit/UIKit.h>
......@@ -11,4 +11,4 @@
@end
#endif // SKY_SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTER_VIEW_H_
#endif // SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTER_VIEW_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/platform/ios/framework/Source/FlutterView.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterView.h"
@interface FlutterView ()<UIInputViewAudioFeedback>
......
......@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "flutter/sky/shell/platform/ios/framework/Headers/FlutterViewController.h"
#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h"
#include "base/mac/scoped_block.h"
#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
#include "flutter/services/platform/ios/system_chrome_impl.h"
#include "flutter/sky/engine/wtf/MakeUnique.h"
#include "flutter/sky/shell/platform/ios/framework/Source/flutter_touch_mapper.h"
#include "flutter/sky/shell/platform/ios/framework/Source/FlutterDartProject_Internal.h"
#include "flutter/sky/shell/platform/ios/platform_view_ios.h"
#include "flutter/sky/shell/platform/mac/platform_mac.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/flutter_touch_mapper.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h"
#include "flutter/shell/platform/darwin/ios/platform_view_ios.h"
#include "flutter/shell/platform/darwin/common/platform_mac.h"
@interface FlutterViewController ()<UIAlertViewDelegate>
@end
......@@ -20,7 +20,7 @@
void FlutterInit(int argc, const char* argv[]) {
NSBundle* bundle = [NSBundle bundleForClass:[FlutterViewController class]];
NSString* icuDataPath = [bundle pathForResource:@"icudtl" ofType:@"dat"];
sky::shell::PlatformMacMain(argc, argv, icuDataPath.UTF8String);
shell::PlatformMacMain(argc, argv, icuDataPath.UTF8String);
}
@implementation FlutterViewController {
......@@ -28,8 +28,8 @@ void FlutterInit(int argc, const char* argv[]) {
UIInterfaceOrientationMask _orientationPreferences;
UIStatusBarStyle _statusBarStyle;
sky::ViewportMetricsPtr _viewportMetrics;
sky::shell::TouchMapper _touchMapper;
std::unique_ptr<sky::shell::PlatformViewIOS> _platformView;
shell::TouchMapper _touchMapper;
std::unique_ptr<shell::PlatformViewIOS> _platformView;
BOOL _initialized;
}
......@@ -73,7 +73,7 @@ void FlutterInit(int argc, const char* argv[]) {
_orientationPreferences = UIInterfaceOrientationMaskAll;
_statusBarStyle = UIStatusBarStyleDefault;
_viewportMetrics = sky::ViewportMetrics::New();
_platformView = WTF::MakeUnique<sky::shell::PlatformViewIOS>(
_platformView = WTF::MakeUnique<shell::PlatformViewIOS>(
reinterpret_cast<CAEAGLLayer*>(self.view.layer));
_platformView->SetupResourceContextOnIOThread();
......
......@@ -2,28 +2,26 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_ACCESSIBILITY_BRIDGE_H_
#define SKY_SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_ACCESSIBILITY_BRIDGE_H_
#ifndef SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_ACCESSIBILITY_BRIDGE_H_
#define SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_ACCESSIBILITY_BRIDGE_H_
#include <memory>
#include <set>
#include <unordered_map>
#include "flutter/services/semantics/semantics.mojom.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterView.h"
#include "flutter/sky/engine/platform/geometry/FloatRect.h"
#include "lib/ftl/macros.h"
#include "mojo/public/cpp/bindings/array.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/interfaces/application/service_provider.mojom.h"
#include "flutter/sky/engine/platform/geometry/FloatRect.h"
#include "flutter/services/semantics/semantics.mojom.h"
#include "flutter/sky/shell/platform/ios/framework/Source/FlutterView.h"
#include "third_party/skia/include/core/SkMatrix44.h"
#include "third_party/skia/include/core/SkRect.h"
namespace sky {
namespace shell {
class AccessibilityBridge;
}
}
} // namespace shell
@interface SemanticObject : NSObject
......@@ -39,12 +37,11 @@ class AccessibilityBridge;
@property(nonatomic, assign) SemanticObject* parent;
- (instancetype)init __attribute__((unavailable("Use initWithBridge instead")));
- (instancetype)initWithBridge:(sky::shell::AccessibilityBridge*)bridge
- (instancetype)initWithBridge:(shell::AccessibilityBridge*)bridge
uid:(uint32_t)uid NS_DESIGNATED_INITIALIZER;
@end
namespace sky {
namespace shell {
class AccessibilityBridge final : public semantics::SemanticsListener {
......@@ -75,6 +72,5 @@ class AccessibilityBridge final : public semantics::SemanticsListener {
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_ACCESSIBILITY_BRIDGE_H_
#endif // SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_ACCESSIBILITY_BRIDGE_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/sky/shell/platform/ios/framework/Source/accessibility_bridge.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h"
#import <UIKit/UIKit.h>
#include <vector>
......@@ -31,7 +31,7 @@ struct Geometry {
} // namespace
@implementation SemanticObject {
sky::shell::AccessibilityBridge* _bridge;
shell::AccessibilityBridge* _bridge;
semantics::SemanticFlagsPtr _flags;
semantics::SemanticStringsPtr _strings;
......@@ -56,7 +56,7 @@ struct Geometry {
#pragma mark - Designated initializers
- (instancetype)initWithBridge:(sky::shell::AccessibilityBridge*)bridge
- (instancetype)initWithBridge:(shell::AccessibilityBridge*)bridge
uid:(uint32_t)uid {
DCHECK(bridge != nil) << "bridge must be set";
DCHECK(uid >= kRootNodeId);
......@@ -94,24 +94,24 @@ struct Geometry {
_canBeScrolledVertically = false;
for (int action : node->actions) {
switch (static_cast<semantics::SemanticAction>(action)) {
case semantics::SemanticAction::TAP:
_canBeTapped = true;
break;
case semantics::SemanticAction::LONG_PRESS:
_canBeLongPressed = true;
break;
case semantics::SemanticAction::SCROLL_LEFT:
case semantics::SemanticAction::SCROLL_RIGHT:
_canBeScrolledHorizontally = true;
break;
case semantics::SemanticAction::SCROLL_UP:
case semantics::SemanticAction::SCROLL_DOWN:
_canBeScrolledVertically = true;
break;
case semantics::SemanticAction::INCREASE:
case semantics::SemanticAction::DECREASE:
_canBeAdjusted = true;
break;
case semantics::SemanticAction::TAP:
_canBeTapped = true;
break;
case semantics::SemanticAction::LONG_PRESS:
_canBeLongPressed = true;
break;
case semantics::SemanticAction::SCROLL_LEFT:
case semantics::SemanticAction::SCROLL_RIGHT:
_canBeScrolledHorizontally = true;
break;
case semantics::SemanticAction::SCROLL_UP:
case semantics::SemanticAction::SCROLL_DOWN:
_canBeScrolledVertically = true;
break;
case semantics::SemanticAction::INCREASE:
case semantics::SemanticAction::DECREASE:
_canBeAdjusted = true;
break;
}
}
}
......@@ -246,16 +246,20 @@ struct Geometry {
switch (direction) {
case UIAccessibilityScrollDirectionRight:
_bridge->server()->PerformAction(_uid, semantics::SemanticAction::SCROLL_RIGHT);
_bridge->server()->PerformAction(_uid,
semantics::SemanticAction::SCROLL_RIGHT);
break;
case UIAccessibilityScrollDirectionLeft:
_bridge->server()->PerformAction(_uid, semantics::SemanticAction::SCROLL_LEFT);
_bridge->server()->PerformAction(_uid,
semantics::SemanticAction::SCROLL_LEFT);
break;
case UIAccessibilityScrollDirectionUp:
_bridge->server()->PerformAction(_uid, semantics::SemanticAction::SCROLL_UP);
_bridge->server()->PerformAction(_uid,
semantics::SemanticAction::SCROLL_UP);
break;
case UIAccessibilityScrollDirectionDown:
_bridge->server()->PerformAction(_uid, semantics::SemanticAction::SCROLL_DOWN);
_bridge->server()->PerformAction(_uid,
semantics::SemanticAction::SCROLL_DOWN);
break;
default:
DCHECK(false) << "Unsupported scroll direction: " << direction;
......@@ -280,7 +284,6 @@ struct Geometry {
#pragma mark - AccessibilityBridge impl
namespace sky {
namespace shell {
AccessibilityBridge::AccessibilityBridge(UIView* view,
......@@ -323,8 +326,8 @@ void AccessibilityBridge::UpdateSemanticsTree(
} else {
view_.accessibilityElements = nil;
}
UIAccessibilityPostNotification(
UIAccessibilityLayoutChangedNotification, nil);
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification,
nil);
}
SemanticObject* AccessibilityBridge::UpdateSemanticObject(
......@@ -370,4 +373,3 @@ void AccessibilityBridge::RemoveSemanticObject(
}
} // namespace shell
} // namespace sky
......@@ -2,18 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_APPLICATION_MESSAGES_IMPL_H_
#define SKY_SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_APPLICATION_MESSAGES_IMPL_H_
#ifndef SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_APPLICATION_MESSAGES_IMPL_H_
#define SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_APPLICATION_MESSAGES_IMPL_H_
#include <unordered_map>
#include "lib/ftl/memory/weak_ptr.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "flutter/services/platform/app_messages.mojom.h"
#include "flutter/sky/shell/platform/ios/framework/Headers/FlutterAsyncMessageListener.h"
#include "flutter/sky/shell/platform/ios/framework/Headers/FlutterMessageListener.h"
#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterAsyncMessageListener.h"
#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterMessageListener.h"
namespace sky {
namespace shell {
class ApplicationMessagesImpl : public flutter::platform::ApplicationMessages {
......@@ -45,6 +44,5 @@ class ApplicationMessagesImpl : public flutter::platform::ApplicationMessages {
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_ACCESSIBILITY_BRIDGE_H_
#endif // SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_ACCESSIBILITY_BRIDGE_H_
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册