Bug 737354 - Embedding initialize GL context before gfxPlatform::Init. r=roc
authorOleg Romashin <romaxa@gmail.com>
Wed, 21 Mar 2012 16:14:09 -0700
changeset 89981 501cf2524658fda4225ef09aa6598e9cccf21e1d
parent 89980 d3b01ea93daba5b32ac3b4ccad634075908ad20f
child 89982 73e62d29b0837fb08a9283aea83bca38dc6946ed
push id629
push usergsharp@mozilla.com
push dateFri, 23 Mar 2012 23:21:27 +0000
treeherderfx-team@8bc3c696e0a7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs737354
milestone14.0a1
Bug 737354 - Embedding initialize GL context before gfxPlatform::Init. r=roc
gfx/tests/gfxFontSelectionTest.cpp
gfx/tests/gfxTextRunPerfTest.cpp
gfx/tests/gfxWordCacheTest.cpp
gfx/thebes/gfxPlatform.h
widget/qt/nsWindow.cpp
--- a/gfx/tests/gfxFontSelectionTest.cpp
+++ b/gfx/tests/gfxFontSelectionTest.cpp
@@ -336,18 +336,17 @@ main (int argc, char **argv) {
     CocoaPoolInit();
 #endif
 
     // Initialize XPCOM
     nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
     if (NS_FAILED(rv))
         return -1;
 
-    rv = gfxPlatform::Init();
-    if (NS_FAILED(rv))
+    if (!gfxPlatform::GetPlatform())
         return -1;
 
     // let's get all the xpcom goop out of the system
     fflush (stderr);
     fflush (stdout);
 
     // don't need to query, we might need to set up some prefs later
     if (0) {
--- a/gfx/tests/gfxTextRunPerfTest.cpp
+++ b/gfx/tests/gfxTextRunPerfTest.cpp
@@ -145,18 +145,17 @@ main (int argc, char **argv) {
     CocoaPoolInit();
 #endif
 
     // Initialize XPCOM
     nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
     if (NS_FAILED(rv))
         return -1; 
 
-    rv = gfxPlatform::Init();
-    if (NS_FAILED(rv))
+    if (!gfxPlatform::GetPlatform())
         return -1;
 
     // let's get all the xpcom goop out of the system
     fflush (stderr);
     fflush (stdout);
 
     nsRefPtr<gfxContext> context = MakeContext();
 
--- a/gfx/tests/gfxWordCacheTest.cpp
+++ b/gfx/tests/gfxWordCacheTest.cpp
@@ -132,18 +132,17 @@ main (int argc, char **argv) {
    CocoaPoolInit();
 #endif
 
    // Initialize XPCOM
    nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
    if (NS_FAILED(rv))
        return -1;
 
-   rv = gfxPlatform::Init();
-   if (NS_FAILED(rv))
+   if (!gfxPlatform::GetPlatform())
        return -1;
 
    // let's get all the xpcom goop out of the system
    fflush (stderr);
    fflush (stdout);
 
    gTextRuns = new FrameTextRunCache();
 
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -170,20 +170,16 @@ class THEBES_API gfxPlatform {
 public:
     /**
      * Return a pointer to the current active platform.
      * This is a singleton; it contains mostly convenience
      * functions to obtain platform-specific objects.
      */
     static gfxPlatform *GetPlatform();
 
-    /**
-     * Start up Thebes.
-     */
-    static void Init();
 
     /**
      * Shut down Thebes.
      * Init() arranges for this to be called at an appropriate time.
      */
     static void Shutdown();
 
     /**
@@ -476,16 +472,21 @@ protected:
 
     // which scripts should be shaped with harfbuzz
     PRInt32 mUseHarfBuzzScripts;
 
     // The preferred draw target backend to use
     mozilla::gfx::BackendType mPreferredDrawTargetBackend;
 
 private:
+    /**
+     * Start up Thebes.
+     */
+    static void Init();
+
     virtual qcms_profile* GetPlatformCMSOutputProfile();
 
     nsRefPtr<gfxASurface> mScreenReferenceSurface;
     nsTArray<PRUint32> mCJKPrefLangs;
     nsCOMPtr<nsIObserver> mSRGBOverrideObserver;
     nsCOMPtr<nsIObserver> mFontPrefsObserver;
     mozilla::widget::GfxInfoCollector<gfxPlatform> mAzureBackendCollector;
 };
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -253,16 +253,17 @@ nsWindow::nsWindow()
     mListenForResizes    = false;
     mNeedsShow           = false;
     mGesturesCancelled   = false;
     mTimerStarted        = false;
     mPinchEvent.needDispatch = false;
     mMoveEvent.needDispatch = false;
     
     if (!gGlobalsInitialized) {
+        gfxPlatform::GetPlatform();
         gGlobalsInitialized = true;
 
 #if defined(MOZ_X11) && (MOZ_PLATFORM_MAEMO == 6)
         // This cannot be called on non-main thread
         if (QThread::currentThread() == qApp->thread()) {
             sPluginIMEAtom = XInternAtom(QX11Info::display(), PLUGIN_VKB_REQUEST_PROP, False);
         }
 #endif