API impl refactor: Id allocation and global object register in browser

This is mainly for dealing with Window in new renderer process, where
multiple dispatcher hosts should share the same object registry. And
the Id allocation on the renderer side is moved to the browser side to
keep the id global across multiple renderers.