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 #include "content/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
6 | 6 |
7 #include <QuartzCore/QuartzCore.h> | 7 #include <QuartzCore/QuartzCore.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 "RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped"); | 872 "RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped"); |
873 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 873 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
874 AcceleratedPluginView* view = ViewForPluginWindowHandle(params.window); | 874 AcceleratedPluginView* view = ViewForPluginWindowHandle(params.window); |
875 DCHECK(view); | 875 DCHECK(view); |
876 if (view) { | 876 if (view) { |
877 last_frame_was_accelerated_ = (params.window == | 877 last_frame_was_accelerated_ = (params.window == |
878 plugin_container_manager_.root_container_handle()); | 878 plugin_container_manager_.root_container_handle()); |
879 plugin_container_manager_.SetSurfaceWasPaintedTo(params.window, | 879 plugin_container_manager_.SetSurfaceWasPaintedTo(params.window, |
880 params.surface_id); | 880 params.surface_id); |
881 | 881 |
882 // The surface is hidden until its first paint, to not show gargabe. | 882 // The surface is hidden until its first paint, to not show garbage. |
883 if (plugin_container_manager_.SurfaceShouldBeVisible(params.window)) | 883 if (plugin_container_manager_.SurfaceShouldBeVisible(params.window)) |
884 [view setHidden:NO]; | 884 [view setHidden:NO]; |
885 [view drawView]; | 885 [view drawView]; |
886 } | 886 } |
887 | 887 |
888 if (params.route_id != 0) { | 888 if (params.route_id != 0) { |
889 RenderWidgetHost::AcknowledgeSwapBuffers(params.route_id, gpu_host_id); | 889 RenderWidgetHost::AcknowledgeSwapBuffers(params.route_id, gpu_host_id); |
890 } | 890 } |
891 } | 891 } |
892 | 892 |
893 void RenderWidgetHostViewMac::AcceleratedSurfacePostSubBuffer( | 893 void RenderWidgetHostViewMac::AcceleratedSurfacePostSubBuffer( |
894 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, | 894 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, |
895 int gpu_host_id) { | 895 int gpu_host_id) { |
896 NOTIMPLEMENTED(); | 896 TRACE_EVENT0("browser", |
| 897 "RenderWidgetHostViewMac::AcceleratedSurfacePostSubBuffer"); |
| 898 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 899 AcceleratedPluginView* view = ViewForPluginWindowHandle(params.window); |
| 900 DCHECK(view); |
| 901 if (view) { |
| 902 last_frame_was_accelerated_ = (params.window == |
| 903 plugin_container_manager_.root_container_handle()); |
| 904 plugin_container_manager_.SetSurfaceWasPaintedTo( |
| 905 params.window, |
| 906 params.surface_id, |
| 907 gfx::Rect(params.x, params.y, params.width, params.height)); |
| 908 |
| 909 // The surface is hidden until its first paint, to not show garbage. |
| 910 if (plugin_container_manager_.SurfaceShouldBeVisible(params.window)) |
| 911 [view setHidden:NO]; |
| 912 [view drawView]; |
| 913 } |
| 914 |
| 915 if (params.route_id != 0) { |
| 916 RenderWidgetHost::AcknowledgePostSubBuffer(params.route_id, gpu_host_id); |
| 917 } |
897 } | 918 } |
898 | 919 |
899 void RenderWidgetHostViewMac::UpdateRootGpuViewVisibility( | 920 void RenderWidgetHostViewMac::UpdateRootGpuViewVisibility( |
900 bool show_gpu_widget) { | 921 bool show_gpu_widget) { |
901 // Plugins are destroyed on page navigate. The compositor layer on the other | 922 // Plugins are destroyed on page navigate. The compositor layer on the other |
902 // hand is created on demand and then stays alive until its renderer process | 923 // hand is created on demand and then stays alive until its renderer process |
903 // dies (usually on cross-domain navigation). Instead, only a flag | 924 // dies (usually on cross-domain navigation). Instead, only a flag |
904 // |is_accelerated_compositing_active()| is flipped when the compositor output | 925 // |is_accelerated_compositing_active()| is flipped when the compositor output |
905 // should be shown/hidden. | 926 // should be shown/hidden. |
906 // Show/hide the view belonging to the compositor here. | 927 // Show/hide the view belonging to the compositor here. |
(...skipping 1801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2708 if (!string) return NO; | 2729 if (!string) return NO; |
2709 | 2730 |
2710 // If the user is currently using an IME, confirm the IME input, | 2731 // If the user is currently using an IME, confirm the IME input, |
2711 // and then insert the text from the service, the same as TextEdit and Safari. | 2732 // and then insert the text from the service, the same as TextEdit and Safari. |
2712 [self confirmComposition]; | 2733 [self confirmComposition]; |
2713 [self insertText:string]; | 2734 [self insertText:string]; |
2714 return YES; | 2735 return YES; |
2715 } | 2736 } |
2716 | 2737 |
2717 @end | 2738 @end |
OLD | NEW |