interface框架结构firefox os 框架结构及调用机制

废话就不多说了,开始。。。

    近来学习了一些新的比拟前沿的东西,贴出来和大家分享,我想胜利是留给少数人的,抓住比拟前沿的东西学习也是一件有意义的事!!嘿嘿!!

    

    interface和框架结构 http://

    Gecko-js async Communicate With Gaia

    

    1.   DOM request 

    

          Once we use the refer interface, it would return a DOMRequest. Code sample: 

    

          (1) IDL file 

    

                ......

    

               nsIDOMDOMRequest get(in jsval name);

    

               ......

    

         (2) Gecko js file 

    

               ......

    

               Cu.import('resource://gre/modules/DOMRequestHelper.jsm');

    

              ......

    

              let request = this.createRequest();

    

              ......

    

              return request;

    

              ......

    

    

    2.  Register callback 

    

         When gaia want to monitor the change about something, it can register one callback. IDL file 

    

    

         interface XXXX : nsISupports

    

        {

    

           attribute nsIDOMEventListener xxxxx;

    

        };

    

        ......

    

       [scriptable, function, uuid(df31c120-ded6-11d1-bd85-00805f8ae3f4)]

    

       interface nsIDOMEventListener : nsISupports

    

       {

    

           void handleEvent(in nsIDOMEvent event);

    

       };

    

    

    

    Gecko-cpp async Communicate With Gaia

    

    

    1.  Callback 

    每日一道理
当浮华给予我们过多欺骗,现实中的虚假几乎让我们忘却了真的存在,是真情唤回了迷离的心,是真情带给了我们最纯、最真的感觉,它流露的是美的誓言,渗透的是永恒执著的真爱。

    

         (1) IDL interface provide one callback parameter. Gaia deliver the callback function when use that idl interface. And gecko-c++ use "handleEvent" to execute the callback function. Example: IDL file 

    

    

              [scriptable, function, uuid(9cba3cdc-3a2a-44ed-a72a-4bd70b98e7d3)]

    

              interface nsIDOMJrdFotaCommonCb : nsISupports

    

             {

    

                  void handleEvent(in DOMString actionType,

    

                           in bool isSuccessed,

    

                           in DOMString errorType);

    

             };

    

             [scriptable, builtinclass, uuid(50f140da-78e8-449c-a688-d512e1df443a)]

    

             interface nsIDOMMozJrdFotaManager:nsISupports

    

            {

    

                 void pause(in nsIDOMJrdFotaCommonCb pauseCallback);

    

            };

    

        (2) CPP source / header file 

    

             nsCOMPtr<nsIDOMJrdFotaCommonCb> gOnCommonCb;

    

            gOnCommonCb->HandleEvent(actionType, isSuccess, errorType);

    

    

    2.  Register callback 

    

        (1) When gaia want to the switch status, it can register one callback. Gecko can dispatch this event at any time.Example: IDL file 

    

    

            [scriptable, builtinclass, uuid(2bdb02e7-ec3a-47a9-885c-0ab514566801)]

    

            interface nsIDOMMozSmsManager : nsIDOMEventTarget

    

            {

    

                 [implicit_jscontext] attribute jsval onsending;

    

            };

    

        (2)Add this event into GkAtomList(<project>/gecko/content/base/src/nsGkAtomList.h) 

    

    

             GK_ATOM(onsending, "onsending")

    

    

    3.  DOM request 

    

        Sometimes Gecko-C++ has used the gecko-js DOM request interface. In this case, C++ IDL interface can provide one DOM request interface to gaia. 

    

    原文出处及更多详细资料

文章结束给大家分享下程序员的一些笑话语录:

古鸽是一种搜索隐禽,在中国快绝迹了…初步的研究表明,古鸽的离去,很可能导致另一种长着熊爪,酷似古鸽,却又习性不同的猛禽类——犤毒鸟

---------------------------------
原创文章 By
interface和框架结构
---------------------------------

原文链接: https://www.cnblogs.com/jiangu66/archive/2013/05/28/3105069.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    interface框架结构firefox os 框架结构及调用机制

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/90376

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月10日 上午12:36
下一篇 2023年2月10日 上午12:36

相关推荐