257 Commits

Author SHA1 Message Date
Dan Field
e778949043 Reland path vol tracker (flutter/engine#23840)
This time making sure to deref the native object on GC.
2021-01-21 16:03:43 -08:00
Dan Field
cb57183325 revert path volatility tracker (flutter/engine#23822) 2021-01-21 08:34:02 -08:00
Jason Simmons
fa72fff62d Remove unused fml::Message serializer (flutter/engine#23669) 2021-01-14 14:44:04 -08:00
Jason Simmons
3c26d58ae9 Call JavaVM::AttachCurrentThread only once per thread (flutter/engine#23188) 2021-01-06 17:44:02 -08:00
s-sami
5619043974 Use syslog for logging on Fuchsia (flutter/engine#23429)
Make fml logging use syslog on Fuchsia. This allows logs
to be attributed to flutter and not pollute kernel logs.
2021-01-06 14:02:07 -08:00
Dan Field
dedf9bd1af Reland path volatility tracker, disabling it if deterministic rendering is requested (flutter/engine#23226)
* Reland path volatility tracker (#23063)" (#23220)

This reverts commit b56fc25561417f96e17dacab375e66f474a54c94.

* allow disabling based on whether deterministic rendering is needed
2020-12-22 08:25:20 -08:00
Dan Field
b56fc25561 Revert "Reland path volatility tracker (#23063)" (flutter/engine#23220)
This reverts commit 77c7096efb0b1392acc9793c386561a3c36012ba.
2020-12-21 13:53:18 -08:00
Dan Field
77c7096efb Reland path volatility tracker (flutter/engine#23063)
* Revert "Revert "Set SkPath::setIsVolatile based on whether the path survives at least two frames (#22620)" (#23044)"

This reverts commit feda80cb42f99e2588a9a6b9ab3dd1f812d0f45b.

* Fix tracing
2020-12-14 17:21:55 -08:00
freiling
4903a92b2b SKP based shader warmup (flutter/engine#20643) 2020-11-04 23:19:02 -08:00
Chinmay Garde
2f755560eb Add FML_UNREACHABLE to declare points in code that should never be reached. (flutter/engine#21941)
A version of this macro is present in most code-bases. The use of this macro
must satisfy two requirements:

1: If reached, the process must be terminated in all runtime modes and at all
   optimization levels.
2: If the compiler requires a value to be returned from the function,
   encountering this macro should not make the compiler insist on a return value
  (since the process is about to die anyway).

We used to have a version of this macro that wasn't widely used and didn't
satisfy the two requirements. I have removed the same and another unused macro
in fml/logging.h

Fixes https://github.com/flutter/flutter/issues/68164.
2020-10-16 20:47:43 -07:00
Chinmay Garde
db5c793ed5 Enable loading snapshots with sound null safety enabled. (flutter/engine#21820)
Snapshots compiled with sound null-safety enabled require changes to the way in
which isolates are launched. Specifically, the `Dart_IsolateFlags::null_safety`
field needs to be known upfront. The value of this field can only be determined
once the kernel snapshot is available. This poses a problem in the engine
because the engine used to launch the isolate at shell initialization and only
need the kernel mappings later at isolate launch (when transitioning the root
isolate to the `DartIsolate::Phase::Running` phase). This patch delays launch of
the isolate on the UI task runner till a kernel mapping is available. The side
effects of this delay (callers no longer having access to the non-running
isolate handle) have been addressed in this patch. The DartIsolate API has also
been amended to hide the method that could return a non-running isolate to the
caller.  Instead, it has been replaced with a method that requires a valid
isolate configuration that returns a running root isolate. The isolate will be
launched by asking the isolate configuration for its null-safety
characteristics.

A side effect of enabling null-safety is that Dart APIs that work with legacy
types will now terminate the process if used with an isolate that has sound
null-safety enabled. These APIs may no longer be used in the engine. This
primarily affects the Dart Convertors in Tonic that convert certain C++ objects
into the Dart counterparts. All known Dart Converters have been updated to
convert C++ objects to non-nullable Dart types inferred using type traits of the
corresponding C++ object. The few spots in the engine that used the old Dart
APIs directly have been manually updated. To ensure that no usage of the legacy
APIs remain in the engine (as these would cause runtime process terminations),
the legacy APIs were prefixed with the `DART_LEGACY_API` macro and the macro
defined to `[[deprecated]]` in all engine translation units. While the engine
now primarily works with non-nullable Dart types, callers can still use
`Dart_TypeToNonNullableType` to acquire nullable types for use directly or with
Tonic. One use case that is not addressed with the Tonic Dart Convertors is the
creation of non-nullable lists of nullable types. This hasn’t come up so far in
the engine.

A minor related change is reworking tonic to define a single library target.
This allows the various tonic subsystems to depend on one another. Primarily,
this is used to make the Dart convertors use the logging utilities. This now
allows errors to be more descriptive as the presence of error handles is caught
(and logged) earlier.

Fixes https://github.com/flutter/flutter/issues/59879
2020-10-16 14:53:26 -07:00
Dan Field
9377073f34 Fix windows popup (flutter/engine#21522) 2020-09-30 14:38:44 -07:00
Chinmay Garde
aacf00f3b6 Make scoped_nsprotocol::release() private. (flutter/engine#21467)
This is not used anywhere in the engine. However, this API is easy to misuse as
one might incorrectly assume that it releases the reference on the underlying
object. Callers must use `reset` for this purpose.
2020-09-28 14:02:21 -07:00
Chris Bracken
2586db3b22 Clean up C++ includes (flutter/engine#21127)
Cleans up header order/grouping for consistency: associated header, C/C++ system/standard library headers, library headers, platform-specific #includes.

Adds <cstring> where strlen, memcpy are being used: there are a bunch of places we use them transitively.

Applies linter-required cleanups. Disables linter on one file due to included RapidJson header. See https://github.com/flutter/flutter/issues/65676

This patch does not cover flutter/shell/platform/darwin. There's a separate, slightly more intensive cleanup for those in progress.
2020-09-11 21:18:35 -07:00
Chris Bracken
d03692449b Prefer C++ standard headers to their C counterpart (flutter/engine#21091)
We currently use a mix of C standard includes (e.g. limits.h) and their
C++ variants (e.g. climits). This migrates to a consistent style for all
cases where the C++ variants are acceptable, but leaves the C
equivalents in place where they are required, such as in the embedder
API and other headers that may be used from C.
2020-09-11 17:10:00 -07:00
Emmanuel Garcia
a942137a5d Only clear GL context after changing the thread configuration (flutter/engine#20965) 2020-09-02 22:10:02 -07:00
Emmanuel Garcia
9d05be2966 Add ability to disable the raster thread merger (flutter/engine#20800) 2020-08-28 17:25:00 -07:00
Chris Yang
c85f437dc9 |MessageLoopImpl::FlushTasks| runs one task at a time (flutter/engine#20771) 2020-08-27 14:18:02 -07:00
Emmanuel Garcia
d0947b9852 Ensure loop is woken up at the right time (flutter/engine#20721) 2020-08-24 13:09:44 -07:00
Chris Yang
72162b7a66 Ensure threads are merged when tearing down the Rasterizer (flutter/engine#19919) 2020-08-19 08:31:01 -07:00
David Worsham
4e60afdf2a Fix broken shell_unittests on Fuchsia (flutter/engine#20422)
Fixes https://github.com/flutter/flutter/issues/53399
2020-08-11 17:31:25 -07:00
Zachary Anderson
b7b32e51b4 Enable linting in several files (flutter/engine#20134) 2020-07-31 21:28:36 -07:00
Greg Spencer
d9b08f5411 Lint fixes for fml, tools subdirs (flutter/engine#19990)
This does lint fixes for the fml and tools subdirs.
2020-07-30 12:40:31 -07:00
Siva
03706dce89 Manual roll of Dart from 24c7666def...40fd1c456e (flutter/engine#20092)
* Manual roll of Dart from 24c7666def...40fd1c456e

dart-lang/sdk@40fd1c456e Revert "[dart:io] Add Abort() on HttpClientRequest"
dart-lang/sdk@17d7296a42 [vm/nnbd/bytecode] Fix reuse of type arguments in bytecode
dart-lang/sdk@58b6f40c73 Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns. (reland)
dart-lang/sdk@fc8a6d9f9b [VM/compiler] Dereference TypeRef literal when propagating constants.
dart-lang/sdk@0689ec527a Move "test.dart" (well, most of its contents) into pkg/test_runner.
dart-lang/sdk@1094b3c61d Prepare static error test updater tool to handle web tests.
dart-lang/sdk@b258585f2f [observatory] Migrate from deprecated isInstanceOf to isA.
dart-lang/sdk@dfe1d9b682 Disable OverrideContributor for Cider.
dart-lang/sdk@aea99b2f5c scope debug property assist to Diagnosticables
dart-lang/sdk@4b96f20a79 [dart:io] Add Abort() on HttpClientRequest
dart-lang/sdk@1b1a39708c [build] Use frameworks instead of libs
dart-lang/sdk@3fef522496 Revert "Reland "[vm] Replaces fuchsia.deprecatedtimezone""
dart-lang/sdk@8c664d4f3f Revert "Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns."
dart-lang/sdk@2efb5bebc7 [ dart:_http ] Fix typo in HTTP response timeline event
dart-lang/sdk@0884dae36c Revert "Fix the #include path for ICU headers"
dart-lang/sdk@5171534e81 Scope tweaks. Report REFERENCED_BEFORE_DECLARATION in more places.
dart-lang/sdk@6bba75079a Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns.
dart-lang/sdk@b4ebbb7f5c [build] Update gn to match Fuchsia
dart-lang/sdk@cb428a7a02 [dart2js] Remove old bug work around in collector.
dart-lang/sdk@08663c20ab Change flutter patch to match existing DEPS on master branch
dart-lang/sdk@146ad014d9 update js/meta for the 2.10 dev sdk
dart-lang/sdk@488c718793 [co19] Roll co19 to d79951e06e443213243e54c2c32694b79a221b65
dart-lang/sdk@ba20edd7be Add patch for flutter-engine when changing to version 2.10

* Rev buildroot to latest version.

* Update license.

* update.

* Update gn revision.

* Format BUILD.gn files as the gn revision has been updated.
2020-07-29 13:10:15 -07:00
gaaclarke
ee0e1788d9 Made the linter print out more information in its output and fixed bugs (flutter/engine#19895) 2020-07-22 15:38:09 -07:00
David Worsham
980420fed4 fuchsia: Allow setting thread-name (flutter/engine#19792) 2020-07-16 12:43:53 -07:00
David Worsham
cbd3cd9c0d fuchsia: Enable most unittests (flutter/engine#19583)
Tweak the primary flutter build rule so that fuchsia is more similar to
other platforms in how tests and the shell are built.

Only embedder_unittests and GLFW tests are disabled on Fuchsia now.

TEST: Ran unittests on host/fuchsia; workstation on fuchsia
BUG: fxb/53847, fxb/54056
2020-07-13 17:36:19 -07:00
Emmanuel Garcia
202c1af268 Implement external view embedder on Android (flutter/engine#19033)
The external view embedder allows to embed Android views in a Flutter app.
2020-06-20 12:51:55 -07:00
Michael Goderbauer
e6d2948d07 Rename trace-whitelist to trace-allowlist (flutter/engine#19047) 2020-06-15 20:52:43 -07:00
Chinmay Garde
3df6d47028 Include the memory header as unique_ptr is used in ASCII Trie. (flutter/engine#18978) 2020-06-10 17:25:04 -07:00
Jason Simmons
4e7ea8b87c Disable event tracing templates in release mode (flutter/engine#18855) 2020-06-09 10:58:05 -07:00
zljj0818
ae9618cf4d fix AttachCurrentThread override thread name issue (flutter/engine#18815) 2020-06-08 12:03:03 -07:00
George Wright
76c1ffec81 Implement WriteAtomically using write/fsync on all platforms, and enable (flutter/engine#18320) 2020-05-21 12:07:03 -07:00
David Worsham
9ed56044d4 fuchsia: Fix runtime_tests and shell_tests (flutter/engine#18492) 2020-05-20 18:47:02 -07:00
George Wright
955906137a Set caches directory on Fuchsia (flutter/engine#18321) 2020-05-20 11:05:55 -07:00
Chris Yang
80c707a642 Introduce TaskRunnerAffineWeakPtrFactory to generate TaskRunnerAffineWeakPtrs (flutter/engine#18346) 2020-05-19 16:36:17 -07:00
liyuqian
256ab19662 Automatically remove old persistent cache dir (flutter/engine#18244)
Fixes https://github.com/flutter/flutter/issues/53445
2020-05-15 14:15:59 -07:00
Chris Yang
d01fc45249 refactor the task_runner and task_runner_checker (flutter/engine#18238) 2020-05-11 13:58:08 -07:00
Kaushik Iska
b1b1cea351 [profiling] CPU Profiling support for iOS (flutter/engine#18087)
See flutter.dev/go/engine-cpu-profiling for details
2020-05-07 08:11:07 -07:00
Chris Yang
d1d6103681 Introduce TaskRunnerChecker, TaskRunnerAffineWeakPtr (flutter/engine#17649) 2020-05-01 11:28:20 -07:00
liyuqian
6c93145ef5 Read SkSLs from asset (flutter/engine#17601)
Fixes https://github.com/flutter/flutter/issues/53117

Test added:
- ShellTest.CanLoadSkSLsFromAsset
2020-04-10 00:16:33 -07:00
gaaclarke
9513e65f95 Added "unrecognized-selector" errors to match g3 builds (flutter/engine#17566)
Added "unrecognized-selector" errors to match g3 builds, added
"overriding-method-mismatch" to catch a common error.
2020-04-07 13:28:42 -07:00
Chris Bracken
2a97bc1e16 Revert "Added errors to match g3 builds and simple errors (#17536)" (flutter/engine#17564)
Test failure:

    [ RUN      ] FlutterStringCodec.CanEncodeAndDecodeNil
    2020-04-07 10:21:25.091 flutter_channels_unittests[26965:163315] *** Assertion failure in -[FlutterStringCodec encode:], ../../flutter/shell/platform/darwin/common/framework/Source/FlutterCodecs.mm:36
    2020-04-07 10:21:25.118 flutter_channels_unittests[26965:163315] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: ''
    *** First throw call stack:
    (
    	0   CoreFoundation                      0x00007fff2ccabcf9 __exceptionPreprocess + 256
    	1   libobjc.A.dylib                     0x00007fff5785ea17 objc_exception_throw + 48
    	2   CoreFoundation                      0x00007fff2ccc6a16 +[NSException raise:format:arguments:] + 98
    	3   Foundation                          0x00007fff2ef58e11 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
    	4   flutter_channels_unittests          0x0000000105f1cce2 -[FlutterStringCodec encode:] + 290
    	5   flutter_channels_unittests          0x0000000105f01bbb _ZN45FlutterStringCodec_CanEncodeAndDecodeNil_Test8TestBodyEv + 107
    	6   flutter_channels_unittests          0x00000001081d1732 _ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc + 146
    	7   flutter_channels_unittests          0x00000001081a76b0 _ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc + 128
    	8   flutter_channels_unittests          0x00000001081a75c1 _ZN7testing4Test3RunEv + 209
    	9   flutter_channels_unittests          0x00000001081a8415 _ZN7testing8TestInfo3RunEv + 229
    	10  flutter_channels_unittests          0x00000001081a95aa _ZN7testing9TestSuite3RunEv + 266
    	11  flutter_channels_unittests          0x00000001081b4e43 _ZN7testing8internal12UnitTestImpl11RunAllTestsEv + 995
    	12  flutter_channels_unittests          0x00000001081d8572 _ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc + 146
    	13  flutter_channels_unittests          0x00000001081b49b3 _ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc + 131
    	14  flutter_channels_unittests          0x00000001081b4835 _ZN7testing8UnitTest3RunEv + 197
    	15  flutter_channels_unittests          0x0000000105f22e73 _Z13RUN_ALL_TESTSv + 35
    	16  flutter_channels_unittests          0x0000000105f22d79 main + 553
    	17  libdyld.dylib                       0x00007fff5908c3d5 start + 1
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException
    [ERROR:flutter/fml/backtrace.cc(110)] Caught signal SIGABRT during program execution.
    Frame 0: 0x7fff591316a6 abort
    Frame 1: 0x7fff560ea641 __cxa_bad_cast
    Frame 2: 0x7fff560ea7df default_unexpected_handler()�
    Frame 3: 0x7fff57860ee3 _objc_terminate()�
    Frame 4: 0x7fff560f619e std::__terminate(void (*)())�
    Frame 5: 0x7fff560f5f86 __cxa_get_exception_ptr
    Frame 6: 0x7fff560e8f99 __cxa_get_globals
    Frame 7: 0x7fff5785eb51 objc_exception_throw
    Frame 8: 0x7fff2ccc6a16 +[NSException raise:format:arguments:]
    Frame 9: 0x7fff2ef58e11 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
    Frame 10: 0x105f1cce2 -[FlutterStringCodec encode:]
    Frame 11: 0x105f01bbb FlutterStringCodec_CanEncodeAndDecodeNil_Test::TestBody()�
    Frame 12: 0x1081d1732 void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)�
    Frame 13: 0x1081a76b0 void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)�
    Frame 14: 0x1081a75c1 testing::Test::Run()�
    Frame 15: 0x1081a8415 testing::TestInfo::Run()�
    Frame 16: 0x1081a95aa testing::TestSuite::Run()�
    Frame 17: 0x1081b4e43 testing::internal::UnitTestImpl::RunAllTests()�
    Frame 18: 0x1081d8572 bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)�
    Frame 19: 0x1081b49b3 bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)�
    Frame 20: 0x1081b4835 testing::UnitTest::Run()�
    Frame 21: 0x105f22e73 RUN_ALL_TESTS()�
    Frame 22: 0x105f22d79 main
    Frame 23: 0x7fff5908c3d5 start

This reverts commit 46f82a3d938a621d2cae8591d6f7566e01f118e1.
2020-04-07 10:32:38 -07:00
gaaclarke
46f82a3d93 Added errors to match g3 builds and simple errors (flutter/engine#17536)
"unrecognized-selector" and "overriding-method-mismatch" added as errors.
2020-04-07 10:03:49 -07:00
Kaushik Iska
ce0ec9042f [pipeline] Add trace event for lag between target and display times (flutter/engine#17384)
This change also adds TimeRecorder which records time at the start
of each frame to capture the latest vsync target display time and
wires it in to the rasterizer to add trace events when there is a lag.
2020-04-02 17:15:45 -07:00
liyuqian
b4f8a7c881 GPU to raster rename, patch 2 (flutter/engine#17428) 2020-03-31 15:16:11 -07:00
liyuqian
b5318d05ff More rename from GPU thread to raster thread (flutter/engine#17408)
This PR touches variable names, class names, and file names so it's significantly more risky than its predecessor https://github.com/flutter/engine/pull/17329

Due to file name changes, this PR is expected to change the license files.

We haven't rename `shell/gpu` to `shell/raster` yet. It should be optional but I think it's better to have `raster_surface_software.cc` than `gpu_surface_software.cc`.
2020-03-31 14:05:28 -07:00
liyuqian
10824995dd Rename GPU thread to raster thread in code comments (flutter/engine#17329)
1. Simple "GPU thread" to "raster thread" replacement.

2. Regex replace "GPU([\n\r\s]+//+ thread)" with "raster$1".

3. Regex replace "// gpu$" with "// raster".

4. Simple test change.

5. Run ci/format.sh
2020-03-25 22:49:59 -07:00
Chinmay Garde
929fb3f825 Remove checks for the always true using_fuchsia_sdk flag in all GN files. (flutter/engine#17261) 2020-03-23 18:31:02 -07:00
Chinmay Garde
44f93dddb7 Allow external texture sources when using the Metal backend. (flutter/engine#17154) 2020-03-22 22:36:03 -07:00