Bug 95844 - Refactor CommandInfoProvider
Summary: Refactor CommandInfoProvider
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: framework (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: medium normal
Assignee: Rohan Kumar
URL:
Whiteboard: target:5.4.0
Keywords: difficultyBeginner, easyHack, skillCpp, topicCleanup
Depends on:
Blocks:
 
Reported: 2015-11-16 07:27 UTC by Samuel Mehrbrodt (allotropia)
Modified: 2017-03-02 22:16 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Mehrbrodt (allotropia) 2015-11-16 07:27:59 UTC
Instead of a singleton, CommandInfoProvider (svtools/source/misc/commandinfoprovider.cxx) should just be a set of static methods.

The task is to refactor that class accordingly and update all usages: http://opengrok.libreoffice.org/search?q=CommandInfoProvider .
Comment 1 Samuel Mehrbrodt (allotropia) 2015-11-25 11:26:20 UTC
Update: CommandInfoProvider is now in vcl/source/helper/commandinfoprovider.cxx.
Comment 2 Robinson Tryon (qubit) 2015-12-14 07:06:37 UTC Comment hidden (obsolete)
Comment 3 Robinson Tryon (qubit) 2016-02-18 14:52:24 UTC Comment hidden (obsolete)
Comment 4 Aleksas Pantechovskis 2016-03-09 13:19:03 UTC
I am working on it.
Comment 5 Aleksas Pantechovskis 2016-03-09 14:30:21 UTC
Is this task only about making it static instead of singleton, keeping the same API, or we also should do something with SetFrame and dispose methods?
Comment 6 Samuel Mehrbrodt (allotropia) 2016-03-10 07:11:25 UTC
(In reply to Aleksas Pantechovskis from comment #5)
> Is this task only about making it static instead of singleton, keeping the
> same API, or we also should do something with SetFrame and dispose methods?

I would just make all members of that class static and keep the SetFrame. We do not need the dispose method anymore.

Or do we also want to remove all the caching from here? Not sure what would be the performance impact. @Maxim, any comments?
Comment 7 Maxim Monastirsky 2016-03-10 09:17:30 UTC
(In reply to Samuel Mehrbrodt (CIB) from comment #6)
> I would just make all members of that class static and keep the SetFrame. We
> do not need the dispose method anymore.
Why is that? As long as the frame reference is static, we do need the dispose thing to ensure destructing at the right moment during shutdown.

> Or do we also want to remove all the caching from here?
Caching is apparently the reason of it being a singleton. As long as caching is needed, we should keep the singleton as well, so that frames can down to refcount of 0 and destructed when needed.

> Not sure what would be the performance impact.
But we pass the frame in each call anyway, so what's the point of caching it? That was the reason of why I suggested this refactoring in the first place.

(Moreover the frame is mostly used to get the module id, so why not just pass the module id instead? It can be an optional arg. and empty one would mean "get from the current frame". That would make it possible to use in the new db wizard too.)

Unless you can shed some light on the purpose of caching here? (I noticed now that accelerator configurations are also cached - maybe that's the reason? - surely those can be also refactored in some way to (optionally) get from the caller?)
Comment 8 jani 2016-04-12 15:59:19 UTC
Aleksis@ still working on this patch (otherwise please unsaying yourself) ?
Comment 9 Rohan Kumar 2016-12-13 01:37:09 UTC
Hi Samuel,

I've submitted a patch corresponding to this issue: https://gerrit.libreoffice.org/#/c/31861/ . But it seems to be breaking a test case(CppunitTest_vcl_app_test). Could you please have a look at it?
Comment 10 jani 2017-01-24 07:37:14 UTC
(In reply to Rohan Kumar from comment #9)
> Hi Samuel,
> 
> I've submitted a patch corresponding to this issue:
> https://gerrit.libreoffice.org/#/c/31861/ . But it seems to be breaking a
> test case(CppunitTest_vcl_app_test). Could you please have a look at it?

You have merge conflict in that patch, and a comment.
Comment 11 Commit Notification 2017-02-20 23:54:22 UTC
Rohan Kumar committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=33c51e8002f58847ba43bc111dabc49278e36daf

tdf#95844 Refactor CommandInfoProvider

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Rohan Kumar 2017-03-02 18:46:04 UTC
@Samuel, Maxim : Should we move to Resolved now?
Comment 13 Maxim Monastirsky 2017-03-02 22:16:16 UTC
(In reply to Rohan Kumar from comment #12)
> @Samuel, Maxim : Should we move to Resolved now?
Absolutely. Thank you so much for your work on this bug!