Chromium Code Reviews| 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/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 | 40 |
| 41 #if defined(TOOLKIT_GTK) | 41 #if defined(TOOLKIT_GTK) |
| 42 #include "content/browser/renderer_host/backing_store_gtk.h" | 42 #include "content/browser/renderer_host/backing_store_gtk.h" |
| 43 #elif defined(OS_MACOSX) | 43 #elif defined(OS_MACOSX) |
| 44 #include "content/browser/renderer_host/backing_store_mac.h" | 44 #include "content/browser/renderer_host/backing_store_mac.h" |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 using base::Time; | 47 using base::Time; |
| 48 using base::TimeDelta; | 48 using base::TimeDelta; |
| 49 using base::TimeTicks; | 49 using base::TimeTicks; |
| 50 using content::RenderWidgetHostViewPort; | 50 using content::RenderWidgetHostViewPort; |
|
jam
2012/03/05 23:59:28
nit: don't need these two lines, and all the "cont
Jói
2012/03/06 16:38:55
Done.
| |
| 51 using content::UserMetricsAction; | 51 using content::UserMetricsAction; |
| 52 using WebKit::WebGestureEvent; | 52 using WebKit::WebGestureEvent; |
| 53 using WebKit::WebInputEvent; | 53 using WebKit::WebInputEvent; |
| 54 using WebKit::WebKeyboardEvent; | 54 using WebKit::WebKeyboardEvent; |
| 55 using WebKit::WebMouseEvent; | 55 using WebKit::WebMouseEvent; |
| 56 using WebKit::WebMouseWheelEvent; | 56 using WebKit::WebMouseWheelEvent; |
| 57 using WebKit::WebTextDirection; | 57 using WebKit::WebTextDirection; |
| 58 | 58 |
| 59 namespace { | |
| 60 | |
| 59 // How long to (synchronously) wait for the renderer to respond with a | 61 // How long to (synchronously) wait for the renderer to respond with a |
| 60 // PaintRect message, when our backing-store is invalid, before giving up and | 62 // PaintRect message, when our backing-store is invalid, before giving up and |
| 61 // returning a null or incorrectly sized backing-store from GetBackingStore. | 63 // returning a null or incorrectly sized backing-store from GetBackingStore. |
| 62 // This timeout impacts the "choppiness" of our window resize perf. | 64 // This timeout impacts the "choppiness" of our window resize perf. |
| 63 static const int kPaintMsgTimeoutMS = 40; | 65 static const int kPaintMsgTimeoutMS = 40; |
| 64 | 66 |
| 65 // How long to wait before we consider a renderer hung. | 67 // How long to wait before we consider a renderer hung. |
| 66 static const int kHungRendererDelayMs = 20000; | 68 static const int kHungRendererDelayMs = 20000; |
| 67 | 69 |
| 68 namespace { | |
| 69 | |
| 70 // Returns |true| if the two wheel events should be coalesced. | 70 // Returns |true| if the two wheel events should be coalesced. |
| 71 bool ShouldCoalesceMouseWheelEvents(const WebMouseWheelEvent& last_event, | 71 bool ShouldCoalesceMouseWheelEvents(const WebMouseWheelEvent& last_event, |
| 72 const WebMouseWheelEvent& new_event) { | 72 const WebMouseWheelEvent& new_event) { |
| 73 return last_event.modifiers == new_event.modifiers && | 73 return last_event.modifiers == new_event.modifiers && |
| 74 last_event.scrollByPage == new_event.scrollByPage && | 74 last_event.scrollByPage == new_event.scrollByPage && |
| 75 last_event.hasPreciseScrollingDeltas | 75 last_event.hasPreciseScrollingDeltas |
| 76 == new_event.hasPreciseScrollingDeltas && | 76 == new_event.hasPreciseScrollingDeltas && |
| 77 last_event.phase == new_event.phase && | 77 last_event.phase == new_event.phase && |
| 78 last_event.momentumPhase == new_event.momentumPhase; | 78 last_event.momentumPhase == new_event.momentumPhase; |
| 79 } | 79 } |
| 80 | 80 |
| 81 } // namespace | 81 } // namespace |
| 82 | 82 |
| 83 namespace content { | |
| 84 | |
| 83 // static | 85 // static |
| 84 RenderWidgetHost* RenderWidgetHost::FromIPCChannelListener( | 86 RenderWidgetHost* RenderWidgetHost::FromIPCChannelListener( |
| 85 IPC::Channel::Listener* listener) { | 87 IPC::Channel::Listener* listener) { |
| 86 return static_cast<RenderWidgetHost*>( | 88 return static_cast<RenderWidgetHost*>( |
| 87 static_cast<RenderWidgetHostImpl*>(listener)); | 89 static_cast<RenderWidgetHostImpl*>(listener)); |
| 88 } | 90 } |
| 89 | 91 |
| 90 // static | 92 // static |
| 91 const RenderWidgetHost* RenderWidgetHost::FromIPCChannelListener( | 93 const RenderWidgetHost* RenderWidgetHost::FromIPCChannelListener( |
| 92 const IPC::Channel::Listener* listener) { | 94 const IPC::Channel::Listener* listener) { |
| (...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1638 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); | 1640 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); |
| 1639 } | 1641 } |
| 1640 | 1642 |
| 1641 // static | 1643 // static |
| 1642 void RenderWidgetHostImpl::AcknowledgePostSubBuffer(int32 route_id, | 1644 void RenderWidgetHostImpl::AcknowledgePostSubBuffer(int32 route_id, |
| 1643 int gpu_host_id) { | 1645 int gpu_host_id) { |
| 1644 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 1646 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
| 1645 if (ui_shim) | 1647 if (ui_shim) |
| 1646 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); | 1648 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); |
| 1647 } | 1649 } |
| 1650 | |
| 1651 } // namespace content | |
| OLD | NEW |