OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/renderer/webplugin_delegate_proxy.h" | 5 #include "chrome/renderer/webplugin_delegate_proxy.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #if defined(OS_LINUX) | 9 #if defined(OS_LINUX) |
10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 OnGetCPBrowsingContext) | 379 OnGetCPBrowsingContext) |
380 IPC_MESSAGE_HANDLER(PluginHostMsg_CancelDocumentLoad, OnCancelDocumentLoad) | 380 IPC_MESSAGE_HANDLER(PluginHostMsg_CancelDocumentLoad, OnCancelDocumentLoad) |
381 IPC_MESSAGE_HANDLER(PluginHostMsg_InitiateHTTPRangeRequest, | 381 IPC_MESSAGE_HANDLER(PluginHostMsg_InitiateHTTPRangeRequest, |
382 OnInitiateHTTPRangeRequest) | 382 OnInitiateHTTPRangeRequest) |
383 IPC_MESSAGE_HANDLER(PluginHostMsg_DeferResourceLoading, | 383 IPC_MESSAGE_HANDLER(PluginHostMsg_DeferResourceLoading, |
384 OnDeferResourceLoading) | 384 OnDeferResourceLoading) |
385 | 385 |
386 #if defined(OS_MACOSX) | 386 #if defined(OS_MACOSX) |
387 IPC_MESSAGE_HANDLER(PluginHostMsg_UpdateGeometry_ACK, | 387 IPC_MESSAGE_HANDLER(PluginHostMsg_UpdateGeometry_ACK, |
388 OnUpdateGeometry_ACK) | 388 OnUpdateGeometry_ACK) |
| 389 // Used only on 10.6 and later |
| 390 IPC_MESSAGE_HANDLER(PluginHostMsg_GPUPluginSetIOSurface, |
| 391 OnGPUPluginSetIOSurface) |
| 392 IPC_MESSAGE_HANDLER(PluginHostMsg_GPUPluginBuffersSwapped, |
| 393 OnGPUPluginBuffersSwapped) |
389 #endif | 394 #endif |
390 | 395 |
391 IPC_MESSAGE_UNHANDLED_ERROR() | 396 IPC_MESSAGE_UNHANDLED_ERROR() |
392 IPC_END_MESSAGE_MAP() | 397 IPC_END_MESSAGE_MAP() |
393 } | 398 } |
394 | 399 |
395 void WebPluginDelegateProxy::OnChannelError() { | 400 void WebPluginDelegateProxy::OnChannelError() { |
396 if (plugin_) { | 401 if (plugin_) { |
397 if (window_) { | 402 if (window_) { |
398 // The actual WebPluginDelegate never got a chance to tell the WebPlugin | 403 // The actual WebPluginDelegate never got a chance to tell the WebPlugin |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 void WebPluginDelegateProxy::OnSetWindow(gfx::PluginWindowHandle window) { | 889 void WebPluginDelegateProxy::OnSetWindow(gfx::PluginWindowHandle window) { |
885 windowless_ = !window; | 890 windowless_ = !window; |
886 window_ = window; | 891 window_ = window; |
887 if (plugin_) | 892 if (plugin_) |
888 plugin_->SetWindow(window); | 893 plugin_->SetWindow(window); |
889 } | 894 } |
890 | 895 |
891 void WebPluginDelegateProxy::WillDestroyWindow() { | 896 void WebPluginDelegateProxy::WillDestroyWindow() { |
892 DCHECK(window_); | 897 DCHECK(window_); |
893 plugin_->WillDestroyWindow(window_); | 898 plugin_->WillDestroyWindow(window_); |
| 899 #if defined(OS_MACOSX) |
| 900 if (window_) { |
| 901 // This is actually a "fake" window handle only for the GPU |
| 902 // plugin. Deallocate it on the browser side. |
| 903 if (render_view_) |
| 904 render_view_->DestroyFakePluginWindowHandle(window_); |
| 905 } |
| 906 #endif |
894 window_ = gfx::kNullPluginWindow; | 907 window_ = gfx::kNullPluginWindow; |
895 } | 908 } |
896 | 909 |
897 #if defined(OS_WIN) | 910 #if defined(OS_WIN) |
898 void WebPluginDelegateProxy::OnSetWindowlessPumpEvent( | 911 void WebPluginDelegateProxy::OnSetWindowlessPumpEvent( |
899 HANDLE modal_loop_pump_messages_event) { | 912 HANDLE modal_loop_pump_messages_event) { |
900 DCHECK(modal_loop_pump_messages_event_ == NULL); | 913 DCHECK(modal_loop_pump_messages_event_ == NULL); |
901 | 914 |
902 // Bug 25583: this can be null because some "virus scanners" block the | 915 // Bug 25583: this can be null because some "virus scanners" block the |
903 // DuplicateHandle call in the plugin process. | 916 // DuplicateHandle call in the plugin process. |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 return NULL; | 1205 return NULL; |
1193 | 1206 |
1194 ResourceClientProxy* proxy = new ResourceClientProxy(channel_host_, | 1207 ResourceClientProxy* proxy = new ResourceClientProxy(channel_host_, |
1195 instance_id_); | 1208 instance_id_); |
1196 proxy->InitializeForSeekableStream(resource_id, range_request_id); | 1209 proxy->InitializeForSeekableStream(resource_id, range_request_id); |
1197 return proxy; | 1210 return proxy; |
1198 } | 1211 } |
1199 | 1212 |
1200 CommandBufferProxy* WebPluginDelegateProxy::CreateCommandBuffer() { | 1213 CommandBufferProxy* WebPluginDelegateProxy::CreateCommandBuffer() { |
1201 #if defined(ENABLE_GPU) | 1214 #if defined(ENABLE_GPU) |
| 1215 #if defined(OS_MACOSX) |
| 1216 // We need to synthesize a fake window handle for this nested |
| 1217 // delegate to identify the instance of the GPU plugin back to the |
| 1218 // browser. |
| 1219 gfx::PluginWindowHandle fake_window = NULL; |
| 1220 if (render_view_) |
| 1221 fake_window = render_view_->AllocateFakePluginWindowHandle(); |
| 1222 // If we aren't running on 10.6, this allocation will fail. |
| 1223 if (!fake_window) |
| 1224 return NULL; |
| 1225 OnSetWindow(fake_window); |
| 1226 if (!Send(new PluginMsg_SetFakeGPUPluginWindowHandle(instance_id_, |
| 1227 fake_window))) { |
| 1228 return NULL; |
| 1229 } |
| 1230 #endif |
| 1231 |
1202 int command_buffer_id; | 1232 int command_buffer_id; |
1203 if (!Send(new PluginMsg_CreateCommandBuffer(instance_id_, | 1233 if (!Send(new PluginMsg_CreateCommandBuffer(instance_id_, |
1204 &command_buffer_id))) { | 1234 &command_buffer_id))) { |
1205 return NULL; | 1235 return NULL; |
1206 } | 1236 } |
1207 | 1237 |
1208 return new CommandBufferProxy(channel_host_, command_buffer_id); | 1238 return new CommandBufferProxy(channel_host_, command_buffer_id); |
1209 #else | 1239 #else |
1210 return NULL; | 1240 return NULL; |
1211 #endif // ENABLE_GPU | 1241 #endif // ENABLE_GPU |
(...skipping 28 matching lines...) Expand all Loading... |
1240 // Now that the ACK has been received, the TransportDIBs that were used | 1270 // Now that the ACK has been received, the TransportDIBs that were used |
1241 // prior to the UpdateGeometry message now being acknowledged are known to | 1271 // prior to the UpdateGeometry message now being acknowledged are known to |
1242 // be no longer needed. Release them, and take the stale entry out of the | 1272 // be no longer needed. Release them, and take the stale entry out of the |
1243 // map. | 1273 // map. |
1244 ReleaseTransportDIB(iterator->second.backing_store.get()); | 1274 ReleaseTransportDIB(iterator->second.backing_store.get()); |
1245 ReleaseTransportDIB(iterator->second.transport_store.get()); | 1275 ReleaseTransportDIB(iterator->second.transport_store.get()); |
1246 ReleaseTransportDIB(iterator->second.background_store.get()); | 1276 ReleaseTransportDIB(iterator->second.background_store.get()); |
1247 | 1277 |
1248 old_transport_dibs_.erase(iterator); | 1278 old_transport_dibs_.erase(iterator); |
1249 } | 1279 } |
| 1280 |
| 1281 void WebPluginDelegateProxy::OnGPUPluginSetIOSurface( |
| 1282 gfx::PluginWindowHandle window, |
| 1283 int32 width, |
| 1284 int32 height, |
| 1285 uint64 io_surface_identifier) { |
| 1286 if (render_view_) |
| 1287 render_view_->GPUPluginSetIOSurface(window, width, height, |
| 1288 io_surface_identifier); |
| 1289 } |
| 1290 |
| 1291 void WebPluginDelegateProxy::OnGPUPluginBuffersSwapped( |
| 1292 gfx::PluginWindowHandle window) { |
| 1293 if (render_view_) |
| 1294 render_view_->GPUPluginBuffersSwapped(window); |
| 1295 } |
1250 #endif | 1296 #endif |
OLD | NEW |