diff options
4 files changed, 20 insertions, 16 deletions
diff --git a/content/browser/renderer_host/browser_render_process_host.cc b/content/browser/renderer_host/browser_render_process_host.cc index 66b5332..4147ed4 100644 --- a/content/browser/renderer_host/browser_render_process_host.cc +++ b/content/browser/renderer_host/browser_render_process_host.cc @@ -16,6 +16,8 @@ #endif #include "base/base_switches.h" +#include "base/bind.h" +#include "base/bind_helpers.h" #include "base/callback.h" #include "base/command_line.h" #include "base/logging.h" @@ -414,8 +416,8 @@ void BrowserRenderProcessHost::CreateMessageFilters() { id(), &browser_context()->GetResourceContext(), content::GetContentClient()->browser()->GetResourceDispatcherHost(), - NewCallbackWithReturnValue( - widget_helper_.get(), &RenderWidgetHelper::GetNextRoutingID))); + base::Bind(&RenderWidgetHelper::GetNextRoutingID, + base::Unretained(widget_helper_.get())))); #if defined(ENABLE_P2P_APIS) channel_->AddFilter(new content::P2PSocketDispatcherHost( diff --git a/content/browser/worker_host/worker_message_filter.cc b/content/browser/worker_host/worker_message_filter.cc index c9a0745..a921d4a 100644 --- a/content/browser/worker_host/worker_message_filter.cc +++ b/content/browser/worker_host/worker_message_filter.cc @@ -14,11 +14,11 @@ WorkerMessageFilter::WorkerMessageFilter( int render_process_id, const content::ResourceContext* resource_context, ResourceDispatcherHost* resource_dispatcher_host, - CallbackWithReturnValue<int>::Type* next_routing_id) + const NextRoutingIDCallback& callback) : render_process_id_(render_process_id), resource_context_(resource_context), resource_dispatcher_host_(resource_dispatcher_host), - next_routing_id_(next_routing_id) { + next_routing_id_(callback) { DCHECK(resource_context); } @@ -72,14 +72,14 @@ bool WorkerMessageFilter::OnMessageReceived(const IPC::Message& message, } int WorkerMessageFilter::GetNextRoutingID() { - return next_routing_id_->Run(); + return next_routing_id_.Run(); } void WorkerMessageFilter::OnCreateWorker( const ViewHostMsg_CreateWorker_Params& params, int* route_id) { *route_id = params.route_id != MSG_ROUTING_NONE ? - params.route_id : next_routing_id_->Run(); + params.route_id : next_routing_id_.Run(); WorkerService::GetInstance()->CreateWorker( params, *route_id, this, *resource_context_); } @@ -89,7 +89,7 @@ void WorkerMessageFilter::OnLookupSharedWorker( bool* exists, int* route_id, bool* url_error) { - *route_id = next_routing_id_->Run(); + *route_id = next_routing_id_.Run(); WorkerService::GetInstance()->LookupSharedWorker( params, *route_id, this, resource_context_, exists, url_error); @@ -109,6 +109,6 @@ void WorkerMessageFilter::OnDocumentDetached(unsigned long long document_id) { void WorkerMessageFilter::OnCreateMessagePort(int *route_id, int* message_port_id) { - *route_id = next_routing_id_->Run(); + *route_id = next_routing_id_.Run(); MessagePortService::GetInstance()->Create(*route_id, this, message_port_id); } diff --git a/content/browser/worker_host/worker_message_filter.h b/content/browser/worker_host/worker_message_filter.h index d5556f8..5f5aae1 100644 --- a/content/browser/worker_host/worker_message_filter.h +++ b/content/browser/worker_host/worker_message_filter.h @@ -5,7 +5,7 @@ #ifndef CONTENT_BROWSER_WORKER_HOST_WORKER_MESSAGE_FILTER_H_ #define CONTENT_BROWSER_WORKER_HOST_WORKER_MESSAGE_FILTER_H_ -#include "base/callback_old.h" +#include "base/callback.h" #include "content/browser/browser_message_filter.h" class ResourceDispatcherHost; @@ -21,13 +21,15 @@ struct ViewHostMsg_CreateWorker_Params; class WorkerMessageFilter : public BrowserMessageFilter { public: + typedef base::Callback<int(void)> NextRoutingIDCallback; + // |next_routing_id| is owned by this object. It can be used up until // OnChannelClosing. WorkerMessageFilter( int render_process_id, const content::ResourceContext* resource_context, ResourceDispatcherHost* resource_dispatcher_host, - CallbackWithReturnValue<int>::Type* next_routing_id); + const NextRoutingIDCallback& callback); // BrowserMessageFilter implementation. virtual void OnChannelClosing(); @@ -61,7 +63,7 @@ class WorkerMessageFilter : public BrowserMessageFilter { // This is guaranteed to be valid until OnChannelClosing is closed, and it's // not used after. - scoped_ptr<CallbackWithReturnValue<int>::Type> next_routing_id_; + NextRoutingIDCallback next_routing_id_; DISALLOW_IMPLICIT_CONSTRUCTORS(WorkerMessageFilter); }; diff --git a/content/browser/worker_host/worker_process_host.cc b/content/browser/worker_host/worker_process_host.cc index 07bc27d..f04c6c8 100644 --- a/content/browser/worker_host/worker_process_host.cc +++ b/content/browser/worker_host/worker_process_host.cc @@ -8,6 +8,8 @@ #include <vector> #include "base/base_switches.h" +#include "base/bind.h" +#include "base/bind_helpers.h" #include "base/callback.h" #include "base/command_line.h" #include "base/message_loop.h" @@ -248,11 +250,9 @@ void WorkerProcessHost::CreateMessageFilters(int render_process_id) { AddFilter(resource_message_filter); worker_message_filter_ = new WorkerMessageFilter( - render_process_id, - resource_context_, - resource_dispatcher_host_, - NewCallbackWithReturnValue( - WorkerService::GetInstance(), &WorkerService::next_worker_route_id)); + render_process_id, resource_context_, resource_dispatcher_host_, + base::Bind(&WorkerService::next_worker_route_id, + base::Unretained(WorkerService::GetInstance()))); AddFilter(worker_message_filter_); AddFilter(new AppCacheDispatcherHost( resource_context_->appcache_service(), id())); |