| 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 #include "gin/arguments.h" | 5 #include "gin/arguments.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "gin/converter.h" | 8 #include "gin/converter.h" |
| 9 | 9 |
| 10 namespace gin { | 10 namespace gin { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 Arguments::~Arguments() { | 26 Arguments::~Arguments() { |
| 27 } | 27 } |
| 28 | 28 |
| 29 v8::Local<v8::Value> Arguments::PeekNext() const { | 29 v8::Local<v8::Value> Arguments::PeekNext() const { |
| 30 if (next_ >= info_->Length()) | 30 if (next_ >= info_->Length()) |
| 31 return v8::Local<v8::Value>(); | 31 return v8::Local<v8::Value>(); |
| 32 return (*info_)[next_]; | 32 return (*info_)[next_]; |
| 33 } | 33 } |
| 34 | 34 |
| 35 v8::Local<v8::Context> Arguments::GetHolderCreationContext() { |
| 36 return info_->Holder()->CreationContext(); |
| 37 } |
| 38 |
| 35 std::string V8TypeAsString(v8::Local<v8::Value> value) { | 39 std::string V8TypeAsString(v8::Local<v8::Value> value) { |
| 36 if (value.IsEmpty()) | 40 if (value.IsEmpty()) |
| 37 return "<empty handle>"; | 41 return "<empty handle>"; |
| 38 if (value->IsUndefined()) | 42 if (value->IsUndefined()) |
| 39 return "undefined"; | 43 return "undefined"; |
| 40 if (value->IsNull()) | 44 if (value->IsNull()) |
| 41 return "null"; | 45 return "null"; |
| 42 std::string result; | 46 std::string result; |
| 43 if (!ConvertFromV8(NULL, value, &result)) | 47 if (!ConvertFromV8(NULL, value, &result)) |
| 44 return std::string(); | 48 return std::string(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 57 void Arguments::ThrowTypeError(const std::string& message) const { | 61 void Arguments::ThrowTypeError(const std::string& message) const { |
| 58 isolate_->ThrowException(v8::Exception::TypeError( | 62 isolate_->ThrowException(v8::Exception::TypeError( |
| 59 StringToV8(isolate_, message))); | 63 StringToV8(isolate_, message))); |
| 60 } | 64 } |
| 61 | 65 |
| 62 bool Arguments::IsConstructCall() const { | 66 bool Arguments::IsConstructCall() const { |
| 63 return info_->IsConstructCall(); | 67 return info_->IsConstructCall(); |
| 64 } | 68 } |
| 65 | 69 |
| 66 } // namespace gin | 70 } // namespace gin |
| OLD | NEW |