Chromium Code Reviews| 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "cc/layers/content_layer.h" | 8 #include "cc/layers/content_layer.h" |
| 9 #include "cc/layers/heads_up_display_layer.h" | 9 #include "cc/layers/heads_up_display_layer.h" |
| 10 #include "cc/layers/io_surface_layer.h" | 10 #include "cc/layers/io_surface_layer.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 times_to_lose_during_draw_(0), | 55 times_to_lose_during_draw_(0), |
| 56 times_to_fail_recreate_(0), | 56 times_to_fail_recreate_(0), |
| 57 times_to_fail_reinitialize_(0), | 57 times_to_fail_reinitialize_(0), |
| 58 times_to_lose_on_recreate_(0), | 58 times_to_lose_on_recreate_(0), |
| 59 times_to_fail_create_offscreen_(0), | 59 times_to_fail_create_offscreen_(0), |
| 60 times_to_fail_recreate_offscreen_(0), | 60 times_to_fail_recreate_offscreen_(0), |
| 61 times_to_expect_create_failed_(0), | 61 times_to_expect_create_failed_(0), |
| 62 times_create_failed_(0), | 62 times_create_failed_(0), |
| 63 times_offscreen_created_(0), | 63 times_offscreen_created_(0), |
| 64 committed_at_least_once_(false), | 64 committed_at_least_once_(false), |
| 65 context_should_support_io_surface_(false) { | 65 context_should_support_io_surface_(false), |
| 66 fallback_context_works_(false) { | |
| 66 media::InitializeMediaLibraryForTesting(); | 67 media::InitializeMediaLibraryForTesting(); |
| 67 } | 68 } |
| 68 | 69 |
| 69 void LoseContext() { | 70 void LoseContext() { |
| 70 context3d_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 71 context3d_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
| 71 GL_INNOCENT_CONTEXT_RESET_ARB); | 72 GL_INNOCENT_CONTEXT_RESET_ARB); |
| 72 context3d_ = NULL; | 73 context3d_ = NULL; |
| 73 } | 74 } |
| 74 | 75 |
| 75 virtual scoped_ptr<TestWebGraphicsContext3D> CreateContext3d() { | 76 virtual scoped_ptr<TestWebGraphicsContext3D> CreateContext3d() { |
| 76 return TestWebGraphicsContext3D::Create(); | 77 return TestWebGraphicsContext3D::Create(); |
| 77 } | 78 } |
| 78 | 79 |
| 79 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { | 80 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) |
| 81 OVERRIDE { | |
| 80 if (times_to_fail_create_) { | 82 if (times_to_fail_create_) { |
| 81 --times_to_fail_create_; | 83 --times_to_fail_create_; |
| 82 ExpectCreateToFail(); | 84 ExpectCreateToFail(); |
| 83 return scoped_ptr<OutputSurface>(); | 85 return scoped_ptr<OutputSurface>(); |
| 84 } | 86 } |
| 85 | 87 |
| 86 scoped_ptr<TestWebGraphicsContext3D> context3d = CreateContext3d(); | 88 scoped_ptr<TestWebGraphicsContext3D> context3d = CreateContext3d(); |
| 87 context3d_ = context3d.get(); | 89 context3d_ = context3d.get(); |
| 88 | 90 |
| 89 if (context_should_support_io_surface_) { | 91 if (context_should_support_io_surface_) { |
| 90 context3d_->set_have_extension_io_surface(true); | 92 context3d_->set_have_extension_io_surface(true); |
| 91 context3d_->set_have_extension_egl_image(true); | 93 context3d_->set_have_extension_egl_image(true); |
| 92 } | 94 } |
| 93 | 95 |
| 94 if (times_to_fail_initialize_) { | 96 if (times_to_fail_initialize_ && !(fallback && fallback_context_works_)) { |
| 95 --times_to_fail_initialize_; | 97 --times_to_fail_initialize_; |
| 96 // Make the context get lost during reinitialization. | 98 // Make the context get lost during reinitialization. |
| 97 // The number of times MakeCurrent succeeds is not important, and | 99 // The number of times MakeCurrent succeeds is not important, and |
| 98 // can be changed if needed to make this pass with future changes. | 100 // can be changed if needed to make this pass with future changes. |
| 99 context3d_->set_times_make_current_succeeds(2); | 101 context3d_->set_times_make_current_succeeds(2); |
| 100 ExpectCreateToFail(); | 102 ExpectCreateToFail(); |
| 101 } else if (times_to_lose_on_create_) { | 103 } else if (times_to_lose_on_create_) { |
| 102 --times_to_lose_on_create_; | 104 --times_to_lose_on_create_; |
| 103 LoseContext(); | 105 LoseContext(); |
| 104 ExpectCreateToFail(); | 106 ExpectCreateToFail(); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 int times_to_fail_recreate_; | 226 int times_to_fail_recreate_; |
| 225 int times_to_fail_reinitialize_; | 227 int times_to_fail_reinitialize_; |
| 226 int times_to_lose_on_recreate_; | 228 int times_to_lose_on_recreate_; |
| 227 int times_to_fail_create_offscreen_; | 229 int times_to_fail_create_offscreen_; |
| 228 int times_to_fail_recreate_offscreen_; | 230 int times_to_fail_recreate_offscreen_; |
| 229 int times_to_expect_create_failed_; | 231 int times_to_expect_create_failed_; |
| 230 int times_create_failed_; | 232 int times_create_failed_; |
| 231 int times_offscreen_created_; | 233 int times_offscreen_created_; |
| 232 bool committed_at_least_once_; | 234 bool committed_at_least_once_; |
| 233 bool context_should_support_io_surface_; | 235 bool context_should_support_io_surface_; |
| 236 bool fallback_context_works_; | |
| 234 | 237 |
| 235 scoped_refptr<FakeContextProvider> offscreen_contexts_main_thread_; | 238 scoped_refptr<FakeContextProvider> offscreen_contexts_main_thread_; |
| 236 scoped_refptr<FakeContextProvider> offscreen_contexts_compositor_thread_; | 239 scoped_refptr<FakeContextProvider> offscreen_contexts_compositor_thread_; |
| 237 }; | 240 }; |
| 238 | 241 |
| 239 class LayerTreeHostContextTestLostContextSucceeds | 242 class LayerTreeHostContextTestLostContextSucceeds |
| 240 : public LayerTreeHostContextTest { | 243 : public LayerTreeHostContextTest { |
| 241 public: | 244 public: |
| 242 LayerTreeHostContextTestLostContextSucceeds() | 245 LayerTreeHostContextTestLostContextSucceeds() |
| 243 : LayerTreeHostContextTest(), | 246 : LayerTreeHostContextTest(), |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 255 | 258 |
| 256 if (first_initialized_) | 259 if (first_initialized_) |
| 257 ++num_losses_; | 260 ++num_losses_; |
| 258 else | 261 else |
| 259 first_initialized_ = true; | 262 first_initialized_ = true; |
| 260 | 263 |
| 261 recovered_context_ = true; | 264 recovered_context_ = true; |
| 262 } | 265 } |
| 263 | 266 |
| 264 virtual void AfterTest() OVERRIDE { | 267 virtual void AfterTest() OVERRIDE { |
| 265 EXPECT_EQ(10u, test_case_); | 268 EXPECT_EQ(11u, test_case_); |
| 266 EXPECT_EQ(8 + 10 + 10, num_losses_); | 269 EXPECT_EQ(8 + 10 + 10 + 1, num_losses_); |
|
danakj
2013/07/30 01:04:07
Heh, I should have commented this variable the las
| |
| 267 } | 270 } |
| 268 | 271 |
| 269 virtual void DidCommitAndDrawFrame() OVERRIDE { | 272 virtual void DidCommitAndDrawFrame() OVERRIDE { |
| 270 // If the last frame had a context loss, then we'll commit again to | 273 // If the last frame had a context loss, then we'll commit again to |
| 271 // recover. | 274 // recover. |
| 272 if (!recovered_context_) | 275 if (!recovered_context_) |
| 273 return; | 276 return; |
| 274 if (times_to_lose_during_commit_) | 277 if (times_to_lose_during_commit_) |
| 275 return; | 278 return; |
| 276 if (times_to_lose_during_draw_) | 279 if (times_to_lose_during_draw_) |
| 277 return; | 280 return; |
| 278 | 281 |
| 279 recovered_context_ = false; | 282 recovered_context_ = false; |
| 280 if (NextTestCase()) | 283 if (NextTestCase()) |
| 281 InvalidateAndSetNeedsCommit(); | 284 InvalidateAndSetNeedsCommit(); |
| 282 else | 285 else |
| 283 EndTest(); | 286 EndTest(); |
| 284 } | 287 } |
| 285 | 288 |
| 286 virtual void InvalidateAndSetNeedsCommit() { | 289 virtual void InvalidateAndSetNeedsCommit() { |
| 287 // Cause damage so we try to draw. | 290 // Cause damage so we try to draw. |
| 288 layer_tree_host()->root_layer()->SetNeedsDisplay(); | 291 layer_tree_host()->root_layer()->SetNeedsDisplay(); |
| 289 } | 292 } |
| 290 | 293 |
| 291 bool NextTestCase() { | 294 bool NextTestCase() { |
| 292 static const TestCase kTests[] = { | 295 static const TestCase kTests[] = { |
| 293 // Losing the context and failing to recreate it (or losing it again | 296 // Losing the context and failing to recreate it (or losing it again |
| 294 // immediately) a small number of times should succeed. | 297 // immediately) a small number of times should succeed. |
| 295 { 1, // times_to_lose_during_commit | 298 { 1, // times_to_lose_during_commit |
| 296 0, // times_to_lose_during_draw | 299 0, // times_to_lose_during_draw |
| 297 3, // times_to_fail_reinitialize | 300 3, // times_to_fail_reinitialize |
| 298 0, // times_to_fail_recreate | 301 0, // times_to_fail_recreate |
| 299 0, // times_to_lose_on_recreate | 302 0, // times_to_lose_on_recreate |
| 300 0, // times_to_fail_recreate_offscreen | 303 0, // times_to_fail_recreate_offscreen |
| 301 }, | 304 false, // fallback_context_works |
| 302 { 0, // times_to_lose_during_commit | 305 }, |
| 303 1, // times_to_lose_during_draw | 306 { 0, // times_to_lose_during_commit |
| 304 3, // times_to_fail_reinitialize | 307 1, // times_to_lose_during_draw |
| 305 0, // times_to_fail_recreate | 308 3, // times_to_fail_reinitialize |
| 306 0, // times_to_lose_on_recreate | 309 0, // times_to_fail_recreate |
| 307 0, // times_to_fail_recreate_offscreen | 310 0, // times_to_lose_on_recreate |
| 308 }, | 311 0, // times_to_fail_recreate_offscreen |
| 309 { 1, // times_to_lose_during_commit | 312 false, // fallback_context_works |
| 310 0, // times_to_lose_during_draw | 313 }, |
| 311 0, // times_to_fail_reinitialize | 314 { 1, // times_to_lose_during_commit |
| 312 3, // times_to_fail_recreate | 315 0, // times_to_lose_during_draw |
| 313 0, // times_to_lose_on_recreate | 316 0, // times_to_fail_reinitialize |
| 314 0, // times_to_fail_recreate_offscreen | 317 3, // times_to_fail_recreate |
| 315 }, | 318 0, // times_to_lose_on_recreate |
| 316 { 0, // times_to_lose_during_commit | 319 0, // times_to_fail_recreate_offscreen |
| 317 1, // times_to_lose_during_draw | 320 false, // fallback_context_works |
| 318 0, // times_to_fail_reinitialize | 321 }, |
| 319 3, // times_to_fail_recreate | 322 { 0, // times_to_lose_during_commit |
| 320 0, // times_to_lose_on_recreate | 323 1, // times_to_lose_during_draw |
| 321 0, // times_to_fail_recreate_offscreen | 324 0, // times_to_fail_reinitialize |
| 322 }, | 325 3, // times_to_fail_recreate |
| 323 { 1, // times_to_lose_during_commit | 326 0, // times_to_lose_on_recreate |
| 324 0, // times_to_lose_during_draw | 327 0, // times_to_fail_recreate_offscreen |
| 325 0, // times_to_fail_reinitialize | 328 false, // fallback_context_works |
| 326 0, // times_to_fail_recreate | 329 }, |
| 327 3, // times_to_lose_on_recreate | 330 { 1, // times_to_lose_during_commit |
| 328 0, // times_to_fail_recreate_offscreen | 331 0, // times_to_lose_during_draw |
| 329 }, | 332 0, // times_to_fail_reinitialize |
| 330 { 0, // times_to_lose_during_commit | 333 0, // times_to_fail_recreate |
| 331 1, // times_to_lose_during_draw | 334 3, // times_to_lose_on_recreate |
| 332 0, // times_to_fail_reinitialize | 335 0, // times_to_fail_recreate_offscreen |
| 333 0, // times_to_fail_recreate | 336 false, // fallback_context_works |
| 334 3, // times_to_lose_on_recreate | 337 }, |
| 335 0, // times_to_fail_recreate_offscreen | 338 { 0, // times_to_lose_during_commit |
| 336 }, | 339 1, // times_to_lose_during_draw |
| 337 { 1, // times_to_lose_during_commit | 340 0, // times_to_fail_reinitialize |
| 338 0, // times_to_lose_during_draw | 341 0, // times_to_fail_recreate |
| 339 0, // times_to_fail_reinitialize | 342 3, // times_to_lose_on_recreate |
| 340 0, // times_to_fail_recreate | 343 0, // times_to_fail_recreate_offscreen |
| 341 0, // times_to_lose_on_recreate | 344 false, // fallback_context_works |
| 342 3, // times_to_fail_recreate_offscreen | 345 }, |
| 343 }, | 346 { 1, // times_to_lose_during_commit |
| 344 { 0, // times_to_lose_during_commit | 347 0, // times_to_lose_during_draw |
| 345 1, // times_to_lose_during_draw | 348 0, // times_to_fail_reinitialize |
| 346 0, // times_to_fail_reinitialize | 349 0, // times_to_fail_recreate |
| 347 0, // times_to_fail_recreate | 350 0, // times_to_lose_on_recreate |
| 348 0, // times_to_lose_on_recreate | 351 3, // times_to_fail_recreate_offscreen |
| 349 3, // times_to_fail_recreate_offscreen | 352 false, // fallback_context_works |
| 350 }, | 353 }, |
| 351 // Losing the context and recreating it any number of times should | 354 { 0, // times_to_lose_during_commit |
| 355 1, // times_to_lose_during_draw | |
| 356 0, // times_to_fail_reinitialize | |
| 357 0, // times_to_fail_recreate | |
| 358 0, // times_to_lose_on_recreate | |
| 359 3, // times_to_fail_recreate_offscreen | |
| 360 false, // fallback_context_works | |
| 361 }, | |
| 362 // Losing the context and recreating it any number of times should | |
| 352 // succeed. | 363 // succeed. |
| 353 { 10, // times_to_lose_during_commit | 364 { 10, // times_to_lose_during_commit |
| 354 0, // times_to_lose_during_draw | 365 0, // times_to_lose_during_draw |
| 355 0, // times_to_fail_reinitialize | 366 0, // times_to_fail_reinitialize |
| 356 0, // times_to_fail_recreate | 367 0, // times_to_fail_recreate |
| 357 0, // times_to_lose_on_recreate | 368 0, // times_to_lose_on_recreate |
| 358 0, // times_to_fail_recreate_offscreen | 369 0, // times_to_fail_recreate_offscreen |
| 359 }, | 370 false, // fallback_context_works |
| 360 { 0, // times_to_lose_during_commit | 371 }, |
| 361 10, // times_to_lose_during_draw | 372 { 0, // times_to_lose_during_commit |
| 362 0, // times_to_fail_reinitialize | 373 10, // times_to_lose_during_draw |
| 363 0, // times_to_fail_recreate | 374 0, // times_to_fail_reinitialize |
| 364 0, // times_to_lose_on_recreate | 375 0, // times_to_fail_recreate |
| 365 0, // times_to_fail_recreate_offscreen | 376 0, // times_to_lose_on_recreate |
| 366 }, | 377 0, // times_to_fail_recreate_offscreen |
| 378 false, // fallback_context_works | |
| 379 }, | |
| 380 // Losing the context, failing to reinitialize it, and making a fallback | |
| 381 // context should work. | |
| 382 { 0, // times_to_lose_during_commit | |
| 383 1, // times_to_lose_during_draw | |
| 384 10, // times_to_fail_reinitialize | |
| 385 0, // times_to_fail_recreate | |
| 386 0, // times_to_lose_on_recreate | |
| 387 0, // times_to_fail_recreate_offscreen | |
| 388 true, // fallback_context_works | |
| 389 }, | |
| 367 }; | 390 }; |
| 368 | 391 |
| 369 if (test_case_ >= arraysize(kTests)) | 392 if (test_case_ >= arraysize(kTests)) |
| 370 return false; | 393 return false; |
| 371 | 394 |
| 372 times_to_lose_during_commit_ = | 395 times_to_lose_during_commit_ = |
| 373 kTests[test_case_].times_to_lose_during_commit; | 396 kTests[test_case_].times_to_lose_during_commit; |
| 374 times_to_lose_during_draw_ = | 397 times_to_lose_during_draw_ = |
| 375 kTests[test_case_].times_to_lose_during_draw; | 398 kTests[test_case_].times_to_lose_during_draw; |
| 376 times_to_fail_reinitialize_ = kTests[test_case_].times_to_fail_reinitialize; | 399 times_to_fail_reinitialize_ = kTests[test_case_].times_to_fail_reinitialize; |
| 377 times_to_fail_recreate_ = kTests[test_case_].times_to_fail_recreate; | 400 times_to_fail_recreate_ = kTests[test_case_].times_to_fail_recreate; |
| 378 times_to_lose_on_recreate_ = kTests[test_case_].times_to_lose_on_recreate; | 401 times_to_lose_on_recreate_ = kTests[test_case_].times_to_lose_on_recreate; |
| 379 times_to_fail_recreate_offscreen_ = | 402 times_to_fail_recreate_offscreen_ = |
| 380 kTests[test_case_].times_to_fail_recreate_offscreen; | 403 kTests[test_case_].times_to_fail_recreate_offscreen; |
| 404 fallback_context_works_ = kTests[test_case_].fallback_context_works; | |
| 381 ++test_case_; | 405 ++test_case_; |
| 382 return true; | 406 return true; |
| 383 } | 407 } |
| 384 | 408 |
| 385 struct TestCase { | 409 struct TestCase { |
| 386 int times_to_lose_during_commit; | 410 int times_to_lose_during_commit; |
| 387 int times_to_lose_during_draw; | 411 int times_to_lose_during_draw; |
| 388 int times_to_fail_reinitialize; | 412 int times_to_fail_reinitialize; |
| 389 int times_to_fail_recreate; | 413 int times_to_fail_recreate; |
| 390 int times_to_lose_on_recreate; | 414 int times_to_lose_on_recreate; |
| 391 int times_to_fail_recreate_offscreen; | 415 int times_to_fail_recreate_offscreen; |
| 416 bool fallback_context_works; | |
| 392 }; | 417 }; |
| 393 | 418 |
| 394 protected: | 419 protected: |
| 395 size_t test_case_; | 420 size_t test_case_; |
| 396 int num_losses_; | 421 int num_losses_; |
| 397 bool recovered_context_; | 422 bool recovered_context_; |
| 398 bool first_initialized_; | 423 bool first_initialized_; |
| 399 }; | 424 }; |
| 400 | 425 |
| 401 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestLostContextSucceeds); | 426 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestLostContextSucceeds); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 458 } | 483 } |
| 459 } | 484 } |
| 460 | 485 |
| 461 virtual void AfterTest() OVERRIDE { | 486 virtual void AfterTest() OVERRIDE { |
| 462 LayerTreeHostContextTestLostContextSucceeds::AfterTest(); | 487 LayerTreeHostContextTestLostContextSucceeds::AfterTest(); |
| 463 if (use_surface_) { | 488 if (use_surface_) { |
| 464 // 1 create to start with + | 489 // 1 create to start with + |
| 465 // 6 from test cases that fail on initializing the renderer (after the | 490 // 6 from test cases that fail on initializing the renderer (after the |
| 466 // offscreen context is created) + | 491 // offscreen context is created) + |
| 467 // 6 from test cases that lose the offscreen context directly + | 492 // 6 from test cases that lose the offscreen context directly + |
| 493 // 4 from test cases that create a fallback + | |
| 468 // All the test cases that recreate both contexts only once | 494 // All the test cases that recreate both contexts only once |
| 469 // per time it is lost. | 495 // per time it is lost. |
| 470 EXPECT_EQ(6 + 6 + 1 + num_losses_, times_offscreen_created_); | 496 EXPECT_EQ(6 + 6 + 1 + 4 + num_losses_, times_offscreen_created_); |
| 471 } else { | 497 } else { |
| 472 EXPECT_EQ(0, times_offscreen_created_); | 498 EXPECT_EQ(0, times_offscreen_created_); |
| 473 } | 499 } |
| 474 } | 500 } |
| 475 | 501 |
| 476 protected: | 502 protected: |
| 477 bool use_surface_; | 503 bool use_surface_; |
| 478 FakeContentLayerClient client_; | 504 FakeContentLayerClient client_; |
| 479 scoped_refptr<Layer> root_; | 505 scoped_refptr<Layer> root_; |
| 480 scoped_refptr<ContentLayer> content_; | 506 scoped_refptr<ContentLayer> content_; |
| (...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1568 | 1594 |
| 1569 // Not reusing LayerTreeTest because it expects creating LTH to always succeed. | 1595 // Not reusing LayerTreeTest because it expects creating LTH to always succeed. |
| 1570 class LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface | 1596 class LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface |
| 1571 : public testing::Test, | 1597 : public testing::Test, |
| 1572 public FakeLayerTreeHostClient { | 1598 public FakeLayerTreeHostClient { |
| 1573 public: | 1599 public: |
| 1574 LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface() | 1600 LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface() |
| 1575 : FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D) {} | 1601 : FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D) {} |
| 1576 | 1602 |
| 1577 // FakeLayerTreeHostClient implementation. | 1603 // FakeLayerTreeHostClient implementation. |
| 1578 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { | 1604 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) |
| 1605 OVERRIDE { | |
| 1579 return scoped_ptr<OutputSurface>(); | 1606 return scoped_ptr<OutputSurface>(); |
| 1580 } | 1607 } |
| 1581 | 1608 |
| 1582 void RunTest(bool threaded, | 1609 void RunTest(bool threaded, |
| 1583 bool delegating_renderer, | 1610 bool delegating_renderer, |
| 1584 bool impl_side_painting) { | 1611 bool impl_side_painting) { |
| 1585 scoped_ptr<base::Thread> impl_thread; | 1612 scoped_ptr<base::Thread> impl_thread; |
| 1586 if (threaded) { | 1613 if (threaded) { |
| 1587 impl_thread.reset(new base::Thread("LayerTreeTest")); | 1614 impl_thread.reset(new base::Thread("LayerTreeTest")); |
| 1588 ASSERT_TRUE(impl_thread->Start()); | 1615 ASSERT_TRUE(impl_thread->Start()); |
| 1589 ASSERT_TRUE(impl_thread->message_loop_proxy().get()); | 1616 ASSERT_TRUE(impl_thread->message_loop_proxy().get()); |
| 1590 } | 1617 } |
| 1591 | 1618 |
| 1592 LayerTreeSettings settings; | 1619 LayerTreeSettings settings; |
| 1593 settings.impl_side_painting = impl_side_painting; | 1620 settings.impl_side_painting = impl_side_painting; |
| 1594 scoped_ptr<LayerTreeHost> layer_tree_host = LayerTreeHost::Create( | 1621 scoped_ptr<LayerTreeHost> layer_tree_host = LayerTreeHost::Create( |
| 1595 this, | 1622 this, |
| 1596 settings, | 1623 settings, |
| 1597 impl_thread ? impl_thread->message_loop_proxy() : NULL); | 1624 impl_thread ? impl_thread->message_loop_proxy() : NULL); |
| 1598 EXPECT_FALSE(layer_tree_host); | 1625 EXPECT_FALSE(layer_tree_host); |
| 1599 } | 1626 } |
| 1600 }; | 1627 }; |
| 1601 | 1628 |
| 1602 SINGLE_AND_MULTI_THREAD_TEST_F( | 1629 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1603 LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface); | 1630 LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface); |
| 1604 | 1631 |
| 1605 } // namespace | 1632 } // namespace |
| 1606 } // namespace cc | 1633 } // namespace cc |
| OLD | NEW |