| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file defines utility functions for sending notifications (calling | 5 // This file defines utility functions for sending notifications (calling |
| 6 // methods that return void and do not have out params) to the RenderViewHost | 6 // methods that return void and do not have out params) to the RenderViewHost |
| 7 // or one of its delegate interfaces. The notifications are dispatched | 7 // or one of its delegate interfaces. The notifications are dispatched |
| 8 // asynchronously, and only if the specified RenderViewHost still exists. | 8 // asynchronously, and only if the specified RenderViewHost still exists. |
| 9 | 9 |
| 10 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_NOTIFICATION_TASK_H_ | 10 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_NOTIFICATION_TASK_H_ |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 UnboundMethod<typename Mapper::MappedType, Method, Params> unbound_method_; | 55 UnboundMethod<typename Mapper::MappedType, Method, Params> unbound_method_; |
| 56 | 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(RenderViewHostNotificationTask); | 57 DISALLOW_COPY_AND_ASSIGN(RenderViewHostNotificationTask); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 // For proxying calls to RenderViewHost | 60 // For proxying calls to RenderViewHost |
| 61 | 61 |
| 62 template <typename Method, typename Params> | 62 template <typename Method, typename Params> |
| 63 inline void CallRenderViewHostHelper(int render_process_id, int render_view_id, | 63 inline void CallRenderViewHostHelper(int render_process_id, int render_view_id, |
| 64 Method method, const Params& params) { | 64 Method method, const Params& params) { |
| 65 using content::BrowserThread; |
| 65 BrowserThread::PostTask( | 66 BrowserThread::PostTask( |
| 66 BrowserThread::UI, FROM_HERE, | 67 BrowserThread::UI, FROM_HERE, |
| 67 new RenderViewHostNotificationTask<Method, Params>(render_process_id, | 68 new RenderViewHostNotificationTask<Method, Params>(render_process_id, |
| 68 render_view_id, | 69 render_view_id, |
| 69 method, | 70 method, |
| 70 params)); | 71 params)); |
| 71 } | 72 } |
| 72 | 73 |
| 73 // For proxying calls to RenderViewHostDelegate::RendererManagement | 74 // For proxying calls to RenderViewHostDelegate::RendererManagement |
| 74 | 75 |
| 75 class RenderViewHostToRendererManagementDelegate { | 76 class RenderViewHostToRendererManagementDelegate { |
| 76 public: | 77 public: |
| 77 typedef RenderViewHostDelegate::RendererManagement MappedType; | 78 typedef RenderViewHostDelegate::RendererManagement MappedType; |
| 78 static MappedType* Map(RenderViewHost* rvh) { | 79 static MappedType* Map(RenderViewHost* rvh) { |
| 79 return rvh ? rvh->delegate()->GetRendererManagementDelegate() : NULL; | 80 return rvh ? rvh->delegate()->GetRendererManagementDelegate() : NULL; |
| 80 } | 81 } |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 template <typename Method, typename Params> | 84 template <typename Method, typename Params> |
| 84 inline void CallRenderViewHostRendererManagementDelegateHelper( | 85 inline void CallRenderViewHostRendererManagementDelegateHelper( |
| 85 int render_process_id, | 86 int render_process_id, |
| 86 int render_view_id, | 87 int render_view_id, |
| 87 Method method, | 88 Method method, |
| 88 const Params& params) { | 89 const Params& params) { |
| 90 using content::BrowserThread; |
| 89 BrowserThread::PostTask( | 91 BrowserThread::PostTask( |
| 90 BrowserThread::UI, FROM_HERE, | 92 BrowserThread::UI, FROM_HERE, |
| 91 new RenderViewHostNotificationTask< | 93 new RenderViewHostNotificationTask< |
| 92 Method, Params, RenderViewHostToRendererManagementDelegate>( | 94 Method, Params, RenderViewHostToRendererManagementDelegate>( |
| 93 render_process_id, | 95 render_process_id, |
| 94 render_view_id, | 96 render_view_id, |
| 95 method, | 97 method, |
| 96 params)); | 98 params)); |
| 97 } | 99 } |
| 98 | 100 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 internal::CallRenderViewHostRendererManagementDelegateHelper( | 171 internal::CallRenderViewHostRendererManagementDelegateHelper( |
| 170 render_process_id, | 172 render_process_id, |
| 171 render_view_id, | 173 render_view_id, |
| 172 method, | 174 method, |
| 173 MakeTuple(a, b)); | 175 MakeTuple(a, b)); |
| 174 } | 176 } |
| 175 | 177 |
| 176 // ---------------------------------------------------------------------------- | 178 // ---------------------------------------------------------------------------- |
| 177 | 179 |
| 178 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_NOTIFICATION_TASK_H_ | 180 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_NOTIFICATION_TASK_H_ |
| OLD | NEW |