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)); popup_delegate_.reset(new BrowserWebViewDelegate(this));
nav_controller_.reset(new BrowserNavigationController(this)); nav_controller_.reset(new BrowserNavigationController(this));
request_context_proxy_ =
new BrowserRequestContextProxy(_Context->request_context(), this);
if (!file_system_root_.CreateUniqueTempDir()) { if (!file_system_root_.CreateUniqueTempDir()) {
LOG(WARNING) << "Failed to create a temp dir for the filesystem." LOG(WARNING) << "Failed to create a temp dir for the filesystem."
"FileSystem feature will be disabled."; "FileSystem feature will be disabled.";
@ -785,7 +782,10 @@ void CefBrowserImpl::UIT_DestroyBrowser() {
UIT_ClearMainWndHandle(); UIT_ClearMainWndHandle();
main_frame_ = NULL; 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(). // Remove the reference added in UIT_CreateBrowser().
Release(); Release();
@ -1585,6 +1585,16 @@ GURL CefBrowserImpl::pending_url() {
return 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) { void CefBrowserImpl::UIT_CreateDevToolsClient(BrowserDevToolsAgent *agent) {
dev_tools_client_.reset(new BrowserDevToolsClient(this, 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; } void set_popup_rect(const gfx::Rect& rect) { popup_rect_ = rect; }
net::URLRequestContext* request_context_proxy() { net::URLRequestContext* request_context_proxy();
return request_context_proxy_;
}
static bool ImplementsThreadSafeReferenceCounting() { return true; } static bool ImplementsThreadSafeReferenceCounting() { return true; }

View File

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

View File

@ -7,15 +7,16 @@
#pragma once #pragma once
#include <string> #include <string>
#include "include/cef_base.h"
#include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context.h"
class BrowserRequestContext; class BrowserRequestContext;
class CefBrowserImpl; 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 { class BrowserRequestContextProxy : public net::URLRequestContext {
public: public:
// Use an in-memory cache
BrowserRequestContextProxy(BrowserRequestContext* context, BrowserRequestContextProxy(BrowserRequestContext* context,
CefBrowserImpl* browser); CefBrowserImpl* browser);
@ -23,7 +24,7 @@ class BrowserRequestContextProxy : public net::URLRequestContext {
private: private:
BrowserRequestContext* context_; BrowserRequestContext* context_;
CefBrowserImpl* browser_; CefRefPtr<CefBrowserImpl> browser_;
}; };
#endif // CEF_LIBCEF_BROWSER_REQUEST_CONTEXT_PROXY_H_ #endif // CEF_LIBCEF_BROWSER_REQUEST_CONTEXT_PROXY_H_

View File

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