Skip to content

Instantly share code, notes, and snippets.

@darkfall
Created December 30, 2012 15:53
Show Gist options
  • Save darkfall/4413438 to your computer and use it in GitHub Desktop.
Save darkfall/4413438 to your computer and use it in GitHub Desktop.
Reading notes of libcef & chromium
Cef1:
CefBrowser::CreateBrowser ->
CreateBrowserHelper ->
PostTask to UI Thread ->
CefBrowser::CreateBrowserSync
CefBrowser::CreateBrowserSync(window_info, client_handler, url, settings) [browser_impl.cc]
-> new CefBrowserImpl(window_info, settings, opener{NativeView = null}, client_handler)
-> BrowserWebViewDelegate(this)
-> main_frame_ -> CefFrameImpl(this, 0, "", "")
-> this->UIT_CreateBrowser(startup_url)
-> Native CefBrowserImpl
-> Gtk [browser_impl_gtk.cc]
-> parentView = window_info.parent_widget [= null -> gtk_new_window]
-> webviewHost = WebViewHost::Create(parent_widget, rect, delegate, 0{PaintDelegate*}, dev_tools, pref)
-> Gtk WebViewHost::Create [webview_host_gtk.cc]
-> host = new WebViewHost(delegate)
-> host->view = WebWidgetHost::CreateWidget(parent_widget, host)
-> Gtk WebWidgetHost::CreateWidget [webwidget_host_gtk.cc]
-> WebWidgetHostGtkWidget::CreateNewWidget(parent_widget, host)
-> gtk_fixed_new()
-> gtk_box_pack_start(parent_widget, widget, 1, 1, 0)
-> connect signals
-> g_object_set_data(widget, key, host)
-> host->webwidget = WebView::create(delegate)[Webkit/chromium/src/WebViewImpl.cpp]
-> new WebViewImpl(delegate)
-> page = new Page(pageClients)
-> host->webwidget->set{Permission, Prerenderer}Client(delegate)
-> host->webwidget->initializeMainFrame(delegate)
-> webFrame = WebFrameImpl::create(delegate)
-> webFrame->initializeMainFrame
-> Frame::create(page)
-> pref.Apply((WebView*)host->webwidget) [webikit/glue/webpreferences.cc]
-> window_info.widget = webviewHost->::WebWidgetHost::view_handle() [connect "destroy"]
-> Mac [browser_impl_mac.mm]
-> window_info.window_rendering_disabled
[
YES -> parentWnd = window_info.parent_view [= null -> [NSWindow alloc]]
NO -> paint_delegate = new CefBrowserImpl::PaintDelegate(this)
]
-> webviewHost = WebViewHost::Create(parent_view, rect, delegate, paint_delegate, dev_tools, pref)
-> OSX WebViewHost::Create [webview_host_mac.mm]
-> host = new WebViewHost(delegate)
-> paint_delegate
[
= 0 ->
host->view = [BrowserWebView alloc]
[parent_view addSubView: host->view]
!= 0 ->
host->paint_delegate = paint_delegate
host->view = 0
]
-> BrowserWebView: NSView [browser_webview_mac.mm]
BrowserWebView::drawRect(dirtyRect)
-> webViewHost->Paint(diryRect) [webwidget_host_mac.mm]
-> canvas::reset(new skia::PlatformCanvas)
-> skia::CreatePlatformCanvas [skia/ext/platform_canvas.h]
-> host->view
[
!= 0 ->
skia::DrawToNativeContext
= 0 ->
bitmap = canvas->getDevice()->accessBitmap [check bitmap.config() == kARGB_8888_Config]
pixels = bitmap.getPixels()
paint_delegate->Paint(popup, rects, pixels)
]
-> host->webwidget = WebView::create(delegate) [Webkit/chromium/src/WebViewImpl.cpp]
...
-> webViewHost->SetIsTransparent(window_info.is_transparent)
-> window_info.view = webviewHost->::WebWidgetHost::view_handle()
-> Win
-> window_info.window_rendering_disabled
[
YES -> parentWnd = window_info.parent_view [= null -> CreateWindowEx]
NO -> paint_delegate = new CefBrowserImpl::PaintDelegate(this)
]
-> webviewHost = WebViewHost::Create(parent_view, rect, delegate, paint_delegate, dev_tools, pref)
-> Win WebViewHost::Create [webview_host_win.cc]
paint_delegate
[
= 0 ->
host->view = CreateWindow(WebWidgetHost::WndProc)
SetWindowUserData(host->view, host)
!= 0 ->
host->paint_delegate = paint_delegate
host->view = 0
]
-> WebWidgetHost::WndProc [webwidget_host_win.cc]
[
WM_PAINT -> host->Paint()
-> WebWidgetHost::Paint()
-> host->view
[
!= 0 ->
skia::DrawToNativeContxt
= 0 ->
bitmap = canvas->getDevice()->accessBitmap [check bitmap.config() == kARGB_8888_Config]
pixels = bitmap.getPixels()
paint_delegate->Paint
]
]
-> host->webwidget = WebView::create(delegate) [Webkit/chromium/src/WebViewImpl.cpp]
...
Cef3:
CefBrowser::CreateBrowser ->
CreateBrowserHelper ->
PostTask to UI Thread ->
CefBrowser::CreateBrowserSync
CefBrowser::CreateBrowserSync(window_info, client, url, settings) [browser_host_impl.cc]
-> new CefBrowserImpl(window_info, client, url, settings)
-> browser = CefBrowserHostImpl::Create(window_info, settings, client, web_contents{=0}, browser_id, opener{=0})
-> if web_contents = 0
web_contents = content::WebContents::Create [browser/web_contents.h]
-> WebContents::CreateWithOpener [browser/web_contents/web_contents_impl.cc]
-> new_contents = new WebContentsImpl
-> Native WebContenstViewImpls [web_contents_view_{gtk, mac, win, guest, ...}.cc]
-> browser = new CefBrowserHostImpl(window_info, settings, client, web_contents, browiser_id, opender{=0})
-> web_contents->setDelegate(this)
-> registrar->add(NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, web_contents)
-> placeholder_frame = new CefFrameHostImpl
-> SetRenderViewHost(web_contents->GetRenderViewHost())
-> regisrar->add(NOTIFICATION_FOCUS_CHANGED_IN_PAGE, render_host)
-> browser->PlatformCreateWindow
-> Gtk PlatformCreateWindow [browser_host_impl_gtk.cc]
-> parentView = window_info.parent_widget [= null -> gtk_new_window]
-> window_info.widget = web_contents->GetView()->GetNativeView() [connect "destroy"]
-> gtk_container_add(parentView, window_info.widget)
-> Mac PlatformCreateWindow [browser_host_impl_mac.mm]
-> parentView = window_info.parent_view [= null -> [UnderlayOpenGLHostingWindow alloc]]
-> browserView = [CefBrowserHostView alloc]
-> [parentView addSubview: browserView]
-> nativeView = web_contents->GetView()->GetNativeView()
-> [browserView addSubView: nativeView]
-> window_info.view = browser_view
-> Win PlatformCreateWindow [browser_host_impl_win.cc]
-> window_info.window = CreateWindowEx
-> SetParent(web_contents->GetView()->GetNativeView(), window_info.window)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment