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

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

Issue 309553002: Add ByteString support to IDL bindings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 | Annotate | Revision Log
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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 NonThrowableExceptionState exceptionState; 485 NonThrowableExceptionState exceptionState;
486 return toUInt64(value, NormalConversion, exceptionState); 486 return toUInt64(value, NormalConversion, exceptionState);
487 } 487 }
488 488
489 float toFloat(v8::Handle<v8::Value> value, ExceptionState& exceptionState) 489 float toFloat(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
490 { 490 {
491 TONATIVE_DEFAULT_EXCEPTIONSTATE(v8::Local<v8::Number>, numberObject, value-> ToNumber(), exceptionState, 0); 491 TONATIVE_DEFAULT_EXCEPTIONSTATE(v8::Local<v8::Number>, numberObject, value-> ToNumber(), exceptionState, 0);
492 return numberObject->NumberValue(); 492 return numberObject->NumberValue();
493 } 493 }
494 494
495 String toByteString(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
496 {
497 String string = toCoreString(value.As<v8::String>());
jsbell 2014/05/30 21:53:28 Yeah, this As<v8::String> is bogus if it's not a s
Nils Barth (inactive) 2014/06/02 03:20:16 Should it be ToString() instead then? (JS values a
jsbell 2014/06/03 23:22:36 Yeah; handling should be identical to js->DOMStrin
498 if (!string.containsOnlyLatin1()) {
499 exceptionState.throwTypeError("Value is not a valid ByteString.");
500 return String();
501 }
502 return string;
503 }
504
495 PassRefPtrWillBeRawPtr<XPathNSResolver> toXPathNSResolver(v8::Handle<v8::Value> value, v8::Isolate* isolate) 505 PassRefPtrWillBeRawPtr<XPathNSResolver> toXPathNSResolver(v8::Handle<v8::Value> value, v8::Isolate* isolate)
496 { 506 {
497 RefPtrWillBeRawPtr<XPathNSResolver> resolver = nullptr; 507 RefPtrWillBeRawPtr<XPathNSResolver> resolver = nullptr;
498 if (V8XPathNSResolver::hasInstance(value, isolate)) 508 if (V8XPathNSResolver::hasInstance(value, isolate))
499 resolver = V8XPathNSResolver::toNative(v8::Handle<v8::Object>::Cast(valu e)); 509 resolver = V8XPathNSResolver::toNative(v8::Handle<v8::Object>::Cast(valu e));
500 else if (value->IsObject()) 510 else if (value->IsObject())
501 resolver = V8CustomXPathNSResolver::create(value->ToObject(), isolate); 511 resolver = V8CustomXPathNSResolver::create(value->ToObject(), isolate);
502 return resolver; 512 return resolver;
503 } 513 }
504 514
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(Executio nContext* context, v8::Handle<v8::Function> function, v8::Isolate* isolate) 800 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(Executio nContext* context, v8::Handle<v8::Function> function, v8::Isolate* isolate)
791 { 801 {
792 int scriptId = 0; 802 int scriptId = 0;
793 String resourceName; 803 String resourceName;
794 int lineNumber = 1; 804 int lineNumber = 1;
795 GetDevToolsFunctionInfo(function, isolate, scriptId, resourceName, lineNumbe r); 805 GetDevToolsFunctionInfo(function, isolate, scriptId, resourceName, lineNumbe r);
796 return InspectorFunctionCallEvent::data(context, scriptId, resourceName, lin eNumber); 806 return InspectorFunctionCallEvent::data(context, scriptId, resourceName, lin eNumber);
797 } 807 }
798 808
799 } // namespace WebCore 809 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698