Summary: | [EFL] Prevent the client from creating ewk_view when EWebkit is not initialized | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Grzegorz Czajkowski <g.czajkowski> | ||||||||
Component: | WebKit EFL | Assignee: | Grzegorz Czajkowski <g.czajkowski> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | bunhere, cdumez, commit-queue, gyuyoung.kim, jinwoo7.song, lucas.de.marchi, rakuco, ryuan.choi, sergio | ||||||||
Priority: | P2 | ||||||||||
Version: | 528+ (Nightly build) | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Bug Depends on: | |||||||||||
Bug Blocks: | 136822 | ||||||||||
Attachments: |
|
Description
Grzegorz Czajkowski
2014-08-05 06:34:07 PDT
Created attachment 236028 [details]
Patch
Comment on attachment 236028 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=236028&action=review Thank you for nice fix ! > Source/WebKit2/UIProcess/efl/EwkMain.cpp:3 > + Copyright (C) 2009-2011 Samsung Electronics Please update 2011 -> 2014. > Source/WebKit2/UIProcess/efl/EwkMain.cpp:73 > + EINA_LOG_CRIT("could not register log domain 'ewebkit2'"); I hope to use same macro as below. CRITICAL() > Source/WebKit2/UIProcess/efl/EwkMain.cpp:80 > + eina_log_domain_unregister(m_ewkLogDomainId); How about adding a function to process shutdown ? For example, if (!evas_init()) { CRITICAL("could not init evas."); shutdownEFLLibraries(EVAS_INIT); } if (!ecore_init()) { CRITICAL("could not init ecore."); shutdownEFLLibraries(EVAS_INIT); } EwkMain::shutdownEFLLibraries(int failed) { switch(failed) { case ecore_init: break; case ecore_evas_init: break; case ecore_imf_init: ecore_evas_shutdown(); ecore_shutdown(); evas_shutdown(); break; case efreet_init: break; } eina_log_domain_unregister(m_ewkLogDomainId); m_ewkLogDomainId = -1; eina_shutdown(); return 0; } Comment on attachment 236028 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=236028&action=review IMHO, EwkMain in ewk_main_private.h looks fine (without WK). > Source/WebKit2/UIProcess/API/C/efl/WKMain.cpp:33 > +int WKMainInitialize() Why WKxxx ? It looks not quite related to WK APIs to me. > Source/WebKit2/UIProcess/efl/EwkMain.cpp:34 > +#include <glib-object.h> > +#include <glib.h> Should we still include this? > Source/WebKit2/UIProcess/efl/EwkMain.cpp:64 > + if (isInitialized()) > + return ++m_ewkInitCount; Nit, Just for me, if (m_ewkInitCount) looks readable. Created attachment 236094 [details]
Apply Gyuyoung and Ryuan comments
Comment on attachment 236028 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=236028&action=review Thank you guys for the review! >> Source/WebKit2/UIProcess/API/C/efl/WKMain.cpp:33 >> +int WKMainInitialize() > > Why WKxxx ? > > It looks not quite related to WK APIs to me. Yeahh, that was overkill a bit. What I wanted to achieve was to use WK C API (WKMainIsInitialized) in ewk_view.cpp. It seems that the style in ewk is completely mixed. >> Source/WebKit2/UIProcess/efl/EwkMain.cpp:3 >> + Copyright (C) 2009-2011 Samsung Electronics > > Please update 2011 -> 2014. Done. >> Source/WebKit2/UIProcess/efl/EwkMain.cpp:34 >> +#include <glib.h> > > Should we still include this? Good catch! Indeed they are not needed any longer. >> Source/WebKit2/UIProcess/efl/EwkMain.cpp:64 >> + return ++m_ewkInitCount; > > Nit, > Just for me, > if (m_ewkInitCount) looks readable. Restored. >> Source/WebKit2/UIProcess/efl/EwkMain.cpp:73 >> + EINA_LOG_CRIT("could not register log domain 'ewebkit2'"); > > I hope to use same macro as below. CRITICAL() Unfortunately we ca not use CRITICAL() macro here as the registration of new log domain (which CRITICAL uses) has failed. Similarly to !eina_init() - fixed in patch #2. >> Source/WebKit2/UIProcess/efl/EwkMain.cpp:80 >> + eina_log_domain_unregister(m_ewkLogDomainId); > > How about adding a function to process shutdown ? For example, > > if (!evas_init()) { > CRITICAL("could not init evas."); > shutdownEFLLibraries(EVAS_INIT); > } > > if (!ecore_init()) { > CRITICAL("could not init ecore."); > shutdownEFLLibraries(EVAS_INIT); > } > > EwkMain::shutdownEFLLibraries(int failed) { > switch(failed) { > case ecore_init: > break; > case ecore_evas_init: > break; > case ecore_imf_init: > ecore_evas_shutdown(); > ecore_shutdown(); > evas_shutdown(); > break; > case efreet_init: > break; > } > > eina_log_domain_unregister(m_ewkLogDomainId); > m_ewkLogDomainId = -1; > eina_shutdown(); > return 0; > } That's is cool! Added. Thanks! Comment on attachment 236094 [details] Apply Gyuyoung and Ryuan comments View in context: https://bugs.webkit.org/attachment.cgi?id=236094&action=review > Source/WebKit2/UIProcess/API/efl/ewk_main_private.h:31 > +typedef unsigned EFLLibraryInitFailure; How about using enum class or exposing enum ? > Source/WebKit2/UIProcess/API/efl/ewk_main_private.h:48 > + int m_ewkInitCount; > + int m_ewkLogDomainId; ewk looks meaningless. > Source/WebKit2/UIProcess/API/efl/ewk_private.h:29 > +#include "ewk_main_private.h" Hmm. should we keep ewk_private.h? Comment on attachment 236094 [details] Apply Gyuyoung and Ryuan comments View in context: https://bugs.webkit.org/attachment.cgi?id=236094&action=review > Source/WebKit2/UIProcess/API/efl/ewk_main.cpp:189 > +int ewk_init(void) IIRC, we decided that void parameter is only used for webkit-efl's public header. > Source/WebKit2/UIProcess/API/efl/ewk_main.cpp:194 > +int ewk_shutdown(void) ditto. Comment on attachment 236094 [details] Apply Gyuyoung and Ryuan comments View in context: https://bugs.webkit.org/attachment.cgi?id=236094&action=review Thanks for the review. I will take it into consideration in patch #3. >> Source/WebKit2/UIProcess/API/efl/ewk_private.h:29 >> +#include "ewk_main_private.h" > > Hmm. should we keep ewk_private.h? It seems that ewk_private.h is responsible for defining debug macros. How about renaming it to EwkDebug,h and moving out of API/ directory? (In reply to comment #8) > (From update of attachment 236094 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=236094&action=review > > Thanks for the review. I will take it into consideration in patch #3. > > >> Source/WebKit2/UIProcess/API/efl/ewk_private.h:29 > >> +#include "ewk_main_private.h" > > > > Hmm. should we keep ewk_private.h? > > It seems that ewk_private.h is responsible for defining debug macros. How about renaming it to EwkDebug,h and moving out of API/ directory? +1 Created attachment 236364 [details]
Patch
(In reply to comment #9) > (In reply to comment #8) > > (From update of attachment 236094 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=236094&action=review > > > > Thanks for the review. I will take it into consideration in patch #3. > > > > >> Source/WebKit2/UIProcess/API/efl/ewk_private.h:29 > > >> +#include "ewk_main_private.h" > > > > > > Hmm. should we keep ewk_private.h? > > > > It seems that ewk_private.h is responsible for defining debug macros. How about renaming it to EwkDebug,h and moving out of API/ directory? > > +1 I'll do it separately at bug 135797. Comment on attachment 236364 [details]
Patch
LGTM
Committed r172430: <http://trac.webkit.org/changeset/172430> |