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 <math.h> | 7 #include <math.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/debug/trace_event.h" | 13 #include "base/debug/trace_event.h" |
14 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
16 #include "base/metrics/field_trial.h" | 16 #include "base/metrics/field_trial.h" |
17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
18 #include "base/string_number_conversions.h" | 18 #include "base/string_number_conversions.h" |
19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
20 #include "cc/gl_compositor_frame.h" | |
20 #include "content/browser/gpu/gpu_process_host.h" | 21 #include "content/browser/gpu/gpu_process_host.h" |
21 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 22 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
22 #include "content/browser/gpu/gpu_surface_tracker.h" | 23 #include "content/browser/gpu/gpu_surface_tracker.h" |
23 #include "content/browser/renderer_host/backing_store.h" | 24 #include "content/browser/renderer_host/backing_store.h" |
24 #include "content/browser/renderer_host/backing_store_manager.h" | 25 #include "content/browser/renderer_host/backing_store_manager.h" |
25 #include "content/browser/renderer_host/gesture_event_filter.h" | 26 #include "content/browser/renderer_host/gesture_event_filter.h" |
26 #include "content/browser/renderer_host/overscroll_controller.h" | 27 #include "content/browser/renderer_host/overscroll_controller.h" |
27 #include "content/browser/renderer_host/render_process_host_impl.h" | 28 #include "content/browser/renderer_host/render_process_host_impl.h" |
28 #include "content/browser/renderer_host/render_view_host_impl.h" | 29 #include "content/browser/renderer_host/render_view_host_impl.h" |
29 #include "content/browser/renderer_host/render_widget_helper.h" | 30 #include "content/browser/renderer_host/render_widget_helper.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
324 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady) | 325 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady) |
325 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone) | 326 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone) |
326 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) | 327 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) |
327 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateScreenRects_ACK, | 328 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateScreenRects_ACK, |
328 OnMsgUpdateScreenRectsAck) | 329 OnMsgUpdateScreenRectsAck) |
329 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) | 330 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) |
330 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) | 331 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) |
331 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck) | 332 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck) |
332 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped, | 333 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped, |
333 OnCompositorSurfaceBuffersSwapped) | 334 OnCompositorSurfaceBuffersSwapped) |
335 IPC_MESSAGE_HANDLER(ViewHostMsg_SwapGLCompositorFrame, | |
336 OnMsgSwapGLCompositorFrame) | |
334 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect) | 337 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect) |
335 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnMsgUpdateIsDelayed) | 338 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnMsgUpdateIsDelayed) |
336 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) | 339 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) |
337 IPC_MESSAGE_HANDLER(ViewHostMsg_BeginSmoothScroll, OnMsgBeginSmoothScroll) | 340 IPC_MESSAGE_HANDLER(ViewHostMsg_BeginSmoothScroll, OnMsgBeginSmoothScroll) |
338 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnMsgSelectRangeAck) | 341 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnMsgSelectRangeAck) |
339 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) | 342 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) |
340 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) | 343 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) |
341 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, | 344 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, |
342 OnMsgHasTouchEventHandlers) | 345 OnMsgHasTouchEventHandlers) |
343 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) | 346 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) |
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1502 #if defined(OS_MACOSX) | 1505 #if defined(OS_MACOSX) |
1503 // Compositor window is always gfx::kNullPluginWindow. | 1506 // Compositor window is always gfx::kNullPluginWindow. |
1504 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no | 1507 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no |
1505 // plugin windows. | 1508 // plugin windows. |
1506 gpu_params.window = gfx::kNullPluginWindow; | 1509 gpu_params.window = gfx::kNullPluginWindow; |
1507 #endif | 1510 #endif |
1508 view_->AcceleratedSurfaceBuffersSwapped(gpu_params, | 1511 view_->AcceleratedSurfaceBuffersSwapped(gpu_params, |
1509 gpu_process_host_id); | 1512 gpu_process_host_id); |
1510 } | 1513 } |
1511 | 1514 |
1515 void RenderWidgetHostImpl::OnMsgSwapGLCompositorFrame( | |
1516 const cc::GLCompositorFrame& frame) { | |
1517 #if defined(OS_ANDROID) | |
1518 gfx::Vector2dF scroll_offset = ScaleVector2d( | |
1519 frame.metadata.root_scroll_offset, frame.metadata.page_scale_factor); | |
1520 gfx::SizeF content_size = ScaleSize( | |
1521 frame.metadata.root_layer_size, frame.metadata.page_scale_factor); | |
1522 | |
1523 if (view_) | |
piman
2012/12/14 22:02:22
nit: needs braces per style
aelias_OOO_until_Jul13
2012/12/15 00:06:17
Done.
| |
1524 view_->UpdateFrameInfo( | |
1525 gfx::Vector2d(static_cast<int>(scroll_offset.x()), | |
piman
2012/12/14 22:02:22
Use gfx::ToFlooredVector2d
Should it be Rounded in
aelias_OOO_until_Jul13
2012/12/15 00:06:17
Switched to rounded. On Android, the float is cur
| |
1526 static_cast<int>(scroll_offset.y())), | |
1527 frame.metadata.page_scale_factor, | |
1528 frame.metadata.min_page_scale_factor, | |
1529 frame.metadata.max_page_scale_factor, | |
1530 gfx::Size(static_cast<int>(content_size.width()), | |
piman
2012/12/14 22:02:22
use gfx::ToFlooredSize
Should it be Ceiled?
aelias_OOO_until_Jul13
2012/12/15 00:06:17
Switched to Ceiled.
| |
1531 static_cast<int>(content_size.height()))); | |
1532 #endif | |
1533 } | |
1534 | |
1512 void RenderWidgetHostImpl::OnMsgUpdateRect( | 1535 void RenderWidgetHostImpl::OnMsgUpdateRect( |
1513 const ViewHostMsg_UpdateRect_Params& params) { | 1536 const ViewHostMsg_UpdateRect_Params& params) { |
1514 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnMsgUpdateRect"); | 1537 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnMsgUpdateRect"); |
1515 TimeTicks paint_start = TimeTicks::Now(); | 1538 TimeTicks paint_start = TimeTicks::Now(); |
1516 | 1539 |
1517 // Update our knowledge of the RenderWidget's size. | 1540 // Update our knowledge of the RenderWidget's size. |
1518 current_size_ = params.view_size; | 1541 current_size_ = params.view_size; |
1519 // Update our knowledge of the RenderWidget's scroll offset. | 1542 // Update our knowledge of the RenderWidget's scroll offset. |
1520 last_scroll_offset_ = params.scroll_offset; | 1543 last_scroll_offset_ = params.scroll_offset; |
1521 | 1544 |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2309 return; | 2332 return; |
2310 | 2333 |
2311 OnRenderAutoResized(new_size); | 2334 OnRenderAutoResized(new_size); |
2312 } | 2335 } |
2313 | 2336 |
2314 void RenderWidgetHostImpl::DetachDelegate() { | 2337 void RenderWidgetHostImpl::DetachDelegate() { |
2315 delegate_ = NULL; | 2338 delegate_ = NULL; |
2316 } | 2339 } |
2317 | 2340 |
2318 } // namespace content | 2341 } // namespace content |
OLD | NEW |