crosswalk-project/crosswalk — pull request #1090 by shaochangbin (2013-11-07 09:24:35+00:00)
Title: [Runtime Model] Introduce sqlite table to save system events. 

From [1], System events are events sent by the system, a system event
can wake up a terminated application. If user want a system event has
the capability to wake up, then he/she should add listener to that event
in the main document, listener added in other document won’t have such
capability.

To implement this, system events information that registered in the main
document should be saved into system database during installation time.
Whenever a system event comes to event router, the router will check
whether the event is supported by the specified application. If yes,
router will dispatch the event to application, for example, launches a
terminated application and executing onLaunch callback.

This PR is the SQLite implementation to save system event information into
database. It creates a table named 'registered_events' in Crosswalk
application datbase file('applications.db'). The table contains two
columns for each item, (application_id, event_name). It also provides
some Getter and Setter functions to read/write/remove item(s) from the
database.

In order to speed read/write from database, db_cache_ is introduced. It
is a Dictionary type, with key 'application_id' and value of event name
list.

Reference:
[1]
https://docs.google.com/document/d/1cDb54Cs1wjbNQPb7W44_4aj1bzPI9dqsb2aRDkZmDTE/edit?pli=1#heading=h.v1w5rrn37icm