<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>59922</bug_id>
          
          <creation_ts>2011-05-02 02:46:15 -0700</creation_ts>
          <short_desc>[EFL] Cleanup EFL initialization/shutdown in the EWebLauncher</short_desc>
          <delta_ts>2011-05-11 10:42:46 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit EFL</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Tomasz Morawski">t.morawski</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>gyuyoung.kim</cc>
    
    <cc>kenneth</cc>
    
    <cc>leandro</cc>
    
    <cc>lucas.de.marchi</cc>
    
    <cc>rakuco</cc>
    
    <cc>tonikitoo</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>396304</commentid>
    <comment_count>0</comment_count>
    <who name="Tomasz Morawski">t.morawski</who>
    <bug_when>2011-05-02 02:46:15 -0700</bug_when>
    <thetext>Removed ecore_evas_init and edje_init form main function due to they 
are also called in the ewk_init. Moved ewk_shutdown to quit function.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>396305</commentid>
    <comment_count>1</comment_count>
      <attachid>91901</attachid>
    <who name="Tomasz Morawski">t.morawski</who>
    <bug_when>2011-05-02 02:50:13 -0700</bug_when>
    <thetext>Created attachment 91901
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>396311</commentid>
    <comment_count>2</comment_count>
      <attachid>91901</attachid>
    <who name="Gyuyoung Kim">gyuyoung.kim</who>
    <bug_when>2011-05-02 03:24:02 -0700</bug_when>
    <thetext>Comment on attachment 91901
Patch

LGTM.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>396327</commentid>
    <comment_count>3</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2011-05-02 04:02:29 -0700</bug_when>
    <thetext>The commit-queue encountered the following flaky tests while processing attachment 91901:

http/tests/xmlhttprequest/xmlhttprequest-50ms-download-dispatch.html bug 52016 (author: jchaffraix@webkit.org)
The commit-queue is continuing to process your patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>396328</commentid>
    <comment_count>4</comment_count>
      <attachid>91901</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2011-05-02 04:03:37 -0700</bug_when>
    <thetext>Comment on attachment 91901
Patch

Clearing flags on attachment: 91901

Committed r85471: &lt;http://trac.webkit.org/changeset/85471&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>396329</commentid>
    <comment_count>5</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2011-05-02 04:03:42 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>396358</commentid>
    <comment_count>6</comment_count>
    <who name="Lucas De Marchi">lucas.de.marchi</who>
    <bug_when>2011-05-02 06:37:29 -0700</bug_when>
    <thetext>The rule of thumb in EFL is that you init in all the places you use it. So, if in your application you call ecore_evas_* functions, you have to call ecore_evas_init() first.

All the EFL init functions will just increment a ref if they are already initialized. This is the easiest way to keep things safe and is the way adopted in all the rest of EFL.


So, ewk calls ecore_evas_init() and edje_init() because it uses functions of these libraries. In your application, you shouldn&apos;t trust what the library will do with external libraries, so you should call the _init() function too. As I said, this will be almost a nop and you&apos;ll be safe regarding future updates.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>396382</commentid>
    <comment_count>7</comment_count>
    <who name="Tomasz Morawski">t.morawski</who>
    <bug_when>2011-05-02 07:33:14 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; The rule of thumb in EFL is that you init in all the places you use it. So, if in your application you call ecore_evas_* functions, you have to call ecore_evas_init() first.
&gt; 
&gt; All the EFL init functions will just increment a ref if they are already initialized. This is the easiest way to keep things safe and is the way adopted in all the rest of EFL.
&gt; 
&gt; 
&gt; So, ewk calls ecore_evas_init() and edje_init() because it uses functions of these libraries. In your application, you shouldn&apos;t trust what the library will do with external libraries, so you should call the _init() function too. As I said, this will be almost a nop and you&apos;ll be safe regarding future updates.

Thank you for your comment. Generally I agre with you. This is a good way. 
But in this specific case where we use our own _WebKit engine library_ this redundant initialization makes only code confusion. We exactly know what initialization function will do and it is hard to belive that the EFL initialization code will disappears from there. :) Moreover, when I use an engine I expect that a lot of think like initializations will be done on the engine site without my control. On the other hand why there are functions like ewk_init and ewk_shutdown in the public api and the browser programmer have to call another initalization for objects that are belogns to him only for increase ref counter. 

Should we also move glib initialization to EWebLauncher to be consistent? :)

Best Regards 
Tomasz Morawski</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>396393</commentid>
    <comment_count>8</comment_count>
    <who name="Lucas De Marchi">lucas.de.marchi</who>
    <bug_when>2011-05-02 08:40:38 -0700</bug_when>
    <thetext>(In reply to comment #7)
&gt; Thank you for your comment. Generally I agre with you. This is a good way. 
&gt; But in this specific case where we use our own _WebKit engine library_ this 

What do you mean by &quot;our own webkit engine library&quot;? Besides being a browser for testing the EFL port, EWebLauncher serves as a demo how a browser would be done with this port.

&gt; redundant initialization makes only code confusion. We exactly know what 

Why? This is a common agreement among EFL developers: you init what you use. If your application uses evas, you init evas; if it uses ecore_evas, you init ecore_evas... even if evas is actually initialized by ecore_evas_init().

&gt; initialization function will do and it is hard to belive that the EFL
&gt; initialization code will disappears from there. :) Moreover, when I use an
&gt; engine I expect that a lot of think like initializations will be done on the
&gt; engine site without my control.

Exactly because it&apos;s without your control, you shouldn&apos;t trust it.


&gt; 
&gt; Should we also move glib initialization to EWebLauncher to be consistent? :)

If you use a function in glib&apos;s namespace, I&apos;d say yes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>397033</commentid>
    <comment_count>9</comment_count>
    <who name="Tomasz Morawski">t.morawski</who>
    <bug_when>2011-05-03 04:06:59 -0700</bug_when>
    <thetext>Thank you for your explanation. I know what I have done wrong. Could you revert my commit?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>397205</commentid>
    <comment_count>10</comment_count>
    <who name="Lucas De Marchi">lucas.de.marchi</who>
    <bug_when>2011-05-03 11:16:07 -0700</bug_when>
    <thetext>Reverted r85471 for reason:

The rule of thumb in EFL is that you init in all the places you use it. So, if in your application you call ecore_evas_* functions, you have to call ecore_evas_init() first.

Committed r85625: &lt;http://trac.webkit.org/changeset/85625&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>402006</commentid>
    <comment_count>11</comment_count>
    <who name="Raphael Kubo da Costa (:rakuco)">rakuco</who>
    <bug_when>2011-05-11 09:03:25 -0700</bug_when>
    <thetext>Hey there, wouldn&apos;t it make sense to close this bug now?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>402100</commentid>
    <comment_count>12</comment_count>
    <who name="Lucas De Marchi">lucas.de.marchi</who>
    <bug_when>2011-05-11 10:42:46 -0700</bug_when>
    <thetext>(In reply to comment #11)
&gt; Hey there, wouldn&apos;t it make sense to close this bug now?

Yes, closing it now.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>91901</attachid>
            <date>2011-05-02 02:50:13 -0700</date>
            <delta_ts>2011-05-02 04:03:37 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>EFLInitialization.patch</filename>
            <type>text/plain</type>
            <size>1896</size>
            <attacher name="Tomasz Morawski">t.morawski</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1Rvb2xzL0NoYW5nZUxvZyBiL1Rvb2xzL0NoYW5nZUxvZwppbmRleCBkNTQw
YWFkLi42MzQyOGExIDEwMDY0NAotLS0gYS9Ub29scy9DaGFuZ2VMb2cKKysrIGIvVG9vbHMvQ2hh
bmdlTG9nCkBAIC0xLDMgKzEsMTcgQEAKKzIwMTEtMDUtMDIgIFRvbWFzeiBNb3Jhd3NraSAgPHQu
bW9yYXdza2lAc2Ftc3VuZy5jb20+CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BT
ISkuCisKKyAgICAgICAgQ2xlYW51cCBFRkwgaW5pdGlhbGl6YXRpb24vc2h1dGRvd24gaW4gdGhl
IEVXZWJMYXVuY2hlcgorICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5j
Z2k/aWQ9NTk5MjIKKworICAgICAgICBSZW1vdmVkIGVjb3JlX2V2YXNfaW5pdCBhbmQgZWRqZV9p
bml0IGZvcm0gbWFpbiBmdW5jdGlvbiBkdWUgdG8gdGhleQorICAgICAgICBhcmUgYWxzbyBjYWxs
ZWQgaW4gdGhlIGV3a19pbml0LiBNb3ZlZCBld2tfc2h1dGRvd24gdG8gcXVpdCBmdW5jdGlvbi4K
KworICAgICAgICAqIEVXZWJMYXVuY2hlci9tYWluLmM6CisgICAgICAgIChxdWl0KToKKyAgICAg
ICAgKG1haW4pOgorCiAyMDExLTA1LTAyICBBZGFtIEJhcnRoICA8YWJhcnRoQHdlYmtpdC5vcmc+
CiAKICAgICAgICAgUmV2aWV3ZWQgYnkgRXJpYyBTZWlkZWwuCmRpZmYgLS1naXQgYS9Ub29scy9F
V2ViTGF1bmNoZXIvbWFpbi5jIGIvVG9vbHMvRVdlYkxhdW5jaGVyL21haW4uYwppbmRle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2LDYgQEAgbWFpbihpbnQgYXJnYywgY2hhciAqYXJndltdKQogICAgIGlmICghdGhlbWVQYXRo
KQogICAgICAgICByZXR1cm4gcXVpdChFSU5BX0ZBTFNFLCAiRVJST1I6IGNvdWxkIG5vdCBmaW5k
IHRoZW1lLlxuIik7CiAKLSAgICBld2tfaW5pdCgpOwogICAgIHRtcCA9IGdldGVudigiVE1QRElS
Iik7CiAgICAgaWYgKCF0bXApCiAgICAgICAgIHRtcCA9ICIvdG1wIjsKQEAgLTg5MCw3ICs4ODMs
NSBAQCBtYWluKGludCBhcmdjLCBjaGFyICphcmd2W10pCiAKICAgICBlY29yZV9tYWluX2xvb3Bf
YmVnaW4oKTsKIAotICAgIGV3a19zaHV0ZG93bigpOwotCiAgICAgcmV0dXJuIHF1aXQoRUlOQV9U
UlVFLCBOVUxMKTsKIH0K
</data>

          </attachment>
      

    </bug>

</bugzilla>