OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // using WebType = const WebMyErrorClass&; | 76 // using WebType = const WebMyErrorClass&; |
77 // static MyErrorClass take(ScriptPromiseResolver* resolver, | 77 // static MyErrorClass take(ScriptPromiseResolver* resolver, |
78 // const WebErrorClass& webError) | 78 // const WebErrorClass& webError) |
79 // { | 79 // { |
80 // return MyErrorClass(webError); | 80 // return MyErrorClass(webError); |
81 // } | 81 // } |
82 // ... | 82 // ... |
83 // }; | 83 // }; |
84 // std::unique_ptr<WebCallbacks<std::unique_ptr<WebMyClass>, | 84 // std::unique_ptr<WebCallbacks<std::unique_ptr<WebMyClass>, |
85 // const WebMyErrorClass&>> | 85 // const WebMyErrorClass&>> |
86 // callbacks = wrapUnique(new CallbackPromiseAdapter<MyClass, MyErrorClass>( | 86 // callbacks = WTF::wrapUnique( |
87 // resolver)); | 87 // new CallbackPromiseAdapter<MyClass, MyErrorClass>(resolver)); |
88 // ... | 88 // ... |
89 // | 89 // |
90 // std::unique_ptr<WebCallbacks<bool, const WebMyErrorClass&>> callbacks2 = | 90 // std::unique_ptr<WebCallbacks<bool, const WebMyErrorClass&>> callbacks2 = |
91 // wrapUnique(new CallbackPromiseAdapter<bool, MyErrorClass>(resolver)); | 91 // WTF::wrapUnique( |
| 92 // new CallbackPromiseAdapter<bool, MyErrorClass>(resolver)); |
92 // ... | 93 // ... |
93 // | 94 // |
94 // | 95 // |
95 // In order to implement the above exceptions, we have template classes below. | 96 // In order to implement the above exceptions, we have template classes below. |
96 // OnSuccess and OnError provide onSuccess and onError implementation, and there | 97 // OnSuccess and OnError provide onSuccess and onError implementation, and there |
97 // are utility templates that provide the trivial WebType holder. | 98 // are utility templates that provide the trivial WebType holder. |
98 | 99 |
99 namespace internal { | 100 namespace internal { |
100 | 101 |
101 // This template is placed outside of CallbackPromiseAdapterInternal because | 102 // This template is placed outside of CallbackPromiseAdapterInternal because |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 203 |
203 } // namespace internal | 204 } // namespace internal |
204 | 205 |
205 template <typename S, typename T> | 206 template <typename S, typename T> |
206 using CallbackPromiseAdapter = | 207 using CallbackPromiseAdapter = |
207 internal::CallbackPromiseAdapterInternal::CallbackPromiseAdapter<S, T>; | 208 internal::CallbackPromiseAdapterInternal::CallbackPromiseAdapter<S, T>; |
208 | 209 |
209 } // namespace blink | 210 } // namespace blink |
210 | 211 |
211 #endif | 212 #endif |
OLD | NEW |