WO2018161812A1 - 一种用户界面渲染方法及装置 - Google Patents

一种用户界面渲染方法及装置 Download PDF

Info

Publication number
WO2018161812A1
WO2018161812A1 PCT/CN2018/077186 CN2018077186W WO2018161812A1 WO 2018161812 A1 WO2018161812 A1 WO 2018161812A1 CN 2018077186 W CN2018077186 W CN 2018077186W WO 2018161812 A1 WO2018161812 A1 WO 2018161812A1
Authority
WO
WIPO (PCT)
Prior art keywords
language
interface
rendering
event
rendering engine
Prior art date
Application number
PCT/CN2018/077186
Other languages
English (en)
French (fr)
Inventor
刘铮
曾旭
马永才
姜立娣
沈轲戎
金德才
张翀
徐庆贺
Original Assignee
阿里巴巴集团控股有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 阿里巴巴集团控股有限公司 filed Critical 阿里巴巴集团控股有限公司
Publication of WO2018161812A1 publication Critical patent/WO2018161812A1/zh
Priority to US16/559,047 priority Critical patent/US20200057660A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45529Embedded in an application, e.g. JavaScript in a Web browser

Definitions

  • the present application relates to the field of computer technologies, and in particular, to a user interface rendering method and apparatus.
  • JavaScript is a dynamic language that is increasingly popular with developers because of its efficiency, dynamics, and ease of use.
  • Node.js is a JavaScript runtime or runtime platform that provides a variety of system-level Application Programming Interfaces (APIs) for easily building applications that are responsive and easy to extend.
  • APIs Application Programming Interfaces
  • the JavaScript program runs on a JavaScript interpreter, and in front-end development, the browser provides such an environment.
  • Node.js provides a JavaScript runtime environment that is separate from the browser and is mainly used for background server development.
  • the rendering engine is used to implement rendering of the user interface. How to integrate user interface rendering capabilities in Node.js is a problem that the industry needs to solve.
  • the embodiment of the present application provides a user interface rendering method and apparatus.
  • the dynamic language application running platform is preloaded with a rendering engine, and the method includes:
  • the first thread acquires a user interface rendering event to be processed, where the first thread is a thread in the dynamic language application running platform;
  • the first thread invokes a corresponding user interface rendering function provided by the rendering engine according to an interface corresponding to the event for invoking a rendering engine.
  • An acquiring unit configured to acquire a user interface rendering event to be processed, where the first thread is a thread in a dynamic language application running platform; wherein the dynamic language application running platform is preloaded with a rendering engine;
  • the first processing unit is configured to invoke a corresponding user interface rendering function provided by the rendering engine according to an interface corresponding to the event for invoking a rendering engine.
  • the embodiment of the present application provides one or more computer readable media having instructions stored thereon, the instructions being executed by one or more processors, such that the communication device performs the above method.
  • a communication device provided by an embodiment of the present application includes: one or more processors; and one or more computer readable media having instructions stored thereon, the instructions being processed by the one or more When executed, the apparatus is caused to perform the above method.
  • the dynamic language application running platform is preloaded with a rendering engine.
  • the rendering engine may be used according to the event.
  • the interface invokes a corresponding user interface rendering function provided by the rendering engine, so that the user interface rendering can be implemented based on the rendering engine in the platform, and the user interface rendering capability in the platform is realized.
  • Figure 1 exemplarily illustrates an operating system architecture 100 in accordance with some embodiments
  • FIG. 2 exemplarily illustrates a schematic diagram of a Node.js preloaded with a rendering engine, in accordance with some embodiments
  • FIG. 3 exemplarily shows a schematic diagram of an interface mapping relationship of a rendering engine according to some embodiments
  • FIG. 4 exemplarily illustrates a schematic diagram of Node.js resources after preloading a rendering engine, in accordance with some embodiments
  • FIG. 5 exemplarily shows a structural diagram of a rendering engine according to some embodiments
  • FIG. 6 exemplarily shows a Node.js preloading diagram according to some embodiments
  • FIG. 7 exemplarily shows a schematic diagram of a user interface rendering process according to some embodiments.
  • FIG. 8 is a schematic diagram showing an event loop mechanism, according to some embodiments.
  • FIG. 9 is a block diagram showing the structure of a user interface rendering apparatus exemplarily according to some embodiments.
  • Figure 10 exemplarily shows a schematic diagram of a device in accordance with some embodiments.
  • references to "an embodiment”, “an embodiment”, “an illustrative embodiment” or the like in the specification are intended to mean that the described embodiments may include specific features, structures, or characteristics, but each embodiment may or may not necessarily include a particular Feature, structure or characteristic. Moreover, such phrases are not necessarily referring to the same embodiments. Further, it is to be understood that the specific features, structures, or characteristics may be combined with other embodiments, whether explicitly described or not, in conjunction with the embodiments. In addition, it should be understood that items included in the list in the form of "at least one of A, B, and C” may represent (A); (B); (C); (A and B); (A and C) ; (B and C); or (A, B and C). Similarly, items listed in the form of "at least one of A, B or C” may represent (A); (B); (C); (A and B); (A and C); (B and C) or (A, B and C).
  • the disclosed embodiments can be implemented in hardware, firmware, software, or any combination thereof.
  • the disclosed embodiments can also be implemented as instructions carried or stored by one or more transitory or non-transitory machine readable (eg, computer readable) storage media, which can be read by one or more processors And execution.
  • a machine-readable storage medium may be embodied in any storage device, mechanism or other physical structure for storing or transmitting information in a machine readable form (eg, a volatile or nonvolatile memory, media disk or other medium). ).
  • the operating system is used to provide the user application with the basic capabilities of the operating system, which can be implemented based on the dynamic language application runtime platform, thereby providing an operating environment for the dynamic language application.
  • Node.js is the running environment or running platform of JavaScript.
  • the dynamic language application runtime platform is preloaded with a variety of modules, called public modules, for providing specific functions, such as system service functions.
  • dynamic language is a language category in computer programming language. It is a kind of language that can dynamically change type and structure at runtime. Functions and attributes can be added, modified and deleted at runtime. For example, JavaScript, Python, Ruby, etc. are all dynamic languages. Dynamic languages don't need to be compiled to run. They need to be supported by the runtime environment at runtime. This environment is called the runtime environment and contains all the elements needed for dynamic language operations, such as Java virtual machines, JavaScript engines, and so on.
  • Node.js is the JavaScript runtime environment and is the web application framework for the JavaScript engine built on Chrome. That is, the operating system provides the basic capabilities of the operating system to user applications based on Node.js.
  • Node.js includes a variety of modules called public modules that can be packaged by code that implements specific functions, such as code that implements operating system-level service functions, such as packaged in component form, such as these.
  • the module may include components that implement a Global Positioning System (GPS) positioning function, components that implement power management functions, and the like.
  • GPS Global Positioning System
  • the interfaces of these modules are exposed to the application layer. Applications in the application layer can implement the functions provided by these modules by calling the interfaces of these modules, parsing the code in the module through the JavaScript engine, and executing the methods provided by these modules.
  • Node.js provides a rich JavaScript API, developers can take advantage of the module's rapid development capabilities, but lack the user interface rendering capabilities.
  • the embodiment of the present application provides a solution for combining a rendering engine with Node.js.
  • the embodiments of the present application are described in detail below with reference to the accompanying drawings.
  • FIG. 1 exemplarily shows an operating system architecture 100.
  • the architecture 100 includes an application layer 10, an application framework layer 20, and an operating system layer 30.
  • One or more applications are included in the application layer 10.
  • the application framework layer 20 includes a dynamic language application runtime platform (such as Node.js).
  • the operating system layer 30 is mainly used to provide an operating system level code base and basic system services, such as provided system services may include device driver services, event management services, and the like.
  • the embodiment of the present application is based on the above architecture, so that the rendering engine can access the capabilities provided by the dynamic language application running platform such as Node.js.
  • the rendering engine can access the capabilities provided by the dynamic language application running platform such as Node.js.
  • the dynamic language application runtime platform can preload various common modules when starting, and can further preload the rendering engine as a standard module of the dynamic language application running platform.
  • the Node.js process preloads various capabilities.
  • the "capabilities" referred to herein may also be referred to as resources, and may include the aforementioned modules (such as components) for implementing specific functions, and may also include some configuration information and/or Resources, such as contexts, event queues, etc.
  • the capabilities pre-loaded by Node.js include at least the rendering engine, and further include the capabilities provided by Node.js. Among them, the capabilities provided by Node.js may include: public modules in Node.js (such as components for providing specific functions or services) and/or JavaScript runtime environment related information.
  • Common modules in Node.js can be encapsulated by JavaScript code that implements specific functions. Each module has an interface (such as an API) that can be supplied to the application layer for application calls.
  • the JavaScript runtime environment related information may include, but is not limited to, one or more of a context of a JavaScript engine, an event loop related configuration.
  • the context is used to describe the various objects, states, and functions within the engine.
  • the context of the JavaScript engine can include interfaces (such as APIs) for modules that are preloaded by the Node.js process.
  • the event loop related configuration may specifically include the configuration of the event queue of the Node.js, such as the location of the memory area where the event queue is located, the queue size, and the like.
  • the Node.js process may encapsulate the preloaded capabilities (such as the rendering engine) as standard modules in Node.js, as a standard module preloaded in Node.js, Node.js, Figure 2 example A schematic diagram of Node.js preloaded with a rendering engine is shown.
  • the rendering engine can be implemented by a dynamic language, such as the JavaScript language, ie, the functions contained in the rendering engine are written by a dynamic language such as the JavaScript language.
  • the implementation of the rendering engine can be divided into two parts, wherein for performance considerations and multi-thread utilization, some are implemented in natural languages such as c/c++, while others are implemented using dynamic languages, such as JavaScript. .
  • the rendering engine can also be implemented entirely in natural languages such as c/c++.
  • the rendering engine can provide the API of the natural language (this API is used to invoke the rendering function provided by the rendering engine based on the natural language implementation, ie, call rendering
  • this API is used to invoke the rendering function provided by the rendering engine based on the natural language implementation, ie, call rendering
  • the language is included in the engine, and the dynamic language application runtime platform supports dynamic languages.
  • Node.js supports the JavaScript language, so you need to map the natural language API (such as c/c++API) provided by the rendering engine.
  • a dynamic language API (such as JavaScript API) supported by a dynamic language application runtime platform (such as Node.js), and the mapped API is provided to the application layer, and the dynamic language application running platform (such as Node.js) saves the API. Mapping relations.
  • FIG. 3 exemplarily shows a schematic diagram of an API mapping relationship of a rendering engine.
  • the rendering engine can include a variety of components, such as Window system components (window system components), UI Elements components (user interface component components), Layout components (layout components), Event Handling components (event processing components), etc.
  • Window system components window system components
  • UI Elements components user interface component components
  • Layout components layout components
  • Event Handling components event processing components
  • the APIs of the c/c++ standard components are mapped one by one to the corresponding APIs that conform to the JavaScript standard.
  • the rendering engine can provide a dynamic language API (this API is used to call the rendering engine to provide user interface rendering based on the natural language implementation, ie, call the rendering engine Contains functions written in this natural language), while dynamic language runtime platforms (such as Node.js) support dynamic languages, such as the JavaScript language, so there is no need to do API mapping.
  • this API is used to call the rendering engine to provide user interface rendering based on the natural language implementation, ie, call the rendering engine Contains functions written in this natural language
  • dynamic language runtime platforms such as Node.js
  • the ability to preload in the dynamic language application runtime platform may also include, but is not limited to, one or more of the following:
  • the capabilities provided by the operating system may include: system services provided by the operating system layer, and the like. Modules for providing system services may be included in the operating system layer, which may be derived from code encapsulation for implementing specific capabilities. Each module has an interface (such as an API). In the embodiment of the present application, the preloading of the operating system capability can be implemented by adding the API of the module in the operating system layer to the context of a dynamic language engine such as a JavaScript engine.
  • User-defined capabilities ie user-defined code for implementing specific functions, can be packaged as modules, each with an interface (such as an API).
  • the pre-loading of the user-defined capability can be implemented by adding the API of the user-defined module to the context of a dynamic language engine (such as a JavaScript engine).
  • FIG. 4 is a schematic diagram of the dynamic language application running platform for Node.js, and exemplarily shows related resources in the application process after preloading the rendering engine.
  • the application process includes a Node.js thread, and the Node.js thread performs event processing such as user interface rendering based on the event loop mechanism of Node.js.
  • the Node.js thread can implement user interface rendering based on the rendering engine.
  • the Node.js thread can implement the application user interface rendering by calling the interface provided by the rendering engine, implement the network connection function by calling the interface provided by the common module 1, and implement the device capability query function by calling the interface provided by the common module 2.
  • the event management function is implemented by calling the interface provided by the common module 3.
  • FIG. 5 exemplarily shows a structural diagram of a rendering engine.
  • the implementation of the rendering engine can be divided into two parts. For performance considerations and multithreading, some can be implemented in natural language (such as c/c++) and in dynamic (such as JavaScript).
  • the natural language is c/c++ and the dynamic language is JavaScript
  • the Node.js thread needs to call the part of the rendering engine implemented by JavaScript
  • the corresponding function in the part is called based on the JavaScript API
  • the Node.js thread needs to be called
  • the part of the rendering thread implemented by c/c++ sends a call instruction to the JavaScript virtual machine, which includes a JavaScript API, and the JavaScript virtual machine maps the JavaScript API to the corresponding c/c++ API and obtains the mapping based on the mapping.
  • the c/c++ API calls the corresponding function in the rendering engine of the c/c++ implementation to implement the user interface rendering functionality.
  • FIG. 6 exemplarily shows a Node.js resource loading process provided by an embodiment of the present application, taking Node.js as an example.
  • This process exemplarily describes the Node.js startup process.
  • the Node.js process is started (for example, when the JavaScript application is started, the corresponding Node.js process is started).
  • the Node.js process performs an initialization process, in which the Node.js process preloads the rendering engine and the common module, and the common module may include a network module, a system module, and the like.
  • the common module may include a network module, a system module, and the like.
  • FIG. 7 exemplarily shows a user interface rendering process provided by an embodiment of the present application.
  • the first thread acquires a user interface rendering event to be processed; in S702, the first thread invokes the corresponding provided by the rendering engine according to an interface corresponding to the event for invoking a rendering engine.
  • User interface rendering capabilities can be a Node.js thread.
  • the user interface rendering event may be generated in the case where the user interface needs to be refreshed by the user's operation behavior (for example, the user switches the application through a touch operation, so the screen display content needs to be refreshed to display the switch.
  • the user interface of the target application to the target application for example, when the user clicks a function button in the user interface to open a page, a user interface rendering event can be generated.
  • the first thread invokes the common module according to the interface corresponding to the event for calling the common module.
  • the interface provided by the rendering engine includes a natural language interface that is mapped to a dynamic language interface for invoking a user interface rendering function based on the natural language provided in the rendering engine.
  • the dynamic language is a dynamic language supported by Node.js.
  • the Node.js thread can obtain a dynamic language interface corresponding to the event that is used to invoke the rendering engine, and map the obtained dynamic language interface to a corresponding natural language.
  • the language interface calls the corresponding user interface rendering function provided by the rendering engine according to the natural language interface obtained by the mapping.
  • the specific process can be seen in Figure 5.
  • Node.js uses an event loop mechanism.
  • the rendering engine is preloaded into Node.js, so the events of the rendering engine and the events of Node.js can be looped based on the event queue of Node.js.
  • the event loop is in a wait state and blocks, and when an event occurs in the Node.js or rendering engine, the event loops.
  • the event loop can be awakened asynchronously, and the events of the rendering engine are stored in the event queue.
  • This event queue usually uses a first-in, first-out mechanism.
  • FIG. 8 exemplarily shows an event loop mechanism of an embodiment of the present application, taking Node.js as an example.
  • the events of Node.js and the events of the rendering engine are stored in the event queue in the order in which they occur.
  • the Node.js thread reads the event from the event queue and responds, if the user interface rendering event is currently read, the corresponding interface corresponding to the rendering engine is called according to the interface for calling the rendering engine corresponding to the rendering event of the user interface.
  • the event can be processed using an asynchronous processing mechanism.
  • a callback function can be registered with the Node.js thread, which is used to notify the Node.js thread when a user interface rendering event occurs.
  • the Node.js process can be notified by the callback function, and the Node.js process can obtain the user to be processed from the Node.js event queue after receiving the notification of the callback function.
  • the interface renders the event.
  • the Node.js event queue can be managed by another thread.
  • the thread used to manage the Node.js event queue is referred to herein as an event thread.
  • the event thread can interface with the operating system, receive operating system related events from the operating system, and store the operating system related events in the Node.js event queue.
  • the operating system related events may include, but are not limited to, a key event, a touch event, and a render event.
  • the Node.js includes a common module and a rendering engine.
  • the Node.js thread obtains the user interface rendering event to be processed, the event corresponding to the event may be acquired.
  • An interface for invoking a rendering engine the corresponding user interface rendering function provided by the rendering engine is invoked according to the obtained interface for invoking the rendering engine, and the interface corresponding to the event for calling the common module is acquired on the other hand.
  • the corresponding public function provided by the common module is called according to the obtained interface for calling the common module. It can be seen that since Node.js includes a rendering engine, on the one hand, user interface rendering can be implemented based on the rendering engine in Node.js.
  • Node.js also includes a common module
  • the first thread can also Implement common functions based on common modules in Node.js, which integrates user interface rendering capabilities in Node.js, which is convenient for developers to develop programs, that is, developers only need to develop applications that can run in Node.js.
  • Program the application can use the common functions provided by the public module in Node.js, and can also use the user interface rendering function provided by the rendering engine in Node.js.
  • the above embodiments of the present application are applicable to mobile terminals such as mobile phones, smart wearable devices, in-vehicle devices, PDAs, and the like.
  • the user interface rendering can be implemented by the Node.js thread based on the rendering engine, so that the user interface rendering operation can use the capability provided by the Node.js to implement the Node.
  • the fusion of .js and rendering engine can be implemented by the Node.js thread based on the rendering engine, so that the user interface rendering operation can use the capability provided by the Node.js to implement the Node.
  • the fusion of .js and rendering engine are examples of .
  • the embodiment of the present application further provides a user interface rendering apparatus, which can implement the user interface rendering process described in the foregoing embodiment.
  • FIG. 9 is a schematic structural diagram of a user interface rendering apparatus provided by an embodiment of the present application.
  • the apparatus may include: an obtaining unit 901, a first processing unit 902, and optionally, a second processing unit 903, wherein:
  • the obtaining unit 901 is configured to obtain a user interface rendering event to be processed, where the first thread is a thread in a dynamic language application running platform, where the dynamic language application running platform is preloaded with a rendering engine;
  • the first processing unit 902 is configured to acquire an interface corresponding to the event for invoking a rendering engine, and invoke a corresponding user interface rendering function provided by the rendering engine according to the obtained interface for invoking a rendering engine.
  • the dynamic language application running platform is further preloaded with a common module
  • the second processing unit 903 is configured to acquire an interface corresponding to the event for calling a common module, according to the obtained public module for calling The interface invokes the corresponding public function provided by the common module.
  • the interface provided by the rendering engine includes a first language interface, the first language interface is mapped to a second language interface, and the first language interface is used to invoke the rendering engine based on the first A language provided user interface rendering function, the second language being a dynamic language supported by the dynamic language application runtime platform.
  • the first processing unit 902 is specifically configured to: acquire a second language interface corresponding to the event that is used to invoke the rendering engine, and map the acquired second language interface to a corresponding first language interface, and obtain a first language according to the mapping.
  • the interface invokes the corresponding user interface rendering functionality provided by the rendering engine.
  • the first processing unit 902 is specifically configured to: send a call instruction to the second language virtual machine, where the call instruction includes a second language interface for invoking a rendering engine, where the call instruction is used to trigger the first
  • the second language virtual machine maps the second language interface to a corresponding first language interface, and invokes a corresponding user interface rendering function provided by the rendering engine based on the first language interface obtained by the mapping.
  • the obtaining unit 901 is specifically configured to: after receiving the notification of the callback function, obtain a user interface rendering event to be processed from the dynamic language application running platform event queue; wherein the callback function is used to The first thread is notified when a user interface rendering event enters the event queue.
  • the dynamic language application running platform comprises Node.js
  • the second language comprises a JavaScript language.
  • the embodiment of the present application further provides an apparatus 1000, which can implement the process described in the foregoing embodiment.
  • FIG. 10 exemplarily illustrates an example apparatus 1000 in accordance with various embodiments.
  • Apparatus 1000 can include one or more processors 1002 coupled to at least one processor 1002, non-volatile memory (NMV)/memory 1004 coupled to system control logic 1001, network interface 1006 Coupled to system control logic 1001.
  • NMV non-volatile memory
  • Processor 1002 can include one or more single core processors or multi-core processors.
  • Processor 1002 can include any general purpose processor or combination of special purpose processors (eg, image processors, application processor baseband processors, etc.).
  • System control logic 1001 in one embodiment may include any suitable interface controller to provide any suitable interface to at least one of processors 1002 and/or to any suitable communication in communication with system control logic 1001. Any suitable interface to the device or component.
  • System control logic 1001 in one embodiment may include one or more memory controllers to provide an interface to system memory 1003.
  • System memory 1003 is used to load and store data and/or instructions.
  • corresponding device 1000 in one embodiment, system memory 1003 can include any suitable volatile memory.
  • NVM/memory 1004 can include one or more tangible, non-transitory computer readable media for storing data and/or instructions.
  • NVM/memory 1004 can include any suitable non-volatile storage device, such as one or more hard disk devices (HDDs), one or more compact disks (CDs), and/or one or more Digital versatile disk (DVD).
  • HDDs hard disk devices
  • CDs compact disks
  • DVD Digital versatile disk
  • the NVM/memory 1004 can include storage resources that are physically part of the device that the system is installed on or can be accessed, but is not necessarily part of the device.
  • NVM/memory 1004 can be accessed by the network via network interface 1006.
  • System memory 1003 and NVM/memory 1004 can each include a copy of a temporary or persistent instruction 1010.
  • the instructions 1010 can include instructions that, when executed by at least one of the processors 1002, cause the apparatus 1000 to implement one or a combination of the methods described.
  • instructions 1010 or hardware, firmware, and/or software components may additionally/alternatively be placed in system control logic 1001, network interface 1006, and/or processor 1002.
  • Network interface 1006 can include a receiver to provide device 1000 with a wireless interface to communicate with one or more networks and/or any suitable device.
  • Network interface 1006 can include any suitable hardware and/or firmware.
  • Network interface 1006 can include multiple antennas to provide a multiple input multiple output wireless interface.
  • network interface 1006 can include a network adapter, a wireless network adapter, a telephone modem, and/or a wireless modem.
  • At least one of the processors 1002 may be packaged with logic for one or more controllers of system control logic. In one embodiment, at least one of the processors may be packaged with logic for one or more controllers of system control logic to form a system level package. In one embodiment, at least one of the processors can be integrated on the same die as the logic of one or more controllers for system control logic. In one embodiment, at least one of the processors can be integrated on the same die as the logic of one or more controllers for system control logic to form a system chip.
  • Apparatus 1000 can further include an input/output device 1005.
  • the input/output device 1005 can include a user interface intended to enable a user to interact with the device 1000, can include a peripheral component interface designed to enable peripheral components to interact with the system, and/or can include sensors for determining environmental conditions And/or location information about the device 1000.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Computing Systems (AREA)
  • User Interface Of Digital Computer (AREA)
  • Stored Programmes (AREA)

Abstract

本申请公开了一种用户界面渲染方法及装置。本申请中,动态语言应用运行平台中预加载有渲染引擎,该方法包括:第一线程获取待处理的用户界面渲染事件,所述第一线程为所述动态语言应用运行平台中的线程;第一线程获取所述事件对应的用于调用渲染引擎的接口,根据获取到的用于调用渲染引擎的接口调用所述渲染引擎提供的相应用户界面渲染功能。采用本申请可实现动态语言应用运行平台与渲染引擎的融合。

Description

一种用户界面渲染方法及装置
本申请要求2017年03月08日递交的申请号为201710135534.9、发明名称为“一种用户界面渲染方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,尤其涉及一种用户界面渲染方法及装置。
背景技术
JavaScript是一种动态语言,因其高效、动态、易用等特点越来越受到开发者的欢迎。Node.js是JavaScript运行环境(runtime)或称运行平台,提供了多种系统级的应用程序编程接口(Application Programming Interface,API),用于方便地搭建响应速度快、易于扩展的应用程序。
JavaScript程序的运行依赖JavaScript解释器,在前端开发中,浏览器提供了这样的环境。而Node.js提供了一套脱离浏览器的JavaScript运行环境,主要应用于后台服务器开发。
渲染引擎用于实现对用户界面的渲染。如何在Node.js中集成用户界面渲染能力,是目前业界需要解决的问题。
发明内容
本申请实施例提供一种用户界面渲染方法及装置。
本申请实施例提供的用户界面渲染方法中,动态语言应用运行平台中预加载有渲染引擎,所述方法包括:
第一线程获取待处理的用户界面渲染事件,所述第一线程为所述动态语言应用运行平台中的线程;
所述第一线程根据所述事件对应的用于调用渲染引擎的接口,调用所述渲染引擎提供的相应用户界面渲染功能。
本申请实施例提供的用户界面渲染装置,包括:
获取单元,用于获取待处理的用户界面渲染事件,所述第一线程为动态语言应用运行平台中的线程;其中,所述动态语言应用运行平台中预加载有渲染引擎;
第一处理单元,用于根据所述事件对应的用于调用渲染引擎的接口,调用所述渲染引擎提供的相应用户界面渲染功能。
本申请实施例提供的一个或多个计算机可读介质,所述可读介质上存储有指令,所述指令被一个或多个处理器执行时,使得通信设备执行上述方法。
本申请实施例提供的通信设备,包括:一个或多个处理器;以及,一个或多个计算机可读介质,所述可读介质上存储有指令,所述指令被所述一个或多个处理器执行时,使得所述装置执行上述方法。
本申请的上述实施例中,动态语言应用运行平台中预加载有渲染引擎,该平台中的第一线程获取到待处理的用户界面渲染事件后,可根据所述事件对应的用于调用渲染引擎的接口,调用所述渲染引擎提供的相应用户界面渲染功能,从而可在该平台中基于渲染引擎实现用户界面渲染,实现了在该平台中集成用户界面渲染能力。
附图说明
本申请的实施例通过示例而非限制的方式示出在所附附图中,类似的附图标记表示类似的元素。
图1根据一些实施例示例性地示出了操作系统架构100;
图2根据一些实施例示例性地示出了预加载有渲染引擎的Node.js的示意图;
图3根据一些实施例示例性地示出了渲染引擎的接口映射关系示意图;
图4根据一些实施例示例性地示出了预加载渲染引擎后Node.js资源的示意图;
图5根据一些实施例示例性地示出了渲染引擎的结构示意图;
图6根据一些实施例示例性地示出了Node.js预加载示意图;
图7根据一些实施例示例性地示出了用户界面渲染流程示意图;
图8为根据一些实施例示例性地示出了事件循环机制示意图;
图9根据一些实施例示例性地示出了用户界面渲染装置的结构示意图;
图10根据一些实施例示例性地示出了一种装置示意图。
具体实施方式
虽然本申请的概念易于进行各种修改和替代形式,但是其具体实施例已经通过附图中的示例示出并且将在本文中详细描述。然而,应当理解,没有意图将本申请的概念限制为所公开的特定形式,而是相反,意图是覆盖与本申请以及所附权利要求一致的所有 修改、等同物和替代物。
说明书中对“一个实施例”、“实施例”、“说明性实施例”等的引用,指示所描述的实施例可包括特定特征、结构或特性,但是每个实施例可以或可以不必包括特定特征、结构或特性。此外,这样的短语不一定指的是相同的实施例。进一步地,认为在本领域技术人员的知识范围内,当结合实施例描述特定特征、结构或特性时,结合无论是否明确描述的其它实施例影响这样的特征,结构或特性。另外,应当理解,以“A,B和C中的至少一个”的形式包括在列表中的项目可以表示(A);(B);(C);(A和B);(A和C);(B和C);或(A,B和C)。类似地,以“A,B或C中的至少一个”的形式列出的项目可以表示(A);(B);(C);(A和B);(A和C);(B和C)或(A,B和C)。
在一些情况下,所公开的实施例可以在硬件、固件、软件或其任何组合中实现。所公开的实施例还可以被实现为由一个或多个暂时性或非暂时性机器可读(例如,计算机可读)存储介质携带或存储的指令,其可以由一个或多个处理器读取和执行。机器可读存储介质可以体现为用于以机器可读形式(例如,易失性或非易失性存储器、介质盘或其他介质)存储或传输信息的任何存储设备,机制或其他物理结构的设备)。
在附图中,一些结构或方法特征可以以特定布置和/或顺序示出。然而,应当理解,可能不需要这样的具体布置和/或排序。相反,在一些实施例中,这些特征可以以与说明性附图中所示不同的方式和/或顺序来布置。另外,在特定图中包括结构或方法特征并不意味着暗示这种特征在所有实施例中都是需要的,并且在一些实施例中可以不包括或可以与其他特征组合。
操作系统用于向用户应用提供操作系统的基础能力,可基于动态语言应用运行平台实现,从而为动态语言应用提供运行环境。其中,Node.js即为JavaScript的运行环境或运行平台。动态语言应用运行平台中预加载有多种模块,称为公共模,用于提供特定功能,比如系统服务功能。
其中,动态语言是计算机编程语言中的一个语言类别,是一类在运行时可以动态地改变类型、结构的语言,在运行时函数和属性可以被增加、修改和删除。例如JavaScript、Python、Ruby等都属于动态语言。动态语言不需要编译即可运行,在运行时需要运行环境的支撑,这个环境叫做运行时环境,它包含动态语言运行所需要的所有要素,例如Java虚拟机、JavaScript引擎等。
以云操作系统(云OS)中的Host系统为例,它可基于Node.js实现。Node.js是 JavaScript的运行环境,是建立在Chrome上的JavaScript引擎的Web应用程序框架,也就是说,操作系统基于Node.js向用户应用提供操作系统的基础能力。Node.js中包括多种模块,称为公共模块,这些模块可通过将用于实现特定功能的代码(比如实现操作系统级服务功能的代码)进行封装得到,比如可封装为组件形式,例如这些模块中可包括实现全球定位系统(Global Positioning System,简称GPS)定位功能的组件、实现电源管理功能的组件等。这些模块的接口被暴露给应用层,应用层中的应用程序可通过调用这些模块的接口,通过JavaScript引擎解析模块中的代码,执行这些模块提供的方法,从而实现这些模块提供的功能。
目前,后台服务器应用一般运行于Node.js。后台服务器应用的用户界面使用渲染引擎进行渲染。而渲染引擎大多专注于图形界面渲染,忽略了编程所需的其他公共模块的集成。使用这样的渲染引擎进行用户界面开发,需要编写或集成大量的公共模块,效率低下。Node.js虽然提供了丰富的JavaScript API,开发者可以利用它提供的模块快速开发功能,但缺失了用户界面渲染能力。
对此,本申请实施例提供了一种将渲染引擎与Node.js相融合的方案。下面结合附图对本申请实施例进行详细描述。
图1示例性地示出了一种操作系统架构100。架构100包括应用层10、应用框架层20和操作系统层30。应用层10中包括一个或多个应用。应用框架层20包括动态语言应用运行平台(比如Node.js)。操作系统层30主要用于提供操作系统级别的代码库以及基本的系统服务,比如提供的系统服务可包括设备驱动服务、事件管理服务等。
本申请实施例基于上述架构,使渲染引擎可以访问到如Node.js等的动态语言应用运行平台提供的能力。下面结合附图对本申请实施例进行详细描述。
动态语言应用运行平台启动时可预加载各种公共模块,并可进一步地将渲染引擎作为动态语言应用运行平台的标准模块进行预加载。
以动态语言应用运行平台为Node.js为例,Node.js启动过程中,Node.js进程被创建。Node.js进程预加载各种能力,这里所说的“能力”也可称为资源,可包括前述所描述的用于实现特定功能的模块(比如组件),还可以包括一些配置信息和/或资源等,比如上下文、事件队列等。Node.js所预加载的能力中至少包括渲染引擎,进一步还可包括Node.js提供的能力。其中,Node.js提供的能力可包括:Node.js中的公共模块(比如用于提供特定功能或服务的组件)和/或JavaScript运行环境相关信息。Node.js中的公共模块可通过对用于实现特定功能的JavaScript代码封装得到。每个模块均具有接口(比如API), 可提供给应用层供应用程序调用。JavaScript运行环境相关信息可包括但不限于JavaScript引擎的上下文、事件循环相关配置中的一种或多种。其中,上下文用于描述引擎内部的各种对象、状态和功能。JavaScript引擎的上下文中可包括由Node.js进程所预加载的模块的接口(如API)。事件循环相关配置具体可包括Node.js的事件队列的配置,比如事件队列所在的内存区域位置、队列大小等。
在一些实施例中,Node.js进程可将预加载的能力(比如渲染引擎)封装为Node.js中的标准模块,作为Node.js的一个标准模块预加载的Node.js中,图2示例性地示出了预加载有渲染引擎的Node.js的示意图。
在一些实施例中,渲染引擎可由动态语言(如JavaScript语言)实现,即,渲染引擎中包含的函数由动态语言(如JavaScript语言)编写。在另外一些实施例中,渲染引擎的实现可分为两部分,其中为了性能考虑和多线程的利用,部分采用c/c++等自然语言实现,而另外的部分则采用动态语言,比如JavaScript语言实现。当然,渲染引擎也可以全部由c/c++等自然语言实现。
对于全部或部分由c/c++等自然语言实现的渲染引擎,渲染引擎可提供该自然语言的API(该API用于调用渲染引擎提供的基于该自然语言实现的用户界面渲染功能,即,调用渲染引擎中包含的该自然语言编写的函数),而动态语言应用运行平台支持动态语言,比如Node.js支持JavaScript语言,因此需要将渲染引擎提供的自然语言API(如c/c++API)映射为动态语言应用运行平台(如Node.js)支持的动态语言API(如JavaScript API),并将映射得到的API提供给应用层,动态语言应用运行平台(如Node.js)中保存该API的映射关系。图3示例性地示出了渲染引擎的API映射关系示意图。其中,渲染引擎中可包括多种组件,比如Window system组件(窗口系统组件)、UI Elements组件(用户界面部件组件)、Layout组件(布局组件)、Event Handling组件(事件处理组件)等,这些符合c/c++标准的组件的API被一一映射为对应的符合JavaScript标准的API。
对于全部由动态语言(如JavaScript语言)实现的渲染引擎,由于渲染引擎可提供动态语言API(该API用于调用渲染引擎提供的基于该自然语言实现的用户界面渲染功能,即,调用渲染引擎中包含的该自然语言编写的函数),而动态语言运行平台(如Node.js)支持动态语言,比如JavaScript语言,因此无需进行API映射。
在一些实施例中,进一步地,动态语言应用运行平台中预加载的能力还可包括但不限于以下中的一种或多种组合:
-操作系统提供的能力
操作系统提供的能力可包括:操作系统层提供的系统服务等。操作系统层中可包括用于提供系统服务的模块,这些模块可由用于实现特定能力的代码封装得到。每个模块均具有接口(比如API)。本申请实施例中,可通过将操作系统层中的模块的API添加到动态语言引擎(如JavaScript引擎)的上下文中,实现对操作系统能力的预加载。
-用户自定义的能力
用户自定义的能力,即用户自定义的用于实现特定功能的代码,可被封装为模块,每个模块均具有接口(如API)。本申请实施例中,可通过将用户自定义的模块的API添加到动态语言引擎(如JavaScript引擎)的上下文中,实现对用户自定义能力的预加载。
图4以动态语言应用运行平台为Node.js为例,示例性地示出了预加载渲染引擎后应用进程中的相关资源的示意图。如图所示,应用进程中包括Node.js线程,Node.js线程基于Node.js的事件循环机制进行用户界面渲染等事件的处理。Node.js线程可基于渲染引擎实现用户界面渲染。作为一个例子,Node.js线程可通过调用渲染引擎提供的接口实现应用程序用户界面渲染,通过调用公共模块1提供的接口实现网络连接功能,通过调用公共模块2提供的接口实现设备能力查询功能,通过调用公共模块3提供的接口实现事件管理功能。
图5示例性地示出了渲染引擎的结构示意图。渲染引擎的实现可分为两部分。为了性能考虑和多线程的利用等,一部分可使用自然语言实现(如c/c++等语言),另一部分使用动态语言实现(如JavaScript)。以自然语言为c/c++、动态语言为JavaScript为例,如果Node.js线程需要调用渲染引擎中由JavaScript实现的部分,则基于JavaScript API调用该部分中对应的函数;如果Node.js线程需要调用渲染线程中由c/c++实现的部分,则向JavaScript虚拟机发送调用指令,该调用指令中包括JavaScript API,JavaScript虚拟机将该JavaScript API映射为对应的c/c++API,并基于映射得到的c/c++API调用渲染引擎中由c/c++的实现部分中的相应函数,以实现用户界面渲染功能。
图6以Node.js为例,示例性地示出了本申请实施例提供的Node.js资源加载过程。该过程示例性地描述了Node.js启动过程。如图所示,在S610中,Node.js进程启动(比如启动JavaScript应用程序时则启动对应的Node.js进程)。在S611~S613中,Node.js进程执行初始化过程,在该过程中,Node.js进程预加载渲染引擎以及公共模块,所述公共模块可包括网络模块、系统模块等。具体预加载过程可参见前述实施例的描述。
图7示例性地示出了本申请实施例提供的用户界面渲染流程。如图所示,在S701 中,第一线程获取待处理的用户界面渲染事件;在S702中,第一线程根据所述事件对应的用于调用渲染引擎的接口,调用所述渲染引擎提供的相应用户界面渲染功能。其中,第一线程可以是Node.js线程。作为一个示例,用户界面渲染事件可在以下情况下生成:由用户操作行为引起的需要刷新用户界面的情况(比如,用户通过触摸操作进行应用程序的切换,因此需要刷新屏幕显示内容,以显示切换到的目标应用程序的用户界面);再例如,用户点击用户界面中的一个功能按键来打开一个页面时,可生成用户界面渲染事件。
进一步地,如果第一线程对应的应用还基于公共模块接口调用了公共模块提供的功能,则在S703中,第一线程根据所述事件对应的用于调用公共模块的接口,调用所述公共模块提供的相应公共功能。
可选地,如前所述,渲染引擎提供的接口包括自然语言接口,该自然语言接口被映射为动态语言接口,该自然语言接口用于调用渲染引擎中基于该自然语言提供的用户界面渲染功能,动态语言为Node.js支持的动态语言,则在S702中,Node.js线程可获取所述事件对应的用于调用渲染引擎的动态语言接口,将获取到的动态语言接口映射为对应的自然语言接口,根据映射得到的自然语言接口调用渲染引擎提供的相应用户界面渲染功能。在一些例子中,具体过程可参见图5所示。
Node.js采用事件循环(Event loop)机制。本申请实施例中,渲染引擎被预加载到Node.js中,因此渲染引擎的事件与Node.js的事件可基于Node.js的事件队列进行事件循环。在没有事件发生的情况下,事件循环处于等待状态并阻塞,当Node.js或者渲染引擎有事件发生时,会将事件循环唤醒。比如,当渲染引擎有事件发生时,可通过异步方式唤醒事件循环,该渲染引擎的事件被存储于事件队列。该事件队列通常采用先进先出的机制。
图8以Node.js为例,示例性地示出了本申请实施例的事件循环机制。如图所示,Node.js的事件和渲染引擎的事件按照发生的先后顺序被存储在事件队列中。Node.js线程从事件队列中读取事件进行响应时,如果当前读取到的是用户界面渲染事件,则根据该用户界面渲染事件对应的用于调用渲染引擎的接口,调用渲染线程中相应的功能,以实现用户界面渲染功能,如果当前读取的是其他Node.js事件,则根据读取到的Node.js事件所对应的用于调用公共模块的接口,调用相应的功能模块,从而实现了将渲染引擎中的事件处理融入到了Node的事件循环中。
可选地,可采用异步处理机制对事件进行处理。具体地,可向Node.js线程注册回调 函数,该回调函数用于在有用户界面渲染事件发生时通知Node.js线程。这样,当有用户界面渲染事件进入队列时,可通过该回调函数通知Node.js进程,Node.js进程可在接收到该回调函数的通知后,从Node.js事件队列中获取待处理的用户界面渲染事件。
可选地,可由另外的线程对Node.js事件队列进行管理。为描述方便,此处将用于管理Node.js事件队列的线程称为事件线程。事件线程可与操作系统对接,从操作系统接收操作系统相关事件,并将该操作系统相关事件存储在Node.js事件队列。其中,所述操作系统相关事件可包括但不限于:按键事件(key event)、触摸事件(touch event)、渲染事件(render event)。
通过以上描述可以看出,本申请的上述实施例中,Node.js中包括公共模块和渲染引擎,Node.js线程获取到待处理的用户界面渲染事件后,一方面可获取所述事件对应的用于调用渲染引擎的接口,根据获取到的用于调用渲染引擎的接口调用所述渲染引擎提供的相应用户界面渲染功能,另一方面可获取所述事件对应的用于调用公共模块的接口,根据获取到的用于调用公共模块的接口调用所述公共模块提供的相应公共功能。由此可见,由于Node.js中包括渲染引擎,因此一方面可在Node.js中基于渲染引擎实现用户界面渲染,另一方面,由于Node.js中还包括公共模块,因此第一线程还可在Node.js中基于公共模块实现公共功能,从而在Node.js中集成了用户界面渲染能力,为开发者进行程序开发提供了方便,即开发者仅需开发可在Node.js中运行的应用程序,该应用程序即可使用Node.js中的公共模块提供的公共功能,还可以使用Node.js中的渲染引擎提供的用户界面渲染功能。
本申请的上述实施例可应用于移动终端,比如手机、智能穿戴设备、车载设备、PDA等。以应用于基于云操作系统的手机为例,采用本申请实施例,可由Node.js线程基于渲染引擎实现用户界面渲染,从而使得用户界面渲染操作可使用Node.js所提供的能力,实现了Node.js与渲染引擎的融合。
基于相同的技术构思,本申请实施例还提供了一种用户界面渲染装置,可实现前述实施例描述的用户界面渲染流程。
图9示例性地示出了本申请实施例提供的用户界面渲染装置的结构示意图。该装置可包括:获取单元901、第一处理单元902,可选地,还可包括第二处理单元903,其中:
获取单元901,用于获取待处理的用户界面渲染事件,所述第一线程为动态语言应用运行平台中的线程;其中,所述动态语言应用运行平台中预加载有渲染引擎;
第一处理单元902,用于获取所述事件对应的用于调用渲染引擎的接口,根据获取 到的用于调用渲染引擎的接口调用所述渲染引擎提供的相应用户界面渲染功能。
可选地,所述动态语言应用运行平台中还预加载有公共模块,第二处理单元903用于获取所述事件对应的用于调用公共模块的接口,根据获取到的用于调用公共模块的接口调用所述公共模块提供的相应公共功能。
可选地,所述渲染引擎提供的接口包括第一语言接口,所述第一语言接口被映射为第二语言接口,所述第一语言接口用于调用所述渲染引擎中基于所述第一语言提供的用户界面渲染功能,所述第二语言为所述动态语言应用运行平台支持的动态语言。第一处理单元902具体用于:获取所述事件对应的用于调用渲染引擎的第二语言接口,将获取到的第二语言接口映射为对应的第一语言接口,根据映射得到的第一语言接口调用所述渲染引擎提供的相应用户界面渲染功能。
可选地,第一处理单元902具体用于:向第二语言虚拟机发送调用指令,所述调用指令中包括用于调用渲染引擎的第二语言接口,所述调用指令用于触发所述第二语言虚拟机将所述第二语言接口映射为对应的第一语言接口,并基于映射得到的第一语言接口调用所述渲染引擎提供的相应用户界面渲染功能。
可选地,获取单元901具体用于:在接收到回调函数的通知后,从所述动态语言应用运行平台事件队列中获取待处理的用户界面渲染事件;其中,所述回调函数用于在有用户界面渲染事件进入所述事件队列时通知所述第一线程。
可选地,所述动态语言应用运行平台包括Node.js,所述第二语言包括JavaScript语言。
基于相同的技术构思,本申请实施例还提供了一种装置1000,该装置1000可实现前述实施例描述的流程。
图10示例性地示出了根据各种实施例的示例装置1000。装置1000可包括一个或多个处理器1002,系统控制逻辑1001耦合于至少一个处理器1002,非易失性存储器(non-volatile memory,NMV)/存储器1004耦合于系统控制逻辑1001,网络接口1006耦合于系统控制逻辑1001。
处理器1002可包括一个或多个单核处理器或多核处理器。处理器1002可包括任何一般用途处理器或专用处理器(如图像处理器、应用处理器基带处理器等)的组合。
一个实施例中的系统控制逻辑1001,可包括任何适当的接口控制器,以提供到处理器1002中的至少一个的任何合适的接口,和/或提供到与系统控制逻辑1001通信的任何合适的设备或组件的任何合适的接口。
一个实施例中的系统控制逻辑1001,可包括一个或多个内存控制器,以提供到系统内存1003的接口。系统内存1003用来加载以及存储数据和/或指令。例如,对应装置1000,在一个实施例中,系统内存1003可包括任何合适的易失性存储器。
NVM/存储器1004可包括一个或多个有形的非暂时的计算机可读介质,用于存储数据和/或指令。例如,NVM/存储器1004可包括任何合适的非易失性存储装置,如一个或多个硬盘(hard disk device,HDD),一个或多个光盘(compact disk,CD),和/或一个或多个数字通用盘(digital versatile disk,DVD)。
NVM/存储器1004可包括存储资源,该存储资源物理上是该系统所安装的或者可以被访问的设备的一部分,但不一定是设备的一部分。例如,NVM/存储器1004可经由网络接口1006被网络访问。
系统内存1003以及NVM/存储器1004可分别包括临时的或持久的指令1010的副本。指令1010可包括当由处理器1002中的至少一个执行时导致装置1000实现6描述的方法之一或组合的指令。各实施例中,指令1010或硬件、固件,和/或软件组件可另外地/可替换地被置于系统控制逻辑1001,网络接口1006和/或处理器1002。
网络接口1006可包括一个接收器来为装置1000提供无线接口来与一个或多个网络和/或任何合适的设备进行通信。网络接口1006可包括任何合适的硬件和/或固件。网络接口1006可包括多个天线来提供多输入多输出无线接口。在一个实施例中,网络接口1006可包括一个网络适配器、一个无线网络适配器、一个电话调制解调器,和/或无线调制解调器。
在一个实施例中,处理器1002中的至少一个可以与用于系统控制逻辑的一个或多个控制器的逻辑一起封装。在一个实施例中,处理器中的至少一个可以与用于系统控制逻辑的一个或多个控制器的逻辑一起封装以形成系统级封装。在一个实施例中,处理器中的至少一个可以与用于系统控制逻辑的一个或多个控制器的逻辑集成在相同的管芯上。在一个实施例中,处理器中的至少一个可以与用于系统控制逻辑的一个或多个控制器的逻辑集成在相同的管芯上以形成系统芯片。
装置1000可进一步包括输入/输出装置1005。输入/输出装置1005可包括用户接口旨在使用户与装置1000进行交互,可包括外围组件接口,其被设计为使得外围组件能够与系统交互,和/或,可包括传感器,旨在确定环境条件和/或有关装置1000的位置信息。

Claims (17)

  1. 一种用户界面渲染方法,其特征在于,动态语言应用运行平台中预加载有渲染引擎,所述方法包括:
    第一线程获取待处理的用户界面渲染事件,所述第一线程为所述动态语言应用运行平台中的线程;
    所述第一线程根据所述事件对应的用于调用渲染引擎的接口,调用所述渲染引擎提供的相应用户界面渲染功能。
  2. 如权利要求1所述的方法,其特征在于,所述动态语言应用运行平台中还预加载有公共模块,所述方法还包括:
    所述第一线程根据所述事件对应的用于调用公共模块的接口,调用所述公共模块提供的相应公共功能。
  3. 如权利要求2所述的方法,其特征在于,所述公共模块包括以下模块中的一种或多种:
    网络模块,用于提供网络连接功能;
    系统模块,用于提供系统服务功能。
  4. 如权利要求1至3中任一项所述的方法,其特征在于,所述渲染引擎提供的接口包括第一语言接口,所述第一语言接口被映射为第二语言接口,所述第一语言接口用于调用所述渲染引擎中基于所述第一语言提供的用户界面渲染功能,所述第二语言为所述动态语言应用运行平台支持的动态语言;
    所述第一线程根据所述事件对应的用于调用渲染引擎的接口,调用所述渲染引擎提供的相应用户界面渲染功能,包括:
    所述第一线程获取所述事件对应的用于调用渲染引擎的第二语言接口,将获取到的第二语言接口映射为对应的第一语言接口,根据映射得到的第一语言接口调用所述渲染引擎提供的相应用户界面渲染功能。
  5. 如权利要求4所述的方法,其特征在于,根据映射得到的第一语言接口调用所述渲染引擎提供的相应用户界面渲染功能,包括:
    所述第一线程向第二语言虚拟机发送调用指令,所述调用指令中包括用于调用渲染引擎的第二语言接口;
    所述第二语言虚拟机将所述第二语言接口映射为对应的第一语言接口,并基于映射得到的第一语言接口调用所述渲染引擎提供的相应用户界面渲染功能。
  6. 如权利要求1至3中任一项所述的方法,其特征在于,第一线程获取待处理的用户界面渲染事件,包括:
    所述第一线程在接收到回调函数的通知后,从所述动态语言应用运行平台事件队列中获取待处理的用户界面渲染事件;其中,所述回调函数用于在有用户界面渲染事件进入所述事件队列时通知所述第一线程。
  7. 如权利要求6所述的方法,其特征在于,还包括:
    第二线程从操作系统接收操作系统相关事件,并将所述操作系统相关事件存储在所述事件队列;其中,所述操作系统相关事件中包括用户界面渲染事件。
  8. 如权利要求1至3中任一项所述的方法,其特征在于,还包括:
    所述动态语言应用运行平台启动时,将所述渲染引擎提供的第一语言接口映射为第二语言接口,并保存所述渲染引擎提供的第一语言接口与映射得到的第二语言接口之间的映射关系信息;
    将接口映射后的渲染引擎加载到所述动态语言应用运行平台中。
  9. 如权利要求4所述的方法,其特征在于,所述动态语言应用运行平台包括Node.js,所述第二语言包括JavaScript语言。
  10. 一种用户界面渲染装置,其特征在于,包括:
    获取单元,用于通过第一线程获取待处理的用户界面渲染事件,所述第一线程为动态语言应用运行平台中的线程;其中,所述动态语言应用运行平台中预加载有渲染引擎;
    第一处理单元,用于根据所述事件对应的用于调用渲染引擎的接口,调用所述渲染引擎提供的相应用户界面渲染功能。
  11. 如权利要求10所述的装置,其特征在于,所述动态语言应用运行平台中还预加载有公共模块,所述装置还包括:
    第二处理单元,用于获取所述事件对应的用于调用公共模块的接口,根据获取到的用于调用公共模块的接口调用所述公共模块提供的相应公共功能。
  12. 如权利要求10或11所述的装置,其特征在于,所述渲染引擎提供的接口包括第一语言接口,所述第一语言接口被映射为第二语言接口,所述第一语言接口用于调用所述渲染引擎中基于所述第一语言提供的用户界面渲染功能,所述第二语言为所述动态语言应用运行平台支持的动态语言;
    所述第一处理单元具体用于:获取所述事件对应的用于调用渲染引擎的第二语言接口,将获取到的第二语言接口映射为对应的第一语言接口,根据映射得到的第一语言接 口调用所述渲染引擎提供的相应用户界面渲染功能。
  13. 如权利要求12所述的装置,其特征在于,所述第一处理单元具体用于:
    向第二语言虚拟机发送调用指令,所述调用指令中包括用于调用渲染引擎的第二语言接口,所述调用指令用于触发所述第二语言虚拟机将所述第二语言接口映射为对应的第一语言接口,并基于映射得到的第一语言接口调用所述渲染引擎提供的相应用户界面渲染功能。
  14. 如权利要求10或11所述的装置,其特征在于,所述获取单元具体用于:
    在接收到回调函数的通知后,从所述动态语言应用运行平台事件队列中获取待处理的用户界面渲染事件;其中,所述回调函数用于在有用户界面渲染事件进入所述事件队列时通知所述第一线程。
  15. 如权利要求12所述的装置,其特征在于,所述动态语言应用运行平台包括Node.js,所述第二语言包括JavaScript语言。
  16. 一个或多个计算机可读介质,所述可读介质上存储有指令,所述指令被一个或多个处理器执行时,使得通信设备执行如权利要求1-9中任一项所述的方法。
  17. 一种通信设备,其特征在于,包括:
    一个或多个处理器;以及
    一个或多个计算机可读介质,所述可读介质上存储有指令,所述指令被所述一个或多个处理器执行时,使得所述处理器执行如权利要求1至9中任一项所述的方法。
PCT/CN2018/077186 2017-03-08 2018-02-26 一种用户界面渲染方法及装置 WO2018161812A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US16/559,047 US20200057660A1 (en) 2017-03-08 2019-09-03 Method and system for rendering user interfaces

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710135534.9 2017-03-08
CN201710135534.9A CN108572818B (zh) 2017-03-08 2017-03-08 一种用户界面渲染方法及装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/559,047 Continuation-In-Part US20200057660A1 (en) 2017-03-08 2019-09-03 Method and system for rendering user interfaces

Publications (1)

Publication Number Publication Date
WO2018161812A1 true WO2018161812A1 (zh) 2018-09-13

Family

ID=63448871

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/077186 WO2018161812A1 (zh) 2017-03-08 2018-02-26 一种用户界面渲染方法及装置

Country Status (4)

Country Link
US (1) US20200057660A1 (zh)
CN (1) CN108572818B (zh)
TW (1) TW201833792A (zh)
WO (1) WO2018161812A1 (zh)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190370095A1 (en) * 2018-05-29 2019-12-05 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Method and device for preloading application, storage medium and intelligent terminal
CN111381920A (zh) * 2020-02-17 2020-07-07 网易(杭州)网络有限公司 弹窗组件的显示方法、装置以及电子终端
CN111740948A (zh) * 2020-05-12 2020-10-02 北京沃东天骏信息技术有限公司 数据包发布方法、动态更新方法、装置、设备及介质
US11086663B2 (en) 2018-05-10 2021-08-10 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Preloading application using active window stack
CN114356324A (zh) * 2021-12-16 2022-04-15 阿里巴巴(中国)有限公司 界面处理方法、装置、设备和存储介质
US11397590B2 (en) 2018-05-10 2022-07-26 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Method for preloading application, storage medium, and terminal
US11442747B2 (en) 2018-05-10 2022-09-13 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Method for establishing applications-to-be preloaded prediction model based on preorder usage sequence of foreground application, storage medium, and terminal
US11467855B2 (en) 2018-06-05 2022-10-11 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Application preloading method and device, storage medium and terminal
US11604660B2 (en) 2018-05-15 2023-03-14 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Method for launching application, storage medium, and terminal

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109697060B (zh) * 2018-12-29 2022-08-26 广州方硅信息技术有限公司 视频特效系统及其生成方法、装置、设备和存储介质
CN111414150B (zh) * 2019-01-04 2022-10-11 厦门雅基软件有限公司 游戏引擎渲染方法、装置、电子设备及计算机存储介质
CN109739505B (zh) 2019-01-08 2019-11-29 网易(杭州)网络有限公司 一种用户界面的处理方法和装置
CN110471709B (zh) * 2019-07-15 2022-12-06 北京字节跳动网络技术有限公司 一种加速网页打开速度的方法、装置、介质和电子设备
CN111158818B (zh) * 2019-12-24 2023-12-01 中国建设银行股份有限公司 一种页面渲染方法和装置
CN111414296B (zh) * 2020-03-25 2023-04-07 北京字节跳动网络技术有限公司 信号监听方法、装置、计算机设备和存储介质
CN111581555B (zh) * 2020-04-27 2023-09-15 北京字节跳动网络技术有限公司 一种文档加载方法、装置、设备及存储介质
CN111857658A (zh) * 2020-06-19 2020-10-30 北京字节跳动网络技术有限公司 一种渲染动态组件的方法、装置、介质和电子设备
CN112256421A (zh) * 2020-11-12 2021-01-22 Oppo广东移动通信有限公司 通信处理方法、装置、存储介质及电子设备
CN114327446B (zh) * 2022-03-14 2022-06-07 恒生电子股份有限公司 一种小程序转换应用程序的处理方法及装置
CN114821002A (zh) * 2022-04-12 2022-07-29 支付宝(杭州)信息技术有限公司 基于ar的互动方法、装置及电子设备
CN114924837A (zh) * 2022-05-18 2022-08-19 京东方科技集团股份有限公司 数据处理方法、电子设备和可读存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103713891A (zh) * 2012-10-09 2014-04-09 阿里巴巴集团控股有限公司 一种在移动设备上进行图形渲染的方法和装置
CN103970966A (zh) * 2014-05-27 2014-08-06 武汉兆图科技有限公司 一种跨嵌入式平台的三维渲染引擎的构建方法
US20150149888A1 (en) * 2013-11-27 2015-05-28 Moboom Ltd. Systems and methods for executing aspects of a document
CN105354014A (zh) * 2014-08-18 2016-02-24 阿里巴巴集团控股有限公司 应用界面渲染展示方法及装置
CN105867911A (zh) * 2016-03-24 2016-08-17 江苏大学 一种Iris 2D图形引擎的实现方法

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9286142B2 (en) * 2011-04-07 2016-03-15 Adobe Systems Incorporated Methods and systems for supporting a rendering API using a runtime environment
US9384012B2 (en) * 2011-12-16 2016-07-05 Sap Se Standalone data entry for backend system
CA2923964A1 (en) * 2013-09-10 2015-03-19 Calgary Scientific Inc. Architecture for distributed server-side and client-side image data rendering

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103713891A (zh) * 2012-10-09 2014-04-09 阿里巴巴集团控股有限公司 一种在移动设备上进行图形渲染的方法和装置
US20150149888A1 (en) * 2013-11-27 2015-05-28 Moboom Ltd. Systems and methods for executing aspects of a document
CN103970966A (zh) * 2014-05-27 2014-08-06 武汉兆图科技有限公司 一种跨嵌入式平台的三维渲染引擎的构建方法
CN105354014A (zh) * 2014-08-18 2016-02-24 阿里巴巴集团控股有限公司 应用界面渲染展示方法及装置
CN105867911A (zh) * 2016-03-24 2016-08-17 江苏大学 一种Iris 2D图形引擎的实现方法

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11086663B2 (en) 2018-05-10 2021-08-10 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Preloading application using active window stack
US11397590B2 (en) 2018-05-10 2022-07-26 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Method for preloading application, storage medium, and terminal
US11442747B2 (en) 2018-05-10 2022-09-13 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Method for establishing applications-to-be preloaded prediction model based on preorder usage sequence of foreground application, storage medium, and terminal
US11604660B2 (en) 2018-05-15 2023-03-14 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Method for launching application, storage medium, and terminal
US20190370095A1 (en) * 2018-05-29 2019-12-05 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Method and device for preloading application, storage medium and intelligent terminal
US11467855B2 (en) 2018-06-05 2022-10-11 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Application preloading method and device, storage medium and terminal
CN111381920A (zh) * 2020-02-17 2020-07-07 网易(杭州)网络有限公司 弹窗组件的显示方法、装置以及电子终端
CN111740948A (zh) * 2020-05-12 2020-10-02 北京沃东天骏信息技术有限公司 数据包发布方法、动态更新方法、装置、设备及介质
CN111740948B (zh) * 2020-05-12 2023-04-07 北京沃东天骏信息技术有限公司 数据包发布方法、动态更新方法、装置、设备及介质
CN114356324A (zh) * 2021-12-16 2022-04-15 阿里巴巴(中国)有限公司 界面处理方法、装置、设备和存储介质

Also Published As

Publication number Publication date
CN108572818B (zh) 2021-07-23
CN108572818A (zh) 2018-09-25
TW201833792A (zh) 2018-09-16
US20200057660A1 (en) 2020-02-20

Similar Documents

Publication Publication Date Title
WO2018161812A1 (zh) 一种用户界面渲染方法及装置
WO2018161813A1 (zh) 一种资源加载方法及装置
US11868785B2 (en) Application program page processing method and device
US10324734B2 (en) Application containers
EP4002108B1 (en) Application start method and electronic device
US10445083B2 (en) Application containers with dynamic sub-package loading
US9619304B2 (en) Automatic connections between application components
WO2016192556A1 (zh) 接口调用方法、装置及终端
EP4145286A1 (en) Memory management method and electronic device
CN113553130B (zh) 应用执行绘制操作的方法及电子设备
US20140208326A1 (en) File presenting method and apparatus for a smart terminal
CN112256421A (zh) 通信处理方法、装置、存储介质及电子设备
CN115016631B (zh) 进程调度方法和终端设备
Uttarwar et al. A Literature Review on Android-A Mobile Operating system
US10599444B2 (en) Extensible input stack for processing input device data
CN116088716B (zh) 窗口管理方法和终端设备
US20190213015A1 (en) Extensible input stack for processing input device data
CN115373869A (zh) 基于aar的进程处理方法、装置及电子设备
CN116450473A (zh) 踩内存问题的定位方法和电子设备
CN117076158B (zh) 一种广播分发处理方法及相关设备
CN116737330B (zh) 任务处理方法和电子设备
CN111767093B (zh) 数据处理方法、设备和存储介质
WO2020133455A1 (zh) 应用程序的管理方法、装置、存储介质及电子设备
CN117992189A (zh) 多系统下的窗口实现方法及电子设备
CN116450228A (zh) 用于运行应用程序的方法和电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18763264

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18763264

Country of ref document: EP

Kind code of ref document: A1