Closed Bug 1432285 Opened 6 years ago Closed 6 years ago

Implement an nsPrintingPromptService::GetSingleton method and make XPCOM use it

Categories

(Core :: Printing: Setup, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla60
Tracking Status
firefox60 --- fixed

People

(Reporter: jwatt, Assigned: jwatt)

Details

Attachments

(1 file, 1 obsolete file)

All consumers of the XPCOM contract ID "@mozilla.org/embedcomp/printingprompt-service;1" obtain the nsIPrintingPromptService using do_GetService (or the JS equivalent CC.getService). None use do_GetInstance (or the JS equivalent). Consequently we only create one instance of nsPrintingPromptService per process, since do_GetService caches the first instance that it returns and then always returns that same object (see the entry->mServiceObject check in nsComponentManagerImpl::GetServiceByContractID).

Having internal C++ code get the concrete nsPrintingPromptService singleton instead of using do_GetService to obtain an nsIPrintingPromptService pointer will help clear the ground for some ownership refactoring I'm writing, without requiring awful hacks to the XPIDL.
Component: Layout → Printing: Setup
Attachment #8944532 - Flags: review?(bobowencode)
Attachment #8944533 - Flags: review?(bobowencode)
Attachment #8944533 - Attachment is obsolete: true
Of course this can't work given nsPrintingProxy...

I guess we can at least still land the first patch.
Summary: Have internal code get the concrete nsPrintingPromptService singleton instead of nsIPrintingPromptService → Implement an nsPrintingPromptService::GetSingleton method and make XPCOM use it
Comment on attachment 8944532 [details]
Bug 1432285 - Implement an nsPrintingPromptService::GetSingleton method and make XPCOM use that.

https://reviewboard.mozilla.org/r/214702/#review220440

::: toolkit/components/printingui/nsPrintingPromptService.h:40
(Diff revision 2)
>    : public nsIPrintingPromptService
>    , public nsIWebProgressListener
>  {
>  
>  public:
> -  nsPrintingPromptService();
> +  static nsPrintingPromptService* GetSingleton();

I don't think we need this version any more.
Attachment #8944532 - Flags: review?(bobowencode) → review+
Pushed by jwatt@jwatt.org:
https://hg.mozilla.org/integration/mozilla-inbound/rev/996706d59171
Implement an nsPrintingPromptService::GetSingleton method and make XPCOM use that. r=bobowen
https://hg.mozilla.org/mozilla-central/rev/996706d59171
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: