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

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

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/v8/V8Binding.h ('k') | no next file » | 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 v8::Handle<v8::Value> throwError(v8::Handle<v8::Value> exception, v8::Isolate* i solate) 75 v8::Handle<v8::Value> throwError(v8::Handle<v8::Value> exception, v8::Isolate* i solate)
76 { 76 {
77 return V8ThrowException::throwError(exception, isolate); 77 return V8ThrowException::throwError(exception, isolate);
78 } 78 }
79 79
80 v8::Handle<v8::Value> throwTypeError(const String& message, v8::Isolate* isolate ) 80 v8::Handle<v8::Value> throwTypeError(const String& message, v8::Isolate* isolate )
81 { 81 {
82 return V8ThrowException::throwTypeError(message, isolate); 82 return V8ThrowException::throwTypeError(message, isolate);
83 } 83 }
84 84
85 void throwArityTypeErrorForMethod(const char* method, const char* type, unsigned expected, unsigned providedLeastNumMandatoryParams, v8::Isolate* isolate)
86 {
87 throwTypeError(ExceptionMessages::failedToExecute(method, type, ExceptionMes sages::notEnoughArguments(expected, providedLeastNumMandatoryParams)), isolate);
88 }
89
90 void throwArityTypeErrorForConstructor(const char* type, unsigned expected, unsi gned providedLeastNumMandatoryParams, v8::Isolate* isolate)
91 {
92 throwTypeError(ExceptionMessages::failedToConstruct(type, ExceptionMessages: :notEnoughArguments(expected, providedLeastNumMandatoryParams)), isolate);
93 }
94
95 void throwArityTypeError(ExceptionState& exceptionState, unsigned expected, unsi gned providedLeastNumMandatoryParams)
96 {
97 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(expected , providedLeastNumMandatoryParams));
98 exceptionState.throwIfNeeded();
99 }
100
85 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 101 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
86 virtual void* Allocate(size_t size) OVERRIDE 102 virtual void* Allocate(size_t size) OVERRIDE
87 { 103 {
88 void* data; 104 void* data;
89 WTF::ArrayBufferContents::allocateMemory(size, WTF::ArrayBufferContents: :ZeroInitialize, data); 105 WTF::ArrayBufferContents::allocateMemory(size, WTF::ArrayBufferContents: :ZeroInitialize, data);
90 return data; 106 return data;
91 } 107 }
92 108
93 virtual void* AllocateUninitialized(size_t size) OVERRIDE 109 virtual void* AllocateUninitialized(size_t size) OVERRIDE
94 { 110 {
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 V8ExecutionScope::V8ExecutionScope(v8::Isolate* isolate) 673 V8ExecutionScope::V8ExecutionScope(v8::Isolate* isolate)
658 : m_handleScope(isolate) 674 : m_handleScope(isolate)
659 , m_context(v8::Context::New(isolate)) 675 , m_context(v8::Context::New(isolate))
660 , m_contextScope(m_context) 676 , m_contextScope(m_context)
661 , m_world(DOMWrapperWorld::create()) 677 , m_world(DOMWrapperWorld::create())
662 , m_perContextData(V8PerContextData::create(m_context, m_world)) 678 , m_perContextData(V8PerContextData::create(m_context, m_world))
663 { 679 {
664 } 680 }
665 681
666 } // namespace WebCore 682 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8Binding.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698