zoukankan      html  css  js  c++  java
  • 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和框架结构
    ---------------------------------

  • 相关阅读:
    商城----项目宏观(1)
    Java动态代理-JDK自带实现
    git提交出现remote rejected master -> XX changes closed
    openstack认证实践
    转一篇Git代码回滚技巧
    线段树解决leetcode307. Range Sum Query
    The Skyline Problem leetcode 详解
    编程容易犯错的几个地方
    c++中小项堆声明和使用
    C++中int转为char 以及int 转为string和string 转int和字符串的split
  • 原文地址:https://www.cnblogs.com/jiangu66/p/3105069.html
Copyright © 2011-2022 走看看