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

Side by Side Diff: Source/bindings/v8/V8Binding.h

Issue 339063003: Add invokeCallback functionality to the code generator (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Ericsson AB. All rights reserved. 3 * Copyright (C) 2012 Ericsson AB. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 v8::Handle<v8::Value> throwTypeError(const String&, v8::Isolate*); 73 v8::Handle<v8::Value> throwTypeError(const String&, v8::Isolate*);
74 74
75 // Helpers for throwing JavaScript TypeErrors for arity mismatches. 75 // Helpers for throwing JavaScript TypeErrors for arity mismatches.
76 void throwArityTypeErrorForMethod(const char* method, const char* type, const ch ar* valid, unsigned provided, v8::Isolate*); 76 void throwArityTypeErrorForMethod(const char* method, const char* type, const ch ar* valid, unsigned provided, v8::Isolate*);
77 void throwArityTypeErrorForConstructor(const char* type, const char* valid, unsi gned provided, v8::Isolate*); 77 void throwArityTypeErrorForConstructor(const char* type, const char* valid, unsi gned provided, v8::Isolate*);
78 void throwArityTypeError(ExceptionState&, const char* valid, unsigned provided); 78 void throwArityTypeError(ExceptionState&, const char* valid, unsigned provided);
79 void throwMinimumArityTypeErrorForMethod(const char* method, const char* type, u nsigned expected, unsigned providedLeastNumMandatoryParams, v8::Isolate*); 79 void throwMinimumArityTypeErrorForMethod(const char* method, const char* type, u nsigned expected, unsigned providedLeastNumMandatoryParams, v8::Isolate*);
80 void throwMinimumArityTypeErrorForConstructor(const char* type, unsigned expecte d, unsigned providedLeastNumMandatoryParams, v8::Isolate*); 80 void throwMinimumArityTypeErrorForConstructor(const char* type, unsigned expecte d, unsigned providedLeastNumMandatoryParams, v8::Isolate*);
81 void throwMinimumArityTypeError(ExceptionState&, unsigned expected, unsigned pro videdLeastNumMandatoryParams); 81 void throwMinimumArityTypeError(ExceptionState&, unsigned expected, unsigned pro videdLeastNumMandatoryParams);
82 82
83 // Returns false if the callback threw an exception, true otherwise.
84 bool invokeCallback(ScriptState*, v8::Local<v8::Function> callback, int argc, v8 ::Handle<v8::Value> argv[]);
85 bool invokeCallback(ScriptState*, v8::Local<v8::Function> callback, v8::Handle<v 8::Value> thisValue, int argc, v8::Handle<v8::Value> argv[]);
86
87 v8::ArrayBuffer::Allocator* v8ArrayBufferAllocator(); 83 v8::ArrayBuffer::Allocator* v8ArrayBufferAllocator();
88 84
89 inline v8::Handle<v8::Value> argumentOrNull(const v8::FunctionCallbackInfo<v8::V alue>& info, int index) 85 inline v8::Handle<v8::Value> argumentOrNull(const v8::FunctionCallbackInfo<v8::V alue>& info, int index)
90 { 86 {
91 return index >= info.Length() ? v8::Local<v8::Value>() : info[index]; 87 return index >= info.Length() ? v8::Local<v8::Value>() : info[index];
92 } 88 }
93 89
94 template<typename CallbackInfo, typename V> 90 template<typename CallbackInfo, typename V>
95 inline void v8SetReturnValue(const CallbackInfo& info, V v) 91 inline void v8SetReturnValue(const CallbackInfo& info, V v)
96 { 92 {
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 m_block.Reset(); 999 m_block.Reset();
1004 } 1000 }
1005 1001
1006 private: 1002 private:
1007 v8::TryCatch& m_block; 1003 v8::TryCatch& m_block;
1008 }; 1004 };
1009 1005
1010 } // namespace WebCore 1006 } // namespace WebCore
1011 1007
1012 #endif // V8Binding_h 1008 #endif // V8Binding_h
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestCallbackInterface.cpp ('k') | Source/bindings/v8/V8Binding.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698