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 <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 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1520 view_->UpdateFrameInfo( | 1520 view_->UpdateFrameInfo( |
| 1521 gfx::ToRoundedVector2d(scroll_offset), | 1521 gfx::ToRoundedVector2d(scroll_offset), |
| 1522 frame.metadata.page_scale_factor, | 1522 frame.metadata.page_scale_factor, |
| 1523 frame.metadata.min_page_scale_factor, | 1523 frame.metadata.min_page_scale_factor, |
| 1524 frame.metadata.max_page_scale_factor, | 1524 frame.metadata.max_page_scale_factor, |
| 1525 gfx::ToCeiledSize(content_size), | 1525 gfx::ToCeiledSize(content_size), |
| 1526 frame.metadata.location_bar_offset, | 1526 frame.metadata.location_bar_offset, |
| 1527 frame.metadata.location_bar_content_translation); | 1527 frame.metadata.location_bar_content_translation); |
| 1528 } | 1528 } |
| 1529 #endif | 1529 #endif |
| 1530 if (view_) | |
| 1531 view_->OnSwapCompositorFrame(frame, process_->GetID(), routing_id_); | |
| 1530 } | 1532 } |
| 1531 | 1533 |
| 1532 void RenderWidgetHostImpl::OnUpdateRect( | 1534 void RenderWidgetHostImpl::OnUpdateRect( |
| 1533 const ViewHostMsg_UpdateRect_Params& params) { | 1535 const ViewHostMsg_UpdateRect_Params& params) { |
| 1534 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnUpdateRect"); | 1536 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnUpdateRect"); |
| 1535 TimeTicks paint_start = TimeTicks::Now(); | 1537 TimeTicks paint_start = TimeTicks::Now(); |
| 1536 | 1538 |
| 1537 // Update our knowledge of the RenderWidget's size. | 1539 // Update our knowledge of the RenderWidget's size. |
| 1538 current_size_ = params.view_size; | 1540 current_size_ = params.view_size; |
| 1539 // Update our knowledge of the RenderWidget's scroll offset. | 1541 // Update our knowledge of the RenderWidget's scroll offset. |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2317 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); | 2319 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); |
| 2318 return true; | 2320 return true; |
| 2319 } | 2321 } |
| 2320 } | 2322 } |
| 2321 } | 2323 } |
| 2322 | 2324 |
| 2323 // static | 2325 // static |
| 2324 void RenderWidgetHostImpl::AcknowledgeBufferPresent( | 2326 void RenderWidgetHostImpl::AcknowledgeBufferPresent( |
| 2325 int32 route_id, int gpu_host_id, | 2327 int32 route_id, int gpu_host_id, |
| 2326 const AcceleratedSurfaceMsg_BufferPresented_Params& params) { | 2328 const AcceleratedSurfaceMsg_BufferPresented_Params& params) { |
| 2329 static bool composite_to_mailbox = | |
| 2330 CommandLine::ForCurrentProcess()->HasSwitch( | |
| 2331 cc::switches::kCompositeToMailbox); | |
|
piman
2013/01/18 02:14:11
This is a bit of a hack. At the call site, dependi
no sievers
2013/02/06 23:36:00
Note that the method needs to be static though. Bu
| |
| 2332 | |
| 2333 if (composite_to_mailbox) { | |
| 2334 // We will return the texture to the renderer. | |
| 2335 cc::CompositorFrameAck ack; | |
| 2336 std::copy(params.mailbox_name.data(), | |
| 2337 params.mailbox_name.data() + params.mailbox_name.length(), | |
| 2338 reinterpret_cast<char*>(ack.mailbox.name)); | |
| 2339 ack.sync_point = params.sync_point; | |
| 2340 RenderProcessHost* host = RenderProcessHost::FromID(gpu_host_id); | |
| 2341 host->Send(new ViewMsg_SwapCompositorFrameAck(route_id, ack)); | |
| 2342 return; | |
| 2343 } | |
| 2344 | |
| 2327 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 2345 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
| 2328 if (ui_shim) { | 2346 if (ui_shim) { |
| 2329 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, | 2347 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, |
| 2330 params)); | 2348 params)); |
| 2331 } | 2349 } |
| 2332 } | 2350 } |
| 2333 | 2351 |
| 2334 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { | 2352 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { |
| 2335 if (!is_threaded_compositing_enabled_) | 2353 if (!is_threaded_compositing_enabled_) |
| 2336 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); | 2354 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 2362 return; | 2380 return; |
| 2363 | 2381 |
| 2364 OnRenderAutoResized(new_size); | 2382 OnRenderAutoResized(new_size); |
| 2365 } | 2383 } |
| 2366 | 2384 |
| 2367 void RenderWidgetHostImpl::DetachDelegate() { | 2385 void RenderWidgetHostImpl::DetachDelegate() { |
| 2368 delegate_ = NULL; | 2386 delegate_ = NULL; |
| 2369 } | 2387 } |
| 2370 | 2388 |
| 2371 } // namespace content | 2389 } // namespace content |
| OLD | NEW |