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

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

Issue 1021713003: [bindings] Let NativeValueTraits<T>::nativeValue be variadic function and merge various convers… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed the compiler error behind ASSERT flag Created 5 years, 9 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
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 27 matching lines...) Expand all
38 #include "bindings/core/v8/ExceptionState.h" 38 #include "bindings/core/v8/ExceptionState.h"
39 #include "bindings/core/v8/NativeValueTraits.h" 39 #include "bindings/core/v8/NativeValueTraits.h"
40 #include "bindings/core/v8/ScriptValue.h" 40 #include "bindings/core/v8/ScriptValue.h"
41 #include "bindings/core/v8/ScriptWrappable.h" 41 #include "bindings/core/v8/ScriptWrappable.h"
42 #include "bindings/core/v8/V8BindingMacros.h" 42 #include "bindings/core/v8/V8BindingMacros.h"
43 #include "bindings/core/v8/V8PerIsolateData.h" 43 #include "bindings/core/v8/V8PerIsolateData.h"
44 #include "bindings/core/v8/V8StringResource.h" 44 #include "bindings/core/v8/V8StringResource.h"
45 #include "bindings/core/v8/V8ThrowException.h" 45 #include "bindings/core/v8/V8ThrowException.h"
46 #include "bindings/core/v8/V8ValueCache.h" 46 #include "bindings/core/v8/V8ValueCache.h"
47 #include "core/CoreExport.h" 47 #include "core/CoreExport.h"
48 #include "platform/JSONValues.h"
48 #include "platform/heap/Handle.h" 49 #include "platform/heap/Handle.h"
49 #include "wtf/text/AtomicString.h" 50 #include "wtf/text/AtomicString.h"
50 #include <v8.h> 51 #include <v8.h>
51 52
52 namespace blink { 53 namespace blink {
53 54
54 class DOMWindow; 55 class DOMWindow;
55 class EventListener; 56 class EventListener;
56 class EventTarget; 57 class EventTarget;
57 class ExecutionContext; 58 class ExecutionContext;
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 }; 835 };
835 836
836 template <typename T> 837 template <typename T>
837 struct NativeValueTraits<Vector<T>> { 838 struct NativeValueTraits<Vector<T>> {
838 static inline Vector<T> nativeValue(v8::Local<v8::Value> value, v8::Isolate* isolate, ExceptionState& exceptionState) 839 static inline Vector<T> nativeValue(v8::Local<v8::Value> value, v8::Isolate* isolate, ExceptionState& exceptionState)
839 { 840 {
840 return toImplArray<T>(value, 0, isolate, exceptionState); 841 return toImplArray<T>(value, 0, isolate, exceptionState);
841 } 842 }
842 }; 843 };
843 844
845 typedef PassRefPtr<JSONValue> JSONValuePtr;
846
847 template <>
848 struct NativeValueTraits<JSONValuePtr> {
849 static JSONValuePtr nativeValue(v8::Local<v8::Value>, v8::Isolate*, Exceptio nState&, int maxDepth = JSONValue::maxDepth);
850 };
851
844 CORE_EXPORT v8::Isolate* toIsolate(ExecutionContext*); 852 CORE_EXPORT v8::Isolate* toIsolate(ExecutionContext*);
845 v8::Isolate* toIsolate(LocalFrame*); 853 v8::Isolate* toIsolate(LocalFrame*);
846 854
847 DOMWindow* toDOMWindow(v8::Isolate*, v8::Handle<v8::Value>); 855 DOMWindow* toDOMWindow(v8::Isolate*, v8::Handle<v8::Value>);
848 DOMWindow* toDOMWindow(v8::Handle<v8::Context>); 856 DOMWindow* toDOMWindow(v8::Handle<v8::Context>);
849 LocalDOMWindow* enteredDOMWindow(v8::Isolate*); 857 LocalDOMWindow* enteredDOMWindow(v8::Isolate*);
850 LocalDOMWindow* currentDOMWindow(v8::Isolate*); 858 LocalDOMWindow* currentDOMWindow(v8::Isolate*);
851 LocalDOMWindow* callingDOMWindow(v8::Isolate*); 859 LocalDOMWindow* callingDOMWindow(v8::Isolate*);
852 ExecutionContext* toExecutionContext(v8::Handle<v8::Context>); 860 ExecutionContext* toExecutionContext(v8::Handle<v8::Context>);
853 CORE_EXPORT ExecutionContext* currentExecutionContext(v8::Isolate*); 861 CORE_EXPORT ExecutionContext* currentExecutionContext(v8::Isolate*);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 properties->Set(integer, integer); 903 properties->Set(integer, integer);
896 } 904 }
897 v8SetReturnValue(info, properties); 905 v8SetReturnValue(info, properties);
898 } 906 }
899 907
900 // These methods store hidden values into an array that is stored in the interna l field of a DOM wrapper. 908 // These methods store hidden values into an array that is stored in the interna l field of a DOM wrapper.
901 void addHiddenValueToArray(v8::Isolate*, v8::Handle<v8::Object>, v8::Local<v8::V alue>, int cacheIndex); 909 void addHiddenValueToArray(v8::Isolate*, v8::Handle<v8::Object>, v8::Local<v8::V alue>, int cacheIndex);
902 void removeHiddenValueFromArray(v8::Isolate*, v8::Handle<v8::Object>, v8::Local< v8::Value>, int cacheIndex); 910 void removeHiddenValueFromArray(v8::Isolate*, v8::Handle<v8::Object>, v8::Local< v8::Value>, int cacheIndex);
903 CORE_EXPORT void moveEventListenerToNewWrapper(v8::Isolate*, v8::Handle<v8::Obje ct>, EventListener* oldValue, v8::Local<v8::Value> newValue, int cacheIndex); 911 CORE_EXPORT void moveEventListenerToNewWrapper(v8::Isolate*, v8::Handle<v8::Obje ct>, EventListener* oldValue, v8::Local<v8::Value> newValue, int cacheIndex);
904 912
905 PassRefPtr<JSONValue> v8ToJSONValue(v8::Isolate*, v8::Handle<v8::Value>, int);
906
907 // Result values for platform object 'deleter' methods, 913 // Result values for platform object 'deleter' methods,
908 // http://www.w3.org/TR/WebIDL/#delete 914 // http://www.w3.org/TR/WebIDL/#delete
909 enum DeleteResult { 915 enum DeleteResult {
910 DeleteSuccess, 916 DeleteSuccess,
911 DeleteReject, 917 DeleteReject,
912 DeleteUnknownProperty 918 DeleteUnknownProperty
913 }; 919 };
914 920
915 class V8IsolateInterruptor : public ThreadState::Interruptor { 921 class V8IsolateInterruptor : public ThreadState::Interruptor {
916 public: 922 public:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol ate*, ExecutionContext*, v8::Handle<v8::Function>); 973 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol ate*, ExecutionContext*, v8::Handle<v8::Function>);
968 974
969 // Callback functions used by generated code. 975 // Callback functions used by generated code.
970 void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName, const v8::Pr opertyCallbackInfo<v8::Value>&); 976 void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName, const v8::Pr opertyCallbackInfo<v8::Value>&);
971 977
972 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*); 978 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*);
973 979
974 } // namespace blink 980 } // namespace blink
975 981
976 #endif // V8Binding_h 982 #endif // V8Binding_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698