Merge revision 650 changes:

- Make sure BrowserRequestContextProxy is only used on the IO thread (issue #542).
- Windows: Reset the window procedure in the WebWidgetHost destructor to avoid crashes if messages are delivered after the window is destroyed.

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1025@651 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2012-05-25 20:46:44 +00:00
parent 0bccf1bff2
commit 46021aafbd
5 changed files with 26 additions and 13 deletions

View File

@ -180,9 +180,6 @@ CefBrowserImpl::CefBrowserImpl(const CefWindowInfo& windowInfo,
popup_delegate_.reset(new BrowserWebViewDelegate(this));
nav_controller_.reset(new BrowserNavigationController(this));
request_context_proxy_ =
new BrowserRequestContextProxy(_Context->request_context(), this);
if (!file_system_root_.CreateUniqueTempDir()) {
LOG(WARNING) << "Failed to create a temp dir for the filesystem."
"FileSystem feature will be disabled.";
@ -785,7 +782,10 @@ void CefBrowserImpl::UIT_DestroyBrowser() {
UIT_ClearMainWndHandle();
main_frame_ = NULL;
request_context_proxy_ = NULL;
// Release the proxy on the IO thread.
CefThread::ReleaseSoon(CefThread::IO, FROM_HERE,
request_context_proxy_.release());
// Remove the reference added in UIT_CreateBrowser().
Release();
@ -1585,6 +1585,16 @@ GURL CefBrowserImpl::pending_url() {
return pending_url_;
}
net::URLRequestContext* CefBrowserImpl::request_context_proxy() {
DCHECK(CefThread::CurrentlyOn(CefThread::IO));
if (!request_context_proxy_) {
request_context_proxy_ =
new BrowserRequestContextProxy(_Context->request_context(), this);
}
return request_context_proxy_;
}
void CefBrowserImpl::UIT_CreateDevToolsClient(BrowserDevToolsAgent *agent) {
dev_tools_client_.reset(new BrowserDevToolsClient(this, agent));
}

View File

@ -356,9 +356,7 @@ class CefBrowserImpl : public CefBrowser {
void set_popup_rect(const gfx::Rect& rect) { popup_rect_ = rect; }
net::URLRequestContext* request_context_proxy() {
return request_context_proxy_;
}
net::URLRequestContext* request_context_proxy();
static bool ImplementsThreadSafeReferenceCounting() { return true; }

View File

@ -3,6 +3,7 @@
// be found in the LICENSE file.
#include "libcef/browser_request_context_proxy.h"
#include "libcef/browser_impl.h"
#include "libcef/browser_request_context.h"
#include "libcef/cookie_store_proxy.h"

View File

@ -7,15 +7,16 @@
#pragma once
#include <string>
#include "include/cef_base.h"
#include "net/url_request/url_request_context.h"
class BrowserRequestContext;
class CefBrowserImpl;
// A basic URLRequestContext that only provides an in-memory cookie store.
// A URLRequestContext implementation that proxies cookie requests to the
// client.
class BrowserRequestContextProxy : public net::URLRequestContext {
public:
// Use an in-memory cache
BrowserRequestContextProxy(BrowserRequestContext* context,
CefBrowserImpl* browser);
@ -23,7 +24,7 @@ class BrowserRequestContextProxy : public net::URLRequestContext {
private:
BrowserRequestContext* context_;
CefBrowserImpl* browser_;
CefRefPtr<CefBrowserImpl> browser_;
};
#endif // CEF_LIBCEF_BROWSER_REQUEST_CONTEXT_PROXY_H_

View File

@ -353,11 +353,14 @@ WebWidgetHost::WebWidgetHost()
}
WebWidgetHost::~WebWidgetHost() {
if (view_)
ui::SetWindowUserData(view_, 0);
TrackMouseLeave(false);
ResetTooltip();
if (view_) {
ui::SetWindowUserData(view_, 0);
ui::SetWindowProc(view_, DefWindowProc);
view_ = NULL;
}
}
bool WebWidgetHost::WndProc(UINT message, WPARAM wparam, LPARAM lparam) {