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

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

Issue 221073003: Add helper functions for throwing arity-related TypeErrors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix style nits. Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/tests/results/V8TestTypedefs.cpp ('k') | Source/bindings/v8/V8Binding.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 // Schedule a JavaScript error to be thrown. 62 // Schedule a JavaScript error to be thrown.
63 v8::Handle<v8::Value> throwError(V8ErrorType, const String&, v8::Isolate*); 63 v8::Handle<v8::Value> throwError(V8ErrorType, const String&, v8::Isolate*);
64 64
65 // Schedule a JavaScript error to be thrown. 65 // Schedule a JavaScript error to be thrown.
66 v8::Handle<v8::Value> throwError(v8::Handle<v8::Value>, v8::Isolate*); 66 v8::Handle<v8::Value> throwError(v8::Handle<v8::Value>, v8::Isolate*);
67 67
68 // A helper for throwing JavaScript TypeError. 68 // A helper for throwing JavaScript TypeError.
69 v8::Handle<v8::Value> throwTypeError(const String&, v8::Isolate*); 69 v8::Handle<v8::Value> throwTypeError(const String&, v8::Isolate*);
70 70
71 // Helpers for throwing JavaScript TypeErrors for arity mismatches.
72 void throwArityTypeErrorForMethod(const char* method, const char* type, unsigned expected, unsigned providedLeastNumMandatoryParams, v8::Isolate*);
73 void throwArityTypeErrorForConstructor(const char* type, unsigned expected, unsi gned providedLeastNumMandatoryParams, v8::Isolate*);
74 void throwArityTypeError(ExceptionState&, unsigned expected, unsigned providedLe astNumMandatoryParams);
75
71 v8::ArrayBuffer::Allocator* v8ArrayBufferAllocator(); 76 v8::ArrayBuffer::Allocator* v8ArrayBufferAllocator();
72 77
73 inline v8::Handle<v8::Value> argumentOrNull(const v8::FunctionCallbackInfo<v8::V alue>& info, int index) 78 inline v8::Handle<v8::Value> argumentOrNull(const v8::FunctionCallbackInfo<v8::V alue>& info, int index)
74 { 79 {
75 return index >= info.Length() ? v8::Local<v8::Value>() : info[index]; 80 return index >= info.Length() ? v8::Local<v8::Value>() : info[index];
76 } 81 }
77 82
78 template<typename CallbackInfo, typename V> 83 template<typename CallbackInfo, typename V>
79 inline void v8SetReturnValue(const CallbackInfo& info, V v) 84 inline void v8SetReturnValue(const CallbackInfo& info, V v)
80 { 85 {
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 v8::HandleScope m_handleScope; 762 v8::HandleScope m_handleScope;
758 v8::Handle<v8::Context> m_context; 763 v8::Handle<v8::Context> m_context;
759 v8::Context::Scope m_contextScope; 764 v8::Context::Scope m_contextScope;
760 RefPtr<DOMWrapperWorld> m_world; 765 RefPtr<DOMWrapperWorld> m_world;
761 OwnPtr<V8PerContextData> m_perContextData; 766 OwnPtr<V8PerContextData> m_perContextData;
762 }; 767 };
763 768
764 } // namespace WebCore 769 } // namespace WebCore
765 770
766 #endif // V8Binding_h 771 #endif // V8Binding_h
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestTypedefs.cpp ('k') | Source/bindings/v8/V8Binding.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698