1. 13 10月, 2020 1 次提交
  2. 10 10月, 2020 2 次提交
    • G
      Migration to PlatformDispatcher and multi-window (#20496) · 85b0031f
      Greg Spencer 提交于
      This is a PR for converting the dart:ui code in the engine to use a multi-window API. The goal here is to convert from the window singleton to an API that has the concept of multiple windows. Also, I'm matching up the new PlatformDispatcher class to talk directly to the PlatformConfiguration class in the engine. I'm not attempting to actually enable creating multiple windows here, just migrate to an API that has a concept of multiple windows. The multi-window API in this PR currently only ever creates one window.
      
      The design doc for this change is here.
      
      The major changes in this PR:
      
      Move the platfom-specific attributes out of Window, and into the new PlatformDispatcher class that holds all of the platform state, so that the platform code need only update the configuration on this class.
      Create FlutterView, FlutterWindow, and SingletonFlutterWindow classes to separate out the concepts of a view (of which there may be multiple in a window), a window (of which there may be multiple on a screen, and they host views), and a window where there is only ever expected to be one (this hosts the entire API of the former Window class, and will eventually be the type of the window singleton).
      Next step after this PR lands:
      
      Remove the Window class entirely (it is replaced by SingletonFlutterWindow). Some minor changes in the Framework are needed to switch to using SingletonFlutterWindow directly first.
      
      The Window class still exists in this PR, but will be removed as soon as the framework is converted to point to the SingletonFlutterWindow class instead. They share the same API, just have different names (Window is currently a subclass of SingletonFlutterWindow). The intention is that the Window name will be freed up to use as a widget class name in the framework for managing windows. The singleton called window will remain, and keep the same API it has now.
      85b0031f
    • G
      11d756a6
  3. 29 9月, 2020 2 次提交
  4. 26 9月, 2020 1 次提交
    • K
      Embedder API Support for display settings (#21355) · 67fdd7ed
      Kaushik Iska 提交于
      Embedders can now notify shell during startup about the various displays and their corresponding settings.
      Adds a notion of Display update type which can later include chages to displays during runtime such as addition / removal / reconfiguration of displays.
      
      We also remove the responsibility of providing the refresh rate from `vsync_waiter` to `DisplayManager`.
      Rewires existing platform implementations of the said API to use `Shell::OnDisplayUpdate` to notify the display manager of the startup configuration.
      
      DisplayManager is also thread-safe to account for rasterizer and UI thread accesses.
      67fdd7ed
  5. 27 8月, 2020 1 次提交
  6. 21 8月, 2020 1 次提交
  7. 20 8月, 2020 1 次提交
  8. 01 8月, 2020 1 次提交
  9. 16 7月, 2020 1 次提交
  10. 10 7月, 2020 1 次提交
  11. 11 5月, 2020 1 次提交
  12. 28 1月, 2020 1 次提交
    • C
      Allow embedders to schedule a callback on all engine managed threads. (#15980) · c5329ef5
      Chinmay Garde 提交于
      `FlutterEnginePostCallbackOnAllNativeThreads` schedule a callback to be run on
      all engine managed threads. The engine will attempt to service this callback the
      next time the message loops for each managed thread is idle. Since the engine
      manages the entire lifecycle of multiple threads, there is no opportunity for
      the embedders to finely tune the priorities of threads directly, or, perform
      other thread specific configuration (for example, setting thread names for
      tracing). This callback gives embedders a chance to affect such tuning.
      
      Fixes flutter/flutter#49551
      Fixes b/143774406
      Fixes b/148278215
      Fixes b/148278931
      c5329ef5
  13. 25 1月, 2020 1 次提交
  14. 09 1月, 2020 1 次提交
  15. 17 12月, 2019 1 次提交
  16. 14 12月, 2019 1 次提交
    • C
      Allow embedders to post Dart objects on send ports from the native side. (#14477) · f0583215
      Chinmay Garde 提交于
      This is a non-breaking addition to the stable Flutter Embedder API and exposes a
      subset of the functionality provided by Dart_PostCObject API in a stable and
      tested manner to custom embedder implementations.
      
      Send port acquisition can currently be done as described in the unit-test but
      there may be opportunities to extend this API in the future to access ports more
      easily or create ports from the native side.
      
      The following capabilities of the the Dart_PostCObject API are explicitly NOT
      exposed:
      * Object arrays: This allows callers to create complex object graphs but only
        using the primitives specified in the native API. I could find no current use
        case for this and would have made the implementation a lot more complex. This
        is something we can add in the future if necessary however.
      * Capabilities and ports: Again no use cases and I honestly I didn’t understand
        how to use capabilities. If needed, these can be added at a later point by
        appending to the union.
      
      Fixes https://github.com/flutter/flutter/issues/46624
      Fixes b/145982720
      f0583215
  17. 20 11月, 2019 1 次提交
  18. 13 11月, 2019 1 次提交
  19. 25 10月, 2019 1 次提交
    • C
      Expose platform view ID on embedder semantics node (#13345) · 4f300e61
      Chris Bracken 提交于
      This exposes platform_view_id on the embedder API's FlutterSemanticNode.
      
      In bd0f9085 (#8055), platformViewId was
      added to SemanticsNode. This field is non-zero when the SemanticsNode
      represents a platform view and is typically used by embedders as a means
      of identifying locations where a platform view's 'native' accessibility
      tree should be injected into the platform-specific accessibility tree
      constructed by the embedder.
      
      Due to the intended use of this field, the Flutter framework is meant to
      enforce that this node has a child count of zero.
      4f300e61
  20. 24 10月, 2019 1 次提交
    • C
      Add FlutterEngineRunsAOTCompiledDartCode to the embedder API. (#13319) · 1663ac9e
      Chinmay Garde 提交于
      For embedder code that is configured for both AOT and JIT mode Dart execution
      based on the Flutter engine being linked to, this runtime check may be used to
      appropriately configure the `FlutterProjectArgs`. In JIT mode execution, the
      kernel snapshots must be present in the Flutter assets directory specified in
      the `FlutterProjectArgs`. For AOT execution, the fields `vm_snapshot_data`,
      `vm_snapshot_instructions`, `isolate_snapshot_data` and
      `isolate_snapshot_instructions` (along with their size fields) must be specified
      in `FlutterProjectArgs`.
      1663ac9e
  21. 23 10月, 2019 1 次提交
  22. 16 10月, 2019 1 次提交
    • C
      Allow embedders to specify a render task runner description. (#13124) · bf81971f
      Chinmay Garde 提交于
      Embedders may use this to specify a thread whose event loop is managed by them
      instead of the engine. In addition, specifying the same task runner for both
      the platform and render task runners allows embedders to effectively perform
      GPU rendering operations on the platform thread.
      
      To affect this change, the following non breaking changes to the API have been
      made:
      
      * The `FlutterCustomTaskRunners` struct now has a new field `render_task_runner`
        for the specification of a custom render task runner.
      * The `FlutterTaskRunnerDescription` has a new field `identifier`. Embedders
        must supply a unique identifier for each task runner they specify. In
        addition, when describing multiple task runners that run their tasks on the
        same thread, their identifiers must match.
      * The embedder may need to process tasks during `FlutterEngineRun` and
        `FlutterEngineShutdown`. However, the embedder doesn't have the Flutter engine
        handle before `FlutterEngineRun` and is supposed to relinquish handle right
        before `FlutterEngineShutdown`. Since the embedder needs the Flutter engine
        handle to service tasks on other threads while these calls are underway,
        there exist opportunities for deadlock. To work around this scenario, three
        new calls have been added that allow more deliberate management of the Flutter
        engine instance.
        * `FlutterEngineRun` can be replaced with `FlutterEngineInitialize` and
          `FlutterEngineRunInitialized`. The embedder can obtain a handle to the
          engine after the first call but the engine will not post any tasks to custom
          task runners specified by the embedder till the
          `FlutterEngineRunInitialized` call. Embedders can guard the Flutter engine
          handle behind a mutex for safe task runner interop.
        * `FlutterEngineShutdown` can be preceded by the `FlutterEngineDeinitialize`
          call. After this call the Flutter engine will no longer post tasks onto
          embedder managed task runners. It is still embedder responsibility to
          collect the Flutter engine handle via `FlutterEngineShutdown`.
      * To maintain backwards compatibility with the old APIs, `FlutterEngineRun` is
        now just a convenience for `FlutterEngineInitialize` and
        `FlutterEngineRunInitilaized`. `FlutterEngineShutdown` now implicitly calls
        `FlutterEngineDeinitialize` as well. This allows existing users who don't care
        are custom task runner interop to keep using the old APIs.
      * Adds complete test coverage for both old and new paths.
      
      Fixes https://github.com/flutter/flutter/issues/42460
      Prerequisite for https://github.com/flutter/flutter/issues/17579
      bf81971f
  23. 10 10月, 2019 1 次提交
  24. 09 10月, 2019 2 次提交
  25. 05 10月, 2019 2 次提交
  26. 01 10月, 2019 1 次提交
  27. 24 9月, 2019 1 次提交
  28. 18 9月, 2019 1 次提交
    • C
      Account for root surface transformation on the surfaces managed by the... · 1c7300ed
      Chinmay Garde 提交于
      Account for root surface transformation on the surfaces managed by the external view embedder. (#11384)
      
      The earlier design speculated that embedders could affect the same
      transformations on the layers post engine compositor presentation but before
      final composition.
      
      However, the linked issue points out that this design is not suitable for use
      with hardware overlay planes. When rendering to the same, to affect the
      transformation before composition, embedders would have to render to an
      off-screen render target and then apply the transformation before presentation.
      This patch negates the need for that off-screen render pass.
      
      To be clear, the previous architecture is still fully viable. Embedders still
      have full control over layer transformations before composition. This is an
      optimization for the hardware overlay planes use-case.
      
      Fixes b/139758641
      1c7300ed
  29. 21 8月, 2019 1 次提交
  30. 14 8月, 2019 1 次提交
    • C
      Allow embedder controlled composition of Flutter layers. (#10195) · e8f95440
      Chinmay Garde 提交于
      This patch allows embedders to split the Flutter layer tree into multiple
      chunks. These chunks are meant to be composed one on top of another. This gives
      embedders a chance to interleave their own contents between these chunks.
      
      The Flutter embedder API already provides hooks for the specification of
      textures for the Flutter engine to compose within its own hierarchy (for camera
      feeds, video, etc..). However, not all embedders can render the contents of such
      sources into textures the Flutter engine can accept. Moreover, this composition
      model may have overheads that are non-trivial for certain use cases. In such
      cases, the embedder may choose to specify multiple render target for Flutter to
      render into instead of just one.
      
      The use of this API allows embedders to perform composition very similar to the
      iOS embedder. This composition model is used on that platform for the embedding
      of UIKit view such and web view and map views within the Flutter hierarchy.
      However, do note that iOS also has threading configurations that are currently
      not available to custom embedders.
      
      The embedder API updates in this patch are ABI stable and existing embedders
      will continue to work are normal. For embedders that want to enable this
      composition mode, the API is designed to make it easy to opt into the same in an
      incremental manner.
      
      Rendering of contents into the “root” rendering surface remains unchanged.
      However, now the application can push “platform views” via a scene builder.
      These platform views need to handled by a FlutterCompositor specified in a new
      field at the end of the FlutterProjectArgs struct.
      
      When a new platform view in introduced within the layer tree, the compositor
      will ask the embedder to create a new render target for that platform view.
      Render targets can currently be OpenGL framebuffers, OpenGL textures or software
      buffers. The type of the render target returned by the embedder must be
      compatible with the root render surface. That is, if the root render surface is
      an OpenGL framebuffer, the render target for each platform view must either be a
      texture or a framebuffer in the same OpenGL context. New render target types as
      well as root renderers for newer APIs like Metal & Vulkan can and will be added
      in the future. The addition of these APIs will be done in an ABI & API stable
      manner.
      
      As Flutter renders frames, it gives the embedder a callback with information
      about the position of the various platform views in the effective hierarchy.
      The embedder is then meant to put the contents of the render targets that it
      setup and had previously given to the engine onto the screen (of course
      interleaving the contents of the platform views).
      
      Unit-tests have been added that test not only the structure and properties of
      layer hierarchy given to the compositor, but also the contents of the texels
      rendered by a test compositor using both the OpenGL and software rendering
      backends.
      
      Fixes b/132812775
      Fixes flutter/flutter#35410
      e8f95440
  31. 09 8月, 2019 1 次提交
  32. 07 8月, 2019 1 次提交
    • C
      Allow embedders to control Dart VM lifecycle on engine shutdown. (#10652) · b769353c
      Chinmay Garde 提交于
      This exposes the `Settings::leak_vm` flag to custom embedders. All embedder
      unit-tests now shut down the VM on the shutdown of the last engine in the
      process. The mechanics of VM shutdown are already tested in the Shell unit-tests
      harness in the DartLifecycleUnittests set of of assertions. This just exposes
      that functionality to custom embedders. Since it is part of the public stable
      API, I also switched the name of the field to be something less snarky than the
      field in private shell settings.
      b769353c
  33. 23 7月, 2019 1 次提交
    • S
      Add a macro for prefixing embedder.h symbols (#9851) · 7d320c45
      stuartmorgan 提交于
      embedder.h is a C API, so has no namespace, and only uses 'Flutter' as a
      prefix for most symbol names. This creates potential collisions with
      other code; for instance, FlutterEngine is the name of a type in
      embedder.h, but also an ObjC class in the iOS Flutter API.
      
      This adds a macro that can be set to prefix symbol names, allowing
      clients (notably, the macOS embedding) to adjust the names used by the
      embedding API internally without breaking ABI or API compatibility for
      the standard engine build.
      
      Currently the macro is only applied to FlutterEngine, since that's the
      symbol that is currently at issue, but it can be expanded to other
      symbols in the future.
      7d320c45
  34. 12 7月, 2019 1 次提交
  35. 04 7月, 2019 1 次提交
  36. 20 6月, 2019 1 次提交