-
Notifications
You must be signed in to change notification settings - Fork 6k
Specify a human readable reason for an error from the embedder API. #13218
Specify a human readable reason for an error from the embedder API. #13218
Conversation
shell/platform/embedder/embedder.cc
Outdated
| FML_LOG(ERROR) << "Returning error '" << name << "' (" << code | ||
| << ") from Flutter Embedder API call to '" << function | ||
| << "'. Origin: " << file << ":" << line; | ||
| const auto file_base = (::strrchr(file, '/') ? strrchr(file, '/') + 1 : file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the paths handed to us in file normalised? i.e. will this be an issue on Windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Yes. See https://godbolt.org/z/F6SO6q. Fixed.
shell/platform/embedder/embedder.cc
Outdated
| << "'. Origin: " << file << ":" << line; | ||
| const auto file_base = (::strrchr(file, '/') ? strrchr(file, '/') + 1 : file); | ||
| char error[256] = {}; | ||
| snprintf(error, (sizeof(error) / sizeof(char)) - 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sizeof(char) is 1 by definition (unless someone's sneakily updated the spec). In theory there's a small advantage to leaving it if we ever changed to wchar or something, it's a nice reminder I suppose.
shell/platform/embedder/embedder.cc
Outdated
| return LOG_EMBEDDER_ERROR(kInvalidLibraryVersion); | ||
| return LOG_EMBEDDER_ERROR( | ||
| kInvalidLibraryVersion, | ||
| "Flutter engine version the embedder was built for did not match the " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Since we're using the a few words in I'd use "The Flutter engine version..." to make this read a bit better. I had to backtrack and brain-reset once when I read this the first time :)
I suppose you could do something like "Flutter embedder version mismatch. The engine version ..."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
shell/platform/embedder/embedder.cc
Outdated
| FML_LOG(WARNING) << "Invalid renderer config."; | ||
| return LOG_EMBEDDER_ERROR(kInvalidArguments); | ||
| return LOG_EMBEDDER_ERROR(kInvalidArguments, | ||
| "The renderer configuration was not valid."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Desperate grasp at avoiding a line-wrap since github doesn't show an 80-col marker: would s/not valid/invalid/ get you to 80 cols by any chance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. But I updated it anyway.
cbracken
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shell/platform/embedder/embedder.cc
Outdated
| << "'. Origin: " << file << ":" << line; | ||
| const auto file_base = (::strrchr(file, '/') ? strrchr(file, '/') + 1 : file); | ||
| char error[256] = {}; | ||
| snprintf(error, (sizeof(error) / sizeof(char)) - 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use sizeof(error) here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to keep space for the null terminator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind. The man page says this is unnecessary.
shell/platform/embedder/embedder.cc
Outdated
| FML_LOG(ERROR) << "Returning error '" << name << "' (" << code | ||
| << ") from Flutter Embedder API call to '" << function | ||
| << "'. Origin: " << file << ":" << line; | ||
| const auto file_base = (::strrchr(file, '/') ? strrchr(file, '/') + 1 : file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a function to fml (similar to fml::paths::GetDirectoryName) that can handle each platform's path separators
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went for a smaller fix. If the same routine is required in any other spots, I will move to fml.
git@github.com:flutter/engine.git/compare/508146f0defb...7a621a7 git log 508146f..7a621a7 --no-merges --oneline 2019-10-18 skia-flutter-autoroll@skia.org Roll src/third_party/skia 20eafffd2d2f..b80d31f8cbe2 (4 commits) (flutter/engine#13226) 2019-10-18 skia-flutter-autoroll@skia.org Roll src/third_party/skia da29d70f1a59..20eafffd2d2f (1 commits) (flutter/engine#13223) 2019-10-18 skia-flutter-autoroll@skia.org Roll src/third_party/skia 63a387395751..da29d70f1a59 (11 commits) (flutter/engine#13221) 2019-10-18 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/linux-amd64 from WpvU_... to _G94w... (flutter/engine#13220) 2019-10-18 chinmaygarde@google.com Specify a human readable reason for an error from the embedder API. (flutter/engine#13218) 2019-10-18 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from _9Uy_... to KNygX... (flutter/engine#13219) 2019-10-17 iska.kaushik@gmail.com Reland ICU update to 64.2 (flutter/engine#13216) 2019-10-17 hterkelsen@users.noreply.github.com Use `window.devicePixelRatio` in the CanvasKit backend (flutter/engine#13192) 2019-10-17 gw280@google.com Re-enable WeakPtr ThreadChecker and fix associated failures (flutter/engine#12257) 2019-10-17 chinmaygarde@gmail.com Re-land "Custom compositor layers must take into account the device pixel ratio." 2019-10-17 chinmaygarde@gmail.com Add trace events around custom compositor callbacks. (flutter/engine#13212) 2019-10-17 skia-flutter-autoroll@skia.org Roll src/third_party/skia 93e853bf2b83..63a387395751 (9 commits) (flutter/engine#13208) 2019-10-17 bkonyi@google.com Roll src/third_party/dart 9b3c7f64d8..a61c775db8 (5 commits) 2019-10-17 chinmaygarde@gmail.com Document //flutter/runtime/dart_snapshot.h (flutter/engine#13196) 2019-10-17 chinmaygarde@gmail.com Revert "Custom compositor layers must take into account the device pixel ratio. (#13193)" (flutter/engine#13211) 2019-10-17 50856934+nturgut@users.noreply.github.com wrap the text in text editing. This was causing a missalingment issue in textarea. (flutter/engine#13207) 2019-10-17 chinmaygarde@google.com Custom compositor layers must take into account the device pixel ratio. (flutter/engine#13193) 2019-10-17 mouad.debbar@gmail.com [web] Environment variable to disable felt snapshot (flutter/engine#13187) 2019-10-17 bkonyi@google.com Roll src/third_party/dart 9e636b5ab4..9b3c7f64d8 (5 commits) 2019-10-17 skia-flutter-autoroll@skia.org Roll src/third_party/skia 0df7697235b4..93e853bf2b83 (1 commits) (flutter/engine#13205) 2019-10-17 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/linux-amd64 from ek5iQ... to WpvU_... (flutter/engine#13203) 2019-10-17 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from 6j3Gw... to _9Uy_... (flutter/engine#13202) 2019-10-17 skia-flutter-autoroll@skia.org Roll src/third_party/skia 6a19e03047cc..0df7697235b4 (1 commits) (flutter/engine#13200) 2019-10-17 bkonyi@google.com Roll src/third_party/dart 1e3e9ee04c..9e636b5ab4 (9 commits) 2019-10-17 skia-flutter-autoroll@skia.org Roll src/third_party/skia f29cb70281d5..6a19e03047cc (5 commits) (flutter/engine#13198) 2019-10-17 bkonyi@google.com Roll src/third_party/dart f020ce5d23..1e3e9ee04c (12 commits) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC franciscojma@google.com on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
git@github.com:flutter/engine.git/compare/508146f0defb...7a621a7 git log 508146f..7a621a7 --no-merges --oneline 2019-10-18 skia-flutter-autoroll@skia.org Roll src/third_party/skia 20eafffd2d2f..b80d31f8cbe2 (4 commits) (flutter/engine#13226) 2019-10-18 skia-flutter-autoroll@skia.org Roll src/third_party/skia da29d70f1a59..20eafffd2d2f (1 commits) (flutter/engine#13223) 2019-10-18 skia-flutter-autoroll@skia.org Roll src/third_party/skia 63a387395751..da29d70f1a59 (11 commits) (flutter/engine#13221) 2019-10-18 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/linux-amd64 from WpvU_... to _G94w... (flutter/engine#13220) 2019-10-18 chinmaygarde@google.com Specify a human readable reason for an error from the embedder API. (flutter/engine#13218) 2019-10-18 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from _9Uy_... to KNygX... (flutter/engine#13219) 2019-10-17 iska.kaushik@gmail.com Reland ICU update to 64.2 (flutter/engine#13216) 2019-10-17 hterkelsen@users.noreply.github.com Use `window.devicePixelRatio` in the CanvasKit backend (flutter/engine#13192) 2019-10-17 gw280@google.com Re-enable WeakPtr ThreadChecker and fix associated failures (flutter/engine#12257) 2019-10-17 chinmaygarde@gmail.com Re-land "Custom compositor layers must take into account the device pixel ratio." 2019-10-17 chinmaygarde@gmail.com Add trace events around custom compositor callbacks. (flutter/engine#13212) 2019-10-17 skia-flutter-autoroll@skia.org Roll src/third_party/skia 93e853bf2b83..63a387395751 (9 commits) (flutter/engine#13208) 2019-10-17 bkonyi@google.com Roll src/third_party/dart 9b3c7f64d8..a61c775db8 (5 commits) 2019-10-17 chinmaygarde@gmail.com Document //flutter/runtime/dart_snapshot.h (flutter/engine#13196) 2019-10-17 chinmaygarde@gmail.com Revert "Custom compositor layers must take into account the device pixel ratio. (flutter#13193)" (flutter/engine#13211) 2019-10-17 50856934+nturgut@users.noreply.github.com wrap the text in text editing. This was causing a missalingment issue in textarea. (flutter/engine#13207) 2019-10-17 chinmaygarde@google.com Custom compositor layers must take into account the device pixel ratio. (flutter/engine#13193) 2019-10-17 mouad.debbar@gmail.com [web] Environment variable to disable felt snapshot (flutter/engine#13187) 2019-10-17 bkonyi@google.com Roll src/third_party/dart 9e636b5ab4..9b3c7f64d8 (5 commits) 2019-10-17 skia-flutter-autoroll@skia.org Roll src/third_party/skia 0df7697235b4..93e853bf2b83 (1 commits) (flutter/engine#13205) 2019-10-17 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/linux-amd64 from ek5iQ... to WpvU_... (flutter/engine#13203) 2019-10-17 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from 6j3Gw... to _9Uy_... (flutter/engine#13202) 2019-10-17 skia-flutter-autoroll@skia.org Roll src/third_party/skia 6a19e03047cc..0df7697235b4 (1 commits) (flutter/engine#13200) 2019-10-17 bkonyi@google.com Roll src/third_party/dart 1e3e9ee04c..9e636b5ab4 (9 commits) 2019-10-17 skia-flutter-autoroll@skia.org Roll src/third_party/skia f29cb70281d5..6a19e03047cc (5 commits) (flutter/engine#13198) 2019-10-17 bkonyi@google.com Roll src/third_party/dart f020ce5d23..1e3e9ee04c (12 commits) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC franciscojma@google.com on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

Fixes flutter/flutter#42480