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

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

Issue 234403004: Rename V8TRYCATCH_* macros in v8/V8BindingMacros.h (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: BOOL*_BOOL -> BOOL* 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/V8AbstractEventListener.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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 return toCoreString(value); 173 return toCoreString(value);
174 } 174 }
175 175
176 inline AtomicString toCoreAtomicString(v8::Handle<v8::String> value) 176 inline AtomicString toCoreAtomicString(v8::Handle<v8::String> value)
177 { 177 {
178 return v8StringToWebCoreString<AtomicString>(value, Externalize); 178 return v8StringToWebCoreString<AtomicString>(value, Externalize);
179 } 179 }
180 180
181 // This method will return a null String if the v8::Value does not contain a v8: :String. 181 // This method will return a null String if the v8::Value does not contain a v8: :String.
182 // It will not call ToString() on the v8::Value. If you want ToString() to be ca lled, 182 // It will not call ToString() on the v8::Value. If you want ToString() to be ca lled,
183 // please use the V8TRYCATCH_FOR_V8STRINGRESOURCE_*() macros instead. 183 // please use the TONATIVE_FOR_V8STRINGRESOURCE_*() macros instead.
184 inline String toCoreStringWithUndefinedOrNullCheck(v8::Handle<v8::Value> value) 184 inline String toCoreStringWithUndefinedOrNullCheck(v8::Handle<v8::Value> value)
185 { 185 {
186 if (value.IsEmpty() || !value->IsString()) 186 if (value.IsEmpty() || !value->IsString())
187 return String(); 187 return String();
188 return toCoreString(value.As<v8::String>()); 188 return toCoreString(value.As<v8::String>());
189 } 189 }
190 190
191 // Convert a string to a V8 string. 191 // Convert a string to a V8 string.
192 // Return a V8 external string that shares the underlying buffer with the given 192 // Return a V8 external string that shares the underlying buffer with the given
193 // WebCore string. The reference counting mechanism is used to keep the 193 // WebCore string. The reference counting mechanism is used to keep the
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 // FIXME: Remove the special casing for NodeFilter and XPathNSResolver. 442 // FIXME: Remove the special casing for NodeFilter and XPathNSResolver.
443 PassRefPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value>, v8::Isolate*); 443 PassRefPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value>, v8::Isolate*);
444 PassRefPtrWillBeRawPtr<XPathNSResolver> toXPathNSResolver(v8::Handle<v8::Value>, v8::Isolate*); 444 PassRefPtrWillBeRawPtr<XPathNSResolver> toXPathNSResolver(v8::Handle<v8::Value>, v8::Isolate*);
445 445
446 template<class T> struct NativeValueTraits; 446 template<class T> struct NativeValueTraits;
447 447
448 template<> 448 template<>
449 struct NativeValueTraits<String> { 449 struct NativeValueTraits<String> {
450 static inline String nativeValue(const v8::Handle<v8::Value>& value, v8::Iso late* isolate) 450 static inline String nativeValue(const v8::Handle<v8::Value>& value, v8::Iso late* isolate)
451 { 451 {
452 V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<>, stringValue, value, String()); 452 TOSTRING_BOOL(V8StringResource<>, stringValue, value, String());
453 return stringValue; 453 return stringValue;
454 } 454 }
455 }; 455 };
456 456
457 template<> 457 template<>
458 struct NativeValueTraits<unsigned> { 458 struct NativeValueTraits<unsigned> {
459 static inline unsigned nativeValue(const v8::Handle<v8::Value>& value, v8::I solate* isolate) 459 static inline unsigned nativeValue(const v8::Handle<v8::Value>& value, v8::I solate* isolate)
460 { 460 {
461 return toUInt32(value); 461 return toUInt32(value);
462 } 462 }
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 return v8Undefined(); 628 return v8Undefined();
629 } 629 }
630 630
631 v8::Local<v8::Value> v8Value(v8::Local<v8::Value>::New(isolate, value)); 631 v8::Local<v8::Value> v8Value(v8::Local<v8::Value>::New(isolate, value));
632 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(v8Value); 632 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(v8Value);
633 v8::Local<v8::String> lengthSymbol = v8AtomicString(isolate, "length"); 633 v8::Local<v8::String> lengthSymbol = v8AtomicString(isolate, "length");
634 634
635 // FIXME: The specification states that the length property should be used a s fallback, if value 635 // FIXME: The specification states that the length property should be used a s fallback, if value
636 // is not a platform object that supports indexed properties. If it supports indexed properties, 636 // is not a platform object that supports indexed properties. If it supports indexed properties,
637 // length should actually be one greater than value’s maximum indexed proper ty index. 637 // length should actually be one greater than value’s maximum indexed proper ty index.
638 V8TRYCATCH(v8::Local<v8::Value>, lengthValue, object->Get(lengthSymbol)); 638 TONATIVE_EXCEPTION(v8::Local<v8::Value>, lengthValue, object->Get(lengthSymb ol));
639 639
640 if (lengthValue->IsUndefined() || lengthValue->IsNull()) { 640 if (lengthValue->IsUndefined() || lengthValue->IsNull()) {
641 // The caller is responsible for reporting a TypeError. 641 // The caller is responsible for reporting a TypeError.
642 return v8Undefined(); 642 return v8Undefined();
643 } 643 }
644 644
645 V8TRYCATCH(uint32_t, sequenceLength, lengthValue->Int32Value()); 645 TONATIVE_EXCEPTION(uint32_t, sequenceLength, lengthValue->Int32Value());
646 length = sequenceLength; 646 length = sequenceLength;
647 return v8Value; 647 return v8Value;
648 } 648 }
649 649
650 v8::Isolate* toIsolate(ExecutionContext*); 650 v8::Isolate* toIsolate(ExecutionContext*);
651 v8::Isolate* toIsolate(LocalFrame*); 651 v8::Isolate* toIsolate(LocalFrame*);
652 652
653 DOMWindow* toDOMWindow(v8::Handle<v8::Value>, v8::Isolate*); 653 DOMWindow* toDOMWindow(v8::Handle<v8::Value>, v8::Isolate*);
654 DOMWindow* toDOMWindow(v8::Handle<v8::Context>); 654 DOMWindow* toDOMWindow(v8::Handle<v8::Context>);
655 DOMWindow* enteredDOMWindow(v8::Isolate*); 655 DOMWindow* enteredDOMWindow(v8::Isolate*);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 759
760 private: 760 private:
761 v8::HandleScope m_handleScope; 761 v8::HandleScope m_handleScope;
762 v8::Context::Scope m_contextScope; 762 v8::Context::Scope m_contextScope;
763 RefPtr<NewScriptState> m_scriptState; 763 RefPtr<NewScriptState> m_scriptState;
764 }; 764 };
765 765
766 } // namespace WebCore 766 } // namespace WebCore
767 767
768 #endif // V8Binding_h 768 #endif // V8Binding_h
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8AbstractEventListener.cpp ('k') | Source/bindings/v8/V8Binding.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698