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/compositor_frame.h" | 20 #include "cc/switches.h" |
21 #include "content/browser/gpu/gpu_process_host.h" | 21 #include "content/browser/gpu/gpu_process_host.h" |
22 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 22 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
23 #include "content/browser/gpu/gpu_surface_tracker.h" | 23 #include "content/browser/gpu/gpu_surface_tracker.h" |
24 #include "content/browser/renderer_host/backing_store.h" | 24 #include "content/browser/renderer_host/backing_store.h" |
25 #include "content/browser/renderer_host/backing_store_manager.h" | 25 #include "content/browser/renderer_host/backing_store_manager.h" |
26 #include "content/browser/renderer_host/gesture_event_filter.h" | 26 #include "content/browser/renderer_host/gesture_event_filter.h" |
27 #include "content/browser/renderer_host/overscroll_controller.h" | 27 #include "content/browser/renderer_host/overscroll_controller.h" |
28 #include "content/browser/renderer_host/render_process_host_impl.h" | 28 #include "content/browser/renderer_host/render_process_host_impl.h" |
29 #include "content/browser/renderer_host/render_view_host_impl.h" | 29 #include "content/browser/renderer_host/render_view_host_impl.h" |
30 #include "content/browser/renderer_host/render_widget_helper.h" | 30 #include "content/browser/renderer_host/render_widget_helper.h" |
(...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1529 view_->UpdateFrameInfo( | 1529 view_->UpdateFrameInfo( |
1530 gfx::ToRoundedVector2d(frame.metadata.root_scroll_offset), | 1530 gfx::ToRoundedVector2d(frame.metadata.root_scroll_offset), |
1531 frame.metadata.page_scale_factor, | 1531 frame.metadata.page_scale_factor, |
1532 frame.metadata.min_page_scale_factor, | 1532 frame.metadata.min_page_scale_factor, |
1533 frame.metadata.max_page_scale_factor, | 1533 frame.metadata.max_page_scale_factor, |
1534 gfx::ToCeiledSize(frame.metadata.root_layer_size), | 1534 gfx::ToCeiledSize(frame.metadata.root_layer_size), |
1535 frame.metadata.location_bar_offset, | 1535 frame.metadata.location_bar_offset, |
1536 frame.metadata.location_bar_content_translation); | 1536 frame.metadata.location_bar_content_translation); |
1537 } | 1537 } |
1538 #endif | 1538 #endif |
1539 if (view_) | |
1540 view_->OnSwapCompositorFrame(frame, process_->GetID(), routing_id_); | |
piman
2013/02/27 01:07:13
We need to send an Ack if we have no view, otherwi
no sievers
2013/02/27 21:07:40
Done.
| |
1539 } | 1541 } |
1540 | 1542 |
1541 void RenderWidgetHostImpl::OnUpdateRect( | 1543 void RenderWidgetHostImpl::OnUpdateRect( |
1542 const ViewHostMsg_UpdateRect_Params& params) { | 1544 const ViewHostMsg_UpdateRect_Params& params) { |
1543 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnUpdateRect"); | 1545 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnUpdateRect"); |
1544 TimeTicks paint_start = TimeTicks::Now(); | 1546 TimeTicks paint_start = TimeTicks::Now(); |
1545 | 1547 |
1546 // Update our knowledge of the RenderWidget's size. | 1548 // Update our knowledge of the RenderWidget's size. |
1547 current_size_ = params.view_size; | 1549 current_size_ = params.view_size; |
1548 // Update our knowledge of the RenderWidget's scroll offset. | 1550 // Update our knowledge of the RenderWidget's scroll offset. |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2328 void RenderWidgetHostImpl::AcknowledgeBufferPresent( | 2330 void RenderWidgetHostImpl::AcknowledgeBufferPresent( |
2329 int32 route_id, int gpu_host_id, | 2331 int32 route_id, int gpu_host_id, |
2330 const AcceleratedSurfaceMsg_BufferPresented_Params& params) { | 2332 const AcceleratedSurfaceMsg_BufferPresented_Params& params) { |
2331 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 2333 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
2332 if (ui_shim) { | 2334 if (ui_shim) { |
2333 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, | 2335 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, |
2334 params)); | 2336 params)); |
2335 } | 2337 } |
2336 } | 2338 } |
2337 | 2339 |
2340 // static | |
2341 void RenderWidgetHostImpl::SendSwapCompositorFrameAck( | |
2342 int32 route_id, int renderer_host_id, const cc::CompositorFrameAck& ack) { | |
2343 RenderProcessHost* host = RenderProcessHost::FromID(renderer_host_id); | |
2344 if (host) | |
2345 host->Send(new ViewMsg_SwapCompositorFrameAck(route_id, ack)); | |
2346 } | |
2347 | |
2338 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { | 2348 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { |
2339 if (!is_threaded_compositing_enabled_) | 2349 if (!is_threaded_compositing_enabled_) |
2340 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); | 2350 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); |
2341 } | 2351 } |
2342 | 2352 |
2343 #if defined(USE_AURA) | 2353 #if defined(USE_AURA) |
2344 | 2354 |
2345 void RenderWidgetHostImpl::ParentChanged(gfx::NativeViewId new_parent) { | 2355 void RenderWidgetHostImpl::ParentChanged(gfx::NativeViewId new_parent) { |
2346 #if defined(OS_WIN) | 2356 #if defined(OS_WIN) |
2347 HWND hwnd = reinterpret_cast<HWND>(new_parent); | 2357 HWND hwnd = reinterpret_cast<HWND>(new_parent); |
(...skipping 18 matching lines...) Expand all Loading... | |
2366 return; | 2376 return; |
2367 | 2377 |
2368 OnRenderAutoResized(new_size); | 2378 OnRenderAutoResized(new_size); |
2369 } | 2379 } |
2370 | 2380 |
2371 void RenderWidgetHostImpl::DetachDelegate() { | 2381 void RenderWidgetHostImpl::DetachDelegate() { |
2372 delegate_ = NULL; | 2382 delegate_ = NULL; |
2373 } | 2383 } |
2374 | 2384 |
2375 } // namespace content | 2385 } // namespace content |
OLD | NEW |