2014년 12월 12일 금요일

Content in Chromium

A name of "Content" in the Chromium makes me confused at first. Normally I have known a meaning of content is related with contents from web. So I first step in investigating with same idea. But as I read code and check how it works, that is not simple and even very huge in the Chromium. Totally different with web contents.
(from http://www.chromium.org/developers/content-module)

As Upper picture shown, a content is related with all other modules. At first I can not understand easily what that means. But that picture has said that "A content does everything in the Chromium".
In fact files in src/content are all content. So I think start with very small point is more easy to know how it works. Between the BrowserProcess and the RenderProcess(and other process like GPU, Plugin..) they communicate with the IPC. If you want to know what a content do, I recommend to start from there. You can realize what they do with APIs those have prefix "on". For example in "render_frame_impl.cc" there is an "OnNavigate" api. That activate that a Renderer start to navigate web pages with input url.

 A content has api sets called as a "content client". Each process has their own content clients apis. The BrowserProcess has a "contentBrowserClient". Similar with the "BrowserProcess", the RenderProcess has a "contentRendererClient".
 All api interfaces are predefined in a "contenClient". If you really want to use those api, you implement that api in proprer inherited from contentClient class. All contentClients class families are inherited from "contentClient". (contentBrowerclient is inherited from contentClient). All contentClient apis are located in proper code positions.

in content_browser_client.cc
WebContentsViewDelegate* ContentBrowserClient::GetWebContentsViewDelegate(
    WebContents* web_contents) {
  return NULL;
}
Upper code snippet is one of api in content_browser_client.cc. It seems to get webContentsViewDelegate. But return is not implemented. If you want to get some meaningful return, you need to describe some code what you want. And that api is using in web_content_impl.cc
void WebContentsImpl::Init(const WebContents::CreateParams& params) {
 .......
  WebContentsViewDelegate* delegate =
      GetContentClient()->browser()->GetWebContentsViewDelegate(this);
... 
When WebContentsImpl launch an init method, contentBrowserClient api is used.
All contentClient apis are able to use like this.

A content in the chromium is very huge part, and covers both the BrowserProcess and the RenderProcess.  But if you understand content what and how to work, reading the chromium is more easily.







댓글 없음:

댓글 쓰기