| 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 DidFlushPaint(); | 566 DidFlushPaint(); |
| 567 } | 567 } |
| 568 | 568 |
| 569 // Continue painting if necessary... | 569 // Continue painting if necessary... |
| 570 DoDeferredUpdateAndSendInputAck(); | 570 DoDeferredUpdateAndSendInputAck(); |
| 571 } | 571 } |
| 572 | 572 |
| 573 bool RenderWidget::SupportsAsynchronousSwapBuffers() { | 573 bool RenderWidget::SupportsAsynchronousSwapBuffers() { |
| 574 // Contexts using the command buffer support asynchronous swapbuffers. | 574 // Contexts using the command buffer support asynchronous swapbuffers. |
| 575 // See RenderWidget::CreateOutputSurface(). | 575 // See RenderWidget::CreateOutputSurface(). |
| 576 if (RenderThreadImpl::current()->compositor_message_loop_proxy()) | 576 if (RenderThreadImpl::current()->compositor_message_loop_proxy().get()) |
| 577 return false; | 577 return false; |
| 578 | 578 |
| 579 return true; | 579 return true; |
| 580 } | 580 } |
| 581 | 581 |
| 582 GURL RenderWidget::GetURLForGraphicsContext3D() { | 582 GURL RenderWidget::GetURLForGraphicsContext3D() { |
| 583 return GURL(); | 583 return GURL(); |
| 584 } | 584 } |
| 585 | 585 |
| 586 bool RenderWidget::ForceCompositingModeEnabled() { | 586 bool RenderWidget::ForceCompositingModeEnabled() { |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 } | 1506 } |
| 1507 | 1507 |
| 1508 void RenderWidget::suppressCompositorScheduling(bool enable) { | 1508 void RenderWidget::suppressCompositorScheduling(bool enable) { |
| 1509 if (compositor_) | 1509 if (compositor_) |
| 1510 compositor_->SetSuppressScheduleComposite(enable); | 1510 compositor_->SetSuppressScheduleComposite(enable); |
| 1511 } | 1511 } |
| 1512 | 1512 |
| 1513 void RenderWidget::willBeginCompositorFrame() { | 1513 void RenderWidget::willBeginCompositorFrame() { |
| 1514 TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame"); | 1514 TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame"); |
| 1515 | 1515 |
| 1516 DCHECK(RenderThreadImpl::current()->compositor_message_loop_proxy()); | 1516 DCHECK(RenderThreadImpl::current()->compositor_message_loop_proxy().get()); |
| 1517 | 1517 |
| 1518 // The following two can result in further layout and possibly | 1518 // The following two can result in further layout and possibly |
| 1519 // enable GPU acceleration so they need to be called before any painting | 1519 // enable GPU acceleration so they need to be called before any painting |
| 1520 // is done. | 1520 // is done. |
| 1521 UpdateTextInputState(DO_NOT_SHOW_IME); | 1521 UpdateTextInputState(DO_NOT_SHOW_IME); |
| 1522 UpdateSelectionBounds(); | 1522 UpdateSelectionBounds(); |
| 1523 | 1523 |
| 1524 WillInitiatePaint(); | 1524 WillInitiatePaint(); |
| 1525 } | 1525 } |
| 1526 | 1526 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 params.needs_ack = false; | 1566 params.needs_ack = false; |
| 1567 params.scale_factor = device_scale_factor_; | 1567 params.scale_factor = device_scale_factor_; |
| 1568 | 1568 |
| 1569 Send(new ViewHostMsg_UpdateRect(routing_id_, params)); | 1569 Send(new ViewHostMsg_UpdateRect(routing_id_, params)); |
| 1570 next_paint_flags_ = 0; | 1570 next_paint_flags_ = 0; |
| 1571 need_update_rect_for_auto_resize_ = false; | 1571 need_update_rect_for_auto_resize_ = false; |
| 1572 } | 1572 } |
| 1573 | 1573 |
| 1574 void RenderWidget::scheduleComposite() { | 1574 void RenderWidget::scheduleComposite() { |
| 1575 TRACE_EVENT0("gpu", "RenderWidget::scheduleComposite"); | 1575 TRACE_EVENT0("gpu", "RenderWidget::scheduleComposite"); |
| 1576 if (RenderThreadImpl::current()->compositor_message_loop_proxy() && | 1576 if (RenderThreadImpl::current()->compositor_message_loop_proxy().get() && |
| 1577 compositor_) { | 1577 compositor_) { |
| 1578 compositor_->setNeedsRedraw(); | 1578 compositor_->setNeedsRedraw(); |
| 1579 } else { | 1579 } else { |
| 1580 // TODO(nduca): replace with something a little less hacky. The reason this | 1580 // TODO(nduca): replace with something a little less hacky. The reason this |
| 1581 // hack is still used is because the Invalidate-DoDeferredUpdate loop | 1581 // hack is still used is because the Invalidate-DoDeferredUpdate loop |
| 1582 // contains a lot of host-renderer synchronization logic that is still | 1582 // contains a lot of host-renderer synchronization logic that is still |
| 1583 // important for the accelerated compositing case. The option of simply | 1583 // important for the accelerated compositing case. The option of simply |
| 1584 // duplicating all that code is less desirable than "faking out" the | 1584 // duplicating all that code is less desirable than "faking out" the |
| 1585 // invalidation path using a magical damage rect. | 1585 // invalidation path using a magical damage rect. |
| 1586 didInvalidateRect(WebRect(0, 0, 1, 1)); | 1586 didInvalidateRect(WebRect(0, 0, 1, 1)); |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2405 | 2405 |
| 2406 if (!context->InitializeWithDefaultBufferSizes( | 2406 if (!context->InitializeWithDefaultBufferSizes( |
| 2407 attributes, | 2407 attributes, |
| 2408 false /* bind generates resources */, | 2408 false /* bind generates resources */, |
| 2409 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) | 2409 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) |
| 2410 return NULL; | 2410 return NULL; |
| 2411 return context.release(); | 2411 return context.release(); |
| 2412 } | 2412 } |
| 2413 | 2413 |
| 2414 } // namespace content | 2414 } // namespace content |
| OLD | NEW |