Improve thread safety and documentation and add support for thread-specific APIs (issue #175).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@174 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2011-01-29 01:42:59 +00:00
parent c89349cf5a
commit 7f1694fb68
20 changed files with 1207 additions and 1128 deletions

View File

@ -20,13 +20,12 @@ using WebKit::WebSize;
CefWindowHandle CefBrowserImpl::GetWindowHandle()
{
Lock();
CefWindowHandle handle = window_info_.m_Widget;
Unlock();
return handle;
AutoLock lock_scope(this);
return window_info_.m_Widget;
}
gfx::NativeWindow CefBrowserImpl::GetMainWndHandle() const {
gfx::NativeWindow CefBrowserImpl::UIT_GetMainWndHandle() const {
REQUIRE_UIT();
GtkWidget* toplevel = gtk_widget_get_ancestor(window_info_.m_Widget,
GTK_TYPE_WINDOW);
return GTK_IS_WINDOW(toplevel) ? GTK_WINDOW(toplevel) : NULL;
@ -35,7 +34,8 @@ gfx::NativeWindow CefBrowserImpl::GetMainWndHandle() const {
void CefBrowserImpl::UIT_CreateBrowser(const CefString& url)
{
REQUIRE_UIT();
Lock();
// Add a reference that will be released in UIT_DestroyBrowser().
AddRef();
@ -58,7 +58,9 @@ void CefBrowserImpl::UIT_CreateBrowser(const CefString& url)
dev_tools_agent_->SetWebView(webviewhost_->webview());
window_info_.m_Widget = webviewhost_->view_handle();
Unlock();
if(handler_.get()) {
// Notify the handler that we're done creating the new window
handler_->HandleAfterCreated(this);