-
Notifications
You must be signed in to change notification settings - Fork 6k
Resize channel buffers #12402
Resize channel buffers #12402
Conversation
lib/ui/channel_buffers.dart
Outdated
| /// buffer size that will avoid any overflows. | ||
| static const int kDefaultBufferSize = 1; | ||
|
|
||
| static const String kControlChannelName = "com.google.flutter/channel-buffers"; |
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.
dev.flutter/
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
lib/ui/channel_buffers.dart
Outdated
| return utf8.decode(list); | ||
| } | ||
|
|
||
| /// Send a control message. |
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.
Somewhat unexpected that the name here is send a control message.
Wouldn't the verb be intercept or monitor?
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.
switched to "handle"
lib/ui/channel_buffers.dart
Outdated
| /// `resize/<channel name>/<new size>` | ||
| void handleMessage(ByteData data) { | ||
| final List<String> command = _getString(data).split('\r'); | ||
| if (command.length == 3 && command[0] == 'resize') { |
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.
Add code comment for the 3
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
lib/ui/hooks.dart
Outdated
| try { | ||
| channelBuffers.handleMessage(data); | ||
| } catch (ex) { | ||
| _printDebug('Message "$name" caused exception $ex'); |
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.
This here would say
"Message dev.flutter/channel-buffers caused exception... " right? Maybe Message to dev.flutter/channel-buffers?
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
| /// This could result in the dropping of messages if newSize is less | ||
| /// than the current length of the queue. | ||
| void resize(String channel, int newSize) { | ||
| void _resize(String channel, int newSize) { |
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.
A previously public method is now hidden. Isn't this a breaking change?
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.
It was public only for about a week.
| /// Arity: 2 | ||
| /// Format: `resize\r<channel name>\r<new size>` | ||
| /// Description: Allows you to set the size of a channel's buffer. | ||
| void handleMessage(ByteData data) { |
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.
Is the structure of these control messages, name of the channel, etc. documented anywhere or is this a new convention?
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.
It's new. I've documented them in the docstring. If there is somewhere else you'd like to see them let me know. The intention is that there is nice API's overtop of them so no one has to create them manually.
git@github.com:flutter/engine.git/compare/5c428d924790...9e6314d git log 5c428d9..9e6314d --no-merges --oneline 2019-10-01 bkonyi@google.com Roll src/third_party/dart 998f1efbe9..1103600280 (6 commits) 2019-10-01 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/linux-amd64 from 3Axx8... to L_AEL... (flutter/engine#12726) 2019-10-01 ychris@google.com Reland "Add iOS platform view mutation XCUITests to the scenario app(#11652)" (flutter/engine#12707) 2019-10-01 skia-flutter-autoroll@skia.org Roll src/third_party/skia a7914a872657..1e9112fbb472 (4 commits) (flutter/engine#12724) 2019-10-01 30870216+gaaclarke@users.noreply.github.com Resize channel buffers (flutter/engine#12402) 2019-10-01 bkonyi@google.com Roll src/third_party/dart fb1c5a6404..998f1efbe9 (3 commits) 2019-10-01 30870216+gaaclarke@users.noreply.github.com Cleanup: Turned on NS_ASSUME_NONNULL_BEGIN for FlutterViewController. (flutter/engine#12708) 2019-10-01 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from Jr7x0... to Q4sFH... (flutter/engine#12722) 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 cbracken@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/5c428d924790...9e6314d git log 5c428d9..9e6314d --no-merges --oneline 2019-10-01 bkonyi@google.com Roll src/third_party/dart 998f1efbe9..1103600280 (6 commits) 2019-10-01 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/linux-amd64 from 3Axx8... to L_AEL... (flutter/engine#12726) 2019-10-01 ychris@google.com Reland "Add iOS platform view mutation XCUITests to the scenario app(flutter#11652)" (flutter/engine#12707) 2019-10-01 skia-flutter-autoroll@skia.org Roll src/third_party/skia a7914a872657..1e9112fbb472 (4 commits) (flutter/engine#12724) 2019-10-01 30870216+gaaclarke@users.noreply.github.com Resize channel buffers (flutter/engine#12402) 2019-10-01 bkonyi@google.com Roll src/third_party/dart fb1c5a6404..998f1efbe9 (3 commits) 2019-10-01 30870216+gaaclarke@users.noreply.github.com Cleanup: Turned on NS_ASSUME_NONNULL_BEGIN for FlutterViewController. (flutter/engine#12708) 2019-10-01 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from Jr7x0... to Q4sFH... (flutter/engine#12722) 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 cbracken@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
Implemented a mechanism for BasicMessageChannels to resize their Channel Buffer.
Under certain circumstances sending messages on channels can result in messages getting thrown away. Channel Buffers added the ability for the engine to store those messages until they can be delivered. Now you can resize those buffers to adjust the behavior of the channel - do you want to store just the latest version? Nothing? Or attempt to store everything?
Related issue: flutter/flutter#38914