From 9cea9b25bb2202c69cc354143fce11185ba2d886 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Sun, 9 Feb 2014 16:13:01 -0800 Subject: [PATCH] Bug 966467 - Disable some unused services in content processes (r=vlad) --- widget/cocoa/nsWidgetFactory.mm | 50 ++++++++++++++++++++---------- widget/gtk/nsWidgetFactory.cpp | 48 ++++++++++++++++------------ widget/windows/nsWidgetFactory.cpp | 41 ++++++++++++++---------- 3 files changed, 87 insertions(+), 52 deletions(-) diff --git a/widget/cocoa/nsWidgetFactory.mm b/widget/cocoa/nsWidgetFactory.mm index 22cd55e0984f..c49707170bec 100644 --- a/widget/cocoa/nsWidgetFactory.mm +++ b/widget/cocoa/nsWidgetFactory.mm @@ -37,6 +37,8 @@ #include "nsPrintSession.h" #include "nsToolkitCompsCID.h" +#include "mozilla/Module.h" + using namespace mozilla; NS_GENERIC_FACTORY_CONSTRUCTOR(nsCocoaWindow) @@ -171,22 +173,30 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = { { &kNS_WINDOW_CID, false, NULL, nsCocoaWindowConstructor }, { &kNS_POPUP_CID, false, NULL, nsCocoaWindowConstructor }, { &kNS_CHILD_CID, false, NULL, nsChildViewConstructor }, - { &kNS_FILEPICKER_CID, false, NULL, nsFilePickerConstructor }, - { &kNS_COLORPICKER_CID, false, NULL, nsColorPickerConstructor }, + { &kNS_FILEPICKER_CID, false, NULL, nsFilePickerConstructor, + mozilla::Module::MAIN_PROCESS_ONLY }, + { &kNS_COLORPICKER_CID, false, NULL, nsColorPickerConstructor, + mozilla::Module::MAIN_PROCESS_ONLY }, { &kNS_APPSHELL_CID, false, NULL, nsAppShellConstructor }, - { &kNS_SOUND_CID, false, NULL, nsSoundConstructor }, + { &kNS_SOUND_CID, false, NULL, nsSoundConstructor, + mozilla::Module::MAIN_PROCESS_ONLY }, { &kNS_TRANSFERABLE_CID, false, NULL, nsTransferableConstructor }, { &kNS_HTMLFORMATCONVERTER_CID, false, NULL, nsHTMLFormatConverterConstructor }, - { &kNS_CLIPBOARD_CID, false, NULL, nsClipboardConstructor }, + { &kNS_CLIPBOARD_CID, false, NULL, nsClipboardConstructor, + mozilla::Module::MAIN_PROCESS_ONLY }, { &kNS_CLIPBOARDHELPER_CID, false, NULL, nsClipboardHelperConstructor }, - { &kNS_DRAGSERVICE_CID, false, NULL, nsDragServiceConstructor }, + { &kNS_DRAGSERVICE_CID, false, NULL, nsDragServiceConstructor, + mozilla::Module::MAIN_PROCESS_ONLY }, { &kNS_BIDIKEYBOARD_CID, false, NULL, nsBidiKeyboardConstructor }, { &kNS_THEMERENDERER_CID, false, NULL, nsNativeThemeCocoaConstructor }, { &kNS_SCREENMANAGER_CID, false, NULL, nsScreenManagerCocoaConstructor }, - { &kNS_DEVICE_CONTEXT_SPEC_CID, false, NULL, nsDeviceContextSpecXConstructor }, - { &kNS_PRINTSESSION_CID, false, NULL, nsPrintSessionConstructor }, + { &kNS_DEVICE_CONTEXT_SPEC_CID, false, NULL, nsDeviceContextSpecXConstructor, + mozilla::Module::MAIN_PROCESS_ONLY }, + { &kNS_PRINTSESSION_CID, false, NULL, nsPrintSessionConstructor, + mozilla::Module::MAIN_PROCESS_ONLY }, { &kNS_PRINTSETTINGSSERVICE_CID, false, NULL, nsPrintOptionsXConstructor }, - { &kNS_PRINTDIALOGSERVICE_CID, false, NULL, nsPrintDialogServiceXConstructor }, + { &kNS_PRINTDIALOGSERVICE_CID, false, NULL, nsPrintDialogServiceXConstructor, + mozilla::Module::MAIN_PROCESS_ONLY }, { &kNS_IDLE_SERVICE_CID, false, NULL, nsIdleServiceXConstructor }, { &kNS_SYSTEMALERTSSERVICE_CID, false, NULL, OSXNotificationCenterConstructor }, { &kNS_NATIVEMENUSERVICE_CID, false, NULL, nsNativeMenuServiceXConstructor }, @@ -207,22 +217,30 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { { "@mozilla.org/widgets/window/mac;1", &kNS_WINDOW_CID }, { "@mozilla.org/widgets/popup/mac;1", &kNS_POPUP_CID }, { "@mozilla.org/widgets/childwindow/mac;1", &kNS_CHILD_CID }, - { "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID }, - { "@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID }, + { "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID, + mozilla::Module::MAIN_PROCESS_ONLY }, + { "@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID, + mozilla::Module::MAIN_PROCESS_ONLY }, { "@mozilla.org/widget/appshell/mac;1", &kNS_APPSHELL_CID }, - { "@mozilla.org/sound;1", &kNS_SOUND_CID }, + { "@mozilla.org/sound;1", &kNS_SOUND_CID, + mozilla::Module::MAIN_PROCESS_ONLY }, { "@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID }, { "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID }, - { "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID }, + { "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID, + mozilla::Module::MAIN_PROCESS_ONLY }, { "@mozilla.org/widget/clipboardhelper;1", &kNS_CLIPBOARDHELPER_CID }, - { "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID }, + { "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, + mozilla::Module::MAIN_PROCESS_ONLY }, { "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID }, { "@mozilla.org/chrome/chrome-native-theme;1", &kNS_THEMERENDERER_CID }, { "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID }, - { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID }, - { "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID }, + { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID, + mozilla::Module::MAIN_PROCESS_ONLY }, + { "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID, + mozilla::Module::MAIN_PROCESS_ONLY }, { "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID }, - { NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID }, + { NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID, + mozilla::Module::MAIN_PROCESS_ONLY }, { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID }, { "@mozilla.org/system-alerts-service;1", &kNS_SYSTEMALERTSSERVICE_CID }, { "@mozilla.org/widget/nativemenuservice;1", &kNS_NATIVEMENUSERVICE_CID }, diff --git a/widget/gtk/nsWidgetFactory.cpp b/widget/gtk/nsWidgetFactory.cpp index e6a4790fd081..c19250b280db 100644 --- a/widget/gtk/nsWidgetFactory.cpp +++ b/widget/gtk/nsWidgetFactory.cpp @@ -248,14 +248,14 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = { { &kNS_WINDOW_CID, false, nullptr, nsWindowConstructor }, { &kNS_CHILD_CID, false, nullptr, nsChildWindowConstructor }, { &kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor }, - { &kNS_COLORPICKER_CID, false, nullptr, nsColorPickerConstructor }, - { &kNS_FILEPICKER_CID, false, nullptr, nsFilePickerConstructor }, - { &kNS_SOUND_CID, false, nullptr, nsSoundConstructor }, + { &kNS_COLORPICKER_CID, false, nullptr, nsColorPickerConstructor, Module::MAIN_PROCESS_ONLY }, + { &kNS_FILEPICKER_CID, false, nullptr, nsFilePickerConstructor, Module::MAIN_PROCESS_ONLY }, + { &kNS_SOUND_CID, false, nullptr, nsSoundConstructor, Module::MAIN_PROCESS_ONLY }, { &kNS_TRANSFERABLE_CID, false, nullptr, nsTransferableConstructor }, #ifdef MOZ_X11 - { &kNS_CLIPBOARD_CID, false, nullptr, nsClipboardConstructor }, + { &kNS_CLIPBOARD_CID, false, nullptr, nsClipboardConstructor, Module::MAIN_PROCESS_ONLY }, { &kNS_CLIPBOARDHELPER_CID, false, nullptr, nsClipboardHelperConstructor }, - { &kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceConstructor }, + { &kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceConstructor, Module::MAIN_PROCESS_ONLY }, #endif { &kNS_HTMLFORMATCONVERTER_CID, false, nullptr, nsHTMLFormatConverterConstructor }, { &kNS_BIDIKEYBOARD_CID, false, nullptr, nsBidiKeyboardConstructor }, @@ -266,11 +266,15 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = { { &kNS_THEMERENDERER_CID, false, nullptr, nsNativeThemeGTKConstructor }, #ifdef NS_PRINTING { &kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, nsPrintOptionsGTKConstructor }, - { &kNS_PRINTER_ENUMERATOR_CID, false, nullptr, nsPrinterEnumeratorGTKConstructor }, - { &kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor }, - { &kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr, nsDeviceContextSpecGTKConstructor }, - { &kNS_PRINTDIALOGSERVICE_CID, false, nullptr, nsPrintDialogServiceGTKConstructor }, -#endif + { &kNS_PRINTER_ENUMERATOR_CID, false, nullptr, nsPrinterEnumeratorGTKConstructor, + Module::MAIN_PROCESS_ONLY }, + { &kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor, + Module::MAIN_PROCESS_ONLY }, + { &kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr, nsDeviceContextSpecGTKConstructor, + Module::MAIN_PROCESS_ONLY }, + { &kNS_PRINTDIALOGSERVICE_CID, false, nullptr, nsPrintDialogServiceGTKConstructor, + Module::MAIN_PROCESS_ONLY }, +#endif { &kNS_IMAGE_TO_PIXBUF_CID, false, nullptr, nsImageToPixbufConstructor }, #if defined(MOZ_X11) { &kNS_IDLE_SERVICE_CID, false, nullptr, nsIdleServiceGTKConstructor }, @@ -283,14 +287,14 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { { "@mozilla.org/widget/window/gtk;1", &kNS_WINDOW_CID }, { "@mozilla.org/widgets/child_window/gtk;1", &kNS_CHILD_CID }, { "@mozilla.org/widget/appshell/gtk;1", &kNS_APPSHELL_CID }, - { "@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID }, - { "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID }, - { "@mozilla.org/sound;1", &kNS_SOUND_CID }, + { "@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID, Module::MAIN_PROCESS_ONLY }, + { "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID, Module::MAIN_PROCESS_ONLY }, + { "@mozilla.org/sound;1", &kNS_SOUND_CID, Module::MAIN_PROCESS_ONLY }, { "@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID }, #ifdef MOZ_X11 - { "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID }, + { "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID, Module::MAIN_PROCESS_ONLY }, { "@mozilla.org/widget/clipboardhelper;1", &kNS_CLIPBOARDHELPER_CID }, - { "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID }, + { "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, Module::MAIN_PROCESS_ONLY }, #endif { "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID }, { "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID }, @@ -301,11 +305,15 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { { "@mozilla.org/chrome/chrome-native-theme;1", &kNS_THEMERENDERER_CID }, #ifdef NS_PRINTING { "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID }, - { "@mozilla.org/gfx/printerenumerator;1", &kNS_PRINTER_ENUMERATOR_CID }, - { "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID }, - { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID }, - { NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID }, -#endif + { "@mozilla.org/gfx/printerenumerator;1", &kNS_PRINTER_ENUMERATOR_CID, + Module::MAIN_PROCESS_ONLY }, + { "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID, + Module::MAIN_PROCESS_ONLY }, + { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID, + Module::MAIN_PROCESS_ONLY }, + { NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID, + Module::MAIN_PROCESS_ONLY }, +#endif { "@mozilla.org/widget/image-to-gdk-pixbuf;1", &kNS_IMAGE_TO_PIXBUF_CID }, #if defined(MOZ_X11) { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID }, diff --git a/widget/windows/nsWidgetFactory.cpp b/widget/windows/nsWidgetFactory.cpp index e1bb5ac9fb2a..e24a0ee3d55c 100644 --- a/widget/windows/nsWidgetFactory.cpp +++ b/widget/windows/nsWidgetFactory.cpp @@ -56,6 +56,9 @@ #include "nsPrintSession.h" #endif +#include "mozilla/Module.h" + +using namespace mozilla; using namespace mozilla::widget; static nsresult @@ -219,16 +222,16 @@ NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID); static const mozilla::Module::CIDEntry kWidgetCIDs[] = { { &kNS_WINDOW_CID, false, nullptr, WindowConstructor }, { &kNS_CHILD_CID, false, nullptr, ChildWindowConstructor }, - { &kNS_FILEPICKER_CID, false, nullptr, FilePickerConstructor }, - { &kNS_COLORPICKER_CID, false, nullptr, ColorPickerConstructor }, + { &kNS_FILEPICKER_CID, false, nullptr, FilePickerConstructor, Module::MAIN_PROCESS_ONLY }, + { &kNS_COLORPICKER_CID, false, nullptr, ColorPickerConstructor, Module::MAIN_PROCESS_ONLY }, { &kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor }, { &kNS_SCREENMANAGER_CID, false, nullptr, nsScreenManagerWinConstructor }, { &kNS_GFXINFO_CID, false, nullptr, GfxInfoConstructor }, { &kNS_THEMERENDERER_CID, false, nullptr, NS_NewNativeTheme }, { &kNS_IDLE_SERVICE_CID, false, nullptr, nsIdleServiceWinConstructor }, - { &kNS_CLIPBOARD_CID, false, nullptr, nsClipboardConstructor }, + { &kNS_CLIPBOARD_CID, false, nullptr, nsClipboardConstructor, Module::MAIN_PROCESS_ONLY }, { &kNS_CLIPBOARDHELPER_CID, false, nullptr, nsClipboardHelperConstructor }, - { &kNS_SOUND_CID, false, nullptr, nsSoundConstructor }, + { &kNS_SOUND_CID, false, nullptr, nsSoundConstructor, Module::MAIN_PROCESS_ONLY }, { &kNS_TRANSFERABLE_CID, false, nullptr, nsTransferableConstructor }, { &kNS_HTMLFORMATCONVERTER_CID, false, nullptr, nsHTMLFormatConverterConstructor }, { &kNS_WIN_TASKBAR_CID, false, nullptr, WinTaskbarConstructor }, @@ -237,16 +240,19 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = { { &kNS_WIN_JUMPLISTSEPARATOR_CID, false, nullptr, JumpListSeparatorConstructor }, { &kNS_WIN_JUMPLISTLINK_CID, false, nullptr, JumpListLinkConstructor }, { &kNS_WIN_JUMPLISTSHORTCUT_CID, false, nullptr, JumpListShortcutConstructor }, - { &kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceConstructor }, + { &kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceConstructor, Module::MAIN_PROCESS_ONLY }, { &kNS_BIDIKEYBOARD_CID, false, nullptr, nsBidiKeyboardConstructor }, #ifdef MOZ_METRO { &kNS_WIN_METROUTILS_CID, false, nullptr, nsWinMetroUtilsConstructor }, #endif #ifdef NS_PRINTING { &kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, nsPrintOptionsWinConstructor }, - { &kNS_PRINTER_ENUMERATOR_CID, false, nullptr, nsPrinterEnumeratorWinConstructor }, - { &kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor }, - { &kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr, nsDeviceContextSpecWinConstructor }, + { &kNS_PRINTER_ENUMERATOR_CID, false, nullptr, nsPrinterEnumeratorWinConstructor, + Module::MAIN_PROCESS_ONLY }, + { &kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor, + Module::MAIN_PROCESS_ONLY }, + { &kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr, nsDeviceContextSpecWinConstructor, + Module::MAIN_PROCESS_ONLY }, #endif { nullptr } }; @@ -254,16 +260,16 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = { static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { { "@mozilla.org/widgets/window/win;1", &kNS_WINDOW_CID }, { "@mozilla.org/widgets/child_window/win;1", &kNS_CHILD_CID }, - { "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID }, - { "@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID }, + { "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID, Module::MAIN_PROCESS_ONLY }, + { "@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID, Module::MAIN_PROCESS_ONLY }, { "@mozilla.org/widget/appshell/win;1", &kNS_APPSHELL_CID }, { "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID }, { "@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID }, { "@mozilla.org/chrome/chrome-native-theme;1", &kNS_THEMERENDERER_CID }, { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID }, - { "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID }, + { "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID, Module::MAIN_PROCESS_ONLY }, { "@mozilla.org/widget/clipboardhelper;1", &kNS_CLIPBOARDHELPER_CID }, - { "@mozilla.org/sound;1", &kNS_SOUND_CID }, + { "@mozilla.org/sound;1", &kNS_SOUND_CID, Module::MAIN_PROCESS_ONLY }, { "@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID }, { "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID }, { "@mozilla.org/windows-taskbar;1", &kNS_WIN_TASKBAR_CID }, @@ -272,16 +278,19 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { { "@mozilla.org/windows-jumplistseparator;1", &kNS_WIN_JUMPLISTSEPARATOR_CID }, { "@mozilla.org/windows-jumplistlink;1", &kNS_WIN_JUMPLISTLINK_CID }, { "@mozilla.org/windows-jumplistshortcut;1", &kNS_WIN_JUMPLISTSHORTCUT_CID }, - { "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID }, + { "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, Module::MAIN_PROCESS_ONLY }, { "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID }, #ifdef MOZ_METRO { "@mozilla.org/windows-metroutils;1", &kNS_WIN_METROUTILS_CID }, #endif #ifdef NS_PRINTING { "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID }, - { "@mozilla.org/gfx/printerenumerator;1", &kNS_PRINTER_ENUMERATOR_CID }, - { "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID }, - { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID }, + { "@mozilla.org/gfx/printerenumerator;1", &kNS_PRINTER_ENUMERATOR_CID, + Module::MAIN_PROCESS_ONLY }, + { "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID, + Module::MAIN_PROCESS_ONLY }, + { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID, + Module::MAIN_PROCESS_ONLY }, #endif { nullptr } };