[adding other folks back so that everyone can have a full picture and this thread is stored in the mailing lists; +chrisha]
Hi Kenichi,
Thanks for your email. My feeling is that in the long run (i.e. once MemoryCoordinator is mature enough), it would be better to have a dedicated DevTools API for the memory coordinator, e.g. Memory.dispatchCoordinatorEvent, as you suggested, and remove the existing APIs (once MemoryCoordinator fully replaces MemoryPressureController).
However, having been through the process of adding the existing APIs (Memory.simulatePressureNotification and Memory.setPressureNotificationsSuppressed) and the subsequent "the API doesn't capture use case X" moment, I'm a little worried about doing this straightaway. If you do that, you are very likely to find that you need to re-design the whole API in a couple of weeks/months and, as we all know, changing an existing API is very cumbersome (especially if it has lots of customers, which the memory coordinator very likely will have).
In the meantime, I think it would make the most sense to recycle the existing API (if possible). I can see that you need to trigger 3 states, which Memory.simulatePressureNotification unfortunately doesn't provide. Here are the possible solutions I can think of:
- Unless you need to keep the ability to suppress pressure notifications, you could theoretically do the following (as a temporary hack):
- Memory.setPressureNotificationsSuppressed(false) → Unthrottle
- Memory.setPressureNotificationsSuppressed(true) → Throttle
- Memory.simulatePressureNotification("critical") → Purge
- Another option is to add an extra option to the PressureLevel DevTools enum. Again, it's not ideal, but probably less risky than adding a whole new API.
If neither of the above options seems right, I'm afraid there's no other option but to add a new API straightaway.
Hope this helps.
Petr
(-other folks)
Hi Petr,
Do you have any preference on this? Specifically, we want to trigger
- Throttle
- Unthrottle
- Purge
events to chrome from telemetry (for now). Nat likes option (2) but my concern of the option are:
- We need to add a compile time flag in content/browser/devtools/protocol/memory_handler.cc to associate SimulatePressureNotification to MemoryCoordinator (which we are going to implement) instead of MemoryPressureControllerImpl
- We can't map 'moderate' nor 'critical' to 'Unthrottle'
So I think it would be better to add a new message like Memory.dispatchCoordinatorEvent to the remote debugging protocol (option 1). WDYT?