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 "gin/converter.h" | 8 #include "gin/converter.h" |
9 #include "gin/gin_export.h" | 9 #include "gin/gin_export.h" |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 info_->GetReturnValue().Set(v8_value); | 74 info_->GetReturnValue().Set(v8_value); |
75 } | 75 } |
76 | 76 |
77 // Returns the creation context of the Holder. | 77 // Returns the creation context of the Holder. |
78 v8::Local<v8::Context> GetHolderCreationContext(); | 78 v8::Local<v8::Context> GetHolderCreationContext(); |
79 | 79 |
80 // Always check the return value whether the handle is empty before | 80 // Always check the return value whether the handle is empty before |
81 // dereferencing the handle. | 81 // dereferencing the handle. |
82 v8::Local<v8::Value> PeekNext() const; | 82 v8::Local<v8::Value> PeekNext() const; |
83 | 83 |
| 84 // Returns all arguments. Since this doesn't require any conversion, it |
| 85 // cannot fail. This does not rely on or modify the current position in the |
| 86 // array used by Get/PeekNext(). |
| 87 std::vector<v8::Local<v8::Value>> GetAll() const; |
| 88 |
84 void ThrowError() const; | 89 void ThrowError() const; |
85 void ThrowTypeError(const std::string& message) const; | 90 void ThrowTypeError(const std::string& message) const; |
86 | 91 |
87 v8::Isolate* isolate() const { return isolate_; } | 92 v8::Isolate* isolate() const { return isolate_; } |
88 | 93 |
89 // Allows the function handler to distinguish between normal invocation | 94 // Allows the function handler to distinguish between normal invocation |
90 // and object construction. | 95 // and object construction. |
91 bool IsConstructCall() const; | 96 bool IsConstructCall() const; |
92 | 97 |
93 private: | 98 private: |
94 v8::Isolate* isolate_; | 99 v8::Isolate* isolate_; |
95 const v8::FunctionCallbackInfo<v8::Value>* info_; | 100 const v8::FunctionCallbackInfo<v8::Value>* info_; |
96 int next_; | 101 int next_; |
97 bool insufficient_arguments_; | 102 bool insufficient_arguments_; |
98 }; | 103 }; |
99 | 104 |
100 } // namespace gin | 105 } // namespace gin |
101 | 106 |
102 #endif // GIN_ARGUMENTS_H_ | 107 #endif // GIN_ARGUMENTS_H_ |
OLD | NEW |