diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-16 03:37:44 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-16 03:37:44 +0000 |
commit | 6b9ec39613fb9fdaa52dcf215e5099ff05c686de (patch) | |
tree | b38d08d10a2a25b77783da06ddaed51ff1c32445 /ppapi/utility | |
parent | b7e44ff6661a0b0eb4bff7c9a0a90478a60b830a (diff) | |
download | chromium_src-6b9ec39613fb9fdaa52dcf215e5099ff05c686de.zip chromium_src-6b9ec39613fb9fdaa52dcf215e5099ff05c686de.tar.gz chromium_src-6b9ec39613fb9fdaa52dcf215e5099ff05c686de.tar.bz2 |
Fix nested invocation of graphics 2D Flush.
This fixes the Graphics 2D Flush ABORT callback to be a task instead of being
executed in a nested context. Previously, this would cause crashes because you
would get a paint message when destroying the paint manager.
This new way will issue the callback later. In the case of the paint manager,
the scoped callback factory will just drop the callback on the floor.
I added a check in the paint manager code just in case we add future failure
cases, we don't want to continue painting.
BUG=http://crbug.com/108688
Review URL: http://codereview.chromium.org/9404019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122234 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/utility')
-rw-r--r-- | ppapi/utility/graphics/paint_manager.cc | 10 | ||||
-rw-r--r-- | ppapi/utility/graphics/paint_manager.h | 4 |
2 files changed, 10 insertions, 4 deletions
diff --git a/ppapi/utility/graphics/paint_manager.cc b/ppapi/utility/graphics/paint_manager.cc index 1141ac6..85892bc 100644 --- a/ppapi/utility/graphics/paint_manager.cc +++ b/ppapi/utility/graphics/paint_manager.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -177,10 +177,16 @@ void PaintManager::DoPaint() { instance_->BindGraphics(graphics_); } -void PaintManager::OnFlushComplete(int32_t) { +void PaintManager::OnFlushComplete(int32_t result) { PP_DCHECK(flush_pending_); flush_pending_ = false; + // Theoretically this shouldn't fail unless we've made an error, but don't + // want to call into the client code to do more painting if something bad + // did happen. + if (result != PP_OK) + return; + // If more paints were enqueued while we were waiting for the flush to // complete, execute them now. if (aggregator_.HasPendingUpdate()) diff --git a/ppapi/utility/graphics/paint_manager.h b/ppapi/utility/graphics/paint_manager.h index c3787e8..366b73d 100644 --- a/ppapi/utility/graphics/paint_manager.h +++ b/ppapi/utility/graphics/paint_manager.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -260,7 +260,7 @@ class PaintManager { void DoPaint(); // Callback for asynchronous completion of Flush. - void OnFlushComplete(int32_t); + void OnFlushComplete(int32_t result); // Callback for manual scheduling of paints when there is no flush callback // pending. |