143 Commits

Author SHA1 Message Date
Zachary Anderson
35107c4dca Revert tracing changes (flutter/engine#9296)
* Revert "[fuchsia] Fix alignment of Fuchsia/non-Fuchsia tracing (#9289)"

This reverts commit e7d406fe36790b1a8161d4687a6a4a144ba44254.

* Revert "Align fuchsia and non-fuchsia tracing (#9199)"

This reverts commit 1ccb372e5f8ceaaf90f5b43b42df617d7f18d955.
2019-06-12 10:25:49 -07:00
liyuqian
fb0ea0ef4c Add onReportTimings and FrameRasterizedCallback API (flutter/engine#8983)
Using it, a Flutter app can monitor missing frames in the release mode, and a custom Flutter runner (e.g., Fuchsia) can add a custom FrameRasterizedCallback.

Related issues:
https://github.com/flutter/flutter/issues/26154
https://github.com/flutter/flutter/issues/31444
https://github.com/flutter/flutter/issues/32447

Need review as soon as possible so we can merge this before the end of May to catch the milestone.

Tests added:
* NoNeedToReportTimingsByDefault
* NeedsReportTimingsIsSetWithCallback
* ReportTimingsIsCalled
* FrameRasterizedCallbackIsCalled
* FrameTimingSetsAndGetsProperly
* onReportTimings preserves callback zone
* FrameTiming.toString has the correct format

This will need a manual engine roll as the TestWindow defined in the framework needs to implement onReportTimings.
2019-06-06 10:42:48 -07:00
Dan Field
1ccb372e5f Align fuchsia and non-fuchsia tracing (flutter/engine#9199) 2019-06-05 15:14:27 -07:00
Chinmay Garde
cb00aac583 Allow specifying both Dart and non-Dart fixtures in engine unit-tests. (flutter/engine#9113)
* Allow specifying both Dart and non-Dart fixtures in engine unittests.

This fixes numerous issues in the way in which fixtures were managed
in the engine unit-tests.

* Instead of only being able to specify Dart fixtures, unit-tests may specify
  non-Dart fixtures as well. These are simply copied over to the fixtures
  directory known to the unit-test at runtime.
* An issue where numerous Dart files could be given to the kernel snapshotter
  has been addressed. It was anticipated that such a (legal) invocation to the
  kernel snapshotter would produce a snapshot with the contents of all the Dart
  files added to the root library. This is incorrect and the behavior in this
  case is undefined.
* Dart files referenced by the main Dart file are correctly tracked via a
  depfile.
* The snapshotter arguments have been cleaned up to get rid of unused
  arguments (`—strong`) and  the use of the VM product mode argument has been
  corrected to no longer depend on the Flutter product mode.
2019-05-28 19:11:47 -07:00
Chris Bracken
21fd6fb32a Correct typos, adopt US spellings (flutter/engine#9081)
Corects a bnuch of typeos throughout teh engien codebsae. Also makes
a couple minor Commonwealth -> US spelling adjustments for consistency
with the rest of Flutter's codebase.

Made use of `misspell` tool:
https://github.com/client9/misspell
2019-05-25 13:14:46 -07:00
stuartmorgan
2b6a8b2d4c Expose pointer type and buttons in embedder.h (flutter/engine#9034)
Rather than hard-coding the type of incoming events to mouse, and
synthesizing a primary button press for kDown/kUp, expose device kind
and buttons in the API.

For backwards compatibility, if the type is not set, the old behavior is
used. If an embedder sets the type to mouse explicitly, however, they
must also set correct button information.

For the touch type, the API abstracts away the framework's internal
expectation that a button is set for touch down/move for simplicity.

Fixes flutter/flutter#32854
2019-05-22 11:30:32 -04:00
Matthew Dempsky
ca6d80857f Initialize next_pointer_flow_id_ to 0 (flutter/engine#9026)
This member variable was added to three classes in #7807, but only
initialized to 0 in one of them. Initialize to 0 in the other two.
2019-05-20 16:52:16 -07:00
Jason Simmons
f1ef8c2748 Add a minimal set of symbols to the dynamic symbol table for Linux executables (flutter/engine#8937)
This will reduce executable size.
2019-05-13 16:12:58 -07:00
Chinmay Garde
879711b321 Wire up the Skia Metal backend on iOS. (flutter/engine#8936) 2019-05-11 15:21:26 -07:00
Tong Mu
fa9dec68eb Synthesize buttons for embedders (flutter/engine#8873)
* Synthesize a buttons = kPrimaryButton for events of down and move
* Add PointerEventButtons
2019-05-10 12:12:51 -07:00
Dan Field
c96714ac5d new lints (flutter/engine#8849)
Dart lints added:
* Avoid optional new
* Avoid optional const
* Prefer single quotes
* Prefer default assignment `=`
2019-05-07 16:10:21 -07:00
liyuqian
358e88cabf Revert "Only allow mappings for ICU initialization. (#8656)" (flutter/engine#8682)
This reverts commit dfaa1c9292238e73c56d36f7264adc63ea53745c.

Reverts flutter/engine#8656

Reason:  https://github.com/flutter/engine/pull/8656 seems to break the framework windows tests and the engine roll (see https://cirrus-ci.com/task/4704667236827136 and https://github.com/flutter/flutter/pull/31330). The failure has been consistent for 7 consecutive engine-to-framework auto-rolls.

TBR: @chinmaygarde
2019-04-22 10:28:54 -07:00
Chinmay Garde
0b2269e30e Put the testing lib in the flutter namespace. (flutter/engine#8661) 2019-04-20 20:42:46 -07:00
Chinmay Garde
dfaa1c9292 Only allow mappings for ICU initialization. (flutter/engine#8656)
If the mapping callback is not set or it the callback returns invalid data, ICU initialization will be embedder responsibility.

This affects all embedders and the following have been audited:
* Android: Via a symbol mapping.
* iOS: Via a file mapping.
* Embedder: Via a file mapping.
* Fuchsia: Via a VMO mapping
* Test shells and Flutter tester: Via file mapping with ICU data needing to be next to the executable.
2019-04-19 15:01:40 -07:00
Chinmay Garde
1133591eeb Add factory methods to FileMapping that make it easy to create common mappings. (flutter/engine#8652)
The GetMapping calls removed in this patch had the same code and had to be repeated across different test harnesses as well as in dart_snapshot.cc. Just make this a factory method so the code is less verbose.
2019-04-19 12:48:53 -07:00
liyuqian
27e4dac06b Rename flow namespace to flutter (flutter/engine#8615)
This follows our namespace change from shell to flutter: https://github.com/flutter/engine/pull/8520.
2019-04-17 14:38:45 -07:00
Qxyat
500f19660d Composite Embedded Views with the correct GrContext
PaintRecorder Canvases are not associated with GrContexts.
2019-04-16 14:13:34 -07:00
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