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

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

Issue 1594653003: Move utilities for V8 extras functions into V8Binding.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move to V8Binding.h and fix tests Created 4 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperationsTest.cpp ('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) 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 19 matching lines...) Expand all
30 */ 30 */
31 31
32 #ifndef V8Binding_h 32 #ifndef V8Binding_h
33 #define V8Binding_h 33 #define V8Binding_h
34 34
35 #include "bindings/core/v8/DOMDataStore.h" 35 #include "bindings/core/v8/DOMDataStore.h"
36 #include "bindings/core/v8/DOMWrapperWorld.h" 36 #include "bindings/core/v8/DOMWrapperWorld.h"
37 #include "bindings/core/v8/ExceptionMessages.h" 37 #include "bindings/core/v8/ExceptionMessages.h"
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/ScriptState.h"
40 #include "bindings/core/v8/ScriptValue.h" 41 #include "bindings/core/v8/ScriptValue.h"
41 #include "bindings/core/v8/ScriptWrappable.h" 42 #include "bindings/core/v8/ScriptWrappable.h"
42 #include "bindings/core/v8/V8BindingMacros.h" 43 #include "bindings/core/v8/V8BindingMacros.h"
43 #include "bindings/core/v8/V8PerIsolateData.h" 44 #include "bindings/core/v8/V8PerIsolateData.h"
45 #include "bindings/core/v8/V8ScriptRunner.h"
44 #include "bindings/core/v8/V8StringResource.h" 46 #include "bindings/core/v8/V8StringResource.h"
45 #include "bindings/core/v8/V8ThrowException.h" 47 #include "bindings/core/v8/V8ThrowException.h"
46 #include "bindings/core/v8/V8ValueCache.h" 48 #include "bindings/core/v8/V8ValueCache.h"
47 #include "core/CoreExport.h" 49 #include "core/CoreExport.h"
48 #include "platform/JSONValues.h" 50 #include "platform/JSONValues.h"
49 #include "platform/heap/Handle.h" 51 #include "platform/heap/Handle.h"
50 #include "wtf/text/AtomicString.h" 52 #include "wtf/text/AtomicString.h"
51 #include <v8.h> 53 #include <v8.h>
52 54
53 namespace blink { 55 namespace blink {
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 mutable v8::Local<v8::Function> m_function; 1085 mutable v8::Local<v8::Function> m_function;
1084 }; 1086 };
1085 1087
1086 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol ate*, ExecutionContext*, v8::Local<v8::Function>); 1088 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol ate*, ExecutionContext*, v8::Local<v8::Function>);
1087 1089
1088 // Callback functions used by generated code. 1090 // Callback functions used by generated code.
1089 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName, const v8::PropertyCallbackInfo<v8::Value>&); 1091 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName, const v8::PropertyCallbackInfo<v8::Value>&);
1090 1092
1091 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*); 1093 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*);
1092 1094
1095 // Utiltiies for calling functions added to the V8 extras binding object.
1096
1097 inline v8::MaybeLocal<v8::Value> v8CallExtraHelper(ScriptState* scriptState, con st char* name, size_t numArgs, v8::Local<v8::Value>* args)
1098 {
1099 v8::Isolate* isolate = scriptState->isolate();
1100 ExecutionContext* ec = scriptState->executionContext();
1101 v8::Local<v8::Value> undefined = v8::Undefined(isolate);
1102 v8::Local<v8::Value> functionValue = scriptState->getFromExtrasExports(name) .v8Value();
1103 v8::Local<v8::Function> function = functionValue.As<v8::Function>();
1104 return V8ScriptRunner::callFunction(function, ec, undefined, numArgs, args, isolate);
1105 }
1106
1107 template <size_t N>
1108 v8::MaybeLocal<v8::Value> v8CallExtra(ScriptState* scriptState, const char* name , v8::Local<v8::Value>(&args)[N])
1109 {
1110 return v8CallExtraHelper(scriptState, name, N, args);
1111 }
1112
1113 template <size_t N>
1114 v8::Local<v8::Value> v8CallExtraOrCrash(ScriptState* scriptState, const char* na me, v8::Local<v8::Value>(&args)[N])
1115 {
1116 return v8CallOrCrash(v8CallExtraHelper(scriptState, name, N, args));
1117 }
1118
1093 } // namespace blink 1119 } // namespace blink
1094 1120
1095 #endif // V8Binding_h 1121 #endif // V8Binding_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperationsTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698