OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 return str.isolatedCopy(); | 48 return str.isolatedCopy(); |
49 } | 49 } |
50 | 50 |
51 CrossThreadCopier<ResourceError>::Type CrossThreadCopier<ResourceError>::copy( | 51 CrossThreadCopier<ResourceError>::Type CrossThreadCopier<ResourceError>::copy( |
52 const ResourceError& error) { | 52 const ResourceError& error) { |
53 return error.copy(); | 53 return error.copy(); |
54 } | 54 } |
55 | 55 |
56 CrossThreadCopier<ResourceRequest>::Type | 56 CrossThreadCopier<ResourceRequest>::Type |
57 CrossThreadCopier<ResourceRequest>::copy(const ResourceRequest& request) { | 57 CrossThreadCopier<ResourceRequest>::copy(const ResourceRequest& request) { |
58 return passed(request.copyData()); | 58 return WTF::passed(request.copyData()); |
59 } | 59 } |
60 | 60 |
61 CrossThreadCopier<ResourceResponse>::Type | 61 CrossThreadCopier<ResourceResponse>::Type |
62 CrossThreadCopier<ResourceResponse>::copy(const ResourceResponse& response) { | 62 CrossThreadCopier<ResourceResponse>::copy(const ResourceResponse& response) { |
63 return passed(response.copyData()); | 63 return WTF::passed(response.copyData()); |
64 } | 64 } |
65 | 65 |
66 // Test CrossThreadCopier using static_assert. | 66 // Test CrossThreadCopier using static_assert. |
67 | 67 |
68 // Verify that ThreadSafeRefCounted objects get handled correctly. | 68 // Verify that ThreadSafeRefCounted objects get handled correctly. |
69 class CopierThreadSafeRefCountedTest | 69 class CopierThreadSafeRefCountedTest |
70 : public ThreadSafeRefCounted<CopierThreadSafeRefCountedTest> {}; | 70 : public ThreadSafeRefCounted<CopierThreadSafeRefCountedTest> {}; |
71 | 71 |
72 // Add a generic specialization which will let's us verify that no other | 72 // Add a generic specialization which will let's us verify that no other |
73 // template matches. | 73 // template matches. |
(...skipping 26 matching lines...) Expand all Loading... |
100 (std::is_same<int, CrossThreadCopier<CopierRefCountedTest*>::Type>::value), | 100 (std::is_same<int, CrossThreadCopier<CopierRefCountedTest*>::Type>::value), |
101 "Raw pointer + RefCounted should NOT pass CrossThreadCopier"); | 101 "Raw pointer + RefCounted should NOT pass CrossThreadCopier"); |
102 | 102 |
103 // Verify that std::unique_ptr gets passed through. | 103 // Verify that std::unique_ptr gets passed through. |
104 static_assert( | 104 static_assert( |
105 (std::is_same<std::unique_ptr<float>, | 105 (std::is_same<std::unique_ptr<float>, |
106 CrossThreadCopier<std::unique_ptr<float>>::Type>::value), | 106 CrossThreadCopier<std::unique_ptr<float>>::Type>::value), |
107 "std::unique_ptr test"); | 107 "std::unique_ptr test"); |
108 | 108 |
109 } // namespace blink | 109 } // namespace blink |
OLD | NEW |