Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 452 // the input reference stale). | 452 // the input reference stale). |
| 453 size_t limit = vector.capacity() + 1; | 453 size_t limit = vector.capacity() + 1; |
| 454 for (size_t i = 0; i < limit; i++) | 454 for (size_t i = 0; i < limit; i++) |
| 455 vector.append(vector.first()); | 455 vector.append(vector.first()); |
| 456 | 456 |
| 457 limit = vector.capacity() + 1; | 457 limit = vector.capacity() + 1; |
| 458 for (size_t i = 0; i < limit; i++) | 458 for (size_t i = 0; i < limit; i++) |
| 459 vector.append(const_cast<const WTF::String&>(vector.first())); | 459 vector.append(const_cast<const WTF::String&>(vector.first())); |
| 460 } | 460 } |
| 461 | 461 |
| 462 // The test below is for the following issue: | |
| 463 // | |
| 464 // https://bugs.chromium.org/p/chromium/issues/detail?id=592767 | |
| 465 // | |
| 466 // where deleted copy assignment operator made canMoveWithMemcpy true because of the implementation of | |
| 467 // IsTriviallyMoveAssignable<T>. | |
| 468 | |
| 469 class MojoMoveOnlyType final { | |
|
yzshen1
2016/03/08 21:30:38
Nit: this class itself doesn't have anything to do
| |
| 470 public: | |
| 471 MojoMoveOnlyType(); | |
| 472 MojoMoveOnlyType(MojoMoveOnlyType&&); | |
| 473 MojoMoveOnlyType& operator=(MojoMoveOnlyType&&); | |
| 474 ~MojoMoveOnlyType(); | |
| 475 | |
| 476 private: | |
| 477 MojoMoveOnlyType(const MojoMoveOnlyType&) = delete; | |
| 478 void operator=(const MojoMoveOnlyType&) = delete; | |
| 479 }; | |
| 480 | |
| 481 static_assert(!IsTriviallyMoveAssignable<MojoMoveOnlyType>::value, "MojoMoveOnly Type isn't trivially move assignable."); | |
| 482 static_assert(!IsTriviallyCopyAssignable<MojoMoveOnlyType>::value, "MojoMoveOnly Type isn't trivially copy assignable."); | |
| 483 | |
| 484 static_assert(!VectorTraits<MojoMoveOnlyType>::canMoveWithMemcpy, "MojoMoveOnlyT ype can't be moved with memcpy."); | |
| 485 static_assert(!VectorTraits<MojoMoveOnlyType>::canCopyWithMemcpy, "MojoMoveOnlyT ype can't be copied with memcpy."); | |
| 486 | |
| 462 } // anonymous namespace | 487 } // anonymous namespace |
| 463 | 488 |
| 464 } // namespace WTF | 489 } // namespace WTF |
| OLD | NEW |