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

Side by Side Diff: third_party/WebKit/public/platform/functional/WebFunction.h

Issue 2132973002: Replace a WTF::Function conversion operator to be a function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef WebFunction_h 5 #ifndef WebFunction_h
6 #define WebFunction_h 6 #define WebFunction_h
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 23 matching lines...) Expand all
34 #endif 34 #endif
35 35
36 public: 36 public:
37 #if BLINK_IMPLEMENTATION 37 #if BLINK_IMPLEMENTATION
38 WebFunction() 38 WebFunction()
39 { 39 {
40 } 40 }
41 41
42 explicit WebFunction(std::unique_ptr<WTFFunction> c) 42 explicit WebFunction(std::unique_ptr<WTFFunction> c)
43 { 43 {
44 m_callback = static_cast<base::Callback<R(Args...)>>(*c); 44 m_callback = convertToBaseCallback(std::move(c));
45 } 45 }
46 #endif 46 #endif
47 47
48 WebFunction(WebFunction&& other) 48 WebFunction(WebFunction&& other)
49 { 49 {
50 *this = std::move(other); 50 *this = std::move(other);
51 } 51 }
52 WebFunction& operator=(WebFunction&& other) 52 WebFunction& operator=(WebFunction&& other)
53 { 53 {
54 #if DCHECK_IS_ON() 54 #if DCHECK_IS_ON()
(...skipping 24 matching lines...) Expand all
79 base::Callback<R(Args...)> m_callback; 79 base::Callback<R(Args...)> m_callback;
80 80
81 DISALLOW_COPY_AND_ASSIGN(WebFunction); 81 DISALLOW_COPY_AND_ASSIGN(WebFunction);
82 }; 82 };
83 83
84 using WebClosure = WebFunction<void()>; 84 using WebClosure = WebFunction<void()>;
85 85
86 } // namespace blink 86 } // namespace blink
87 87
88 #endif // WebClosure_h 88 #endif // WebClosure_h
OLDNEW
« third_party/WebKit/Source/wtf/Functional.h ('K') | « third_party/WebKit/Source/wtf/Functional.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698