Move Surface and friends to flow/ (flutter/engine#18938)

This commit is contained in:
David Worsham
2020-06-09 16:03:01 -07:00
committed by GitHub
parent c63a39b112
commit d2b7646e68
30 changed files with 84 additions and 97 deletions

View File

@@ -28,6 +28,9 @@ FILE: ../../../flutter/flow/compositor_context.cc
FILE: ../../../flutter/flow/compositor_context.h
FILE: ../../../flutter/flow/embedded_views.cc
FILE: ../../../flutter/flow/embedded_views.h
FILE: ../../../flutter/flow/gl_context_switch.cc
FILE: ../../../flutter/flow/gl_context_switch.h
FILE: ../../../flutter/flow/gl_context_switch_unittests.cc
FILE: ../../../flutter/flow/instrumentation.cc
FILE: ../../../flutter/flow/instrumentation.h
FILE: ../../../flutter/flow/layers/backdrop_filter_layer.cc
@@ -102,6 +105,10 @@ FILE: ../../../flutter/flow/scene_update_context.h
FILE: ../../../flutter/flow/skia_gpu_object.cc
FILE: ../../../flutter/flow/skia_gpu_object.h
FILE: ../../../flutter/flow/skia_gpu_object_unittests.cc
FILE: ../../../flutter/flow/surface.cc
FILE: ../../../flutter/flow/surface.h
FILE: ../../../flutter/flow/surface_frame.cc
FILE: ../../../flutter/flow/surface_frame.h
FILE: ../../../flutter/flow/texture.cc
FILE: ../../../flutter/flow/texture.h
FILE: ../../../flutter/flow/texture_unittests.cc
@@ -576,11 +583,6 @@ FILE: ../../../flutter/shell/common/engine.cc
FILE: ../../../flutter/shell/common/engine.h
FILE: ../../../flutter/shell/common/fixtures/shell_test.dart
FILE: ../../../flutter/shell/common/fixtures/shelltest_screenshot.png
FILE: ../../../flutter/shell/common/gl_context_switch.cc
FILE: ../../../flutter/shell/common/gl_context_switch.h
FILE: ../../../flutter/shell/common/gl_context_switch_test.cc
FILE: ../../../flutter/shell/common/gl_context_switch_test.h
FILE: ../../../flutter/shell/common/gl_context_switch_unittests.cc
FILE: ../../../flutter/shell/common/input_events_unittests.cc
FILE: ../../../flutter/shell/common/isolate_configuration.cc
FILE: ../../../flutter/shell/common/isolate_configuration.h
@@ -616,10 +618,6 @@ FILE: ../../../flutter/shell/common/shell_test_platform_view_vulkan.h
FILE: ../../../flutter/shell/common/shell_unittests.cc
FILE: ../../../flutter/shell/common/skia_event_tracer_impl.cc
FILE: ../../../flutter/shell/common/skia_event_tracer_impl.h
FILE: ../../../flutter/shell/common/surface.cc
FILE: ../../../flutter/shell/common/surface.h
FILE: ../../../flutter/shell/common/surface_frame.cc
FILE: ../../../flutter/shell/common/surface_frame.h
FILE: ../../../flutter/shell/common/switches.cc
FILE: ../../../flutter/shell/common/switches.h
FILE: ../../../flutter/shell/common/thread_host.cc

View File

@@ -14,6 +14,8 @@ source_set("flow") {
"compositor_context.h",
"embedded_views.cc",
"embedded_views.h",
"gl_context_switch.cc",
"gl_context_switch.h",
"instrumentation.cc",
"instrumentation.h",
"layers/backdrop_filter_layer.cc",
@@ -62,6 +64,10 @@ source_set("flow") {
"rtree.h",
"skia_gpu_object.cc",
"skia_gpu_object.h",
"surface.cc",
"surface.h",
"surface_frame.cc",
"surface_frame.h",
"texture.cc",
"texture.h",
]
@@ -73,7 +79,6 @@ source_set("flow") {
deps = [
"//flutter/common",
"//flutter/fml",
"//flutter/shell/common:common_standalone",
"//third_party/skia",
]
@@ -103,6 +108,8 @@ source_set("flow_testing") {
testonly = true
sources = [
"testing/gl_context_switch_test.cc",
"testing/gl_context_switch_test.h",
"testing/layer_test.h",
"testing/mock_layer.cc",
"testing/mock_layer.h",
@@ -126,6 +133,7 @@ executable("flow_unittests") {
"flow_run_all_unittests.cc",
"flow_test_utils.cc",
"flow_test_utils.h",
"gl_context_switch_unittests.cc",
"layers/backdrop_filter_layer_unittests.cc",
"layers/clip_path_layer_unittests.cc",
"layers/clip_rect_layer_unittests.cc",

View File

@@ -7,9 +7,9 @@
#include <vector>
#include "flutter/flow/surface_frame.h"
#include "flutter/fml/memory/ref_counted.h"
#include "flutter/fml/raster_thread_merger.h"
#include "flutter/shell/common/surface_frame.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPath.h"
#include "third_party/skia/include/core/SkPoint.h"

View File

@@ -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 "gl_context_switch.h"
#include "flutter/flow/gl_context_switch.h"
namespace flutter {
@@ -11,16 +11,20 @@ SwitchableGLContext::SwitchableGLContext() = default;
SwitchableGLContext::~SwitchableGLContext() = default;
GLContextResult::GLContextResult() = default;
GLContextResult::~GLContextResult() = default;
GLContextResult::GLContextResult(bool static_result) : result_(static_result){};
bool GLContextResult::GetResult() {
return result_;
};
GLContextDefaultResult::~GLContextDefaultResult() = default;
GLContextDefaultResult::GLContextDefaultResult(bool static_result)
: GLContextResult(static_result){};
GLContextDefaultResult::~GLContextDefaultResult() = default;
GLContextSwitch::GLContextSwitch(std::unique_ptr<SwitchableGLContext> context)
: context_(std::move(context)) {
FML_CHECK(context_ != nullptr);

View File

@@ -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 FLUTTER_SHELL_COMMON_GL_CONTEXT_SWITCH_H_
#define FLUTTER_SHELL_COMMON_GL_CONTEXT_SWITCH_H_
#ifndef FLUTTER_FLOW_GL_CONTEXT_SWITCH_H_
#define FLUTTER_FLOW_GL_CONTEXT_SWITCH_H_
#include <functional>
#include <memory>
@@ -14,42 +14,39 @@
namespace flutter {
//------------------------------------------------------------------------------
/// An abstract class represents a gl context that can be switched by
/// GLContextSwitch
///
/// The subclass should wrap a "Context" object inside this class. For example,
/// in iOS while using GL rendering surface, the subclass should wrap an
/// |EAGLContext|.
// This interface represents a gl context that can be switched by
// |GLContextSwitch|.
//
// The implementation should wrap a "Context" object inside this class. For
// example, in iOS while using a GL rendering surface, the implementation should
// wrap an |EAGLContext|.
class SwitchableGLContext {
public:
//------------------------------------------------------------------------------
/// Implement this to set the context wrapped by this |SwitchableGLContext|
/// object to the current context.
virtual bool SetCurrent() = 0;
//------------------------------------------------------------------------------
/// Implement this to remove the context wrapped by this |SwitchableGLContext|
/// object from current context;
virtual bool RemoveCurrent() = 0;
SwitchableGLContext();
virtual ~SwitchableGLContext();
// Implement this to set the context wrapped by this |SwitchableGLContext|
// object to the current context.
virtual bool SetCurrent() = 0;
// Implement this to remove the context wrapped by this |SwitchableGLContext|
// object from current context;
virtual bool RemoveCurrent() = 0;
FML_DISALLOW_COPY_AND_ASSIGN(SwitchableGLContext);
};
//------------------------------------------------------------------------------
/// Represents the result of setting a gl context.
/// This class exists because context results are used in places applies to all
/// the platforms. On certain platforms(for example lower end iOS devices that
/// uses gl), a |GLContextSwitch| is required to protect flutter's gl contect
/// from being polluted by other programs(embedded platform views). A
/// |GLContextSwitch| is a subclass of |GLContextResult|, which can be returned
/// on platforms that requires context switching. A |GLContextDefaultResult| is
/// also a subclass of |GLContextResult|, which can be returned on platforms
/// that doesn't require context switching.
// Represents the result of setting a gl context.
//
// This class exists because context results are used in places applies to all
// the platforms. On certain platforms(for example lower end iOS devices that
// uses gl), a |GLContextSwitch| is required to protect flutter's gl contect
// from being polluted by other programs(embedded platform views). A
// |GLContextSwitch| is a subclass of |GLContextResult|, which can be returned
// on platforms that requires context switching. A |GLContextDefaultResult| is
// also a subclass of |GLContextResult|, which can be returned on platforms
// that doesn't require context switching.
class GLContextResult {
public:
GLContextResult();
@@ -114,4 +111,4 @@ class GLContextSwitch final : public GLContextResult {
} // namespace flutter
#endif
#endif // FLUTTER_FLOW_GL_CONTEXT_SWITCH_H_

View File

@@ -7,14 +7,14 @@
#include <future>
#include <memory>
#include "flutter/shell/common/gl_context_switch.h"
#include "gl_context_switch_test.h"
#include "flutter/flow/gl_context_switch.h"
#include "flutter/flow/testing/gl_context_switch_test.h"
#include "gtest/gtest.h"
namespace flutter {
namespace testing {
TEST_F(GLContextSwitchTest, SwitchKeepsContextCurrentWhileInScope) {
TEST(GLContextSwitchTest, SwitchKeepsContextCurrentWhileInScope) {
{
auto test_gl_context = std::make_unique<TestSwitchableGLContext>(0);
auto context_switch = GLContextSwitch(std::move(test_gl_context));

View File

@@ -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/shell/common/surface.h"
#include "flutter/flow/surface.h"
namespace flutter {

View File

@@ -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 FLUTTER_SHELL_COMMON_SURFACE_H_
#define FLUTTER_SHELL_COMMON_SURFACE_H_
#ifndef FLUTTER_FLOW_SURFACE_H_
#define FLUTTER_FLOW_SURFACE_H_
#include <memory>
#include "flutter/flow/compositor_context.h"
#include "flutter/flow/embedded_views.h"
#include "flutter/flow/surface_frame.h"
#include "flutter/fml/macros.h"
#include "flutter/shell/common/surface_frame.h"
namespace flutter {
@@ -39,4 +39,4 @@ class Surface {
} // namespace flutter
#endif // FLUTTER_SHELL_COMMON_SURFACE_H_
#endif // FLUTTER_FLOW_SURFACE_H_

View File

@@ -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/shell/common/surface_frame.h"
#include "flutter/flow/surface_frame.h"
#include "flutter/fml/logging.h"
namespace flutter {

View File

@@ -2,20 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_SHELL_COMMON_SURFACE_FRAME_H_
#define FLUTTER_SHELL_COMMON_SURFACE_FRAME_H_
#ifndef FLUTTER_FLOW_SURFACE_FRAME_H_
#define FLUTTER_FLOW_SURFACE_FRAME_H_
#include <memory>
#include "flutter/flow/gl_context_switch.h"
#include "flutter/fml/macros.h"
#include "flutter/shell/common/gl_context_switch.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkSurface.h"
namespace flutter {
/// Represents a Frame that has been fully configured for the underlying client
/// rendering API. A frame may only be submitted once.
// This class represents a frame that has been fully configured for the
// underlying client rendering API. A frame may only be submitted once.
class SurfaceFrame {
public:
using SubmitCallback =
@@ -56,4 +56,4 @@ class SurfaceFrame {
} // namespace flutter
#endif // FLUTTER_SHELL_COMMON_SURFACE_FRAME_H_
#endif // FLUTTER_FLOW_SURFACE_FRAME_H_

View File

@@ -5,7 +5,7 @@
#ifndef FLUTTER_SHELL_RENDERER_CONTEXT_TEST_H_
#define FLUTTER_SHELL_RENDERER_CONTEXT_TEST_H_
#include "gl_context_switch.h"
#include "flutter/flow/gl_context_switch.h"
#include "gtest/gtest.h"
namespace flutter {
@@ -43,6 +43,8 @@ class TestSwitchableGLContext : public SwitchableGLContext {
FML_DISALLOW_COPY_AND_ASSIGN(TestSwitchableGLContext);
};
} // namespace testing
} // namespace flutter
#endif // FLUTTER_SHELL_RENDERER_CONTEXT_TEST_H_

View File

@@ -105,8 +105,6 @@ source_set("common") {
"shell_io_manager.h",
"skia_event_tracer_impl.cc",
"skia_event_tracer_impl.h",
"surface.cc",
"surface.h",
"switches.cc",
"switches.h",
"thread_host.cc",
@@ -118,7 +116,6 @@ source_set("common") {
]
deps = [
":common_standalone",
"//flutter/assets",
"//flutter/common",
"//flutter/flow",
@@ -140,20 +137,6 @@ source_set("common") {
public_configs = [ "//flutter:config" ]
}
source_set("common_standalone") {
sources = [
"gl_context_switch.cc",
"gl_context_switch.h",
"surface_frame.cc",
"surface_frame.h",
]
deps = [
"//flutter/fml",
"//third_party/skia",
]
}
template("shell_host_executable") {
executable(target_name) {
testonly = true
@@ -203,9 +186,6 @@ if (enable_unittests) {
testonly = true
sources = [
"gl_context_switch_test.cc",
"gl_context_switch_test.h",
"gl_context_switch_unittests.cc",
"shell_test.cc",
"shell_test.h",
"shell_test_external_view_embedder.cc",
@@ -217,7 +197,6 @@ if (enable_unittests) {
]
public_deps = [
":common_standalone",
"//flutter/flow",
"//flutter/fml/dart",
"//flutter/lib/ui",

View File

@@ -8,6 +8,7 @@
#include <memory>
#include "flutter/common/task_runners.h"
#include "flutter/flow/surface.h"
#include "flutter/flow/texture.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/memory/weak_ptr.h"
@@ -18,7 +19,6 @@
#include "flutter/lib/ui/window/pointer_data_packet_converter.h"
#include "flutter/lib/ui/window/viewport_metrics.h"
#include "flutter/shell/common/pointer_data_dispatcher.h"
#include "flutter/shell/common/surface.h"
#include "flutter/shell/common/vsync_waiter.h"
#include "third_party/skia/include/core/SkSize.h"
#include "third_party/skia/include/gpu/GrContext.h"

View File

@@ -12,6 +12,7 @@
#include "flutter/common/task_runners.h"
#include "flutter/flow/compositor_context.h"
#include "flutter/flow/layers/layer_tree.h"
#include "flutter/flow/surface.h"
#include "flutter/fml/closure.h"
#include "flutter/fml/memory/weak_ptr.h"
#include "flutter/fml/raster_thread_merger.h"
@@ -21,7 +22,6 @@
#include "flutter/fml/time/time_point.h"
#include "flutter/lib/ui/snapshot_delegate.h"
#include "flutter/shell/common/layer_tree_holder.h"
#include "flutter/shell/common/surface.h"
namespace flutter {

View File

@@ -12,6 +12,7 @@
#include "flutter/common/settings.h"
#include "flutter/common/task_runners.h"
#include "flutter/flow/surface.h"
#include "flutter/flow/texture.h"
#include "flutter/fml/closure.h"
#include "flutter/fml/macros.h"
@@ -34,7 +35,6 @@
#include "flutter/shell/common/platform_view.h"
#include "flutter/shell/common/rasterizer.h"
#include "flutter/shell/common/shell_io_manager.h"
#include "flutter/shell/common/surface.h"
namespace flutter {

View File

@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "flutter/shell/common/shell_test_platform_view_vulkan.h"
#include "flutter/shell/common/gl_context_switch.h"
#include "flutter/vulkan/vulkan_utilities.h"
namespace flutter {

View File

@@ -11,7 +11,6 @@ gpu_common_deps = [
"//flutter/flow",
"//flutter/fml",
"//flutter/shell/common",
"//flutter/shell/common:common_standalone",
"//third_party/skia",
]

View File

@@ -9,10 +9,10 @@
#include <memory>
#include "flutter/flow/embedded_views.h"
#include "flutter/flow/gl_context_switch.h"
#include "flutter/flow/surface.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/memory/weak_ptr.h"
#include "flutter/shell/common/gl_context_switch.h"
#include "flutter/shell/common/surface.h"
#include "flutter/shell/gpu/gpu_surface_gl_delegate.h"
#include "third_party/skia/include/gpu/GrContext.h"

View File

@@ -6,8 +6,8 @@
#define FLUTTER_SHELL_GPU_GPU_SURFACE_GL_DELEGATE_H_
#include "flutter/flow/embedded_views.h"
#include "flutter/flow/gl_context_switch.h"
#include "flutter/fml/macros.h"
#include "flutter/shell/common/gl_context_switch.h"
#include "flutter/shell/gpu/gpu_surface_delegate.h"
#include "third_party/skia/include/core/SkMatrix.h"
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"

View File

@@ -7,9 +7,9 @@
#include <Metal/Metal.h>
#include "flutter/flow/surface.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/platform/darwin/scoped_nsobject.h"
#include "flutter/shell/common/surface.h"
#include "flutter/shell/gpu/gpu_surface_delegate.h"
#include "third_party/skia/include/gpu/GrContext.h"

View File

@@ -5,9 +5,9 @@
#ifndef FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_H_
#define FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_H_
#include "flutter/flow/surface.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/memory/weak_ptr.h"
#include "flutter/shell/common/surface.h"
#include "flutter/shell/gpu/gpu_surface_software_delegate.h"
namespace flutter {

View File

@@ -7,9 +7,9 @@
#include <memory>
#include "flutter/flow/surface.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/memory/weak_ptr.h"
#include "flutter/shell/common/surface.h"
#include "flutter/shell/gpu/gpu_surface_vulkan_delegate.h"
#include "flutter/vulkan/vulkan_native_surface.h"
#include "flutter/vulkan/vulkan_window.h"

View File

@@ -7,11 +7,11 @@
#include <memory>
#include "flutter/flow/surface.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/platform/android/jni_util.h"
#include "flutter/fml/platform/android/jni_weak_ref.h"
#include "flutter/shell/common/platform_view.h"
#include "flutter/shell/common/surface.h"
#include "flutter/shell/platform/android/android_context.h"
#include "flutter/shell/platform/android/android_native_window.h"
#include "third_party/skia/include/core/SkSize.h"

View File

@@ -7,10 +7,10 @@
#include <memory>
#include "flutter/flow/gl_context_switch.h"
#include "flutter/flow/texture.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/platform/darwin/scoped_nsobject.h"
#include "flutter/shell/common/gl_context_switch.h"
#include "flutter/shell/platform/darwin/common/framework/Headers/FlutterTexture.h"
#include "flutter/shell/platform/darwin/ios/rendering_api_selection.h"
#include "third_party/skia/include/gpu/GrContext.h"

View File

@@ -10,9 +10,9 @@
#include <memory>
#include "flutter/flow/embedded_views.h"
#include "flutter/flow/surface.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/platform/darwin/scoped_nsobject.h"
#include "flutter/shell/common/surface.h"
@class CALayer;

View File

@@ -5,10 +5,10 @@
#ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SWITCHABLE_GL_CONTEXT_H_
#define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SWITCHABLE_GL_CONTEXT_H_
#include "flutter/flow/gl_context_switch.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/memory/thread_checker.h"
#include "flutter/fml/memory/weak_ptr.h"
#include "flutter/shell/common/gl_context_switch.h"
@class EAGLContext;

View File

@@ -6,8 +6,8 @@
#define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_H_
#include "flutter/flow/embedded_views.h"
#include "flutter/flow/surface.h"
#include "flutter/fml/macros.h"
#include "flutter/shell/common/surface.h"
namespace flutter {

View File

@@ -315,6 +315,7 @@ executable("flutter_runner_unittests") {
"//build/fuchsia/pkg:async-loop-default",
"//build/fuchsia/pkg:scenic_cpp",
"//build/fuchsia/pkg:sys_cpp_testing",
"//flutter/flow",
"//flutter/lib/ui",
"//flutter/runtime",
"//flutter/shell/common",

View File

@@ -5,9 +5,9 @@
#pragma once
#include "compositor_context.h"
#include "flutter/flow/surface.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/memory/weak_ptr.h"
#include "flutter/shell/common/surface.h"
namespace flutter_runner {