diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-16 18:23:22 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-16 18:23:22 +0000 |
commit | 2ab0352e52c75ccb3c0cc1d5c56d0cc09f19ff6c (patch) | |
tree | 0a643aadd7b7c0ea5bb964ee122924f6ea3874b4 /cc/test | |
parent | e9c7f0553447bb4127a5f3231b035ce8db6e7e08 (diff) | |
download | chromium_src-2ab0352e52c75ccb3c0cc1d5c56d0cc09f19ff6c.zip chromium_src-2ab0352e52c75ccb3c0cc1d5c56d0cc09f19ff6c.tar.gz chromium_src-2ab0352e52c75ccb3c0cc1d5c56d0cc09f19ff6c.tar.bz2 |
cc: Don't DeleteResource while holding write lock.
When the context is lost and we can't generate a mailbox for a
resource, we delete that resource. However currently we are already
optimistically holding a write lock on the resource.
Instead, only take the write lock once we have generated the mailbox
so we don't hold it when we delete the resource.
Tests:
VideoResourceUpdaterTest.SoftwareFrame
VideoResourceUpdaterTest.LostContextForSoftwareFrame
R=piman@chromium.org
BUG=260361
Review URL: https://codereview.chromium.org/19272005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211815 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test')
-rw-r--r-- | cc/test/test_web_graphics_context_3d.cc | 14 | ||||
-rw-r--r-- | cc/test/test_web_graphics_context_3d.h | 4 |
2 files changed, 18 insertions, 0 deletions
diff --git a/cc/test/test_web_graphics_context_3d.cc b/cc/test/test_web_graphics_context_3d.cc index f5ebb6b..1e17f91 100644 --- a/cc/test/test_web_graphics_context_3d.cc +++ b/cc/test/test_web_graphics_context_3d.cc @@ -47,6 +47,7 @@ TestWebGraphicsContext3D::TestWebGraphicsContext3D() times_make_current_succeeds_(-1), times_bind_texture_succeeds_(-1), times_end_query_succeeds_(-1), + times_gen_mailbox_succeeds_(-1), context_lost_(false), times_map_image_chromium_succeeds_(-1), times_map_buffer_chromium_succeeds_(-1), @@ -74,6 +75,7 @@ TestWebGraphicsContext3D::TestWebGraphicsContext3D( times_make_current_succeeds_(-1), times_bind_texture_succeeds_(-1), times_end_query_succeeds_(-1), + times_gen_mailbox_succeeds_(-1), context_lost_(false), times_map_image_chromium_succeeds_(-1), times_map_buffer_chromium_succeeds_(-1), @@ -329,6 +331,18 @@ void TestWebGraphicsContext3D::getIntegerv( } void TestWebGraphicsContext3D::genMailboxCHROMIUM(WebKit::WGC3Dbyte* mailbox) { + if (times_gen_mailbox_succeeds_ >= 0) { + if (!times_gen_mailbox_succeeds_) { + loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, + GL_INNOCENT_CONTEXT_RESET_ARB); + } + --times_gen_mailbox_succeeds_; + } + if (context_lost_) { + memset(mailbox, 0, 64); + return; + } + static char mailbox_name1 = '1'; static char mailbox_name2 = '1'; mailbox[0] = mailbox_name1; diff --git a/cc/test/test_web_graphics_context_3d.h b/cc/test/test_web_graphics_context_3d.h index 086ab0f..5952e36 100644 --- a/cc/test/test_web_graphics_context_3d.h +++ b/cc/test/test_web_graphics_context_3d.h @@ -158,6 +158,9 @@ class TestWebGraphicsContext3D : public FakeWebGraphicsContext3D { void set_times_end_query_succeeds(int times) { times_end_query_succeeds_ = times; } + void set_times_gen_mailbox_succeeds(int times) { + times_gen_mailbox_succeeds_ = times; + } // When set, mapImageCHROMIUM and mapBufferCHROMIUM will return NULL after // this many times. @@ -222,6 +225,7 @@ class TestWebGraphicsContext3D : public FakeWebGraphicsContext3D { int times_make_current_succeeds_; int times_bind_texture_succeeds_; int times_end_query_succeeds_; + int times_gen_mailbox_succeeds_; bool context_lost_; int times_map_image_chromium_succeeds_; int times_map_buffer_chromium_succeeds_; |