-
Notifications
You must be signed in to change notification settings - Fork 6k
Conversation
go until message handling is setup.
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.
Let's try to limit the amount of public API we add for this as much as possible. We should also look at the docs that we have that are user facing, as well as any warnings/errors we print.
/cc @Hixie since this is adding public surface API to dart:ui
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.
The web parts LGTM
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.
Sorry, there's a bunch of comments, but mostly around the rigor needed for public Dart APIs
PlatformMessageResponseCallback get callback => _callback; | ||
} | ||
|
||
/// A fixed-size circular queue. |
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 per channel, fixed-size circular queue.
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.
There isn't anything about the implementation that requires this to be used for channels. It's a generic RingBuffer that could be used anywhere.
lib/ui/channel_buffers.dart
Outdated
class _RingBuffer<T> { | ||
final collection.ListQueue<T> _queue; | ||
int _capacity; | ||
Function(T) _dropItemCallback; |
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.
Not clear what this should be. Add doc.
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, missed responding to this last night.
int get capacity => _capacity; | ||
|
||
bool get isEmpty => _queue.isEmpty; | ||
|
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.
doc
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
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 doesn't say anything :) https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#avoid-useless-documentation
Something like Add a callback when previously queued messages are being dropped due to overflow. The message instance is returned in the callback.
.
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.
That seemed redundant since the docstring for _dropItemCallback says all of that. The intent was to point them to that documentation and not repeat it.
I found examples elsewhere and they put the ivar next to the setter and getter and it gets collapsed in the generated documentation so I don't have to repeat it, so done
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.
Yup, this works.
lib/ui/channel_buffers.dart
Outdated
/// Returns true on overflow. | ||
bool push(T val) { | ||
bool overflow = false; | ||
while (_queue.length >= _capacity) { |
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.
wouldn't you want to reuse the resize logic here or extract a part of it? There's some repetition 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.
Done, it wasn't trivial since the logic was a bit different and didn't buy many lines, but since you asked there you go.
} | ||
} | ||
|
||
typedef DrainChannelCallback = Future<void> Function(ByteData, PlatformMessageResponseCallback); |
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.
Doc. Who is supposed to use it. Use See also: for references.
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
'Messages on this channel are being sent faster ' | ||
'than they are being processed which is resulting ' | ||
'in the dropping of messages. The engine may not be ' | ||
'running or you need to adjust the buffer size.'); |
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 would gate adjusting the buffer size with a lot of care. It's rarely what the user really wants to do. Make sure we thoroughly explain the cause before recommending this.
return result; | ||
} | ||
|
||
/// Returns null on underflow. |
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.
When would this happen? Wouldn't consumers check isEmpty first?
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.
They should be calling isEmpty. You know how it is, troublemakers don't follow the protocol.
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.
dem delinquent kids these days
return (queue == null) ? true : queue.isEmpty; | ||
} | ||
|
||
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.
All public Dart classes and fields need dartdocs.
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.
|
||
part of ui; | ||
|
||
typedef DrainChannelCallback = Future<void> Function(ByteData, PlatformMessageResponseCallback); |
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.
dartdoc
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'm not sure what you are referring to. I updated the docstring to match the ones found in lib/ui/window.dart
/// Storage of channel messages until the channels are completely routed, | ||
/// i.e. when a message handler is attached to the channel on the framework side. | ||
/// | ||
/// Each channel has a finite buffer capacity and in a FIFO manner messages will |
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.
Make this doc correct (i.e. this class doesn't do anything on web)
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
queue = _makeRingBuffer(kDefaultBufferSize); | ||
_messages[channel] = queue; | ||
} | ||
final bool result = queue.push(_StoredMessage(data, callback)); |
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.
just call this overflowed locally if that's what it's supposed to mean
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
// TODO(aaclarke): Update this message to include instructions on how to resize | ||
// the buffer once that is available to users. | ||
_Logger._printString('Overflow on channel: $channel. ' | ||
'Messages on this channel are being discarded. ' |
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.
The temporal reference isn't clear. Make it clear that it's previously cached messages that are being discarded.
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.
Added FIFO notice. I don't want to say previous cached methods because if the size is zero, that is misleading.
lib/ui/channel_buffers.dart
Outdated
|
||
/// Changes the capacity of the queue associated with the given channel. | ||
/// | ||
/// This could result in the dropping of messages if the newSize is less |
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 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.
No article? Done.
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.
ha, I'm sure there was a goomics episode about this but I can't find it anymore.
I actually meant use back-ticks ` around method argument references in docs.
lib/ui/channel_buffers.dart
Outdated
|
||
/// Changes the capacity of the queue associated with the given channel. | ||
/// | ||
/// This could result in the dropping of messages if the newSize is less |
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.
dropping of messages from the front of the queue
lib/ui/channel_buffers.dart
Outdated
/// Remove and process all stored messages for a given channel. | ||
/// | ||
/// This should be called once a channel is prepared to handle messages | ||
/// (ie when a message handler is setup in the framework). |
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: i.e.
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
} | ||
} | ||
|
||
final ChannelBuffers channelBuffers = ChannelBuffers(); |
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.
Still needs a doc (for public fields)
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.
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.
LGTM
printed in debug builds.
[email protected]:flutter/engine.git/compare/63873d9f421f...d1692d4 git log 63873d9..d1692d4 --no-merges --oneline 2019-09-17 [email protected] Update canvaskit backend (flutter/engine#12318) 2019-09-17 [email protected] README for the felt tool (flutter/engine#12323) 2019-09-17 [email protected] Fix continuous event polling in the GLFW event loop (flutter/engine#12320) 2019-09-17 [email protected] Tests for #11283 (flutter/engine#12322) 2019-09-17 [email protected] Improve check to render (or not) a DRRect when inner falls outside of outer on RecordingCanvas (flutter/engine#12229) 2019-09-17 [email protected] Roll src/third_party/dart dd1969a43a..7505b3a5f0 (39 commits) 2019-09-17 [email protected] Channel buffers (flutter/engine#12167) 2019-09-17 [email protected] Make iOS FlutterViewController stop sending inactive/pause on app lifecycle events when not visible (flutter/engine#12128) 2019-09-17 [email protected] Adds PluginRegistry to the C++ client wrapper API (flutter/engine#12287) 2019-09-17 [email protected] Add "type" to getDisplayRefreshRate protocol (flutter/engine#12319) 2019-09-17 [email protected] Add a build command to felt (flutter/engine#12303) 2019-09-17 [email protected] Roll src/third_party/skia df432d5efb70..d545bfbb94ca (1 commits) (flutter/engine#12316) 2019-09-17 [email protected] Roll fuchsia/sdk/core/linux-amd64 from rwf0-... to RRgw-... (flutter/engine#12315) 2019-09-17 [email protected] Roll src/third_party/skia f8486f2c5fb6..df432d5efb70 (1 commits) (flutter/engine#12313) 2019-09-17 [email protected] Roll src/third_party/skia b47704b0bd34..f8486f2c5fb6 (2 commits) (flutter/engine#12312) 2019-09-16 [email protected] Fix the declaration of setSystemGestureExclusionRects to match the PlatformMessageHandler interface (flutter/engine#12306) 2019-09-16 [email protected] Manage resource and onscreen contexts using separate IOSGLContext objects (flutter/engine#12277) 2019-09-16 [email protected] Cleanup in web_ui (flutter/engine#12307) 2019-09-16 [email protected] Made flutter startup faster by allowing initialization to be parallelized (flutter/engine#10182) 2019-09-16 [email protected] Roll src/third_party/skia c22498502cda..b47704b0bd34 (16 commits) (flutter/engine#12304) 2019-09-16 [email protected] Include firefox in check to quote font families (flutter/engine#12288) 2019-09-16 [email protected] Roll src/third_party/dart 7799f424f4..dd1969a43a (2 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 [email protected] 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
[email protected]:flutter/engine.git/compare/63873d9f421f...d1692d4 git log 63873d9..d1692d4 --no-merges --oneline 2019-09-17 [email protected] Update canvaskit backend (flutter/engine#12318) 2019-09-17 [email protected] README for the felt tool (flutter/engine#12323) 2019-09-17 [email protected] Fix continuous event polling in the GLFW event loop (flutter/engine#12320) 2019-09-17 [email protected] Tests for flutter#11283 (flutter/engine#12322) 2019-09-17 [email protected] Improve check to render (or not) a DRRect when inner falls outside of outer on RecordingCanvas (flutter/engine#12229) 2019-09-17 [email protected] Roll src/third_party/dart dd1969a43a..7505b3a5f0 (39 commits) 2019-09-17 [email protected] Channel buffers (flutter/engine#12167) 2019-09-17 [email protected] Make iOS FlutterViewController stop sending inactive/pause on app lifecycle events when not visible (flutter/engine#12128) 2019-09-17 [email protected] Adds PluginRegistry to the C++ client wrapper API (flutter/engine#12287) 2019-09-17 [email protected] Add "type" to getDisplayRefreshRate protocol (flutter/engine#12319) 2019-09-17 [email protected] Add a build command to felt (flutter/engine#12303) 2019-09-17 [email protected] Roll src/third_party/skia df432d5efb70..d545bfbb94ca (1 commits) (flutter/engine#12316) 2019-09-17 [email protected] Roll fuchsia/sdk/core/linux-amd64 from rwf0-... to RRgw-... (flutter/engine#12315) 2019-09-17 [email protected] Roll src/third_party/skia f8486f2c5fb6..df432d5efb70 (1 commits) (flutter/engine#12313) 2019-09-17 [email protected] Roll src/third_party/skia b47704b0bd34..f8486f2c5fb6 (2 commits) (flutter/engine#12312) 2019-09-16 [email protected] Fix the declaration of setSystemGestureExclusionRects to match the PlatformMessageHandler interface (flutter/engine#12306) 2019-09-16 [email protected] Manage resource and onscreen contexts using separate IOSGLContext objects (flutter/engine#12277) 2019-09-16 [email protected] Cleanup in web_ui (flutter/engine#12307) 2019-09-16 [email protected] Made flutter startup faster by allowing initialization to be parallelized (flutter/engine#10182) 2019-09-16 [email protected] Roll src/third_party/skia c22498502cda..b47704b0bd34 (16 commits) (flutter/engine#12304) 2019-09-16 [email protected] Include firefox in check to quote font families (flutter/engine#12288) 2019-09-16 [email protected] Roll src/third_party/dart 7799f424f4..dd1969a43a (2 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 [email protected] 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
Started storing messages for channels sent before the engine is properly setup for handling messages. A second part of this work will be draining the channel buffers inside the framework.
Related issue: flutter/flutter#38914
Related Design Doc (internal only, sorry): https://docs.google.com/document/d/10PEzCpY12P0se7cApopg_RCDJXeCqsr9AicNzsxU3Ds/edit#