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

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

Issue 2386173002: reflow comments in Source/bindings/core/v8 (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/DOMDataStore.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // CallbackPromiseAdapter is a WebCallbacks subclass and resolves / rejects the 43 // CallbackPromiseAdapter is a WebCallbacks subclass and resolves / rejects the
44 // stored resolver when onSuccess / onError is called, respectively. 44 // stored resolver when onSuccess / onError is called, respectively.
45 // 45 //
46 // Basically CallbackPromiseAdapter<S, T> is a subclass of 46 // Basically CallbackPromiseAdapter<S, T> is a subclass of
47 // WebCallbacks<S::WebType, T::WebType>. There are some exceptions: 47 // WebCallbacks<S::WebType, T::WebType>. There are some exceptions:
48 // - If S or T don't have WebType (e.g. S = bool), a default WebType holder 48 // - If S or T don't have WebType (e.g. S = bool), a default WebType holder
49 // called trivial WebType holder is used. For example, 49 // called trivial WebType holder is used. For example,
50 // CallbackPromiseAdapter<bool, void> is a subclass of 50 // CallbackPromiseAdapter<bool, void> is a subclass of
51 // WebCallbacks<bool, void>. 51 // WebCallbacks<bool, void>.
52 // - If a WebType is std::unique_ptr<T>, its corresponding type parameter on 52 // - If a WebType is std::unique_ptr<T>, its corresponding type parameter on
53 // WebCallbacks is std::unique_ptr<T>, because WebCallbacks must be exposed t o 53 // WebCallbacks is std::unique_ptr<T>, because WebCallbacks must be exposed
54 // Chromium. 54 // to Chromium.
55 // 55 //
56 // When onSuccess is called with a S::WebType value, the value is passed to 56 // When onSuccess is called with a S::WebType value, the value is passed to
57 // S::take and the resolver is resolved with its return value. Ditto for 57 // S::take and the resolver is resolved with its return value. Ditto for
58 // onError. 58 // onError.
59 // 59 //
60 // ScriptPromiseResolver::resolve / reject will not be called when the execution 60 // ScriptPromiseResolver::resolve / reject will not be called when the execution
61 // context is stopped. 61 // context is stopped.
62 // 62 //
63 // Example: 63 // Example:
64 // class MyClass { 64 // class MyClass {
65 // public: 65 // public:
66 // using WebType = std::unique_ptr<WebMyClass>; 66 // using WebType = std::unique_ptr<WebMyClass>;
67 // static PassRefPtr<MyClass> take(ScriptPromiseResolver* resolver, 67 // static PassRefPtr<MyClass> take(ScriptPromiseResolver* resolver,
68 // std::unique_ptr<WebMyClass> webInstance) 68 // std::unique_ptr<WebMyClass> webInstance)
69 // { 69 // {
70 // return MyClass::create(webInstance); 70 // return MyClass::create(webInstance);
71 // } 71 // }
72 // ... 72 // ...
73 // }; 73 // };
74 // class MyErrorClass { 74 // class MyErrorClass {
75 // public: 75 // public:
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>, const WebMyErrorCla ss&>> 84 // std::unique_ptr<WebCallbacks<std::unique_ptr<WebMyClass>,
85 // const WebMyErrorClass&>>
85 // callbacks = wrapUnique(new CallbackPromiseAdapter<MyClass, MyErrorClass>( 86 // callbacks = wrapUnique(new CallbackPromiseAdapter<MyClass, MyErrorClass>(
86 // resolver)); 87 // resolver));
87 // ... 88 // ...
88 // 89 //
89 // std::unique_ptr<WebCallbacks<bool, const WebMyErrorClass&>> callbacks2 = 90 // std::unique_ptr<WebCallbacks<bool, const WebMyErrorClass&>> callbacks2 =
90 // wrapUnique(new CallbackPromiseAdapter<bool, MyErrorClass>(resolver)); 91 // wrapUnique(new CallbackPromiseAdapter<bool, MyErrorClass>(resolver));
91 // ... 92 // ...
92 // 93 //
93 // 94 //
94 // In order to implement the above exceptions, we have template classes below. 95 // In order to implement the above exceptions, we have template classes below.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 202
202 } // namespace internal 203 } // namespace internal
203 204
204 template <typename S, typename T> 205 template <typename S, typename T>
205 using CallbackPromiseAdapter = 206 using CallbackPromiseAdapter =
206 internal::CallbackPromiseAdapterInternal::CallbackPromiseAdapter<S, T>; 207 internal::CallbackPromiseAdapterInternal::CallbackPromiseAdapter<S, T>;
207 208
208 } // namespace blink 209 } // namespace blink
209 210
210 #endif 211 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/DOMDataStore.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698