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

Side by Side Diff: gin/function_template.h

Issue 693943003: Update from https://crrev.com/302630 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « cc/test/test_gpu_memory_buffer_manager.cc ('k') | gpu/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 GIN_FUNCTION_TEMPLATE_H_ 5 #ifndef GIN_FUNCTION_TEMPLATE_H_
6 #define GIN_FUNCTION_TEMPLATE_H_ 6 #define GIN_FUNCTION_TEMPLATE_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "gin/arguments.h" 10 #include "gin/arguments.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 template <size_t... indices, typename... ArgTypes> 144 template <size_t... indices, typename... ArgTypes>
145 class Invoker<IndicesHolder<indices...>, ArgTypes...> 145 class Invoker<IndicesHolder<indices...>, ArgTypes...>
146 : public ArgumentHolder<indices, ArgTypes>... { 146 : public ArgumentHolder<indices, ArgTypes>... {
147 public: 147 public:
148 // Invoker<> inherits from ArgumentHolder<> for each argument. 148 // Invoker<> inherits from ArgumentHolder<> for each argument.
149 // C++ has always been strict about the class initialization order, 149 // C++ has always been strict about the class initialization order,
150 // so it is guaranteed ArgumentHolders will be initialized (and thus, will 150 // so it is guaranteed ArgumentHolders will be initialized (and thus, will
151 // extract arguments from Arguments) in the right order. 151 // extract arguments from Arguments) in the right order.
152 Invoker(Arguments* args, int create_flags) 152 Invoker(Arguments* args, int create_flags)
153 : ArgumentHolder<indices, ArgTypes>(args, create_flags)..., 153 : ArgumentHolder<indices, ArgTypes>(args, create_flags)..., args_(args) {
154 args_(args) {} 154 // GCC thinks that create_flags is going unused, even though the
155 // expansion above clearly makes use of it. Per jyasskin@, casting
156 // to void is the commonly accepted way to convince the compiler
157 // that you're actually using a parameter/varible.
158 (void)create_flags;
159 }
155 160
156 bool IsOK() { 161 bool IsOK() {
157 return And(ArgumentHolder<indices, ArgTypes>::ok...); 162 return And(ArgumentHolder<indices, ArgTypes>::ok...);
158 } 163 }
159 164
160 template <typename ReturnType> 165 template <typename ReturnType>
161 void DispatchToCallback(base::Callback<ReturnType(ArgTypes...)> callback) { 166 void DispatchToCallback(base::Callback<ReturnType(ArgTypes...)> callback) {
162 args_->Return(callback.Run(ArgumentHolder<indices, ArgTypes>::value...)); 167 args_->Return(callback.Run(ArgumentHolder<indices, ArgTypes>::value...));
163 } 168 }
164 169
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 typedef internal::CallbackHolder<Sig> HolderT; 240 typedef internal::CallbackHolder<Sig> HolderT;
236 HolderT* holder = new HolderT(isolate, callback, callback_flags); 241 HolderT* holder = new HolderT(isolate, callback, callback_flags);
237 tmpl->SetCallAsFunctionHandler(&internal::Dispatcher<Sig>::DispatchToCallback, 242 tmpl->SetCallAsFunctionHandler(&internal::Dispatcher<Sig>::DispatchToCallback,
238 ConvertToV8<v8::Handle<v8::External> >( 243 ConvertToV8<v8::Handle<v8::External> >(
239 isolate, holder->GetHandle(isolate))); 244 isolate, holder->GetHandle(isolate)));
240 } 245 }
241 246
242 } // namespace gin 247 } // namespace gin
243 248
244 #endif // GIN_FUNCTION_TEMPLATE_H_ 249 #endif // GIN_FUNCTION_TEMPLATE_H_
OLDNEW
« no previous file with comments | « cc/test/test_gpu_memory_buffer_manager.cc ('k') | gpu/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698