-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[firebase_performance] Dart side of firebase_performance reformat #1530
Conversation
collinjackson
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.
The general approach looks good to me, it needs updated tests I think
packages/firebase_performance/lib/src/firebase_performance.dart
Outdated
Show resolved
Hide resolved
8617a21 to
bd971ab
Compare
collinjackson
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.
Previously if you called newTrace and never called start, it wouldn't leave anything hanging around. With this new approach the trace will leak. I'm not sure this is a major problem, but just wanted to point it out as a change.
| tearDownAll(() => completer.complete(null)); | ||
|
|
||
| group('firebase_performance test driver', () { | ||
| // TODO(bparrishMines): Rewrite integration tests when iOS portion is written. |
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.
Reminder to remove this if you don't intend to land it.
|
|
||
| static int _traceCount = 0; | ||
| static int _httpMetricCount = 0; | ||
| final int _handle; |
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 guess this is just a matter of personal preference, are you sure you want to identify the singleton with a handle? There's just one on both the Dart and native side, and (AFAIK) _handle will always be zero. I guess an argument could be made for consistency with all the MethodChannel-using objects having a handle. It would be more obviously correct if FirebasePerformance had multiple app support.
I don't have a strong opinion here, just wanted to make sure you've thought about it.
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 do remember thinking about this. My goal was to try and separate the responsibility of the Plugin (FirebasePerformancePlugin) class from the main Firebase class (FirebasePerformance). My thinking would be that the plugin class would only be responsible for calling constructors and maintaining the MethodCallHandlers.
Also, i figured this wouldn't be as weird if it wasn't a Firebase plugin. Most libraries don't have a central class that most of their objects are created from.
And this would also set us up to easily integrate multi-app support if the firebase team decides to add it!
|
The main reason of this restructure was that everything was called in However, it would be possible to have both by only setting up the platform object when start is called and maintaining a list of |
|
Closing in favor of #1557 |
Description
Dart side of possible reformat of Firebase Performance plugin
Related Issues
Android: #1529
iOS: #1556
Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?