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 | |
89 void ThrowError() const; | 84 void ThrowError() const; |
90 void ThrowTypeError(const std::string& message) const; | 85 void ThrowTypeError(const std::string& message) const; |
91 | 86 |
92 v8::Isolate* isolate() const { return isolate_; } | 87 v8::Isolate* isolate() const { return isolate_; } |
93 | 88 |
94 // Allows the function handler to distinguish between normal invocation | 89 // Allows the function handler to distinguish between normal invocation |
95 // and object construction. | 90 // and object construction. |
96 bool IsConstructCall() const; | 91 bool IsConstructCall() const; |
97 | 92 |
98 private: | 93 private: |
99 v8::Isolate* isolate_; | 94 v8::Isolate* isolate_; |
100 const v8::FunctionCallbackInfo<v8::Value>* info_; | 95 const v8::FunctionCallbackInfo<v8::Value>* info_; |
101 int next_; | 96 int next_; |
102 bool insufficient_arguments_; | 97 bool insufficient_arguments_; |
103 }; | 98 }; |
104 | 99 |
105 } // namespace gin | 100 } // namespace gin |
106 | 101 |
107 #endif // GIN_ARGUMENTS_H_ | 102 #endif // GIN_ARGUMENTS_H_ |
OLD | NEW |