Title: [123587] trunk
Revision
123587
Author
[email protected]
Date
2012-07-25 01:30:00 -0700 (Wed, 25 Jul 2012)

Log Message

[EFL][WK2] Add ewk_main.{cpp,h} to EFL WK2
https://bugs.webkit.org/show_bug.cgi?id=92101

Patch by Mikhail Pozdnyakov <[email protected]> on 2012-07-25
Reviewed by Kenneth Rohde Christiansen.

Added a centralized place for general initialization in UI process for EFL WK2.

Source/WebKit2:

* PlatformEfl.cmake:
* UIProcess/API/efl/EWebKit2.h:
* UIProcess/API/efl/ewk_main.cpp: Added.
(ewk_init): General initialization.
(ewk_shutdown): General freeing.
(_ewk_init_body): An aux function.
* UIProcess/API/efl/ewk_main.h: Added.

Tools:

* MiniBrowser/efl/main.c: Added using of newly added ewk_init() and ewk_shutdown() functions.
(main):
* WebKitTestRunner/efl/main.cpp: Ditto.
(main):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (123586 => 123587)


--- trunk/Source/WebKit2/ChangeLog	2012-07-25 08:18:59 UTC (rev 123586)
+++ trunk/Source/WebKit2/ChangeLog	2012-07-25 08:30:00 UTC (rev 123587)
@@ -1,3 +1,20 @@
+2012-07-25  Mikhail Pozdnyakov  <[email protected]>
+
+        [EFL][WK2] Add ewk_main.{cpp,h} to EFL WK2
+        https://bugs.webkit.org/show_bug.cgi?id=92101
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Added a centralized place for general initialization in UI process for EFL WK2.
+
+        * PlatformEfl.cmake:
+        * UIProcess/API/efl/EWebKit2.h:
+        * UIProcess/API/efl/ewk_main.cpp: Added.
+        (ewk_init): General initialization.
+        (ewk_shutdown): General freeing. 
+        (_ewk_init_body): An aux function.
+        * UIProcess/API/efl/ewk_main.h: Added.
+
 2012-07-24  Jae Hyun Park  <[email protected]>
 
         WKContextGetGlobalStatistics() assigns wrong value to wkFrameCount in WKContextStatistics

Modified: trunk/Source/WebKit2/PlatformEfl.cmake (123586 => 123587)


--- trunk/Source/WebKit2/PlatformEfl.cmake	2012-07-25 08:18:59 UTC (rev 123586)
+++ trunk/Source/WebKit2/PlatformEfl.cmake	2012-07-25 08:30:00 UTC (rev 123587)
@@ -44,6 +44,7 @@
     UIProcess/API/efl/ewk_cookie_manager.cpp
     UIProcess/API/efl/ewk_intent.cpp
     UIProcess/API/efl/ewk_intent_service.cpp
+    UIProcess/API/efl/ewk_main.cpp
     UIProcess/API/efl/ewk_navigation_policy_decision.cpp
     UIProcess/API/efl/ewk_url_request.cpp
     UIProcess/API/efl/ewk_url_response.cpp
@@ -181,6 +182,7 @@
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_cookie_manager.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_url_request.h"
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_response.h"

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


--- trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h	2012-07-25 08:18:59 UTC (rev 123586)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h	2012-07-25 08:30:00 UTC (rev 123587)
@@ -31,6 +31,7 @@
 #include "ewk_cookie_manager.h"
 #include "ewk_intent.h"
 #include "ewk_intent_service.h"
+#include "ewk_main.h"
 #include "ewk_navigation_policy_decision.h"
 #include "ewk_url_request.h"
 #include "ewk_url_response.h"

Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_main.cpp (0 => 123587)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_main.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_main.cpp	2012-07-25 08:30:00 UTC (rev 123587)
@@ -0,0 +1,105 @@
+/*
+    Copyright (C) 2009-2010 ProFUSION embedded systems
+    Copyright (C) 2009-2011 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.
+*/
+
+#include "config.h"
+#include "ewk_main.h"
+
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Edje.h>
+#include <Eina.h>
+#include <Evas.h>
+#include <glib-object.h>
+#include <glib.h>
+
+static int _ewkInitCount = 0;
+
+/**
+ * \var     _ewk_log_dom
+ * @brief   the log domain identifier that is used with EINA's macros
+ */
+int _ewk_log_dom = -1;
+
+int ewk_init(void)
+{
+    if (_ewkInitCount)
+        return ++_ewkInitCount;
+
+    if (!eina_init())
+        goto error_eina;
+
+    _ewk_log_dom = eina_log_domain_register("ewebkit2", EINA_COLOR_ORANGE);
+    if (_ewk_log_dom < 0) {
+        EINA_LOG_CRIT("could not register log domain 'ewebkit2'");
+        goto error_log_domain;
+    }
+
+    if (!evas_init()) {
+        EINA_LOG_DOM_CRIT(_ewk_log_dom, "could not init evas.");
+        goto error_evas;
+    }
+
+    if (!ecore_init()) {
+        EINA_LOG_DOM_CRIT(_ewk_log_dom, "could not init ecore.");
+        goto error_ecore;
+    }
+
+    if (!ecore_evas_init()) {
+        EINA_LOG_DOM_CRIT(_ewk_log_dom, "could not init ecore_evas.");
+        goto error_ecore_evas;
+    }
+
+    g_type_init();
+
+    if (!ecore_main_loop_glib_integrate()) {
+        EINA_LOG_DOM_WARN(_ewk_log_dom, "Ecore was not compiled with GLib support, some plugins will not "
+            "work (ie: Adobe Flash)");
+    }
+
+    return ++_ewkInitCount;
+
+error_ecore_evas:
+    ecore_shutdown();
+error_ecore:
+    evas_shutdown();
+error_evas:
+    eina_log_domain_unregister(_ewk_log_dom);
+    _ewk_log_dom = -1;
+error_log_domain:
+    eina_shutdown();
+error_eina:
+    return 0;
+}
+
+int ewk_shutdown(void)
+{
+    if (--_ewkInitCount)
+        return _ewkInitCount;
+
+    ecore_evas_shutdown();
+    ecore_shutdown();
+    evas_shutdown();
+    eina_log_domain_unregister(_ewk_log_dom);
+    _ewk_log_dom = -1;
+    eina_shutdown();
+
+    return 0;
+}

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


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_main.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_main.h	2012-07-25 08:30:00 UTC (rev 123587)
@@ -0,0 +1,58 @@
+/*
+    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

Modified: trunk/Tools/ChangeLog (123586 => 123587)


--- trunk/Tools/ChangeLog	2012-07-25 08:18:59 UTC (rev 123586)
+++ trunk/Tools/ChangeLog	2012-07-25 08:30:00 UTC (rev 123587)
@@ -1,3 +1,17 @@
+2012-07-25  Mikhail Pozdnyakov  <[email protected]>
+
+        [EFL][WK2] Add ewk_main.{cpp,h} to EFL WK2
+        https://bugs.webkit.org/show_bug.cgi?id=92101
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Added a centralized place for general initialization in UI process for EFL WK2.
+
+        * MiniBrowser/efl/main.c: Added using of newly added ewk_init() and ewk_shutdown() functions.
+        (main):
+        * WebKitTestRunner/efl/main.cpp: Ditto.
+        (main):
+
 2012-07-24  Benjamin Poulain  <[email protected]> && Joseph Pecoraro  <[email protected]>
 
         QualifiedName's HashSet should be big enough to hold at least all the static names

Modified: trunk/Tools/MiniBrowser/efl/main.c (123586 => 123587)


--- trunk/Tools/MiniBrowser/efl/main.c	2012-07-25 08:18:59 UTC (rev 123586)
+++ trunk/Tools/MiniBrowser/efl/main.c	2012-07-25 08:30:00 UTC (rev 123587)
@@ -203,7 +203,7 @@
     const char *url;
     int args = 1;
 
-    if (!ecore_evas_init())
+    if (!ewk_init())
         return EXIT_FAILURE;
 
     if (args < argc)
@@ -221,7 +221,7 @@
     ecore_evas_free(browser->ee);
     free(browser);
 
-    ecore_evas_shutdown();
+    ewk_shutdown();
 
     return 0;
 }

Modified: trunk/Tools/WebKitTestRunner/efl/main.cpp (123586 => 123587)


--- trunk/Tools/WebKitTestRunner/efl/main.cpp	2012-07-25 08:18:59 UTC (rev 123586)
+++ trunk/Tools/WebKitTestRunner/efl/main.cpp	2012-07-25 08:30:00 UTC (rev 123587)
@@ -19,12 +19,8 @@
 
 #include "config.h"
 
+#include "EWebKit2.h"
 #include "TestController.h"
-#include <Ecore.h>
-#include <Ecore_Evas.h>
-#include <Edje.h>
-#include <glib-object.h>
-#include <glib.h>
 
 #ifdef HAVE_ECORE_X
 #include <Ecore_X.h>
@@ -32,20 +28,12 @@
 
 int main(int argc, char** argv)
 {
-    g_type_init();
-
-    if (!ecore_evas_init())
+    if (!ewk_init())
         return 1;
 
-    if (!edje_init()) {
-        ecore_evas_shutdown();
-        return 1;
-    }
-
 #ifdef HAVE_ECORE_X
     if (!ecore_x_init(0)) {
-        ecore_evas_shutdown();
-        edje_shutdown();
+        ewk_shutdown();
         return 1;
     }
 #endif
@@ -57,8 +45,7 @@
     ecore_x_shutdown();
 #endif
 
-    edje_shutdown();
-    ecore_evas_shutdown();
+    ewk_shutdown();
 
     return 0;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to