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" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h" |
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenuInfo.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenuInfo.h" |
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" |
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" | 32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" |
33 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" | 33 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" |
34 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" | 34 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" |
35 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 35 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
36 #include "third_party/skia/include/core/SkShader.h" | 36 #include "third_party/skia/include/core/SkShader.h" |
37 #include "ui/base/ui_base_switches.h" | 37 #include "ui/base/ui_base_switches.h" |
38 #include "ui/gfx/point.h" | |
39 #include "ui/gfx/rect_conversions.h" | 38 #include "ui/gfx/rect_conversions.h" |
40 #include "ui/gfx/size.h" | |
41 #include "ui/gfx/size_conversions.h" | 39 #include "ui/gfx/size_conversions.h" |
42 #include "ui/gfx/skia_util.h" | 40 #include "ui/gfx/skia_util.h" |
43 #include "ui/gl/gl_switches.h" | 41 #include "ui/gl/gl_switches.h" |
44 #include "ui/surface/transport_dib.h" | 42 #include "ui/surface/transport_dib.h" |
45 #include "webkit/glue/webkit_glue.h" | 43 #include "webkit/glue/webkit_glue.h" |
46 #include "webkit/plugins/npapi/webplugin.h" | 44 #include "webkit/plugins/npapi/webplugin.h" |
47 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 45 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
48 | 46 |
49 #if defined(OS_POSIX) | 47 #if defined(OS_POSIX) |
50 #include "ipc/ipc_channel_posix.h" | 48 #include "ipc/ipc_channel_posix.h" |
(...skipping 14 matching lines...) Expand all Loading... |
65 using WebKit::WebPopupMenuInfo; | 63 using WebKit::WebPopupMenuInfo; |
66 using WebKit::WebPopupType; | 64 using WebKit::WebPopupType; |
67 using WebKit::WebRange; | 65 using WebKit::WebRange; |
68 using WebKit::WebRect; | 66 using WebKit::WebRect; |
69 using WebKit::WebScreenInfo; | 67 using WebKit::WebScreenInfo; |
70 using WebKit::WebSize; | 68 using WebKit::WebSize; |
71 using WebKit::WebTextDirection; | 69 using WebKit::WebTextDirection; |
72 using WebKit::WebTouchEvent; | 70 using WebKit::WebTouchEvent; |
73 using WebKit::WebVector; | 71 using WebKit::WebVector; |
74 using WebKit::WebWidget; | 72 using WebKit::WebWidget; |
75 using content::RenderThread; | 73 |
| 74 namespace content { |
76 | 75 |
77 static const float kStandardDPI = 160; | 76 static const float kStandardDPI = 160; |
78 | 77 |
79 RenderWidget::RenderWidget(WebKit::WebPopupType popup_type, | 78 RenderWidget::RenderWidget(WebKit::WebPopupType popup_type, |
80 const WebKit::WebScreenInfo& screen_info, | 79 const WebKit::WebScreenInfo& screen_info, |
81 bool swapped_out) | 80 bool swapped_out) |
82 : routing_id_(MSG_ROUTING_NONE), | 81 : routing_id_(MSG_ROUTING_NONE), |
83 surface_id_(0), | 82 surface_id_(0), |
84 webwidget_(NULL), | 83 webwidget_(NULL), |
85 opener_id_(MSG_ROUTING_NONE), | 84 opener_id_(MSG_ROUTING_NONE), |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 IPC_MESSAGE_HANDLER(ViewMsg_ScreenInfoChanged, OnScreenInfoChanged) | 257 IPC_MESSAGE_HANDLER(ViewMsg_ScreenInfoChanged, OnScreenInfoChanged) |
259 IPC_MESSAGE_UNHANDLED(handled = false) | 258 IPC_MESSAGE_UNHANDLED(handled = false) |
260 IPC_END_MESSAGE_MAP() | 259 IPC_END_MESSAGE_MAP() |
261 return handled; | 260 return handled; |
262 } | 261 } |
263 | 262 |
264 bool RenderWidget::Send(IPC::Message* message) { | 263 bool RenderWidget::Send(IPC::Message* message) { |
265 // Don't send any messages after the browser has told us to close, and filter | 264 // Don't send any messages after the browser has told us to close, and filter |
266 // most outgoing messages while swapped out. | 265 // most outgoing messages while swapped out. |
267 if ((is_swapped_out_ && | 266 if ((is_swapped_out_ && |
268 !content::SwappedOutMessages::CanSendWhileSwappedOut(message)) || | 267 !SwappedOutMessages::CanSendWhileSwappedOut(message)) || |
269 closing_) { | 268 closing_) { |
270 delete message; | 269 delete message; |
271 return false; | 270 return false; |
272 } | 271 } |
273 | 272 |
274 // If given a messsage without a routing ID, then assign our routing ID. | 273 // If given a messsage without a routing ID, then assign our routing ID. |
275 if (message->routing_id() == MSG_ROUTING_NONE) | 274 if (message->routing_id() == MSG_ROUTING_NONE) |
276 message->set_routing_id(routing_id_); | 275 message->set_routing_id(routing_id_); |
277 | 276 |
278 return RenderThread::Get()->Send(message); | 277 return RenderThread::Get()->Send(message); |
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1861 } | 1860 } |
1862 } | 1861 } |
1863 | 1862 |
1864 void RenderWidget::GetRenderingStats(WebKit::WebRenderingStats& stats) const { | 1863 void RenderWidget::GetRenderingStats(WebKit::WebRenderingStats& stats) const { |
1865 webwidget()->renderingStats(stats); | 1864 webwidget()->renderingStats(stats); |
1866 stats.numAnimationFrames += software_stats_.numAnimationFrames; | 1865 stats.numAnimationFrames += software_stats_.numAnimationFrames; |
1867 stats.numFramesSentToScreen += software_stats_.numFramesSentToScreen; | 1866 stats.numFramesSentToScreen += software_stats_.numFramesSentToScreen; |
1868 stats.totalPaintTimeInSeconds += software_stats_.totalPaintTimeInSeconds; | 1867 stats.totalPaintTimeInSeconds += software_stats_.totalPaintTimeInSeconds; |
1869 } | 1868 } |
1870 | 1869 |
1871 bool RenderWidget::GetGpuRenderingStats( | 1870 bool RenderWidget::GetGpuRenderingStats(GpuRenderingStats* stats) const { |
1872 content::GpuRenderingStats* stats) const { | |
1873 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); | 1871 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); |
1874 if (!gpu_channel) | 1872 if (!gpu_channel) |
1875 return false; | 1873 return false; |
1876 | 1874 |
1877 return gpu_channel->CollectRenderingStatsForSurface(surface_id(), stats); | 1875 return gpu_channel->CollectRenderingStatsForSurface(surface_id(), stats); |
1878 } | 1876 } |
1879 | 1877 |
1880 void RenderWidget::BeginSmoothScroll( | 1878 void RenderWidget::BeginSmoothScroll( |
1881 bool down, | 1879 bool down, |
1882 bool scroll_far, | 1880 bool scroll_far, |
1883 const SmoothScrollCompletionCallback& callback, | 1881 const SmoothScrollCompletionCallback& callback, |
1884 int mouse_event_x, | 1882 int mouse_event_x, |
1885 int mouse_event_y) { | 1883 int mouse_event_y) { |
1886 DCHECK(!callback.is_null()); | 1884 DCHECK(!callback.is_null()); |
1887 int id = next_smooth_scroll_gesture_id_++; | 1885 int id = next_smooth_scroll_gesture_id_++; |
1888 Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, id, down, scroll_far, | 1886 Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, id, down, scroll_far, |
1889 mouse_event_x, mouse_event_y)); | 1887 mouse_event_x, mouse_event_y)); |
1890 pending_smooth_scroll_gestures_.insert(std::make_pair(id, callback)); | 1888 pending_smooth_scroll_gestures_.insert(std::make_pair(id, callback)); |
1891 } | 1889 } |
1892 | 1890 |
1893 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 1891 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
1894 return false; | 1892 return false; |
1895 } | 1893 } |
1896 | 1894 |
1897 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { | 1895 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { |
1898 return false; | 1896 return false; |
1899 } | 1897 } |
| 1898 |
| 1899 } // namespace content |
OLD | NEW |