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

Side by Side Diff: cc/layers/texture_layer_unittest.cc

Issue 2147873003: cc: Dedup IPCs to return resources to client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add bool is_swap_ack + remove CompositorFrameAck Created 4 years, 5 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
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/layers/texture_layer.h" 5 #include "cc/layers/texture_layer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 #include <string> 11 #include <string>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ptr_util.h" 17 #include "base/memory/ptr_util.h"
18 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
19 #include "base/synchronization/lock.h" 19 #include "base/synchronization/lock.h"
20 #include "base/synchronization/waitable_event.h" 20 #include "base/synchronization/waitable_event.h"
21 #include "base/threading/thread.h" 21 #include "base/threading/thread.h"
22 #include "base/threading/thread_task_runner_handle.h" 22 #include "base/threading/thread_task_runner_handle.h"
23 #include "base/time/time.h" 23 #include "base/time/time.h"
24 #include "cc/animation/animation_host.h" 24 #include "cc/animation/animation_host.h"
25 #include "cc/layers/solid_color_layer.h" 25 #include "cc/layers/solid_color_layer.h"
26 #include "cc/layers/texture_layer_client.h" 26 #include "cc/layers/texture_layer_client.h"
27 #include "cc/layers/texture_layer_impl.h" 27 #include "cc/layers/texture_layer_impl.h"
28 #include "cc/output/compositor_frame_ack.h"
29 #include "cc/output/context_provider.h" 28 #include "cc/output/context_provider.h"
30 #include "cc/resources/returned_resource.h" 29 #include "cc/resources/returned_resource.h"
31 #include "cc/test/fake_impl_task_runner_provider.h" 30 #include "cc/test/fake_impl_task_runner_provider.h"
32 #include "cc/test/fake_layer_tree_host_client.h" 31 #include "cc/test/fake_layer_tree_host_client.h"
33 #include "cc/test/fake_layer_tree_host_impl.h" 32 #include "cc/test/fake_layer_tree_host_impl.h"
34 #include "cc/test/fake_output_surface.h" 33 #include "cc/test/fake_output_surface.h"
35 #include "cc/test/layer_test_common.h" 34 #include "cc/test/layer_test_common.h"
36 #include "cc/test/layer_tree_test.h" 35 #include "cc/test/layer_tree_test.h"
37 #include "cc/test/test_task_graph_runner.h" 36 #include "cc/test/test_task_graph_runner.h"
38 #include "cc/test/test_web_graphics_context_3d.h" 37 #include "cc/test/test_web_graphics_context_3d.h"
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 ASSERT_TRUE(result); 1108 ASSERT_TRUE(result);
1110 DelegatedFrameData* delegated_frame_data = 1109 DelegatedFrameData* delegated_frame_data =
1111 output_surface()->last_sent_frame()->delegated_frame_data.get(); 1110 output_surface()->last_sent_frame()->delegated_frame_data.get();
1112 if (!delegated_frame_data) 1111 if (!delegated_frame_data)
1113 return; 1112 return;
1114 1113
1115 // Return all resources immediately. 1114 // Return all resources immediately.
1116 TransferableResourceArray resources_to_return = 1115 TransferableResourceArray resources_to_return =
1117 output_surface()->resources_held_by_parent(); 1116 output_surface()->resources_held_by_parent();
1118 1117
1119 CompositorFrameAck ack; 1118 ReturnedResourceArray resources;
1120 for (size_t i = 0; i < resources_to_return.size(); ++i) 1119 for (size_t i = 0; i < resources_to_return.size(); ++i)
1121 output_surface()->ReturnResource(resources_to_return[i].id, &ack); 1120 output_surface()->ReturnResource(resources_to_return[i].id, &resources);
1122 host_impl->ReclaimResources(&ack); 1121 host_impl->ReclaimResources(resources);
1123 } 1122 }
1124 1123
1125 void AfterTest() override {} 1124 void AfterTest() override {}
1126 1125
1127 private: 1126 private:
1128 scoped_refptr<TextureLayer> texture_layer_; 1127 scoped_refptr<TextureLayer> texture_layer_;
1129 }; 1128 };
1130 1129
1131 SINGLE_AND_MULTI_THREAD_TEST_F(TextureLayerNoExtraCommitForMailboxTest); 1130 SINGLE_AND_MULTI_THREAD_TEST_F(TextureLayerNoExtraCommitForMailboxTest);
1132 1131
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 ASSERT_TRUE(result); 1245 ASSERT_TRUE(result);
1247 DelegatedFrameData* delegated_frame_data = 1246 DelegatedFrameData* delegated_frame_data =
1248 output_surface()->last_sent_frame()->delegated_frame_data.get(); 1247 output_surface()->last_sent_frame()->delegated_frame_data.get();
1249 if (!delegated_frame_data) 1248 if (!delegated_frame_data)
1250 return; 1249 return;
1251 1250
1252 // Return all resources immediately. 1251 // Return all resources immediately.
1253 TransferableResourceArray resources_to_return = 1252 TransferableResourceArray resources_to_return =
1254 output_surface()->resources_held_by_parent(); 1253 output_surface()->resources_held_by_parent();
1255 1254
1256 CompositorFrameAck ack; 1255 ReturnedResourceArray resources;
1257 for (size_t i = 0; i < resources_to_return.size(); ++i) 1256 for (size_t i = 0; i < resources_to_return.size(); ++i)
1258 output_surface()->ReturnResource(resources_to_return[i].id, &ack); 1257 output_surface()->ReturnResource(resources_to_return[i].id, &resources);
1259 host_impl->ReclaimResources(&ack); 1258 host_impl->ReclaimResources(resources);
1260 } 1259 }
1261 1260
1262 void AfterTest() override {} 1261 void AfterTest() override {}
1263 1262
1264 private: 1263 private:
1265 scoped_refptr<SolidColorLayer> solid_layer_; 1264 scoped_refptr<SolidColorLayer> solid_layer_;
1266 scoped_refptr<Layer> parent_layer_; 1265 scoped_refptr<Layer> parent_layer_;
1267 scoped_refptr<TextureLayer> texture_layer_; 1266 scoped_refptr<TextureLayer> texture_layer_;
1268 1267
1269 // Used on the main thread. 1268 // Used on the main thread.
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 int callback_count_; 1488 int callback_count_;
1490 scoped_refptr<Layer> root_; 1489 scoped_refptr<Layer> root_;
1491 scoped_refptr<TextureLayer> layer_; 1490 scoped_refptr<TextureLayer> layer_;
1492 }; 1491 };
1493 1492
1494 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 1493 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
1495 TextureLayerWithMailboxImplThreadDeleted); 1494 TextureLayerWithMailboxImplThreadDeleted);
1496 1495
1497 } // namespace 1496 } // namespace
1498 } // namespace cc 1497 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698