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

Side by Side Diff: gin/arguments.h

Issue 76923003: First cut at gin::Bind() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | gin/function_template.h » ('j') | gin/function_template.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_ARGUMENTS_H_ 5 #ifndef GIN_ARGUMENTS_H_
6 #define GIN_ARGUMENTS_H_ 6 #define GIN_ARGUMENTS_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "gin/converter.h" 9 #include "gin/converter.h"
10 10
11 namespace gin { 11 namespace gin {
12 12
13 class Arguments { 13 class Arguments {
14 public: 14 public:
15 explicit Arguments(const v8::FunctionCallbackInfo<v8::Value>& info); 15 explicit Arguments(const v8::FunctionCallbackInfo<v8::Value>& info);
16 ~Arguments(); 16 ~Arguments();
17 17
18 template<typename T> 18 template<typename T>
19 // TODO(aa): Rename GetHolder().
19 bool Holder(T* out) { 20 bool Holder(T* out) {
20 return ConvertFromV8(info_.Holder(), out); 21 return ConvertFromV8(info_.Holder(), out);
21 } 22 }
22 23
23 template<typename T> 24 template<typename T>
25 bool GetData(T* out) {
26 return ConvertFromV8(info_.Data(), out);
27 }
28
29 template<typename T>
24 bool GetNext(T* out) { 30 bool GetNext(T* out) {
25 if (next_ >= info_.Length()) { 31 if (next_ >= info_.Length()) {
26 insufficient_arguments_ = true; 32 insufficient_arguments_ = true;
27 return false; 33 return false;
28 } 34 }
29 v8::Handle<v8::Value> val = info_[next_++]; 35 v8::Handle<v8::Value> val = info_[next_++];
30 return ConvertFromV8(val, out); 36 return ConvertFromV8(val, out);
31 } 37 }
32 38
33 template<typename T> 39 template<typename T>
(...skipping 29 matching lines...) Expand all
63 const v8::FunctionCallbackInfo<v8::Value>& info_; 69 const v8::FunctionCallbackInfo<v8::Value>& info_;
64 int next_; 70 int next_;
65 bool insufficient_arguments_; 71 bool insufficient_arguments_;
66 72
67 DISALLOW_COPY_AND_ASSIGN(Arguments); 73 DISALLOW_COPY_AND_ASSIGN(Arguments);
68 }; 74 };
69 75
70 } // namespace gin 76 } // namespace gin
71 77
72 #endif // GIN_ARGUMENTS_H_ 78 #endif // GIN_ARGUMENTS_H_
OLDNEW
« no previous file with comments | « no previous file | gin/function_template.h » ('j') | gin/function_template.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698