OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/test/test_web_graphics_context_3d.h" | 5 #include "cc/test/test_web_graphics_context_3d.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 mailbox_name1 = '1'; | 436 mailbox_name1 = '1'; |
437 ++mailbox_name2; | 437 ++mailbox_name2; |
438 } | 438 } |
439 } | 439 } |
440 | 440 |
441 void TestWebGraphicsContext3D::loseContextCHROMIUM(GLenum current, | 441 void TestWebGraphicsContext3D::loseContextCHROMIUM(GLenum current, |
442 GLenum other) { | 442 GLenum other) { |
443 if (context_lost_) | 443 if (context_lost_) |
444 return; | 444 return; |
445 context_lost_ = true; | 445 context_lost_ = true; |
446 if (!context_lost_callback_.is_null()) | |
447 context_lost_callback_.Run(); | |
448 | 446 |
449 for (size_t i = 0; i < shared_contexts_.size(); ++i) | 447 for (size_t i = 0; i < shared_contexts_.size(); ++i) |
450 shared_contexts_[i]->loseContextCHROMIUM(current, other); | 448 shared_contexts_[i]->loseContextCHROMIUM(current, other); |
451 shared_contexts_.clear(); | 449 shared_contexts_.clear(); |
| 450 |
| 451 // In the single thread case, this could cause the context to be |
| 452 // synchronously deleted, so do it last. |
| 453 if (!context_lost_callback_.is_null()) |
| 454 context_lost_callback_.Run(); |
452 } | 455 } |
453 | 456 |
454 void TestWebGraphicsContext3D::finish() { | 457 void TestWebGraphicsContext3D::finish() { |
455 test_support_->CallAllSyncPointCallbacks(); | 458 test_support_->CallAllSyncPointCallbacks(); |
456 } | 459 } |
457 | 460 |
458 void TestWebGraphicsContext3D::flush() { | 461 void TestWebGraphicsContext3D::flush() { |
459 test_support_->CallAllSyncPointCallbacks(); | 462 test_support_->CallAllSyncPointCallbacks(); |
460 } | 463 } |
461 | 464 |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 | 735 |
733 TestWebGraphicsContext3D::Buffer::Buffer() : target(0), size(0) {} | 736 TestWebGraphicsContext3D::Buffer::Buffer() : target(0), size(0) {} |
734 | 737 |
735 TestWebGraphicsContext3D::Buffer::~Buffer() {} | 738 TestWebGraphicsContext3D::Buffer::~Buffer() {} |
736 | 739 |
737 TestWebGraphicsContext3D::Image::Image() {} | 740 TestWebGraphicsContext3D::Image::Image() {} |
738 | 741 |
739 TestWebGraphicsContext3D::Image::~Image() {} | 742 TestWebGraphicsContext3D::Image::~Image() {} |
740 | 743 |
741 } // namespace cc | 744 } // namespace cc |
OLD | NEW |