Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/thread_proxy.h" | 7 #include "cc/thread_proxy.h" |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "cc/delay_based_time_source.h" | 10 #include "cc/delay_based_time_source.h" |
| 11 #include "cc/draw_quad.h" | 11 #include "cc/draw_quad.h" |
| 12 #include "cc/frame_rate_controller.h" | 12 #include "cc/frame_rate_controller.h" |
| 13 #include "cc/graphics_context.h" | 13 #include "cc/graphics_context.h" |
| 14 #include "cc/input_handler.h" | 14 #include "cc/input_handler.h" |
| 15 #include "cc/layer_tree_host.h" | 15 #include "cc/layer_tree_host.h" |
| 16 #include "cc/scheduler.h" | 16 #include "cc/scheduler.h" |
| 17 #include "cc/scoped_thread_proxy.h" | 17 #include "cc/scoped_thread_proxy.h" |
| 18 #include "cc/settings.h" | |
| 18 #include "cc/thread_task.h" | 19 #include "cc/thread_task.h" |
| 19 #include <public/WebSharedGraphicsContext3D.h> | 20 #include <public/WebSharedGraphicsContext3D.h> |
| 20 #include <wtf/CurrentTime.h> | 21 #include <wtf/CurrentTime.h> |
| 21 | 22 |
| 22 using WebKit::WebSharedGraphicsContext3D; | 23 using WebKit::WebSharedGraphicsContext3D; |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| 26 // Measured in seconds. | 27 // Measured in seconds. |
| 27 const double contextRecreationTickRate = 0.03; | 28 const double contextRecreationTickRate = 0.03; |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 697 // This method is called on a forced draw, regardless of whether we are able to produce a frame, | 698 // This method is called on a forced draw, regardless of whether we are able to produce a frame, |
| 698 // as the calling site on main thread is blocked until its request completes , and we signal | 699 // as the calling site on main thread is blocked until its request completes , and we signal |
| 699 // completion here. If canDraw() is false, we will indicate success=false to the caller, but we | 700 // completion here. If canDraw() is false, we will indicate success=false to the caller, but we |
| 700 // must still signal completion to avoid deadlock. | 701 // must still signal completion to avoid deadlock. |
| 701 | 702 |
| 702 // We guard prepareToDraw() with canDraw() because it always returns a valid frame, so can only | 703 // We guard prepareToDraw() with canDraw() because it always returns a valid frame, so can only |
| 703 // be used when such a frame is possible. Since drawLayers() depends on the result of | 704 // be used when such a frame is possible. Since drawLayers() depends on the result of |
| 704 // prepareToDraw(), it is guarded on canDraw() as well. | 705 // prepareToDraw(), it is guarded on canDraw() as well. |
| 705 | 706 |
| 706 LayerTreeHostImpl::FrameData frame; | 707 LayerTreeHostImpl::FrameData frame; |
| 707 bool drawFrame = m_layerTreeHostImpl->canDraw() && (m_layerTreeHostImpl->pre pareToDraw(frame) || forcedDraw); | 708 bool drawFrame = false; |
| 709 if (m_layerTreeHostImpl->canDraw()) { | |
| 710 drawFrame = m_layerTreeHostImpl->prepareToDraw(frame); | |
| 711 | |
| 712 if (forcedDraw && !Settings::jankInsteadOfCheckerboard()) | |
|
danakj
2012/10/24 20:23:39
Is this going to break readbacks or whatever else
enne (OOO)
2012/10/24 20:27:35
Done.
| |
| 713 drawFrame = true; | |
| 714 } | |
| 708 if (drawFrame) { | 715 if (drawFrame) { |
| 709 m_layerTreeHostImpl->drawLayers(frame); | 716 m_layerTreeHostImpl->drawLayers(frame); |
| 710 result.didDraw = true; | 717 result.didDraw = true; |
| 711 } | 718 } |
| 712 m_layerTreeHostImpl->didDrawAllLayers(frame); | 719 m_layerTreeHostImpl->didDrawAllLayers(frame); |
| 713 | 720 |
| 714 // Check for a pending compositeAndReadback. | 721 // Check for a pending compositeAndReadback. |
| 715 if (m_readbackRequestOnImplThread) { | 722 if (m_readbackRequestOnImplThread) { |
| 716 m_readbackRequestOnImplThread->success = false; | 723 m_readbackRequestOnImplThread->success = false; |
| 717 if (drawFrame) { | 724 if (drawFrame) { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 948 ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() | 955 ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() |
| 949 : monotonicFrameBeginTime(0) | 956 : monotonicFrameBeginTime(0) |
| 950 { | 957 { |
| 951 } | 958 } |
| 952 | 959 |
| 953 ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() | 960 ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() |
| 954 { | 961 { |
| 955 } | 962 } |
| 956 | 963 |
| 957 } // namespace cc | 964 } // namespace cc |
| OLD | NEW |