OLD | NEW |
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 #include "gin/gin_export.h" | 10 #include "gin/gin_export.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 return false; | 54 return false; |
55 } | 55 } |
56 return true; | 56 return true; |
57 } | 57 } |
58 | 58 |
59 template<typename T> | 59 template<typename T> |
60 void Return(T val) { | 60 void Return(T val) { |
61 info_->GetReturnValue().Set(ConvertToV8(isolate_, val)); | 61 info_->GetReturnValue().Set(ConvertToV8(isolate_, val)); |
62 } | 62 } |
63 | 63 |
64 v8::Handle<v8::Value> PeekNext(); | 64 v8::Handle<v8::Value> PeekNext() const; |
65 | 65 |
66 void ThrowError(); | 66 void ThrowError() const; |
67 void ThrowTypeError(const std::string& message); | 67 void ThrowTypeError(const std::string& message) const; |
68 | 68 |
69 v8::Isolate* isolate() const { return isolate_; } | 69 v8::Isolate* isolate() const { return isolate_; } |
70 | 70 |
71 private: | 71 private: |
72 v8::Isolate* isolate_; | 72 v8::Isolate* isolate_; |
73 const v8::FunctionCallbackInfo<v8::Value>* info_; | 73 const v8::FunctionCallbackInfo<v8::Value>* info_; |
74 int next_; | 74 int next_; |
75 bool insufficient_arguments_; | 75 bool insufficient_arguments_; |
76 }; | 76 }; |
77 | 77 |
78 } // namespace gin | 78 } // namespace gin |
79 | 79 |
80 #endif // GIN_ARGUMENTS_H_ | 80 #endif // GIN_ARGUMENTS_H_ |
OLD | NEW |