OLD | NEW |
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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 ReadTestFile("long_scrollable_page"); | 239 ReadTestFile("long_scrollable_page"); |
240 RunTest(false, false, false); | 240 RunTest(false, false, false); |
241 } | 241 } |
242 | 242 |
243 TEST_F(ScrollingLayerTreePerfTest, LongScrollablePageThreadedImplSide) { | 243 TEST_F(ScrollingLayerTreePerfTest, LongScrollablePageThreadedImplSide) { |
244 SetTestName("long_scrollable_page_threaded_impl_side"); | 244 SetTestName("long_scrollable_page_threaded_impl_side"); |
245 ReadTestFile("long_scrollable_page"); | 245 ReadTestFile("long_scrollable_page"); |
246 RunTestWithImplSidePainting(); | 246 RunTestWithImplSidePainting(); |
247 } | 247 } |
248 | 248 |
249 static void EmptyReleaseCallback(unsigned sync_point, bool lost_resource) {} | 249 static void EmptyReleaseCallback(uint32 sync_point, bool lost_resource) {} |
250 | 250 |
251 // Simulates main-thread scrolling on each frame. | 251 // Simulates main-thread scrolling on each frame. |
252 class BrowserCompositorInvalidateLayerTreePerfTest | 252 class BrowserCompositorInvalidateLayerTreePerfTest |
253 : public LayerTreeHostPerfTestJsonReader { | 253 : public LayerTreeHostPerfTestJsonReader { |
254 public: | 254 public: |
255 BrowserCompositorInvalidateLayerTreePerfTest() | 255 BrowserCompositorInvalidateLayerTreePerfTest() |
256 : next_sync_point_(1), clean_up_started_(false) {} | 256 : next_sync_point_(1), clean_up_started_(false) {} |
257 | 257 |
258 virtual void BuildTree() OVERRIDE { | 258 virtual void BuildTree() OVERRIDE { |
259 LayerTreeHostPerfTestJsonReader::BuildTree(); | 259 LayerTreeHostPerfTestJsonReader::BuildTree(); |
260 tab_contents_ = | 260 tab_contents_ = |
261 static_cast<TextureLayer*>( | 261 static_cast<TextureLayer*>( |
262 layer_tree_host()->root_layer()->children()[0]-> | 262 layer_tree_host()->root_layer()->children()[0]-> |
263 children()[0]-> | 263 children()[0]-> |
264 children()[0]-> | 264 children()[0]-> |
265 children()[0].get()); | 265 children()[0].get()); |
266 ASSERT_TRUE(tab_contents_.get()); | 266 ASSERT_TRUE(tab_contents_.get()); |
267 } | 267 } |
268 | 268 |
269 virtual void WillCommit() OVERRIDE { | 269 virtual void WillCommit() OVERRIDE { |
270 gpu::Mailbox gpu_mailbox; | 270 gpu::Mailbox gpu_mailbox; |
271 std::ostringstream name_stream; | 271 std::ostringstream name_stream; |
272 name_stream << "name" << next_sync_point_; | 272 name_stream << "name" << next_sync_point_; |
273 gpu_mailbox.SetName( | 273 gpu_mailbox.SetName( |
274 reinterpret_cast<const int8*>(name_stream.str().c_str())); | 274 reinterpret_cast<const int8*>(name_stream.str().c_str())); |
275 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( | 275 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( |
276 base::Bind(&EmptyReleaseCallback)); | 276 base::Bind(&EmptyReleaseCallback)); |
277 TextureMailbox mailbox(gpu_mailbox, next_sync_point_); | 277 TextureMailbox mailbox(gpu_mailbox, GL_TEXTURE_2D, next_sync_point_); |
278 next_sync_point_++; | 278 next_sync_point_++; |
279 | 279 |
280 tab_contents_->SetTextureMailbox(mailbox, callback.Pass()); | 280 tab_contents_->SetTextureMailbox(mailbox, callback.Pass()); |
281 } | 281 } |
282 | 282 |
283 virtual void DidCommit() OVERRIDE { | 283 virtual void DidCommit() OVERRIDE { |
284 if (CleanUpStarted()) | 284 if (CleanUpStarted()) |
285 return; | 285 return; |
286 layer_tree_host()->SetNeedsCommit(); | 286 layer_tree_host()->SetNeedsCommit(); |
287 } | 287 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 | 388 |
389 TEST_F(PageScaleImplSidePaintingPerfTest, HeavyPage) { | 389 TEST_F(PageScaleImplSidePaintingPerfTest, HeavyPage) { |
390 measure_commit_cost_ = true; | 390 measure_commit_cost_ = true; |
391 SetTestName("heavy_page_page_scale"); | 391 SetTestName("heavy_page_page_scale"); |
392 ReadTestFile("heavy_layer_tree"); | 392 ReadTestFile("heavy_layer_tree"); |
393 RunTestWithImplSidePainting(); | 393 RunTestWithImplSidePainting(); |
394 } | 394 } |
395 | 395 |
396 } // namespace | 396 } // namespace |
397 } // namespace cc | 397 } // namespace cc |
OLD | NEW |