summaryrefslogtreecommitdiffstats
path: root/cc/output/output_surface.cc
diff options
context:
space:
mode:
authorbrianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-14 05:04:45 +0000
committerbrianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-14 05:04:45 +0000
commitb04b301af83033df836efd65c4f0f6be72dce0c3 (patch)
tree907eb8c5ae9957f36aed5f912f0ea3ac540c5ef8 /cc/output/output_surface.cc
parent01aba0df5ec1dcdb17455675e5e7cad1c9561ab5 (diff)
downloadchromium_src-b04b301af83033df836efd65c4f0f6be72dce0c3.zip
chromium_src-b04b301af83033df836efd65c4f0f6be72dce0c3.tar.gz
chromium_src-b04b301af83033df836efd65c4f0f6be72dce0c3.tar.bz2
cc: Always use SetNeedsBeginFrame to request the next BeginFrame
This avoids relying on SwapBuffers to implicitly trigger the next BeginFrame. Only a single code path is used to request the next BeginFrame now: SetNeedsBeginFrame(true). This avoids issues where OutputSurface subclasses might not call OutputSurface::DidSwap() when they need to or when we early out a swap request and don't actually swap anything. BUG=289755 Review URL: https://chromiumcodereview.appspot.com/23498035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223218 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/output/output_surface.cc')
-rw-r--r--cc/output/output_surface.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc
index 2ffcf95..812f46b 100644
--- a/cc/output/output_surface.cc
+++ b/cc/output/output_surface.cc
@@ -39,7 +39,7 @@ OutputSurface::OutputSurface(scoped_refptr<ContextProvider> context_provider)
max_frames_pending_(0),
pending_swap_buffers_(0),
needs_begin_frame_(false),
- begin_frame_pending_(false),
+ client_ready_for_begin_frame_(true),
client_(NULL),
check_for_retroactive_begin_frame_pending_(false),
external_stencil_test_enabled_(false) {}
@@ -54,7 +54,7 @@ OutputSurface::OutputSurface(
max_frames_pending_(0),
pending_swap_buffers_(0),
needs_begin_frame_(false),
- begin_frame_pending_(false),
+ client_ready_for_begin_frame_(true),
client_(NULL),
check_for_retroactive_begin_frame_pending_(false),
external_stencil_test_enabled_(false) {}
@@ -71,7 +71,7 @@ OutputSurface::OutputSurface(
max_frames_pending_(0),
pending_swap_buffers_(0),
needs_begin_frame_(false),
- begin_frame_pending_(false),
+ client_ready_for_begin_frame_(true),
client_(NULL),
check_for_retroactive_begin_frame_pending_(false),
external_stencil_test_enabled_(false) {}
@@ -133,7 +133,7 @@ void OutputSurface::SetNeedsRedrawRect(gfx::Rect damage_rect) {
void OutputSurface::SetNeedsBeginFrame(bool enable) {
TRACE_EVENT1("cc", "OutputSurface::SetNeedsBeginFrame", "enable", enable);
needs_begin_frame_ = enable;
- begin_frame_pending_ = false;
+ client_ready_for_begin_frame_ = true;
if (frame_rate_controller_) {
BeginFrameArgs skipped = frame_rate_controller_->SetActive(enable);
if (skipped.IsValid())
@@ -145,14 +145,14 @@ void OutputSurface::SetNeedsBeginFrame(bool enable) {
void OutputSurface::BeginFrame(const BeginFrameArgs& args) {
TRACE_EVENT2("cc", "OutputSurface::BeginFrame",
- "begin_frame_pending_", begin_frame_pending_,
+ "client_ready_for_begin_frame_", client_ready_for_begin_frame_,
"pending_swap_buffers_", pending_swap_buffers_);
- if (!needs_begin_frame_ || begin_frame_pending_ ||
+ if (!needs_begin_frame_ || !client_ready_for_begin_frame_ ||
(pending_swap_buffers_ >= max_frames_pending_ &&
max_frames_pending_ > 0)) {
skipped_begin_frame_args_ = args;
} else {
- begin_frame_pending_ = true;
+ client_ready_for_begin_frame_ = false;
client_->BeginFrame(args);
// args might be an alias for skipped_begin_frame_args_.
// Do not reset it before calling BeginFrame!
@@ -192,7 +192,6 @@ void OutputSurface::CheckForRetroactiveBeginFrame() {
}
void OutputSurface::DidSwapBuffers() {
- begin_frame_pending_ = false;
pending_swap_buffers_++;
TRACE_EVENT1("cc", "OutputSurface::DidSwapBuffers",
"pending_swap_buffers_", pending_swap_buffers_);
@@ -213,7 +212,7 @@ void OutputSurface::OnSwapBuffersComplete(const CompositorFrameAck* ack) {
void OutputSurface::DidLoseOutputSurface() {
TRACE_EVENT0("cc", "OutputSurface::DidLoseOutputSurface");
- begin_frame_pending_ = false;
+ client_ready_for_begin_frame_ = true;
pending_swap_buffers_ = 0;
client_->DidLoseOutputSurface();
}