Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@gaaclarke
Copy link
Member

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

/// buffer size that will avoid any overflows.
static const int kDefaultBufferSize = 1;

static const String kControlChannelName = "com.google.flutter/channel-buffers";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dev.flutter/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@gaaclarke gaaclarke requested a review from xster September 23, 2019 21:08
return utf8.decode(list);
}

/// Send a control message.
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switched to "handle"

/// `resize/<channel name>/<new size>`
void handleMessage(ByteData data) {
final List<String> command = _getString(data).split('\r');
if (command.length == 3 && command[0] == 'resize') {
Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

try {
channelBuffers.handleMessage(data);
} catch (ex) {
_printDebug('Message "$name" caused exception $ex');
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@gaaclarke gaaclarke requested review from chinmaygarde and xster and removed request for xster September 24, 2019 21:17
/// 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) {
Copy link
Contributor

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?

Copy link
Member Author

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) {
Copy link
Contributor

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?

Copy link
Member Author

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.

@gaaclarke gaaclarke added the CQ+1 label Oct 1, 2019
@gaaclarke gaaclarke merged commit f407e06 into flutter:master Oct 1, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 1, 2019
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Oct 1, 2019
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
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Nov 26, 2019
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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants