Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: cc/resources/resource_provider_unittest.cc

Issue 23648014: cc: Move TextureMailbox::ReleaseCallback to SingleReleaseCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: releasecallback: SingleReleaseCallback Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/single_release_callback.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/resources/resource_provider.h" 5 #include "cc/resources/resource_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "cc/base/scoped_ptr_deque.h" 13 #include "cc/base/scoped_ptr_deque.h"
14 #include "cc/debug/test_web_graphics_context_3d.h" 14 #include "cc/debug/test_web_graphics_context_3d.h"
15 #include "cc/output/output_surface.h" 15 #include "cc/output/output_surface.h"
16 #include "cc/resources/returned_resource.h" 16 #include "cc/resources/returned_resource.h"
17 #include "cc/resources/single_release_callback.h"
17 #include "cc/test/fake_output_surface.h" 18 #include "cc/test/fake_output_surface.h"
18 #include "cc/test/fake_output_surface_client.h" 19 #include "cc/test/fake_output_surface_client.h"
19 #include "gpu/GLES2/gl2extchromium.h" 20 #include "gpu/GLES2/gl2extchromium.h"
20 #include "testing/gmock/include/gmock/gmock.h" 21 #include "testing/gmock/include/gmock/gmock.h"
21 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
22 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" 23 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
23 #include "third_party/khronos/GLES2/gl2.h" 24 #include "third_party/khronos/GLES2/gl2.h"
24 #include "third_party/khronos/GLES2/gl2ext.h" 25 #include "third_party/khronos/GLES2/gl2ext.h"
25 #include "ui/gfx/rect.h" 26 #include "ui/gfx/rect.h"
26 27
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 gpu::Mailbox mailbox; 912 gpu::Mailbox mailbox;
912 context()->genMailboxCHROMIUM(mailbox.name); 913 context()->genMailboxCHROMIUM(mailbox.name);
913 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); 914 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
914 unsigned sync_point = context()->insertSyncPoint(); 915 unsigned sync_point = context()->insertSyncPoint();
915 916
916 // All the logic below assumes that the sync points are all positive. 917 // All the logic below assumes that the sync points are all positive.
917 EXPECT_LT(0u, sync_point); 918 EXPECT_LT(0u, sync_point);
918 919
919 unsigned release_sync_point = 0; 920 unsigned release_sync_point = 0;
920 bool lost_resource = false; 921 bool lost_resource = false;
921 TextureMailbox::ReleaseCallback callback = 922 ReleaseCallback callback =
922 base::Bind(ReleaseTextureMailbox, &release_sync_point, &lost_resource); 923 base::Bind(ReleaseTextureMailbox, &release_sync_point, &lost_resource);
923 ResourceProvider::ResourceId resource = 924 ResourceProvider::ResourceId resource =
924 resource_provider_->CreateResourceFromTextureMailbox( 925 resource_provider_->CreateResourceFromTextureMailbox(
925 TextureMailbox(mailbox, callback, sync_point)); 926 TextureMailbox(mailbox, sync_point),
927 SingleReleaseCallback::Create(callback));
926 EXPECT_EQ(1, context()->texture_count()); 928 EXPECT_EQ(1, context()->texture_count());
927 EXPECT_EQ(0u, release_sync_point); 929 EXPECT_EQ(0u, release_sync_point);
928 { 930 {
929 // Transfer the resource, expect the sync points to be consistent. 931 // Transfer the resource, expect the sync points to be consistent.
930 ResourceProvider::ResourceIdArray resource_ids_to_transfer; 932 ResourceProvider::ResourceIdArray resource_ids_to_transfer;
931 resource_ids_to_transfer.push_back(resource); 933 resource_ids_to_transfer.push_back(resource);
932 TransferableResourceArray list; 934 TransferableResourceArray list;
933 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); 935 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list);
934 ASSERT_EQ(1u, list.size()); 936 ASSERT_EQ(1u, list.size());
935 EXPECT_LE(sync_point, list[0].sync_point); 937 EXPECT_LE(sync_point, list[0].sync_point);
(...skipping 25 matching lines...) Expand all
961 EXPECT_LE(list[0].sync_point, release_sync_point); 963 EXPECT_LE(list[0].sync_point, release_sync_point);
962 EXPECT_FALSE(lost_resource); 964 EXPECT_FALSE(lost_resource);
963 } 965 }
964 966
965 // We're going to do the same thing as above, but testing the case where we 967 // We're going to do the same thing as above, but testing the case where we
966 // delete the resource before we receive it back. 968 // delete the resource before we receive it back.
967 sync_point = release_sync_point; 969 sync_point = release_sync_point;
968 EXPECT_LT(0u, sync_point); 970 EXPECT_LT(0u, sync_point);
969 release_sync_point = 0; 971 release_sync_point = 0;
970 resource = resource_provider_->CreateResourceFromTextureMailbox( 972 resource = resource_provider_->CreateResourceFromTextureMailbox(
971 TextureMailbox(mailbox, callback, sync_point)); 973 TextureMailbox(mailbox, sync_point),
974 SingleReleaseCallback::Create(callback));
972 EXPECT_EQ(1, context()->texture_count()); 975 EXPECT_EQ(1, context()->texture_count());
973 EXPECT_EQ(0u, release_sync_point); 976 EXPECT_EQ(0u, release_sync_point);
974 { 977 {
975 // Transfer the resource, expect the sync points to be consistent. 978 // Transfer the resource, expect the sync points to be consistent.
976 ResourceProvider::ResourceIdArray resource_ids_to_transfer; 979 ResourceProvider::ResourceIdArray resource_ids_to_transfer;
977 resource_ids_to_transfer.push_back(resource); 980 resource_ids_to_transfer.push_back(resource);
978 TransferableResourceArray list; 981 TransferableResourceArray list;
979 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); 982 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list);
980 ASSERT_EQ(1u, list.size()); 983 ASSERT_EQ(1u, list.size());
981 EXPECT_LE(sync_point, list[0].sync_point); 984 EXPECT_LE(sync_point, list[0].sync_point);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 context()->bindTexture(GL_TEXTURE_2D, texture); 1026 context()->bindTexture(GL_TEXTURE_2D, texture);
1024 gpu::Mailbox mailbox; 1027 gpu::Mailbox mailbox;
1025 context()->genMailboxCHROMIUM(mailbox.name); 1028 context()->genMailboxCHROMIUM(mailbox.name);
1026 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); 1029 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
1027 unsigned sync_point = context()->insertSyncPoint(); 1030 unsigned sync_point = context()->insertSyncPoint();
1028 1031
1029 EXPECT_LT(0u, sync_point); 1032 EXPECT_LT(0u, sync_point);
1030 1033
1031 unsigned release_sync_point = 0; 1034 unsigned release_sync_point = 0;
1032 bool lost_resource = false; 1035 bool lost_resource = false;
1033 TextureMailbox::ReleaseCallback callback = 1036 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
1034 base::Bind(ReleaseTextureMailbox, &release_sync_point, &lost_resource); 1037 base::Bind(ReleaseTextureMailbox, &release_sync_point, &lost_resource));
1035 resource_provider_->CreateResourceFromTextureMailbox( 1038 resource_provider_->CreateResourceFromTextureMailbox(
1036 TextureMailbox(mailbox, callback, sync_point)); 1039 TextureMailbox(mailbox, sync_point),
1040 callback.Pass());
1037 1041
1038 EXPECT_EQ(0u, release_sync_point); 1042 EXPECT_EQ(0u, release_sync_point);
1039 EXPECT_FALSE(lost_resource); 1043 EXPECT_FALSE(lost_resource);
1040 1044
1041 resource_provider_.reset(); 1045 resource_provider_.reset();
1042 1046
1043 EXPECT_LE(sync_point, release_sync_point); 1047 EXPECT_LE(sync_point, release_sync_point);
1044 EXPECT_FALSE(lost_resource); 1048 EXPECT_FALSE(lost_resource);
1045 } 1049 }
1046 1050
(...skipping 15 matching lines...) Expand all
1062 1066
1063 TEST_P(ResourceProviderTest, ShutdownSharedMemory) { 1067 TEST_P(ResourceProviderTest, ShutdownSharedMemory) {
1064 if (GetParam() != ResourceProvider::Bitmap) 1068 if (GetParam() != ResourceProvider::Bitmap)
1065 return; 1069 return;
1066 1070
1067 gfx::Size size(64, 64); 1071 gfx::Size size(64, 64);
1068 scoped_ptr<base::SharedMemory> shared_memory( 1072 scoped_ptr<base::SharedMemory> shared_memory(
1069 CreateAndFillSharedMemory(size, 0)); 1073 CreateAndFillSharedMemory(size, 0));
1070 1074
1071 bool release_called = false; 1075 bool release_called = false;
1072 TextureMailbox::ReleaseCallback callback = 1076 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
1073 base::Bind(ReleaseSharedMemoryCallback, &release_called); 1077 base::Bind(ReleaseSharedMemoryCallback, &release_called));
1074 resource_provider_->CreateResourceFromTextureMailbox( 1078 resource_provider_->CreateResourceFromTextureMailbox(
1075 TextureMailbox(shared_memory.get(), size, callback)); 1079 TextureMailbox(shared_memory.get(), size),
1080 callback.Pass());
1076 1081
1077 resource_provider_.reset(); 1082 resource_provider_.reset();
1078 1083
1079 EXPECT_TRUE(release_called); 1084 EXPECT_TRUE(release_called);
1080 } 1085 }
1081 1086
1082 TEST_P(ResourceProviderTest, ShutdownWithExportedResource) { 1087 TEST_P(ResourceProviderTest, ShutdownWithExportedResource) {
1083 // TextureMailbox callbacks only exist for GL textures for now. 1088 // TextureMailbox callbacks only exist for GL textures for now.
1084 if (GetParam() != ResourceProvider::GLTexture) 1089 if (GetParam() != ResourceProvider::GLTexture)
1085 return; 1090 return;
1086 unsigned texture = context()->createTexture(); 1091 unsigned texture = context()->createTexture();
1087 context()->bindTexture(GL_TEXTURE_2D, texture); 1092 context()->bindTexture(GL_TEXTURE_2D, texture);
1088 gpu::Mailbox mailbox; 1093 gpu::Mailbox mailbox;
1089 context()->genMailboxCHROMIUM(mailbox.name); 1094 context()->genMailboxCHROMIUM(mailbox.name);
1090 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); 1095 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
1091 unsigned sync_point = context()->insertSyncPoint(); 1096 unsigned sync_point = context()->insertSyncPoint();
1092 1097
1093 EXPECT_LT(0u, sync_point); 1098 EXPECT_LT(0u, sync_point);
1094 1099
1095 unsigned release_sync_point = 0; 1100 unsigned release_sync_point = 0;
1096 bool lost_resource = false; 1101 bool lost_resource = false;
1097 TextureMailbox::ReleaseCallback callback = 1102 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
1098 base::Bind(ReleaseTextureMailbox, &release_sync_point, &lost_resource); 1103 base::Bind(ReleaseTextureMailbox, &release_sync_point, &lost_resource));
1099 ResourceProvider::ResourceId resource = 1104 ResourceProvider::ResourceId resource =
1100 resource_provider_->CreateResourceFromTextureMailbox( 1105 resource_provider_->CreateResourceFromTextureMailbox(
1101 TextureMailbox(mailbox, callback, sync_point)); 1106 TextureMailbox(mailbox, sync_point),
1107 callback.Pass());
1102 1108
1103 // Transfer the resource, so we can't release it properly on shutdown. 1109 // Transfer the resource, so we can't release it properly on shutdown.
1104 ResourceProvider::ResourceIdArray resource_ids_to_transfer; 1110 ResourceProvider::ResourceIdArray resource_ids_to_transfer;
1105 resource_ids_to_transfer.push_back(resource); 1111 resource_ids_to_transfer.push_back(resource);
1106 TransferableResourceArray list; 1112 TransferableResourceArray list;
1107 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); 1113 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list);
1108 1114
1109 EXPECT_EQ(0u, release_sync_point); 1115 EXPECT_EQ(0u, release_sync_point);
1110 EXPECT_FALSE(lost_resource); 1116 EXPECT_FALSE(lost_resource);
1111 1117
(...skipping 12 matching lines...) Expand all
1124 context()->bindTexture(GL_TEXTURE_2D, texture); 1130 context()->bindTexture(GL_TEXTURE_2D, texture);
1125 gpu::Mailbox mailbox; 1131 gpu::Mailbox mailbox;
1126 context()->genMailboxCHROMIUM(mailbox.name); 1132 context()->genMailboxCHROMIUM(mailbox.name);
1127 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); 1133 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
1128 unsigned sync_point = context()->insertSyncPoint(); 1134 unsigned sync_point = context()->insertSyncPoint();
1129 1135
1130 EXPECT_LT(0u, sync_point); 1136 EXPECT_LT(0u, sync_point);
1131 1137
1132 unsigned release_sync_point = 0; 1138 unsigned release_sync_point = 0;
1133 bool lost_resource = false; 1139 bool lost_resource = false;
1134 TextureMailbox::ReleaseCallback callback = 1140 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
1135 base::Bind(ReleaseTextureMailbox, &release_sync_point, &lost_resource); 1141 base::Bind(ReleaseTextureMailbox, &release_sync_point, &lost_resource));
1136 resource_provider_->CreateResourceFromTextureMailbox( 1142 resource_provider_->CreateResourceFromTextureMailbox(
1137 TextureMailbox(mailbox, callback, sync_point)); 1143 TextureMailbox(mailbox, sync_point),
1144 callback.Pass());
1138 1145
1139 EXPECT_EQ(0u, release_sync_point); 1146 EXPECT_EQ(0u, release_sync_point);
1140 EXPECT_FALSE(lost_resource); 1147 EXPECT_FALSE(lost_resource);
1141 1148
1142 resource_provider_->DidLoseOutputSurface(); 1149 resource_provider_->DidLoseOutputSurface();
1143 resource_provider_.reset(); 1150 resource_provider_.reset();
1144 1151
1145 EXPECT_LE(sync_point, release_sync_point); 1152 EXPECT_LE(sync_point, release_sync_point);
1146 EXPECT_TRUE(lost_resource); 1153 EXPECT_TRUE(lost_resource);
1147 } 1154 }
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 1341
1335 FakeOutputSurfaceClient output_surface_client; 1342 FakeOutputSurfaceClient output_surface_client;
1336 scoped_ptr<OutputSurface> output_surface( 1343 scoped_ptr<OutputSurface> output_surface(
1337 FakeOutputSurface::CreateSoftware(make_scoped_ptr( 1344 FakeOutputSurface::CreateSoftware(make_scoped_ptr(
1338 new SoftwareOutputDevice))); 1345 new SoftwareOutputDevice)));
1339 CHECK(output_surface->BindToClient(&output_surface_client)); 1346 CHECK(output_surface->BindToClient(&output_surface_client));
1340 1347
1341 scoped_ptr<ResourceProvider> resource_provider( 1348 scoped_ptr<ResourceProvider> resource_provider(
1342 ResourceProvider::Create(output_surface.get(), 0)); 1349 ResourceProvider::Create(output_surface.get(), 0));
1343 1350
1344 TextureMailbox::ReleaseCallback callback = base::Bind(&EmptyReleaseCallback); 1351 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
1345 TextureMailbox mailbox(shared_memory.get(), size, callback); 1352 base::Bind(&EmptyReleaseCallback));
1353 TextureMailbox mailbox(shared_memory.get(), size);
1346 1354
1347 ResourceProvider::ResourceId id = 1355 ResourceProvider::ResourceId id =
1348 resource_provider->CreateResourceFromTextureMailbox(mailbox); 1356 resource_provider->CreateResourceFromTextureMailbox(
1357 mailbox, callback.Pass());
1349 EXPECT_NE(0u, id); 1358 EXPECT_NE(0u, id);
1350 1359
1351 { 1360 {
1352 ResourceProvider::ScopedReadLockSoftware lock(resource_provider.get(), id); 1361 ResourceProvider::ScopedReadLockSoftware lock(resource_provider.get(), id);
1353 const SkBitmap* sk_bitmap = lock.sk_bitmap(); 1362 const SkBitmap* sk_bitmap = lock.sk_bitmap();
1354 EXPECT_EQ(sk_bitmap->width(), size.width()); 1363 EXPECT_EQ(sk_bitmap->width(), size.width());
1355 EXPECT_EQ(sk_bitmap->height(), size.height()); 1364 EXPECT_EQ(sk_bitmap->height(), size.height());
1356 EXPECT_EQ(*sk_bitmap->getAddr32(16, 16), kBadBeef); 1365 EXPECT_EQ(*sk_bitmap->getAddr32(16, 16), kBadBeef);
1357 } 1366 }
1358 } 1367 }
(...skipping 20 matching lines...) Expand all
1379 unsigned target = GL_TEXTURE_2D; 1388 unsigned target = GL_TEXTURE_2D;
1380 1389
1381 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); 1390 EXPECT_CALL(*context, bindTexture(_, _)).Times(0);
1382 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); 1391 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0);
1383 EXPECT_CALL(*context, insertSyncPoint()).Times(0); 1392 EXPECT_CALL(*context, insertSyncPoint()).Times(0);
1384 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); 1393 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0);
1385 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); 1394 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0);
1386 1395
1387 gpu::Mailbox gpu_mailbox; 1396 gpu::Mailbox gpu_mailbox;
1388 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); 1397 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1);
1389 TextureMailbox::ReleaseCallback callback = base::Bind(&EmptyReleaseCallback); 1398 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
1399 base::Bind(&EmptyReleaseCallback));
1390 1400
1391 TextureMailbox mailbox(gpu_mailbox, 1401 TextureMailbox mailbox(gpu_mailbox, sync_point);
1392 callback,
1393 sync_point);
1394 1402
1395 ResourceProvider::ResourceId id = 1403 ResourceProvider::ResourceId id =
1396 resource_provider->CreateResourceFromTextureMailbox(mailbox); 1404 resource_provider->CreateResourceFromTextureMailbox(
1405 mailbox, callback.Pass());
1397 EXPECT_NE(0u, id); 1406 EXPECT_NE(0u, id);
1398 1407
1399 Mock::VerifyAndClearExpectations(context); 1408 Mock::VerifyAndClearExpectations(context);
1400 1409
1401 { 1410 {
1402 // Using the texture does a consume of the mailbox. 1411 // Using the texture does a consume of the mailbox.
1403 EXPECT_CALL(*context, bindTexture(target, texture_id)); 1412 EXPECT_CALL(*context, bindTexture(target, texture_id));
1404 EXPECT_CALL(*context, waitSyncPoint(sync_point)); 1413 EXPECT_CALL(*context, waitSyncPoint(sync_point));
1405 EXPECT_CALL(*context, consumeTextureCHROMIUM(target, _)); 1414 EXPECT_CALL(*context, consumeTextureCHROMIUM(target, _));
1406 1415
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 unsigned target = GL_TEXTURE_EXTERNAL_OES; 1452 unsigned target = GL_TEXTURE_EXTERNAL_OES;
1444 1453
1445 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); 1454 EXPECT_CALL(*context, bindTexture(_, _)).Times(0);
1446 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); 1455 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0);
1447 EXPECT_CALL(*context, insertSyncPoint()).Times(0); 1456 EXPECT_CALL(*context, insertSyncPoint()).Times(0);
1448 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); 1457 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0);
1449 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); 1458 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0);
1450 1459
1451 gpu::Mailbox gpu_mailbox; 1460 gpu::Mailbox gpu_mailbox;
1452 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); 1461 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1);
1453 TextureMailbox::ReleaseCallback callback = base::Bind(&EmptyReleaseCallback); 1462 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
1463 base::Bind(&EmptyReleaseCallback));
1454 1464
1455 TextureMailbox mailbox(gpu_mailbox, 1465 TextureMailbox mailbox(gpu_mailbox, target, sync_point);
1456 callback,
1457 target,
1458 sync_point);
1459 1466
1460 ResourceProvider::ResourceId id = 1467 ResourceProvider::ResourceId id =
1461 resource_provider->CreateResourceFromTextureMailbox(mailbox); 1468 resource_provider->CreateResourceFromTextureMailbox(
1469 mailbox, callback.Pass());
1462 EXPECT_NE(0u, id); 1470 EXPECT_NE(0u, id);
1463 1471
1464 Mock::VerifyAndClearExpectations(context); 1472 Mock::VerifyAndClearExpectations(context);
1465 1473
1466 { 1474 {
1467 // Using the texture does a consume of the mailbox. 1475 // Using the texture does a consume of the mailbox.
1468 EXPECT_CALL(*context, bindTexture(target, texture_id)); 1476 EXPECT_CALL(*context, bindTexture(target, texture_id));
1469 EXPECT_CALL(*context, waitSyncPoint(sync_point)); 1477 EXPECT_CALL(*context, waitSyncPoint(sync_point));
1470 EXPECT_CALL(*context, consumeTextureCHROMIUM(target, _)); 1478 EXPECT_CALL(*context, consumeTextureCHROMIUM(target, _));
1471 1479
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 output_surface.get()); 1942 output_surface.get());
1935 } 1943 }
1936 1944
1937 INSTANTIATE_TEST_CASE_P( 1945 INSTANTIATE_TEST_CASE_P(
1938 ResourceProviderTests, 1946 ResourceProviderTests,
1939 ResourceProviderTest, 1947 ResourceProviderTest,
1940 ::testing::Values(ResourceProvider::GLTexture, ResourceProvider::Bitmap)); 1948 ::testing::Values(ResourceProvider::GLTexture, ResourceProvider::Bitmap));
1941 1949
1942 } // namespace 1950 } // namespace
1943 } // namespace cc 1951 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/single_release_callback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698