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

Side by Side Diff: gin/arguments.h

Issue 103703002: Gin: Add support for binding JS methods to C++ instance methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again 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
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 // Arguments is a wrapper around v8::FunctionCallbackInfo that integrates 13 // Arguments is a wrapper around v8::FunctionCallbackInfo that integrates
14 // with Converter to make it easier to marshall arguments and return values 14 // with Converter to make it easier to marshall arguments and return values
15 // between V8 and C++. 15 // between V8 and C++.
16 class Arguments { 16 class Arguments {
17 public: 17 public:
18 Arguments(); 18 Arguments();
19 explicit Arguments(const v8::FunctionCallbackInfo<v8::Value>& info); 19 explicit Arguments(const v8::FunctionCallbackInfo<v8::Value>& info);
20 ~Arguments(); 20 ~Arguments();
21 21
22 template<typename T> 22 template<typename T>
23 // TODO(aa): Rename GetHolder(). 23 bool GetHolder(T* out) {
24 bool Holder(T* out) {
25 return ConvertFromV8(isolate_, info_->Holder(), out); 24 return ConvertFromV8(isolate_, info_->Holder(), out);
26 } 25 }
27 26
28 template<typename T> 27 template<typename T>
29 bool GetData(T* out) { 28 bool GetData(T* out) {
30 return ConvertFromV8(isolate_, info_->Data(), out); 29 return ConvertFromV8(isolate_, info_->Data(), out);
31 } 30 }
32 31
33 template<typename T> 32 template<typename T>
34 bool GetNext(T* out) { 33 bool GetNext(T* out) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 67
69 v8::Isolate* isolate() const { return isolate_; } 68 v8::Isolate* isolate() const { return isolate_; }
70 69
71 private: 70 private:
72 v8::Isolate* isolate_; 71 v8::Isolate* isolate_;
73 const v8::FunctionCallbackInfo<v8::Value>* info_; 72 const v8::FunctionCallbackInfo<v8::Value>* info_;
74 int next_; 73 int next_;
75 bool insufficient_arguments_; 74 bool insufficient_arguments_;
76 }; 75 };
77 76
78 template<>
79 bool Arguments::GetNext<Arguments>(Arguments* out);
80
81 } // namespace gin 77 } // namespace gin
82 78
83 #endif // GIN_ARGUMENTS_H_ 79 #endif // GIN_ARGUMENTS_H_
OLDNEW
« no previous file with comments | « base/template_util_unittest.cc ('k') | gin/arguments.cc » ('j') | gin/object_template_builder.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698