OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "cc/base/switches.h" | 17 #include "cc/base/switches.h" |
18 #include "cc/base/thread.h" | 18 #include "cc/base/thread.h" |
19 #include "cc/base/thread_impl.h" | 19 #include "cc/base/thread_impl.h" |
20 #include "cc/output/output_surface.h" | 20 #include "cc/output/output_surface.h" |
21 #include "cc/trees/layer_tree_host.h" | 21 #include "cc/trees/layer_tree_host.h" |
22 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 22 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 23 #include "content/common/input_messages.h" |
23 #include "content/common/swapped_out_messages.h" | 24 #include "content/common/swapped_out_messages.h" |
24 #include "content/common/view_messages.h" | 25 #include "content/common/view_messages.h" |
25 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
26 #include "content/renderer/gpu/compositor_output_surface.h" | 27 #include "content/renderer/gpu/compositor_output_surface.h" |
27 #include "content/renderer/gpu/compositor_software_output_device.h" | 28 #include "content/renderer/gpu/compositor_software_output_device.h" |
28 #include "content/renderer/gpu/input_handler_manager.h" | 29 #include "content/renderer/gpu/input_handler_manager.h" |
29 #include "content/renderer/gpu/mailbox_output_surface.h" | 30 #include "content/renderer/gpu/mailbox_output_surface.h" |
30 #include "content/renderer/gpu/render_widget_compositor.h" | 31 #include "content/renderer/gpu/render_widget_compositor.h" |
31 #include "content/renderer/render_process.h" | 32 #include "content/renderer/render_process.h" |
32 #include "content/renderer/render_thread_impl.h" | 33 #include "content/renderer/render_thread_impl.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 RenderProcess::current()->AddRefProcess(); | 288 RenderProcess::current()->AddRefProcess(); |
288 } | 289 } |
289 | 290 |
290 bool RenderWidget::AllowPartialSwap() const { | 291 bool RenderWidget::AllowPartialSwap() const { |
291 return true; | 292 return true; |
292 } | 293 } |
293 | 294 |
294 bool RenderWidget::OnMessageReceived(const IPC::Message& message) { | 295 bool RenderWidget::OnMessageReceived(const IPC::Message& message) { |
295 bool handled = true; | 296 bool handled = true; |
296 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) | 297 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) |
| 298 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent) |
| 299 IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost) |
| 300 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus) |
297 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) | 301 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) |
298 IPC_MESSAGE_HANDLER(ViewMsg_CreatingNew_ACK, OnCreatingNewAck) | 302 IPC_MESSAGE_HANDLER(ViewMsg_CreatingNew_ACK, OnCreatingNewAck) |
299 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) | 303 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) |
300 IPC_MESSAGE_HANDLER(ViewMsg_ChangeResizeRect, OnChangeResizeRect) | 304 IPC_MESSAGE_HANDLER(ViewMsg_ChangeResizeRect, OnChangeResizeRect) |
301 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) | 305 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) |
302 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) | 306 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) |
303 IPC_MESSAGE_HANDLER(ViewMsg_WasSwappedOut, OnWasSwappedOut) | 307 IPC_MESSAGE_HANDLER(ViewMsg_WasSwappedOut, OnWasSwappedOut) |
304 IPC_MESSAGE_HANDLER(ViewMsg_UpdateRect_ACK, OnUpdateRectAck) | 308 IPC_MESSAGE_HANDLER(ViewMsg_UpdateRect_ACK, OnUpdateRectAck) |
305 IPC_MESSAGE_HANDLER(ViewMsg_SwapBuffers_ACK, | 309 IPC_MESSAGE_HANDLER(ViewMsg_SwapBuffers_ACK, |
306 OnViewContextSwapBuffersComplete) | 310 OnViewContextSwapBuffersComplete) |
307 IPC_MESSAGE_HANDLER(ViewMsg_HandleInputEvent, OnHandleInputEvent) | |
308 IPC_MESSAGE_HANDLER(ViewMsg_MouseCaptureLost, OnMouseCaptureLost) | |
309 IPC_MESSAGE_HANDLER(ViewMsg_SetFocus, OnSetFocus) | |
310 IPC_MESSAGE_HANDLER(ViewMsg_SetInputMethodActive, OnSetInputMethodActive) | 311 IPC_MESSAGE_HANDLER(ViewMsg_SetInputMethodActive, OnSetInputMethodActive) |
311 IPC_MESSAGE_HANDLER(ViewMsg_ImeSetComposition, OnImeSetComposition) | 312 IPC_MESSAGE_HANDLER(ViewMsg_ImeSetComposition, OnImeSetComposition) |
312 IPC_MESSAGE_HANDLER(ViewMsg_ImeConfirmComposition, OnImeConfirmComposition) | 313 IPC_MESSAGE_HANDLER(ViewMsg_ImeConfirmComposition, OnImeConfirmComposition) |
313 IPC_MESSAGE_HANDLER(ViewMsg_PaintAtSize, OnPaintAtSize) | 314 IPC_MESSAGE_HANDLER(ViewMsg_PaintAtSize, OnPaintAtSize) |
314 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) | 315 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) |
315 IPC_MESSAGE_HANDLER(ViewMsg_SmoothScrollCompleted, OnSmoothScrollCompleted) | 316 IPC_MESSAGE_HANDLER(ViewMsg_SmoothScrollCompleted, OnSmoothScrollCompleted) |
316 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) | 317 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) |
317 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) | 318 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) |
318 IPC_MESSAGE_HANDLER(ViewMsg_ScreenInfoChanged, OnScreenInfoChanged) | 319 IPC_MESSAGE_HANDLER(ViewMsg_ScreenInfoChanged, OnScreenInfoChanged) |
319 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) | 320 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 INPUT_EVENT_ACK_STATE_CONSUMED : INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 741 INPUT_EVENT_ACK_STATE_CONSUMED : INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
741 if (!processed && input_event->type == WebInputEvent::TouchStart) { | 742 if (!processed && input_event->type == WebInputEvent::TouchStart) { |
742 const WebTouchEvent& touch_event = | 743 const WebTouchEvent& touch_event = |
743 *static_cast<const WebTouchEvent*>(input_event); | 744 *static_cast<const WebTouchEvent*>(input_event); |
744 ack_result = HasTouchEventHandlersAt(touch_event.touches[0].position) ? | 745 ack_result = HasTouchEventHandlersAt(touch_event.touches[0].position) ? |
745 INPUT_EVENT_ACK_STATE_NOT_CONSUMED : | 746 INPUT_EVENT_ACK_STATE_NOT_CONSUMED : |
746 INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; | 747 INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; |
747 } | 748 } |
748 | 749 |
749 IPC::Message* response = | 750 IPC::Message* response = |
750 new ViewHostMsg_HandleInputEvent_ACK(routing_id_, input_event->type, | 751 new InputHostMsg_HandleInputEvent_ACK(routing_id_, input_event->type, |
751 ack_result); | 752 ack_result); |
752 bool event_type_gets_rate_limited = | 753 bool event_type_gets_rate_limited = |
753 input_event->type == WebInputEvent::MouseMove || | 754 input_event->type == WebInputEvent::MouseMove || |
754 input_event->type == WebInputEvent::MouseWheel || | 755 input_event->type == WebInputEvent::MouseWheel || |
755 WebInputEvent::isTouchEventType(input_event->type); | 756 WebInputEvent::isTouchEventType(input_event->type); |
756 | 757 |
757 bool frame_pending = paint_aggregator_.HasPendingUpdate(); | 758 bool frame_pending = paint_aggregator_.HasPendingUpdate(); |
758 if (is_accelerated_compositing_active_) { | 759 if (is_accelerated_compositing_active_) { |
759 frame_pending = compositor_ && | 760 frame_pending = compositor_ && |
760 compositor_->commitRequested(); | 761 compositor_->commitRequested(); |
761 } | 762 } |
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2319 | 2320 |
2320 if (!context->Initialize( | 2321 if (!context->Initialize( |
2321 attributes, | 2322 attributes, |
2322 false /* bind generates resources */, | 2323 false /* bind generates resources */, |
2323 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) | 2324 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) |
2324 return NULL; | 2325 return NULL; |
2325 return context.release(); | 2326 return context.release(); |
2326 } | 2327 } |
2327 | 2328 |
2328 } // namespace content | 2329 } // namespace content |
OLD | NEW |