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

Side by Side Diff: gin/arguments.h

Issue 1152653004: Re-land: gin: Use V8 Maybe APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months 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
« no previous file with comments | « content/shell/renderer/test_runner/event_sender.cc ('k') | gin/converter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "gin/gin_export.h" 10 #include "gin/gin_export.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 next_++; 62 next_++;
63 return true; 63 return true;
64 } 64 }
65 65
66 int Length() const { 66 int Length() const {
67 return info_->Length(); 67 return info_->Length();
68 } 68 }
69 69
70 template<typename T> 70 template<typename T>
71 void Return(T val) { 71 void Return(T val) {
72 info_->GetReturnValue().Set(ConvertToV8(isolate_, val)); 72 v8::Local<v8::Value> v8_value;
73 if (!TryConvertToV8(isolate_, val, &v8_value))
74 return;
75 info_->GetReturnValue().Set(v8_value);
73 } 76 }
74 77
75 v8::Local<v8::Value> PeekNext() const; 78 v8::Local<v8::Value> PeekNext() const;
76 79
77 void ThrowError() const; 80 void ThrowError() const;
78 void ThrowTypeError(const std::string& message) const; 81 void ThrowTypeError(const std::string& message) const;
79 82
80 v8::Isolate* isolate() const { return isolate_; } 83 v8::Isolate* isolate() const { return isolate_; }
81 84
82 // Allows the function handler to distinguish between normal invocation 85 // Allows the function handler to distinguish between normal invocation
83 // and object construction. 86 // and object construction.
84 bool IsConstructCall() const; 87 bool IsConstructCall() const;
85 88
86 private: 89 private:
87 v8::Isolate* isolate_; 90 v8::Isolate* isolate_;
88 const v8::FunctionCallbackInfo<v8::Value>* info_; 91 const v8::FunctionCallbackInfo<v8::Value>* info_;
89 int next_; 92 int next_;
90 bool insufficient_arguments_; 93 bool insufficient_arguments_;
91 }; 94 };
92 95
93 } // namespace gin 96 } // namespace gin
94 97
95 #endif // GIN_ARGUMENTS_H_ 98 #endif // GIN_ARGUMENTS_H_
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/event_sender.cc ('k') | gin/converter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698