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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/CallbackPromiseAdapter.h

Issue 2131873002: Remove unneeded type indirections from CallbackPromiseAdapter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/CallbackPromiseAdapter.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/CallbackPromiseAdapter.h b/third_party/WebKit/Source/bindings/core/v8/CallbackPromiseAdapter.h
index 97c401df9508f63776e8b89808c12818866a740f..af758ce312f733d4ff271bdec49295b371454d02 100644
--- a/third_party/WebKit/Source/bindings/core/v8/CallbackPromiseAdapter.h
+++ b/third_party/WebKit/Source/bindings/core/v8/CallbackPromiseAdapter.h
@@ -116,34 +116,13 @@ private:
template <typename T> static CallbackPromiseAdapterTrivialWebTypeHolder<T> webTypeHolderMatcher(...);
template <typename T> using WebTypeHolder = decltype(webTypeHolderMatcher<T>(nullptr));
- // The following templates should be gone when the repositories are merged
- // and we can use C++11 libraries.
- template <typename T>
- struct PassTypeImpl {
- using Type = T;
- };
- template <typename T>
- struct PassTypeImpl<std::unique_ptr<T>> {
- using Type = std::unique_ptr<T>;
- };
- template <typename T>
- struct WebPassTypeImpl {
- using Type = T;
- };
- template <typename T>
- struct WebPassTypeImpl<std::unique_ptr<T>> {
- using Type = std::unique_ptr<T>;
- };
- template <typename T> using PassType = typename PassTypeImpl<T>::Type;
- template <typename T> using WebPassType = typename WebPassTypeImpl<T>::Type;
template <typename T> static T& adopt(T& x) { return x; }
- template <typename T>
- static std::unique_ptr<T> adopt(std::unique_ptr<T>& x) { return std::move(x); }
- template <typename T> static PassType<T> pass(T& x) { return x; }
+ template <typename T> static std::unique_ptr<T> adopt(std::unique_ptr<T>& x) { return std::move(x); }
+ template <typename T> static T pass(T& x) { return x; }
template <typename T> static std::unique_ptr<T> pass(std::unique_ptr<T>& x) { return std::move(x); }
template <typename S, typename T>
- class Base : public WebCallbacks<WebPassType<typename S::WebType>, WebPassType<typename T::WebType>> {
+ class Base : public WebCallbacks<typename S::WebType, typename T::WebType> {
public:
explicit Base(ScriptPromiseResolver* resolver) : m_resolver(resolver) {}
ScriptPromiseResolver* resolver() { return m_resolver; }
@@ -156,7 +135,7 @@ private:
class OnSuccess : public Base<S, T> {
public:
explicit OnSuccess(ScriptPromiseResolver* resolver) : Base<S, T>(resolver) {}
- void onSuccess(WebPassType<typename S::WebType> r) override
+ void onSuccess(typename S::WebType r) override
{
typename S::WebType result(adopt(r));
ScriptPromiseResolver* resolver = this->resolver();
@@ -181,7 +160,7 @@ private:
class OnError : public OnSuccess<S, T> {
public:
explicit OnError(ScriptPromiseResolver* resolver) : OnSuccess<S, T>(resolver) {}
- void onError(WebPassType<typename T::WebType> e) override
+ void onError(typename T::WebType e) override
{
typename T::WebType result(adopt(e));
ScriptPromiseResolver* resolver = this->resolver();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698