OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser/renderer_host/render_widget_host.h" | 5 #include "chrome/browser/renderer_host/render_widget_host.h" |
6 | 6 |
7 #include "app/keyboard_codes.h" | 7 #include "app/keyboard_codes.h" |
8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 int routing_id) | 72 int routing_id) |
73 : renderer_initialized_(false), | 73 : renderer_initialized_(false), |
74 renderer_accessible_(false), | 74 renderer_accessible_(false), |
75 view_(NULL), | 75 view_(NULL), |
76 process_(process), | 76 process_(process), |
77 painting_observer_(NULL), | 77 painting_observer_(NULL), |
78 routing_id_(routing_id), | 78 routing_id_(routing_id), |
79 is_loading_(false), | 79 is_loading_(false), |
80 is_hidden_(false), | 80 is_hidden_(false), |
81 is_gpu_rendering_active_(false), | 81 is_gpu_rendering_active_(false), |
| 82 #if defined(OS_MACOSX) |
| 83 needs_to_hide_gpu_view_on_paint_(false), |
| 84 #endif |
82 repaint_ack_pending_(false), | 85 repaint_ack_pending_(false), |
83 resize_ack_pending_(false), | 86 resize_ack_pending_(false), |
84 mouse_move_pending_(false), | 87 mouse_move_pending_(false), |
85 mouse_wheel_pending_(false), | 88 mouse_wheel_pending_(false), |
86 needs_repainting_on_restore_(false), | 89 needs_repainting_on_restore_(false), |
87 is_unresponsive_(false), | 90 is_unresponsive_(false), |
88 in_get_backing_store_(false), | 91 in_get_backing_store_(false), |
89 view_being_painted_(false), | 92 view_being_painted_(false), |
90 ignore_input_events_(false), | 93 ignore_input_events_(false), |
91 text_direction_updated_(false), | 94 text_direction_updated_(false), |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 // Paint the backing store. This will update it with the | 819 // Paint the backing store. This will update it with the |
817 // renderer-supplied bits. The view will read out of the backing store | 820 // renderer-supplied bits. The view will read out of the backing store |
818 // later to actually draw to the screen. | 821 // later to actually draw to the screen. |
819 PaintBackingStoreRect(params.bitmap, params.bitmap_rect, | 822 PaintBackingStoreRect(params.bitmap, params.bitmap_rect, |
820 params.copy_rects, params.view_size, | 823 params.copy_rects, params.view_size, |
821 &painted_synchronously); | 824 &painted_synchronously); |
822 } | 825 } |
823 } | 826 } |
824 } | 827 } |
825 | 828 |
| 829 #if defined(OS_MACOSX) |
| 830 if (needs_to_hide_gpu_view_on_paint_) { |
| 831 if (view_) |
| 832 view_->GpuRenderingStateDidChange(); |
| 833 needs_to_hide_gpu_view_on_paint_ = false; |
| 834 } |
| 835 #endif |
| 836 |
826 // ACK early so we can prefetch the next PaintRect if there is a next one. | 837 // ACK early so we can prefetch the next PaintRect if there is a next one. |
827 // This must be done AFTER we're done painting with the bitmap supplied by the | 838 // This must be done AFTER we're done painting with the bitmap supplied by the |
828 // renderer. This ACK is a signal to the renderer that the backing store can | 839 // renderer. This ACK is a signal to the renderer that the backing store can |
829 // be re-used, so the bitmap may be invalid after this call. If the backing | 840 // be re-used, so the bitmap may be invalid after this call. If the backing |
830 // store is painting asynchronously, it will manage issuing this IPC. | 841 // store is painting asynchronously, it will manage issuing this IPC. |
831 if (painted_synchronously) | 842 if (painted_synchronously) |
832 Send(new ViewMsg_UpdateRect_ACK(routing_id_)); | 843 Send(new ViewMsg_UpdateRect_ACK(routing_id_)); |
833 | 844 |
834 // We don't need to update the view if the view is hidden. We must do this | 845 // We don't need to update the view if the view is hidden. We must do this |
835 // early return after the ACK is sent, however, or the renderer will not send | 846 // early return after the ACK is sent, however, or the renderer will not send |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 if (view_) | 975 if (view_) |
965 view_->ImeCancelComposition(); | 976 view_->ImeCancelComposition(); |
966 } | 977 } |
967 | 978 |
968 void RenderWidgetHost::OnMsgGpuRenderingActivated(bool activated) { | 979 void RenderWidgetHost::OnMsgGpuRenderingActivated(bool activated) { |
969 #if defined(OS_MACOSX) | 980 #if defined(OS_MACOSX) |
970 bool old_state = is_gpu_rendering_active_; | 981 bool old_state = is_gpu_rendering_active_; |
971 #endif | 982 #endif |
972 is_gpu_rendering_active_ = activated; | 983 is_gpu_rendering_active_ = activated; |
973 #if defined(OS_MACOSX) | 984 #if defined(OS_MACOSX) |
974 if (old_state != is_gpu_rendering_active_ && view_) | 985 if (old_state != is_gpu_rendering_active_ && view_) { |
975 view_->GpuRenderingStateDidChange(); | 986 if (is_gpu_rendering_active_) { |
| 987 view_->GpuRenderingStateDidChange(); |
| 988 } else { |
| 989 // Delay revealing the non-gpu view until it has been repainted. |
| 990 needs_to_hide_gpu_view_on_paint_ = true; |
| 991 } |
| 992 } |
976 #endif | 993 #endif |
977 } | 994 } |
978 | 995 |
979 #if defined(OS_MACOSX) | 996 #if defined(OS_MACOSX) |
980 | 997 |
981 void RenderWidgetHost::OnMsgShowPopup( | 998 void RenderWidgetHost::OnMsgShowPopup( |
982 const ViewHostMsg_ShowPopup_Params& params) { | 999 const ViewHostMsg_ShowPopup_Params& params) { |
983 view_->ShowPopupWithItems(params.bounds, | 1000 view_->ShowPopupWithItems(params.bounds, |
984 params.item_height, | 1001 params.item_height, |
985 params.item_font_size, | 1002 params.item_font_size, |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1225 // of this key event. | 1242 // of this key event. |
1226 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { | 1243 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { |
1227 UnhandledKeyboardEvent(front_item); | 1244 UnhandledKeyboardEvent(front_item); |
1228 | 1245 |
1229 // WARNING: This RenderWidgetHost can be deallocated at this point | 1246 // WARNING: This RenderWidgetHost can be deallocated at this point |
1230 // (i.e. in the case of Ctrl+W, where the call to | 1247 // (i.e. in the case of Ctrl+W, where the call to |
1231 // UnhandledKeyboardEvent destroys this RenderWidgetHost). | 1248 // UnhandledKeyboardEvent destroys this RenderWidgetHost). |
1232 } | 1249 } |
1233 } | 1250 } |
1234 } | 1251 } |
OLD | NEW |