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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 } | 363 } |
364 | 364 |
365 bool RenderWidget::UsingSynchronousRendererCompositor() const { | 365 bool RenderWidget::UsingSynchronousRendererCompositor() const { |
366 #if defined(OS_ANDROID) | 366 #if defined(OS_ANDROID) |
367 return SynchronousCompositorFactory::GetInstance() != NULL; | 367 return SynchronousCompositorFactory::GetInstance() != NULL; |
368 #else | 368 #else |
369 return false; | 369 return false; |
370 #endif | 370 #endif |
371 } | 371 } |
372 | 372 |
| 373 void RenderWidget::ScheduleCompositeWithForcedRedraw() { |
| 374 if (compositor_ && force_redraw) { |
| 375 // Regardless of whether threaded compositing is enabled, always |
| 376 // use this mechanism to force the compositor to redraw. However, |
| 377 // the invalidation code path below is still needed for the |
| 378 // non-threaded case. |
| 379 compositor_->SetNeedsForcedRedraw(); |
| 380 } |
| 381 ScheduleCompositeImpl(true); |
| 382 } |
| 383 |
| 384 void RenderWidget::ScheduleCompositeImpl(bool force_redraw) { |
| 385 if (RenderThreadImpl::current()->compositor_message_loop_proxy().get() && |
| 386 compositor_) { |
| 387 if (!force_redraw) { |
| 388 compositor_->setNeedsRedraw(); |
| 389 } |
| 390 } else { |
| 391 // TODO(nduca): replace with something a little less hacky. The reason this |
| 392 // hack is still used is because the Invalidate-DoDeferredUpdate loop |
| 393 // contains a lot of host-renderer synchronization logic that is still |
| 394 // important for the accelerated compositing case. The option of simply |
| 395 // duplicating all that code is less desirable than "faking out" the |
| 396 // invalidation path using a magical damage rect. |
| 397 didInvalidateRect(WebRect(0, 0, 1, 1)); |
| 398 } |
| 399 } |
| 400 |
373 bool RenderWidget::OnMessageReceived(const IPC::Message& message) { | 401 bool RenderWidget::OnMessageReceived(const IPC::Message& message) { |
374 bool handled = true; | 402 bool handled = true; |
375 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) | 403 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) |
376 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent) | 404 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent) |
377 IPC_MESSAGE_HANDLER(InputMsg_CursorVisibilityChange, | 405 IPC_MESSAGE_HANDLER(InputMsg_CursorVisibilityChange, |
378 OnCursorVisibilityChange) | 406 OnCursorVisibilityChange) |
379 IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost) | 407 IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost) |
380 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus) | 408 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus) |
381 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) | 409 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) |
382 IPC_MESSAGE_HANDLER(ViewMsg_CreatingNew_ACK, OnCreatingNewAck) | 410 IPC_MESSAGE_HANDLER(ViewMsg_CreatingNew_ACK, OnCreatingNewAck) |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1664 params.scroll_offset = GetScrollOffset(); | 1692 params.scroll_offset = GetScrollOffset(); |
1665 params.needs_ack = false; | 1693 params.needs_ack = false; |
1666 params.scale_factor = device_scale_factor_; | 1694 params.scale_factor = device_scale_factor_; |
1667 | 1695 |
1668 Send(new ViewHostMsg_UpdateRect(routing_id_, params)); | 1696 Send(new ViewHostMsg_UpdateRect(routing_id_, params)); |
1669 next_paint_flags_ = 0; | 1697 next_paint_flags_ = 0; |
1670 need_update_rect_for_auto_resize_ = false; | 1698 need_update_rect_for_auto_resize_ = false; |
1671 } | 1699 } |
1672 | 1700 |
1673 void RenderWidget::scheduleComposite() { | 1701 void RenderWidget::scheduleComposite() { |
1674 if (RenderThreadImpl::current()->compositor_message_loop_proxy().get() && | 1702 ScheduleCompositeImpl(false); |
1675 compositor_) { | |
1676 compositor_->setNeedsRedraw(); | |
1677 } else { | |
1678 // TODO(nduca): replace with something a little less hacky. The reason this | |
1679 // hack is still used is because the Invalidate-DoDeferredUpdate loop | |
1680 // contains a lot of host-renderer synchronization logic that is still | |
1681 // important for the accelerated compositing case. The option of simply | |
1682 // duplicating all that code is less desirable than "faking out" the | |
1683 // invalidation path using a magical damage rect. | |
1684 didInvalidateRect(WebRect(0, 0, 1, 1)); | |
1685 } | |
1686 } | 1703 } |
1687 | 1704 |
1688 void RenderWidget::scheduleAnimation() { | 1705 void RenderWidget::scheduleAnimation() { |
1689 if (animation_update_pending_) | 1706 if (animation_update_pending_) |
1690 return; | 1707 return; |
1691 | 1708 |
1692 TRACE_EVENT0("gpu", "RenderWidget::scheduleAnimation"); | 1709 TRACE_EVENT0("gpu", "RenderWidget::scheduleAnimation"); |
1693 animation_update_pending_ = true; | 1710 animation_update_pending_ = true; |
1694 if (!animation_timer_.IsRunning()) { | 1711 if (!animation_timer_.IsRunning()) { |
1695 animation_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(0), this, | 1712 animation_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(0), this, |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2592 kDefaultCommandBufferSize, | 2609 kDefaultCommandBufferSize, |
2593 kDefaultStartTransferBufferSize, | 2610 kDefaultStartTransferBufferSize, |
2594 kDefaultMinTransferBufferSize, | 2611 kDefaultMinTransferBufferSize, |
2595 kDefaultMaxTransferBufferSize, | 2612 kDefaultMaxTransferBufferSize, |
2596 mapped_memory_reclaim_limit)) | 2613 mapped_memory_reclaim_limit)) |
2597 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); | 2614 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); |
2598 return context.Pass(); | 2615 return context.Pass(); |
2599 } | 2616 } |
2600 | 2617 |
2601 } // namespace content | 2618 } // namespace content |
OLD | NEW |