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

Side by Side Diff: third_party/WebKit/Source/core/dom/CrossThreadTask.h

Issue 1925583003: Replace AllowCrossThreadAccess() + non-GCed pointers with crossThreadUnretained() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Kuroneko_4
Patch Set: Rebase. Created 4 years, 5 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-2010 Google Inc. All rights reserved. 2 * Copyright (C) 2009-2010 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // ptr->member(p1, ..., pn); 73 // ptr->member(p1, ..., pn);
74 // 74 //
75 // ExecutionContext: 75 // ExecutionContext:
76 // |context| is supplied by the target thread. 76 // |context| is supplied by the target thread.
77 // 77 //
78 // Deep copies by threadSafeBind(): 78 // Deep copies by threadSafeBind():
79 // |ptr|, |p1|, ..., |pn| are processed by threadSafeBind() and thus 79 // |ptr|, |p1|, ..., |pn| are processed by threadSafeBind() and thus
80 // CrossThreadCopier. 80 // CrossThreadCopier.
81 // You don't have to call manually e.g. isolatedCopy(). 81 // You don't have to call manually e.g. isolatedCopy().
82 // To pass things that cannot be copied by CrossThreadCopier 82 // To pass things that cannot be copied by CrossThreadCopier
83 // (e.g. pointers), use AllowCrossThreadAccess() explicitly. 83 // (e.g. pointers), use crossThreadUnretained() explicitly.
84 84
85 // RETTYPE, PS, and MPS are added as template parameters to circumvent MSVC 18.0 0.21005.1 (VS 2013) issues. 85 // RETTYPE, PS, and MPS are added as template parameters to circumvent MSVC 18.0 0.21005.1 (VS 2013) issues.
86 86
87 template<typename FunctionType, typename... P, 87 template<typename FunctionType, typename... P,
88 typename RETTYPE = std::unique_ptr<ExecutionContextTask>, size_t PS = sizeof ...(P), size_t MPS = WTF::FunctionWrapper<FunctionType>::numberOfArguments> 88 typename RETTYPE = std::unique_ptr<ExecutionContextTask>, size_t PS = sizeof ...(P), size_t MPS = WTF::FunctionWrapper<FunctionType>::numberOfArguments>
89 typename std::enable_if<PS + 1 == MPS, RETTYPE>::type createCrossThreadTask(Func tionType function, P&&... parameters) 89 typename std::enable_if<PS + 1 == MPS, RETTYPE>::type createCrossThreadTask(Func tionType function, P&&... parameters)
90 { 90 {
91 return internal::createCallClosureTask(threadSafeBind(function, std::forward <P>(parameters)...)); 91 return internal::createCallClosureTask(threadSafeBind(function, std::forward <P>(parameters)...));
92 } 92 }
93 93
94 template<typename FunctionType, typename... P, 94 template<typename FunctionType, typename... P,
95 typename RETTYPE = std::unique_ptr<ExecutionContextTask>, size_t PS = sizeof ...(P), size_t MPS = WTF::FunctionWrapper<FunctionType>::numberOfArguments> 95 typename RETTYPE = std::unique_ptr<ExecutionContextTask>, size_t PS = sizeof ...(P), size_t MPS = WTF::FunctionWrapper<FunctionType>::numberOfArguments>
96 typename std::enable_if<PS == MPS, RETTYPE>::type createCrossThreadTask(Function Type function, P&&... parameters) 96 typename std::enable_if<PS == MPS, RETTYPE>::type createCrossThreadTask(Function Type function, P&&... parameters)
97 { 97 {
98 return internal::createCallClosureTask(threadSafeBind(function, std::forward <P>(parameters)...)); 98 return internal::createCallClosureTask(threadSafeBind(function, std::forward <P>(parameters)...));
99 } 99 }
100 100
101 } // namespace blink 101 } // namespace blink
102 102
103 #endif // CrossThreadTask_h 103 #endif // CrossThreadTask_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698