Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: third_party/WebKit/Source/platform/CrossThreadCopier.cpp

Issue 2355153002: Disallowed PassRefPtr copies across threads. (Closed)
Patch Set: Removed CrossThreadCopierPassThrough inheritence Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // Verify that ThreadSafeRefCounted objects get handled correctly. 69 // Verify that ThreadSafeRefCounted objects get handled correctly.
70 class CopierThreadSafeRefCountedTest : public ThreadSafeRefCounted<CopierThreadS afeRefCountedTest> { 70 class CopierThreadSafeRefCountedTest : public ThreadSafeRefCounted<CopierThreadS afeRefCountedTest> {
71 }; 71 };
72 72
73 // Add a generic specialization which will let's us verify that no other templat e matches. 73 // Add a generic specialization which will let's us verify that no other templat e matches.
74 template<typename T> struct CrossThreadCopierBase<T, false> { 74 template<typename T> struct CrossThreadCopierBase<T, false> {
75 typedef int Type; 75 typedef int Type;
76 }; 76 };
77 77
78 static_assert((std::is_same< 78 static_assert((std::is_same<
79 PassRefPtr<CopierThreadSafeRefCountedTest>, 79 CopierThreadSafeRefCountedTest,
Yuta Kitamura 2016/09/27 01:59:28 You don't have to change this.
80 CrossThreadCopier<PassRefPtr<CopierThreadSafeRefCountedTest>>::Type 80 CrossThreadCopier<PassRefPtr<CopierThreadSafeRefCountedTest>>::Type
81 >::value), 81 >::value),
82 "PassRefPtr + ThreadSafeRefCounted should pass CrossThreadCopier"); 82 "PassRefPtr + ThreadSafeRefCounted should pass CrossThreadCopier");
83 static_assert((std::is_same< 83 static_assert((std::is_same<
84 RefPtr<CopierThreadSafeRefCountedTest>, 84 RefPtr<CopierThreadSafeRefCountedTest>,
85 CrossThreadCopier<RefPtr<CopierThreadSafeRefCountedTest>>::Type 85 CrossThreadCopier<RefPtr<CopierThreadSafeRefCountedTest>>::Type
86 >::value), 86 >::value),
87 "RefPtr + ThreadSafeRefCounted should pass CrossThreadCopier"); 87 "RefPtr + ThreadSafeRefCounted should pass CrossThreadCopier");
88 static_assert((std::is_same< 88 static_assert((std::is_same<
89 int, 89 int,
(...skipping 12 matching lines...) Expand all
102 "Raw pointer + RefCounted should NOT pass CrossThreadCopier"); 102 "Raw pointer + RefCounted should NOT pass CrossThreadCopier");
103 103
104 // Verify that std::unique_ptr gets passed through. 104 // Verify that std::unique_ptr gets passed through.
105 static_assert((std::is_same< 105 static_assert((std::is_same<
106 std::unique_ptr<float>, 106 std::unique_ptr<float>,
107 CrossThreadCopier<std::unique_ptr<float>>::Type 107 CrossThreadCopier<std::unique_ptr<float>>::Type
108 >::value), 108 >::value),
109 "std::unique_ptr test"); 109 "std::unique_ptr test");
110 110
111 } // namespace blink 111 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698