Chromium Code Reviews| Index: chrome/browser/renderer_host/resource_dispatcher_host.cc |
| =================================================================== |
| --- chrome/browser/renderer_host/resource_dispatcher_host.cc (revision 19988) |
| +++ chrome/browser/renderer_host/resource_dispatcher_host.cc (working copy) |
| @@ -114,6 +114,9 @@ |
| // constructed on the IO thread and run in the UI thread. |
| class NotificationTask : public Task { |
| public: |
| + typedef void (RenderViewHostDelegate::Resource::* ResourceFunction) |
| + (ResourceRequestDetails*); |
| + |
| // Supply the originating URLRequest, a function on RenderViewHostDelegate |
| // to call, and the details to use as the parameter to the given function. |
| // |
| @@ -121,7 +124,7 @@ |
| // allocated on the heap. |
| NotificationTask( |
| URLRequest* request, |
| - void (RenderViewHostDelegate::* function)(ResourceRequestDetails*), |
| + ResourceFunction function, |
| ResourceRequestDetails* details) |
| : function_(function), |
| details_(details) { |
| @@ -134,8 +137,12 @@ |
| virtual void Run() { |
| RenderViewHost* rvh = RenderViewHost::FromID(render_process_host_id_, |
| render_view_host_id_); |
| - if (rvh) |
| - (rvh->delegate()->*function_)(details_.get()); |
| + if (rvh) { |
| + RenderViewHostDelegate::Resource* resource_delegate = |
| + rvh->delegate()->GetResourceDelegate(); |
| + if (resource_delegate) |
| + (resource_delegate->*function_)(details_.get()); |
| + } |
| } |
| private: |
| @@ -143,7 +150,7 @@ |
| int render_view_host_id_; |
| // The function to call on RenderViewHostDelegate on the UI thread. |
|
Erik does not do reviews
2009/07/07 18:33:05
update comment
|
| - void (RenderViewHostDelegate::* function_)(ResourceRequestDetails*); |
| + ResourceFunction function_; |
| // The details for the notification. |
| scoped_ptr<ResourceRequestDetails> details_; |
| @@ -1392,7 +1399,7 @@ |
| // Notify the observers on the UI thread. |
| ui_loop_->PostTask(FROM_HERE, new NotificationTask(request, |
| - &RenderViewHostDelegate::DidStartReceivingResourceResponse, |
| + &RenderViewHostDelegate::Resource::DidStartReceivingResourceResponse, |
| new ResourceRequestDetails(request, |
| GetCertID(request, process_id)))); |
| } |
| @@ -1417,10 +1424,8 @@ |
| // Notify the observers on the UI thread. |
| ui_loop_->PostTask(FROM_HERE, |
| new NotificationTask(request, |
| - &RenderViewHostDelegate::DidRedirectResource, |
| - new ResourceRedirectDetails(request, |
| - cert_id, |
| - new_url))); |
| + &RenderViewHostDelegate::Resource::DidRedirectResource, |
| + new ResourceRedirectDetails(request, cert_id, new_url))); |
| } |
| namespace { |