Title: [129863] trunk
Revision
129863
Author
[email protected]
Date
2012-09-28 01:56:55 -0700 (Fri, 28 Sep 2012)

Log Message

[EFL][WK2] Refactoring initialization and shutdown codes of EFL libraries.
https://bugs.webkit.org/show_bug.cgi?id=97173

Patch by Eunmi Lee <[email protected]> on 2012-09-28
Reviewed by Gyuyoung Kim.

Source/WebCore:

Remove codes to initialize and shutdown the EFL libraries from
RunLoopEfl.cpp. Initialization and shutdown will be done in the
ewk_main.cpp for ui process and WebProcessMainEfl.cpp for web
process.

No new tests. This patch doesn't change behavior.

* platform/efl/RunLoopEfl.cpp:
(WebCore::RunLoop::RunLoop):
(WebCore::RunLoop::~RunLoop):

Source/WebKit2:

Initialize and shutdown the EFL libraries in the ewk_main.cpp for ui
process and WebProcessMainEfl.cpp for web process.
Additionally, initialization and shutdown are done when ewk_context is
created and deleted, so ewk_{init,shutdown} APIs are changed to
internal function and applications don't have to call them.

* PlatformEfl.cmake:
* UIProcess/API/efl/EWebKit2.h:
* UIProcess/API/efl/ewk_context.cpp:
(_Ewk_Context::_Ewk_Context):
(_Ewk_Context::~_Ewk_Context):
* UIProcess/API/efl/ewk_main.cpp:
(ewk_init):
(ewk_shutdown):
* UIProcess/API/efl/ewk_main.h: Removed.
* UIProcess/API/efl/ewk_main_private.h: Added.
* UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp:
(EWK2UnitTest::EWK2UnitTestBase::SetUp):
(EWK2UnitTest::EWK2UnitTestBase::TearDown):
* WebProcess/efl/WebProcessMainEfl.cpp:
(WebKit::WebProcessMainEfl):

Tools:

The initialization and shutdown are done inside the webkit, so we don't
have to call them out of the webkit.

* MiniBrowser/efl/main.c:
(quit):
(main):
* WebKitTestRunner/efl/PlatformWebViewEfl.cpp:
(WTR::initEcoreEvas):
(WTR::PlatformWebView::~PlatformWebView):
* WebKitTestRunner/efl/main.cpp:
(main):

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (129862 => 129863)


--- trunk/Source/WebCore/ChangeLog	2012-09-28 08:44:38 UTC (rev 129862)
+++ trunk/Source/WebCore/ChangeLog	2012-09-28 08:56:55 UTC (rev 129863)
@@ -1,3 +1,21 @@
+2012-09-28  Eunmi Lee  <[email protected]>
+
+        [EFL][WK2] Refactoring initialization and shutdown codes of EFL libraries.
+        https://bugs.webkit.org/show_bug.cgi?id=97173
+
+        Reviewed by Gyuyoung Kim.
+
+        Remove codes to initialize and shutdown the EFL libraries from
+        RunLoopEfl.cpp. Initialization and shutdown will be done in the
+        ewk_main.cpp for ui process and WebProcessMainEfl.cpp for web
+        process.
+
+        No new tests. This patch doesn't change behavior.
+
+        * platform/efl/RunLoopEfl.cpp:
+        (WebCore::RunLoop::RunLoop):
+        (WebCore::RunLoop::~RunLoop):
+
 2012-09-19  Vsevolod Vlasov  <[email protected]>
 
         Web Inspector: Prepare UISourceCode to transformation into File.

Modified: trunk/Source/WebCore/platform/efl/RunLoopEfl.cpp (129862 => 129863)


--- trunk/Source/WebCore/platform/efl/RunLoopEfl.cpp	2012-09-28 08:44:38 UTC (rev 129862)
+++ trunk/Source/WebCore/platform/efl/RunLoopEfl.cpp	2012-09-28 08:56:55 UTC (rev 129863)
@@ -28,9 +28,6 @@
 #include "RunLoop.h"
 
 #include <Ecore.h>
-#include <Ecore_Evas.h>
-#include <Ecore_File.h>
-#include <Edje.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 
@@ -42,47 +39,12 @@
 RunLoop::RunLoop()
     : m_initEfl(false)
 {
-    if (!ecore_init()) {
-        LOG_ERROR("could not init ecore.");
-        return;
-    }
-
-    if (!ecore_evas_init()) {
-        LOG_ERROR("could not init ecore_evas.");
-        goto errorEcoreEvas;
-    }
-
-    if (!ecore_file_init()) {
-        LOG_ERROR("could not init ecore_file.");
-        goto errorEcoreFile;
-    }
-
-    if (!edje_init()) {
-        LOG_ERROR("could not init edje.");
-        goto errorEdje;
-    }
-
     m_pipe = adoptPtr(ecore_pipe_add(wakeUpEvent, this));
     m_initEfl = true;
-
-    return;
-
-errorEdje:
-    ecore_file_shutdown();
-errorEcoreFile:
-    ecore_evas_shutdown();
-errorEcoreEvas:
-    ecore_shutdown();
 }
 
 RunLoop::~RunLoop()
 {
-    if (m_initEfl) {
-        edje_shutdown();
-        ecore_file_shutdown();
-        ecore_evas_shutdown();
-        ecore_shutdown();
-    }
 }
 
 void RunLoop::run()

Modified: trunk/Source/WebKit2/ChangeLog (129862 => 129863)


--- trunk/Source/WebKit2/ChangeLog	2012-09-28 08:44:38 UTC (rev 129862)
+++ trunk/Source/WebKit2/ChangeLog	2012-09-28 08:56:55 UTC (rev 129863)
@@ -1,3 +1,32 @@
+2012-09-28  Eunmi Lee  <[email protected]>
+
+        [EFL][WK2] Refactoring initialization and shutdown codes of EFL libraries.
+        https://bugs.webkit.org/show_bug.cgi?id=97173
+
+        Reviewed by Gyuyoung Kim.
+
+        Initialize and shutdown the EFL libraries in the ewk_main.cpp for ui
+        process and WebProcessMainEfl.cpp for web process.
+        Additionally, initialization and shutdown are done when ewk_context is
+        created and deleted, so ewk_{init,shutdown} APIs are changed to
+        internal function and applications don't have to call them.
+
+        * PlatformEfl.cmake:
+        * UIProcess/API/efl/EWebKit2.h:
+        * UIProcess/API/efl/ewk_context.cpp:
+        (_Ewk_Context::_Ewk_Context):
+        (_Ewk_Context::~_Ewk_Context):
+        * UIProcess/API/efl/ewk_main.cpp:
+        (ewk_init):
+        (ewk_shutdown):
+        * UIProcess/API/efl/ewk_main.h: Removed.
+        * UIProcess/API/efl/ewk_main_private.h: Added.
+        * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp:
+        (EWK2UnitTest::EWK2UnitTestBase::SetUp):
+        (EWK2UnitTest::EWK2UnitTestBase::TearDown):
+        * WebProcess/efl/WebProcessMainEfl.cpp:
+        (WebKit::WebProcessMainEfl):
+
 2012-09-27  Beth Dakin  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=97823

Modified: trunk/Source/WebKit2/PlatformEfl.cmake (129862 => 129863)


--- trunk/Source/WebKit2/PlatformEfl.cmake	2012-09-28 08:44:38 UTC (rev 129862)
+++ trunk/Source/WebKit2/PlatformEfl.cmake	2012-09-28 08:56:55 UTC (rev 129863)
@@ -220,7 +220,6 @@
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_form_submission_request.h"
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_intent.h"
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_intent_service.h"
-    "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_main.h"
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_navigation_policy_decision.h"
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_popup_menu_item.h"
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_settings.h"

Modified: trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h (129862 => 129863)


--- trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h	2012-09-28 08:44:38 UTC (rev 129862)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h	2012-09-28 08:56:55 UTC (rev 129863)
@@ -36,7 +36,6 @@
 #include "ewk_form_submission_request.h"
 #include "ewk_intent.h"
 #include "ewk_intent_service.h"
-#include "ewk_main.h"
 #include "ewk_navigation_policy_decision.h"
 #include "ewk_popup_menu_item.h"
 #include "ewk_settings.h"

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp (129862 => 129863)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp	2012-09-28 08:44:38 UTC (rev 129862)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp	2012-09-28 08:56:55 UTC (rev 129863)
@@ -35,6 +35,7 @@
 #include "ewk_cookie_manager_private.h"
 #include "ewk_download_job.h"
 #include "ewk_download_job_private.h"
+#include "ewk_main_private.h"
 #include <WebCore/FileSystem.h>
 #include <wtf/HashMap.h>
 #include <wtf/text/WTFString.h>
@@ -81,6 +82,8 @@
         , cookieManager(0)
         , requestManager(WKContextGetSoupRequestManager(contextRef.get()))
     {
+        ewk_init();
+
 #if ENABLE(BATTERY_STATUS)
         WKBatteryManagerRef wkBatteryManager = WKContextGetBatteryManager(contextRef.get());
         batteryProvider = BatteryProvider::create(wkBatteryManager);
@@ -114,6 +117,8 @@
         HashMap<uint64_t, Ewk_Download_Job*>::iterator end = downloadJobs.end();
         for ( ; it != end; ++it)
             ewk_download_job_unref(it->second);
+
+        ewk_shutdown();
     }
 };
 

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_main.cpp (129862 => 129863)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_main.cpp	2012-09-28 08:44:38 UTC (rev 129862)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_main.cpp	2012-09-28 08:56:55 UTC (rev 129863)
@@ -20,7 +20,6 @@
 */
 
 #include "config.h"
-#include "ewk_main.h"
 
 #include "ewk_private.h"
 #include <Ecore.h>
@@ -39,6 +38,13 @@
  */
 int _ewk_log_dom = -1;
 
+/**
+ * @internal
+ * Initializes WebKit's instance.
+ * - initializes components needed by EFL,
+ * - increases a reference count of WebKit's instance.
+ * Returns a reference count of WebKit's instance on success or 0 on failure
+ */
 int ewk_init(void)
 {
     if (_ewkInitCount)
@@ -68,6 +74,11 @@
         goto error_ecore_evas;
     }
 
+    if (!edje_init()) {
+        CRITICAL("could not init edje.");
+        goto error_edje;
+    }
+
     g_type_init();
 
     if (!ecore_main_loop_glib_integrate()) {
@@ -77,6 +88,8 @@
 
     return ++_ewkInitCount;
 
+error_edje:
+    ecore_evas_shutdown();
 error_ecore_evas:
     ecore_shutdown();
 error_ecore:
@@ -90,11 +103,18 @@
     return 0;
 }
 
+/**
+ * @internal
+ * Decreases a reference count of WebKit's instance, possibly destroying it.
+ * If the reference count reaches 0, WebKit's instance is destroyed.
+ * Returns a reference count of WebKit's instance
+ */
 int ewk_shutdown(void)
 {
     if (--_ewkInitCount)
         return _ewkInitCount;
 
+    edje_shutdown();
     ecore_evas_shutdown();
     ecore_shutdown();
     evas_shutdown();

Deleted: trunk/Source/WebKit2/UIProcess/API/efl/ewk_main.h (129862 => 129863)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_main.h	2012-09-28 08:44:38 UTC (rev 129862)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_main.h	2012-09-28 08:56:55 UTC (rev 129863)
@@ -1,58 +0,0 @@
-/*
-    Copyright (C) 2009-2010 ProFUSION embedded systems
-    Copyright (C) 2009-2010 Samsung Electronics
-    Copyright (C) 2012 Intel Corporation
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-/**
- * @file    ewk_main.h
- * @brief   The general initialization of WebKit2-EFL, not tied to any view object.
- */
-
-#ifndef ewk_main_h
-#define ewk_main_h
-
-#include <Eina.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Initializes WebKit's instance.
- *
- * - initializes components needed by EFL,
- * - increases a reference count of WebKit's instance.
- *
- * @return a reference count of WebKit's instance on success or 0 on failure
- */
-EAPI int ewk_init(void);
-
-/**
- * Decreases a reference count of WebKit's instance, possibly destroying it.
- *
- * If the reference count reaches 0 WebKit's instance is destroyed.
- *
- * @return a reference count of WebKit's instance
- */
-EAPI int ewk_shutdown(void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif // ewk_main_h

Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_main_private.h (0 => 129863)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_main_private.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_main_private.h	2012-09-28 08:56:55 UTC (rev 129863)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ * Copyright (C) 2012 Intel Corporation
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ewk_main_private_h
+#define ewk_main_private_h
+
+int ewk_init();
+int ewk_shutdown();
+
+#endif // ewk_main_private_h

Modified: trunk/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp (129862 => 129863)


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp	2012-09-28 08:44:38 UTC (rev 129862)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp	2012-09-28 08:56:55 UTC (rev 129863)
@@ -45,7 +45,7 @@
 
 void EWK2UnitTestBase::SetUp()
 {
-    ewk_init();
+    ASSERT_GT(ecore_evas_init(), 0);
 
     unsigned int width = environment->defaultWidth();
     unsigned int height = environment->defaultHeight();
@@ -71,7 +71,7 @@
 {
     evas_object_del(m_webView);
     ecore_evas_free(m_ecoreEvas);
-    ewk_shutdown();
+    ecore_evas_shutdown();
 }
 
 void EWK2UnitTestBase::loadUrlSync(const char* url)

Modified: trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp (129862 => 129863)


--- trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp	2012-09-28 08:44:38 UTC (rev 129862)
+++ trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp	2012-09-28 08:56:55 UTC (rev 129863)
@@ -31,6 +31,8 @@
 #include "ProxyResolverSoup.h"
 #include "WKBase.h"
 #include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Edje.h>
 #include <Efreet.h>
 #include <WebCore/ResourceHandle.h>
 #include <WebCore/RunLoop.h>
@@ -64,6 +66,19 @@
         return 1;
     }
 
+    if (!ecore_evas_init()) {
+        ecore_shutdown();
+        eina_shutdown();
+        return 1;
+    }
+
+    if (!edje_init()) {
+        ecore_evas_shutdown();
+        ecore_shutdown();
+        eina_shutdown();
+        return 1;
+    }
+
 #if ENABLE(GLIB_SUPPORT)
     g_type_init();
 
@@ -105,6 +120,11 @@
     soup_cache_dump(soupCache);
     g_object_unref(soupCache);
 
+    edje_shutdown();
+    ecore_evas_shutdown();
+    ecore_shutdown();
+    eina_shutdown();
+
     return 0;
 
 }

Modified: trunk/Tools/ChangeLog (129862 => 129863)


--- trunk/Tools/ChangeLog	2012-09-28 08:44:38 UTC (rev 129862)
+++ trunk/Tools/ChangeLog	2012-09-28 08:56:55 UTC (rev 129863)
@@ -1,3 +1,22 @@
+2012-09-28  Eunmi Lee  <[email protected]>
+
+        [EFL][WK2] Refactoring initialization and shutdown codes of EFL libraries.
+        https://bugs.webkit.org/show_bug.cgi?id=97173
+
+        Reviewed by Gyuyoung Kim.
+
+        The initialization and shutdown are done inside the webkit, so we don't
+        have to call them out of the webkit.
+
+        * MiniBrowser/efl/main.c:
+        (quit):
+        (main):
+        * WebKitTestRunner/efl/PlatformWebViewEfl.cpp:
+        (WTR::initEcoreEvas):
+        (WTR::PlatformWebView::~PlatformWebView):
+        * WebKitTestRunner/efl/main.cpp:
+        (main):
+
 2012-09-27  Alexandre Elias  <[email protected]>
 
         [chromium] DumpRenderTree support for software compositing

Modified: trunk/Tools/MiniBrowser/efl/main.c (129862 => 129863)


--- trunk/Tools/MiniBrowser/efl/main.c	2012-09-28 08:44:38 UTC (rev 129862)
+++ trunk/Tools/MiniBrowser/efl/main.c	2012-09-28 08:56:55 UTC (rev 129863)
@@ -200,7 +200,7 @@
 static int
 quit(Eina_Bool success, const char *msg)
 {
-    ewk_shutdown();
+    ecore_evas_shutdown();
 
     if (msg)
         fputs(msg, (success) ? stdout : stderr);
@@ -268,7 +268,7 @@
         ECORE_GETOPT_VALUE_NONE
     };
 
-    if (!ewk_init())
+    if (!ecore_evas_init())
         return EXIT_FAILURE;
 
     ecore_app_args_set(argc, (const char **) argv);

Modified: trunk/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp (129862 => 129863)


--- trunk/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp	2012-09-28 08:44:38 UTC (rev 129862)
+++ trunk/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp	2012-09-28 08:56:55 UTC (rev 129863)
@@ -32,6 +32,9 @@
 
 static Ecore_Evas* initEcoreEvas()
 {
+    if (!ecore_evas_init())
+        return 0;
+
     Ecore_Evas* ecoreEvas = useX11Window ? ecore_evas_new(0, 0, 0, 800, 600, 0) : ecore_evas_buffer_new(800, 600);
     if (!ecoreEvas)
         return 0;
@@ -57,6 +60,7 @@
 {
     evas_object_del(m_view);
     ecore_evas_free(m_window);
+    ecore_evas_shutdown();
 }
 
 void PlatformWebView::resizeTo(unsigned width, unsigned height)

Modified: trunk/Tools/WebKitTestRunner/efl/main.cpp (129862 => 129863)


--- trunk/Tools/WebKitTestRunner/efl/main.cpp	2012-09-28 08:44:38 UTC (rev 129862)
+++ trunk/Tools/WebKitTestRunner/efl/main.cpp	2012-09-28 08:56:55 UTC (rev 129863)
@@ -32,18 +32,13 @@
 {
     WTFInstallReportBacktraceOnCrashHook();
 
-    if (!ewk_init())
-        return 1;
-
 #ifdef HAVE_ECORE_X
     const char* display = getenv("DISPLAY");
-    int intialized = 0;
+    int initialized = 0;
     if (display) {
-        intialized = ecore_x_init(0);
-        if (!intialized) {
-            ewk_shutdown();
+        initialized = ecore_x_init(0);
+        if (!initialized)
             return 1;
-        }
     }
 #endif
 
@@ -51,12 +46,10 @@
     WTR::TestController controller(argc, const_cast<const char**>(argv));
 
 #ifdef HAVE_ECORE_X
-    if (intialized)
+    if (initialized)
         ecore_x_shutdown();
 #endif
 
-    ewk_shutdown();
-
     return 0;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to