diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index bb6a62e25..c368311c8 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -499,6 +499,7 @@ void CefBrowserHostImpl::DestroyBrowser() { } registrar_.reset(NULL); + response_manager_.reset(NULL); content::WebContentsObserver::Observe(NULL); web_contents_.reset(NULL); @@ -669,7 +670,7 @@ void CefBrowserHostImpl::SendCommand( params.user_initiated = false; if (responseHandler.get()) { - params.request_id = response_manager_.RegisterHandler(responseHandler); + params.request_id = response_manager_->RegisterHandler(responseHandler); params.expect_response = true; } else { params.request_id = -1; @@ -705,7 +706,7 @@ void CefBrowserHostImpl::SendCode( params.user_initiated = false; if (responseHandler.get()) { - params.request_id = response_manager_.RegisterHandler(responseHandler); + params.request_id = response_manager_->RegisterHandler(responseHandler); params.expect_response = true; } else { params.request_id = -1; @@ -1031,13 +1032,13 @@ void CefBrowserHostImpl::OnRequest(const Cef_Request_Params& params) { } void CefBrowserHostImpl::OnResponse(const Cef_Response_Params& params) { - response_manager_.RunHandler(params); + response_manager_->RunHandler(params); if (params.expect_response_ack) Send(new CefMsg_ResponseAck(routing_id(), params.request_id)); } void CefBrowserHostImpl::OnResponseAck(int request_id) { - response_manager_.RunAckHandler(request_id); + response_manager_->RunAckHandler(request_id); } @@ -1102,6 +1103,7 @@ CefBrowserHostImpl::CefBrowserHostImpl(const CefWindowInfo& window_info, registrar_.reset(new content::NotificationRegistrar); registrar_->Add(this, content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, content::Source(web_contents)); + response_manager_.reset(new CefResponseManager); placeholder_frame_ = new CefFrameHostImpl(this, CefFrameHostImpl::kInvalidFrameId, true); diff --git a/libcef/browser/browser_host_impl.h b/libcef/browser/browser_host_impl.h index 5bf0bf90c..d65074874 100644 --- a/libcef/browser/browser_host_impl.h +++ b/libcef/browser/browser_host_impl.h @@ -353,15 +353,15 @@ class CefBrowserHostImpl : public CefBrowserHost, // Used when no other frame exists. Provides limited functionality. CefRefPtr placeholder_frame_; - // Manages response registrations. - CefResponseManager response_manager_; - // Used for managing notification subscriptions. scoped_ptr registrar_; // Used for proxying cookie requests. scoped_refptr request_context_proxy_; + // Manages response registrations. + scoped_ptr response_manager_; + // Used for creating and managing JavaScript dialogs. scoped_ptr dialog_creator_; diff --git a/libcef/renderer/browser_impl.cc b/libcef/renderer/browser_impl.cc index ae0bdd6cf..c548d0357 100644 --- a/libcef/renderer/browser_impl.cc +++ b/libcef/renderer/browser_impl.cc @@ -11,6 +11,7 @@ #include "libcef/common/cef_messages.h" #include "libcef/common/content_client.h" #include "libcef/common/process_message_impl.h" +#include "libcef/common/response_manager.h" #include "libcef/renderer/content_renderer_client.h" #include "libcef/renderer/thread_util.h" #include "libcef/renderer/webkit_glue.h" @@ -261,6 +262,7 @@ CefBrowserImpl::CefBrowserImpl(content::RenderView* render_view) browser_window_id_(kInvalidBrowserId), is_popup_(false), last_focused_frame_id_(kInvalidFrameId) { + response_manager_.reset(new CefResponseManager); } CefBrowserImpl::~CefBrowserImpl() { @@ -424,6 +426,8 @@ void CefBrowserImpl::OnDestruct() { handler->OnBrowserDestroyed(this); } + response_manager_.reset(NULL); + CefContentRendererClient::Get()->OnBrowserDestroyed(this); } @@ -655,11 +659,11 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) { } void CefBrowserImpl::OnResponse(const Cef_Response_Params& params) { - response_manager_.RunHandler(params); + response_manager_->RunHandler(params); if (params.expect_response_ack) Send(new CefHostMsg_ResponseAck(routing_id(), params.request_id)); } void CefBrowserImpl::OnResponseAck(int request_id) { - response_manager_.RunAckHandler(request_id); + response_manager_->RunAckHandler(request_id); } diff --git a/libcef/renderer/browser_impl.h b/libcef/renderer/browser_impl.h index d6387b570..7c1df8aa6 100644 --- a/libcef/renderer/browser_impl.h +++ b/libcef/renderer/browser_impl.h @@ -13,10 +13,10 @@ #include "include/cef_browser.h" #include "include/cef_client.h" -#include "libcef/common/response_manager.h" #include "libcef/common/tracker.h" #include "libcef/renderer/frame_impl.h" +#include "base/memory/scoped_ptr.h" #include "content/public/renderer/render_view_observer.h" class GURL; @@ -24,6 +24,7 @@ struct CefMsg_LoadRequest_Params; struct Cef_Request_Params; struct Cef_Response_Params; class CefContentRendererClient; +class CefResponseManager; namespace base { class ListValue; @@ -125,7 +126,7 @@ class CefBrowserImpl : public CefBrowser, FrameObjectMap frame_objects_; // Manages response registrations. - CefResponseManager response_manager_; + scoped_ptr response_manager_; IMPLEMENT_REFCOUNTING(CefBrowserImpl); DISALLOW_COPY_AND_ASSIGN(CefBrowserImpl);