[meta] replace the hardcoded contract id with placehold

VERIFIED FIXED

Status

()

Core
Embedding: APIs
VERIFIED FIXED
16 years ago
16 years ago

People

(Reporter: Henry Jia, Assigned: Adam Lock)

Tracking

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

16 years ago
It's not a good idea to use hardcoded contract id, such as
"@mozilla.org/embedcomp/window-watcher;1" instead of NS_WINDOWWATCHER_CONTRACTID.

First, the code style is not good.

Second, it is more easy to be wrong using the literal than the placehold.

Third, if the literal changed someday, you may need to change it everywhere.
Although this may not be easy to happen.

Also for convenience of bug 154047
(Reporter)

Comment 1

16 years ago
Add some experts here.

Comment 2

16 years ago
I'm not a big expert, but: Would this change have any influence to the performence?
(Reporter)

Updated

16 years ago
Depends on: 158080, 158608, 159889
(Reporter)

Comment 3

16 years ago
Since the change is like this: 

#define NS_WINDOWWATCHER_CONTRACTID "@mozilla.org/embedcomp/window-watcher;1"

and use NS_WINDOWWATCHER_CONTRACTID instead of
"@mozilla.org/embedcomp/window-watcher;1" later, 

there should not be performance loss.

Comment 4

16 years ago
The only valid argument for making changes like this is so that you can bump the
contract ID "version" easier.  I am not sure that may people care about this
task as it yields nothing.  Instead, I would hope that we could move to use cid
where possible.  This has the possibly of reducing data and speeding up mozilla.  
(There is, though, an argument that, *if* we're going to use ContractIDs rather
than CIDs, it's better to use macros than writing the strings directly because
it means that a typo will be a compile-time error rather than a (much slower to
fix) run-time error.  This argument doesn't apply so much to modifying existing
code, though.)

Comment 6

16 years ago
I don't want to start a big CID vs. ContractID debate but I think if someone
wants to replace hardcoded contractIDs with macros, it would be fine... but I
would rather that that person's time be spent on something that improves mozilla
rather than just cleaning up code appearence.

(Reporter)

Comment 7

16 years ago
According to the above comments, let's take this issue as a relax work. When we
want to relax ourself, we can do this work.
(Assignee)

Comment 8

16 years ago
Closing out this bug. Raise bugs to cover specific instances
Status: NEW → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → FIXED

Comment 9

16 years ago
verified
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.