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

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

Issue 284163002: Better arity checks for overloads (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Return properly Created 6 years, 7 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/v8/V8Binding.h ('k') | Source/bindings/v8/custom/V8ElementCustom.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) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 v8::Handle<v8::Value> throwError(v8::Handle<v8::Value> exception, v8::Isolate* i solate) 78 v8::Handle<v8::Value> throwError(v8::Handle<v8::Value> exception, v8::Isolate* i solate)
79 { 79 {
80 return V8ThrowException::throwError(exception, isolate); 80 return V8ThrowException::throwError(exception, isolate);
81 } 81 }
82 82
83 v8::Handle<v8::Value> throwTypeError(const String& message, v8::Isolate* isolate ) 83 v8::Handle<v8::Value> throwTypeError(const String& message, v8::Isolate* isolate )
84 { 84 {
85 return V8ThrowException::throwTypeError(message, isolate); 85 return V8ThrowException::throwTypeError(message, isolate);
86 } 86 }
87 87
88 void throwArityTypeErrorForMethod(const char* method, const char* type, unsigned expected, unsigned providedLeastNumMandatoryParams, v8::Isolate* isolate) 88 void throwArityTypeErrorForMethod(const char* method, const char* type, const ch ar* valid, unsigned provided, v8::Isolate* isolate)
89 {
90 throwTypeError(ExceptionMessages::failedToExecute(method, type, ExceptionMes sages::invalidArity(valid, provided)), isolate);
91 }
92
93 void throwArityTypeErrorForConstructor(const char* type, const char* valid, unsi gned provided, v8::Isolate* isolate)
94 {
95 throwTypeError(ExceptionMessages::failedToConstruct(type, ExceptionMessages: :invalidArity(valid, provided)), isolate);
96 }
97
98 void throwArityTypeError(ExceptionState& exceptionState, const char* valid, unsi gned provided)
99 {
100 exceptionState.throwTypeError(ExceptionMessages::invalidArity(valid, provide d));
101 exceptionState.throwIfNeeded();
102 }
103
104 void throwMinimumArityTypeErrorForMethod(const char* method, const char* type, u nsigned expected, unsigned providedLeastNumMandatoryParams, v8::Isolate* isolate )
89 { 105 {
90 throwTypeError(ExceptionMessages::failedToExecute(method, type, ExceptionMes sages::notEnoughArguments(expected, providedLeastNumMandatoryParams)), isolate); 106 throwTypeError(ExceptionMessages::failedToExecute(method, type, ExceptionMes sages::notEnoughArguments(expected, providedLeastNumMandatoryParams)), isolate);
91 } 107 }
92 108
93 void throwArityTypeErrorForConstructor(const char* type, unsigned expected, unsi gned providedLeastNumMandatoryParams, v8::Isolate* isolate) 109 void throwMinimumArityTypeErrorForConstructor(const char* type, unsigned expecte d, unsigned providedLeastNumMandatoryParams, v8::Isolate* isolate)
94 { 110 {
95 throwTypeError(ExceptionMessages::failedToConstruct(type, ExceptionMessages: :notEnoughArguments(expected, providedLeastNumMandatoryParams)), isolate); 111 throwTypeError(ExceptionMessages::failedToConstruct(type, ExceptionMessages: :notEnoughArguments(expected, providedLeastNumMandatoryParams)), isolate);
96 } 112 }
97 113
98 void throwArityTypeError(ExceptionState& exceptionState, unsigned expected, unsi gned providedLeastNumMandatoryParams) 114 void throwMinimumArityTypeError(ExceptionState& exceptionState, unsigned expecte d, unsigned providedLeastNumMandatoryParams)
99 { 115 {
100 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(expected , providedLeastNumMandatoryParams)); 116 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(expected , providedLeastNumMandatoryParams));
101 exceptionState.throwIfNeeded(); 117 exceptionState.throwIfNeeded();
102 } 118 }
103 119
104 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 120 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
105 virtual void* Allocate(size_t size) OVERRIDE 121 virtual void* Allocate(size_t size) OVERRIDE
106 { 122 {
107 void* data; 123 void* data;
108 WTF::ArrayBufferContents::allocateMemory(size, WTF::ArrayBufferContents: :ZeroInitialize, data); 124 WTF::ArrayBufferContents::allocateMemory(size, WTF::ArrayBufferContents: :ZeroInitialize, data);
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 { 791 {
776 return m_scriptState.get(); 792 return m_scriptState.get();
777 } 793 }
778 794
779 v8::Isolate* V8ExecutionScope::isolate() const 795 v8::Isolate* V8ExecutionScope::isolate() const
780 { 796 {
781 return m_scriptState->isolate(); 797 return m_scriptState->isolate();
782 } 798 }
783 799
784 } // namespace WebCore 800 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8Binding.h ('k') | Source/bindings/v8/custom/V8ElementCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698