| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 OnAcceleratedSurfaceSetIOSurface) | 173 OnAcceleratedSurfaceSetIOSurface) |
| 174 IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceSetTransportDIB, | 174 IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceSetTransportDIB, |
| 175 OnAcceleratedSurfaceSetTransportDIB) | 175 OnAcceleratedSurfaceSetTransportDIB) |
| 176 IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceBuffersSwapped, | 176 IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceBuffersSwapped, |
| 177 OnAcceleratedSurfaceBuffersSwapped) | 177 OnAcceleratedSurfaceBuffersSwapped) |
| 178 #elif defined(OS_POSIX) | 178 #elif defined(OS_POSIX) |
| 179 IPC_MESSAGE_HANDLER(ViewHostMsg_CreatePluginContainer, | 179 IPC_MESSAGE_HANDLER(ViewHostMsg_CreatePluginContainer, |
| 180 OnMsgCreatePluginContainer) | 180 OnMsgCreatePluginContainer) |
| 181 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyPluginContainer, | 181 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyPluginContainer, |
| 182 OnMsgDestroyPluginContainer) | 182 OnMsgDestroyPluginContainer) |
| 183 #elif defined(OS_WIN) |
| 184 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowCompositorHostWindow, |
| 185 OnShowCompositorHostWindow) |
| 183 #endif | 186 #endif |
| 184 IPC_MESSAGE_UNHANDLED_ERROR() | 187 IPC_MESSAGE_UNHANDLED_ERROR() |
| 185 IPC_END_MESSAGE_MAP_EX() | 188 IPC_END_MESSAGE_MAP_EX() |
| 186 | 189 |
| 187 if (!msg_is_ok) { | 190 if (!msg_is_ok) { |
| 188 // The message de-serialization failed. Kill the renderer process. | 191 // The message de-serialization failed. Kill the renderer process. |
| 189 process()->ReceivedBadMessage(msg.type()); | 192 process()->ReceivedBadMessage(msg.type()); |
| 190 } | 193 } |
| 191 } | 194 } |
| 192 | 195 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 if (!view_) | 368 if (!view_) |
| 366 return NULL; | 369 return NULL; |
| 367 return view_->AllocBackingStore(size); | 370 return view_->AllocBackingStore(size); |
| 368 } | 371 } |
| 369 | 372 |
| 370 void RenderWidgetHost::DonePaintingToBackingStore() { | 373 void RenderWidgetHost::DonePaintingToBackingStore() { |
| 371 Send(new ViewMsg_UpdateRect_ACK(routing_id())); | 374 Send(new ViewMsg_UpdateRect_ACK(routing_id())); |
| 372 } | 375 } |
| 373 | 376 |
| 374 void RenderWidgetHost::ScheduleComposite() { | 377 void RenderWidgetHost::ScheduleComposite() { |
| 375 DCHECK(!is_hidden_ || !is_gpu_rendering_active_) << | 378 if (!is_hidden_ || !is_gpu_rendering_active_) { |
| 376 "ScheduleCompositeAndSync called while hidden!"; | 379 return; |
| 380 } |
| 377 | 381 |
| 378 // Send out a request to the renderer to paint the view if required. | 382 // Send out a request to the renderer to paint the view if required. |
| 379 if (!repaint_ack_pending_ && !resize_ack_pending_ && !view_being_painted_) { | 383 if (!repaint_ack_pending_ && !resize_ack_pending_ && !view_being_painted_) { |
| 380 repaint_start_time_ = TimeTicks::Now(); | 384 repaint_start_time_ = TimeTicks::Now(); |
| 381 repaint_ack_pending_ = true; | 385 repaint_ack_pending_ = true; |
| 382 Send(new ViewMsg_Repaint(routing_id_, current_size_)); | 386 Send(new ViewMsg_Repaint(routing_id_, current_size_)); |
| 383 } | 387 } |
| 384 | 388 |
| 385 // When we have asked the RenderWidget to resize, and we are still waiting on | 389 // When we have asked the RenderWidget to resize, and we are still waiting on |
| 386 // a response, block for a little while to see if we can't get a response. | 390 // a response, block for a little while to see if we can't get a response. |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 } | 1038 } |
| 1035 } | 1039 } |
| 1036 | 1040 |
| 1037 void RenderWidgetHost::OnMsgDestroyPluginContainer(gfx::PluginWindowHandle id) { | 1041 void RenderWidgetHost::OnMsgDestroyPluginContainer(gfx::PluginWindowHandle id) { |
| 1038 if (view_) { | 1042 if (view_) { |
| 1039 view_->DestroyPluginContainer(id); | 1043 view_->DestroyPluginContainer(id); |
| 1040 } else { | 1044 } else { |
| 1041 NOTIMPLEMENTED(); | 1045 NOTIMPLEMENTED(); |
| 1042 } | 1046 } |
| 1043 } | 1047 } |
| 1044 | 1048 #elif defined(OS_WIN) |
| 1049 void RenderWidgetHost::OnShowCompositorHostWindow(bool show) { |
| 1050 if (view_) { |
| 1051 view_->ShowCompositorHostWindow(show); |
| 1052 } else { |
| 1053 NOTIMPLEMENTED(); |
| 1054 } |
| 1055 } |
| 1045 #endif | 1056 #endif |
| 1046 | 1057 |
| 1047 void RenderWidgetHost::PaintBackingStoreRect( | 1058 void RenderWidgetHost::PaintBackingStoreRect( |
| 1048 TransportDIB::Id bitmap, | 1059 TransportDIB::Id bitmap, |
| 1049 const gfx::Rect& bitmap_rect, | 1060 const gfx::Rect& bitmap_rect, |
| 1050 const std::vector<gfx::Rect>& copy_rects, | 1061 const std::vector<gfx::Rect>& copy_rects, |
| 1051 const gfx::Size& view_size) { | 1062 const gfx::Size& view_size) { |
| 1052 // The view may be destroyed already. | 1063 // The view may be destroyed already. |
| 1053 if (!view_) | 1064 if (!view_) |
| 1054 return; | 1065 return; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 // of this key event. | 1170 // of this key event. |
| 1160 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { | 1171 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { |
| 1161 UnhandledKeyboardEvent(front_item); | 1172 UnhandledKeyboardEvent(front_item); |
| 1162 | 1173 |
| 1163 // WARNING: This RenderWidgetHost can be deallocated at this point | 1174 // WARNING: This RenderWidgetHost can be deallocated at this point |
| 1164 // (i.e. in the case of Ctrl+W, where the call to | 1175 // (i.e. in the case of Ctrl+W, where the call to |
| 1165 // UnhandledKeyboardEvent destroys this RenderWidgetHost). | 1176 // UnhandledKeyboardEvent destroys this RenderWidgetHost). |
| 1166 } | 1177 } |
| 1167 } | 1178 } |
| 1168 } | 1179 } |
| OLD | NEW |