126 Commits

Author SHA1 Message Date
stuartmorgan
6956c8a88c Export extern constants in embedder.h (flutter/engine#8550)
PR #8498 made these constants extern, but forgot to export them so they
would be public symbols.
2019-04-11 23:32:29 -07:00
stuartmorgan
93b8033015 Move constant definitions out embedder.h (flutter/engine#8498) 2019-04-10 10:03:10 -07:00
Chinmay Garde
4dd267959f Rename the shell namespace to flutter. (flutter/engine#8520) 2019-04-09 17:10:46 -07:00
Chinmay Garde
1fd28a143a Rename the blink namespace to flutter. (flutter/engine#8517)
Some components in the Flutter engine were derived from the forked blink codebase. While the forked components have either been removed or rewritten, the use of the blink namespace has mostly (and inconsistently) remained. This renames the blink namesapce to flutter for consistency. There are no functional changes in this patch.
2019-04-09 12:44:42 -07:00
Chinmay Garde
b330816fdd Log the correct function on error in the embedder. (flutter/engine#8461) 2019-04-05 15:16:07 -07:00
Chinmay Garde
18af29469e Allow native entrypoint registration for runtime unittests. (flutter/engine#8379) 2019-03-29 17:53:49 -07:00
Chinmay Garde
9a54dbc65a Move libdart selection into its own target in //flutter/runtime. (flutter/engine#8373)
Cleanup repeated rules.
2019-03-29 14:29:09 -07:00
Chinmay Garde
1238fd06a1 Remove the standalone a11y test runners and merge its tests into embedder_unittests. (flutter/engine#8338)
Also cleans up the a11y unittests to use the new builder API and avoids polluting the global namespace with state for assertions.
2019-03-28 11:22:06 -07:00
Chinmay Garde
f3080acb10 Reset min log levels on each engine launch. (flutter/engine#8343) 2019-03-28 11:21:25 -07:00
Chinmay Garde
792c41fb98 Fix Windows build. (flutter/engine#8336) 2019-03-27 16:43:08 -07:00
Chinmay Garde
20fe654ef3 Allow embedders to specify their own task runner interfaces. (flutter/engine#8273)
Currently, all Flutter threads are managed by the engine itself. This works for
all threads except the platform thread. On this thread, the engine cannot see
the underlying event multiplexing mechanism. Using the new task runner
interfaces, the engine can relinquish the task of setting up the event
multiplexing mechanism and instead have the embedder provide one for it during
setup.

This scheme is only wired up for the platform thread. But, the eventual goal
is to expose this message loop interoperability for all threads.
2019-03-27 16:16:59 -07:00
Chinmay Garde
fc3d221b49 Reland "Allow specification of std::functions as native entrypoints from Dart code." (flutter/engine#8329)
This reverts commit 90c1cc90cf3a36a2ca2d68719c9c8e266a65aace after fixing Windows issues.
2019-03-27 12:22:48 -07:00
Chinmay Garde
90c1cc90cf Revert "Allow specification of std::functions as native entrypoints from Dart code. (#8309)" (flutter/engine#8312)
This reverts commit 07f506f752b4f1220cf51768fe2dcf595d03a039.
2019-03-26 13:49:41 -07:00
Chinmay Garde
07f506f752 Allow specification of std::functions as native entrypoints from Dart code. (flutter/engine#8309)
This allows for the specification of std::functions (using EmbedderContext::NativeEntry) with their captures as native entrypoints. Earlier, only C functions we allowed which meant that there were no captures and assertions had to use globals which could introduce bugs when used with gtest_repeat.
2019-03-26 12:56:23 -07:00
Chinmay Garde
43a8481ba6 Enable lambda like native callbacks in tests and add support for custom entrypoints. (flutter/engine#8299) 2019-03-26 11:29:08 -07:00
Chinmay Garde
8be9d3af19 Migrate existing embedder unit tests to use the fixture. (flutter/engine#8296)
Also allows tests to specify their own embedder contexts.
2019-03-25 15:10:24 -07:00
Chinmay Garde
871d19c495 Make it easy to write embedder unit tests by creating a fixture and config builder. (flutter/engine#8276)
All embedder unit-tests have to setup the Flutter project arguments from scratch
before launching the engine. The boilerplate and having to deal with the low
level C API during each engine launch is a hinderance to writing tests.

This patch introduces an EmbedderTest fixture that sets up all the embedder side snapshots before allowing the unit test to create a FlutterConfigBuilder` that
the test can use to incrementally build and edit the Flutter project
configuration. From the given state state of a configuration, multiple engines
can be launched with their lifecylces managed by appropriate RAII wrappers.

This allows the a fully configured Flutter engine to be launched using 4 lines
of code in a fixture.

```
EmbedderConfigBuilder builder;
builder.SetSoftwareRendererConfig();
builder.SetAssetsPathFromFixture(this);
builder.SetSnapshotsFromFixture(this);
auto engine = builder.LaunchEngine();
```
2019-03-25 11:58:38 -07:00
Chinmay Garde
9ada55b844 Add frame and target time metadata to vsync events and connect platform vsync events using flows. (flutter/engine#8172)
This will allow us to easily visualize the time the platform informed the engine of a vsync event, its arguments, and when the engine began its UI thread workload using this information.
2019-03-14 16:48:01 -07:00
Chinmay Garde
8fc02f5b1d Add an allocator specific check to ensure that strings passed to the timeline are not heap allocated. (flutter/engine#8168)
Verified that the tests fail on issues like https://github.com/flutter/engine/pull/8166. Unfortunately, there is no x-platform way to perform this check but this should gate incorrect traces being added to the engine.
2019-03-14 14:15:46 -07:00
Dan Field
a068a0b631 Fix the Windows build (flutter/engine#8106)
* Make macro for logging embedder errors build on Windows
2019-03-10 10:46:27 -07:00
Chinmay Garde
c19f28cd22 Log non-kSuccess returns from embedder API calls. (flutter/engine#8096)
Embedders don’t realize that some calls to the API return an error and don’t handle the same. Log such erroneous returns.
2019-03-09 20:04:16 -08:00
Chinmay Garde
1079e83608 Clarify arguments to FlutterEngineOnVsync (flutter/engine#8093) 2019-03-08 18:09:17 -08:00
Chinmay Garde
d7a0ec6eca Allow embedders to post tasks onto the render thread. (flutter/engine#8089)
Some embedders may have to wait on fences asynchronously before committing
contents. This allows them to post a task onto the engine managed thread used
for rendering.
2019-03-08 16:30:48 -08:00
liyuqian
8545cec8d6 Add read-only persistent cache (flutter/engine#8049)
Some clients (e.g., embedded devices) prefer generating persistent cache files for the specific device beforehand, and ship them as readonly files in OTA packages.
2019-03-08 12:15:45 -08:00
Chris Bracken
3469631eb6 Update a11y word forward/back enum names (flutter/engine#8073)
This updates the FlutterSemanticsAction enumerator identifiers for the
'move cursor forward/back one word' actions (added in
flutter/engine#8033) for consistency with the 'move cusor forward/back
on character' identifiers.

ABI compatibility is unaffected, but this with require the following
change in any embedder making use of these fields:

Rename:
    kFlutterSemanticsActionMoveCursorForwardByWordIndex
to:
    kFlutterSemanticsActionMoveCursorForwardByWord

Rename:
    kFlutterSemanticsActionMoveCursorBackwardByWordIndex
to:
    kFlutterSemanticsActionMoveCursorBackwardByWord
2019-03-07 16:46:44 -08:00
Chinmay Garde
cff370118a Delay the vsync callback till the frame start time specified by embedder. (flutter/engine#8072)
The current assumption is that the embedder will wait till the vsync event and
then fire the callback. However, some embedders have that information upfront.
Since the time point has already been specified by the embedder, there is no
reason to burden the embedder with having to setup a wait either.
2019-03-07 16:28:22 -08:00
stuartmorgan
5745c57f0c Add engine support for scrollwheel events (flutter/engine#7494)
Adds support for pointer signals, in a way that will support both discrete events (e.g., scroll wheels, flutter/flutter#22762) and continuous gestures (e.g., trackpad scroll, flutter/flutter#21953).

Also exposes these new event options to the embedder. Does not include code to send the
new events from the platform shells.
2019-03-05 14:12:07 -08:00
Chris Bracken
e23839700a Add missing values to semantics action enums (flutter/engine#8033)
This brings the Dart and C++ semantics flag enums back in sync.

In #5902, the ability to move the cursor forward and backward one word
were added to dart:ui, and to the Android embedder, but not to the
SemanticsAction enum on the C++ side.
2019-03-05 07:58:26 -08:00
Chris Bracken
e560943579 Add missing kHasImplicitScrolling enum value (flutter/engine#8030)
This brings the Dart and C++ semantics flag enums back in sync.

In #5941, implicit scrolling support was added to SemanticsFlag in
dart:ui, and to the Android embedder, but not to the SemanticsFlags enum
on the C++ side.

This also clarifies/corrects the documentation for this value in dart:ui
and in the embedder API.
2019-03-04 22:00:54 -08:00
Chris Bracken
362096c282 Fix incorrect transformation matrix (flutter/engine#8001)
Previously the transformation matrix returned on semantics nodes was
fetched by matrix col,row (incorrectly). This uses the SkMatrix
constants instead and adds a test.
2019-02-28 19:19:06 -08:00
Chris Bracken
7c4f8d8116 Fix two typos in embedder.h (flutter/engine#7993)
occured -> occurred
preceeded -> preceded
2019-02-27 21:10:08 -08:00
Chris Bracken
0d1a8035df Provide batching for semantics updates (flutter/engine#7988)
Some embedders prefer to minimise the number of semantics node/custom
action updates sent back to the host platform -- for example due to
expensive serialisation mechanisms, etc.

This patch provides a 'batch end' signal that provides embedders with an
indication of when a self-consistent set of semantics node or custom action
updates have been sent.

We overload the node/action ID with information that conveys a batch end
by using an ID (-1) that is never allotted to semantics nodes by the
framework.
2019-02-27 12:12:45 -08:00
Ben Konyi
0669ddc849 Link dart:* sources into engine for debugger source support (flutter/engine#7908)
Link dart:* sources into engine for debugger source support

Currently, dart:* libraries appear to have no source in
debuggers like Observatory. With this change, these sources will be
available in debug mode applications. Sources for dart:* libraries are
lazily loaded on a script-by-script basis.

Refer to https://dart-review.googlesource.com/c/sdk/+/93375 for the Dart
SDK change.
2019-02-26 13:28:04 -08:00
Chris Bracken
92397389c1 Correct FlutterSemanticsNode member name style (flutter/engine#7942)
Correct struct members whose names were camelCase rather than
snake_case. This is a breaking API change, but does not break ABI.
2019-02-24 22:33:55 -08:00
Chinmay Garde
d0f9af0324 Allow embedders to specify a vsync waiter. (flutter/engine#7914)
Fixes https://github.com/flutter/flutter/issues/28240
2019-02-21 23:02:32 -08:00
Chinmay Garde
8d12a45c6a Allow embedders to add events to the timeline. (flutter/engine#7917)
Fixes https://github.com/flutter/flutter/issues/28283
2019-02-21 22:42:49 -08:00
Jason Simmons
4290d0349c Embedder API for setting the persistent cache path (flutter/engine#7915)
Fixes https://github.com/flutter/flutter/issues/28278
2019-02-21 17:30:17 -08:00
Chris Bracken
b9ceb3090d Add accessibility semantics support to embedder (flutter/engine#7891)
Flutter's accessibility APIs consist of three main calls from the
embedder to the Dart application:

  1. FlutterEngineUpdateSemanticsEnabled: enables/disables semantics support.

  2. FlutterEngineUpdateAccessibilityFeatures: sets embedder-specific
     accessibility features.

  3. FlutterEngineDispatchSemanticsAction: dispatches an action (tap,
     long-press, scroll, etc.) to a semantics node.

and two main callbacks triggered by Dart code:

  1. FlutterUpdateSemanticsNodeCallback: notifies the embedder of
     updates to the properties of a given semantics node.

  2. FlutterUpdateSemanticsCustomActionCallback: notifies the embedder
     of updates to custom semantics actions registered in Dart code.

In the Flutter framework, when accessibility is first enabled, the
embedder will receive a stream of update callbacks notifying the
embedder of the full semantics tree. On further changes in the Dart
application, only updates will be sent.
2019-02-20 18:59:29 -08:00
Chinmay Garde
c37c0d78b0 Respect the custom GL proc table when creating the resource context on the IO thread. (flutter/engine#7893)
Fixes https://github.com/flutter/flutter/issues/28229
2019-02-20 17:23:14 -08:00
stuartmorgan
7524aa2d8c Expose more pointer phases in embedder.h (flutter/engine#7813)
Adds 'add', 'remove', and 'hover' to the set of pointer phases that are
available to embedders. This is necessary for them to send hover events
to the engine.
2019-02-19 07:06:57 -08:00
Jason Simmons
a0f4916009 Remove the Dart JIT snapshot data from AOT builds of the embedder library (flutter/engine#7806)
Also extend the embedder unit tests to cover AOT execution
2019-02-15 09:43:23 -08:00
nathanrogersgoogle
7517ae90c3 Add flow events connecting pointer events to frames (flutter/engine#7807) 2019-02-13 22:27:12 -08:00
Chinmay Garde
8d53a804f3 Allow embedders to specify pointer device IDs. (flutter/engine#7790) 2019-02-11 16:49:45 -08:00
Chinmay Garde
46842b5f57 Update documentation for command line args in FlutterProjectArgs. (flutter/engine#7733) 2019-02-07 14:14:44 -08:00
Chris Bracken
7ff50beb59 Add FlutterProjectArgs::root_isolate_create_callback (flutter/engine#7651)
Allows embedders to specify a callback to be invoked in isolate scope
once root isolate has been created and marked runnable.

As an example of where this is useful, embedder unit test fixtures may
want to include Dart functions backed by a native implementation. On
isolate creation, this patch allows the unit test author to call
Dart_SetNativeResolver in root isolate scope.
2019-02-06 14:16:47 -08:00
Chris Bracken
03b5b4a509 Fix two typos in embedder docs (flutter/engine#7649) 2019-01-30 18:11:08 -08:00
Chinmay Garde
f7b24f4d90 Document make_resource_current on FlutterOpenGLRendererConfig and warn if the callback is not set. (flutter/engine#7648) 2019-01-30 16:13:00 -08:00
stuartmorgan
9292896011 Rename FlutterResult in embedder.h (flutter/engine#7567)
FlutterResult is also the name of a class in the Objective-C API
surface, which is problematic when building a framework that contains
both (such as a macOS implementation of the Flutter framework).
2019-01-29 14:01:31 -08:00
Chinmay Garde
1d7eebcc1b [embedder] Avoid looking for the kernel binary in AOT builds. (flutter/engine#7577) 2019-01-24 14:22:39 -08:00
Brian Osman
3dd1198f0d Remove SkColorSpaceXformCanvas, use color-managed SkSurfaces instead (flutter/engine#7548)
Behavior (visual) changes should be very minor. Things that are to be expected:
* A few things were not color managed correctly by the transform canvas (color emoji, some color filters). Those will be handled correctly with the tagged surfaces (although we're always transforming to sRGB, so nothing should change until we target a wider gamut).
* Image filtering will happen in the source color space, rather than the destination. Very minor.
* The transform canvas did caching of images in the destination color space. Now, the conversion happens at draw time. If there are performance issues, images can be pre-converted to the destination with makeColorSpace().
2019-01-22 15:34:51 -05:00