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

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

Issue 1670743002: Move V8 extra-calling utilities to V8ScriptRunner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 mutable v8::Local<v8::Function> m_function; 1080 mutable v8::Local<v8::Function> m_function;
1081 }; 1081 };
1082 1082
1083 PassRefPtr<TracedValue> devToolsTraceEventData(v8::Isolate*, ExecutionContext*, v8::Local<v8::Function>); 1083 PassRefPtr<TracedValue> devToolsTraceEventData(v8::Isolate*, ExecutionContext*, v8::Local<v8::Function>);
1084 1084
1085 // Callback functions used by generated code. 1085 // Callback functions used by generated code.
1086 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName, const v8::PropertyCallbackInfo<v8::Value>&); 1086 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName, const v8::PropertyCallbackInfo<v8::Value>&);
1087 1087
1088 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*); 1088 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*);
1089 1089
1090 // Utiltiies for calling functions added to the V8 extras binding object.
1091
1092 inline v8::MaybeLocal<v8::Value> v8CallExtraHelper(ScriptState* scriptState, con st char* name, size_t numArgs, v8::Local<v8::Value>* args)
1093 {
1094 v8::Isolate* isolate = scriptState->isolate();
1095 ExecutionContext* ec = scriptState->executionContext();
1096 v8::Local<v8::Value> undefined = v8::Undefined(isolate);
1097 v8::Local<v8::Value> functionValue = scriptState->getFromExtrasExports(name) .v8Value();
1098 v8::Local<v8::Function> function = functionValue.As<v8::Function>();
1099 return V8ScriptRunner::callFunction(function, ec, undefined, numArgs, args, isolate);
1100 }
1101
1102 template <size_t N>
1103 v8::MaybeLocal<v8::Value> v8CallExtra(ScriptState* scriptState, const char* name , v8::Local<v8::Value>(&args)[N])
1104 {
1105 return v8CallExtraHelper(scriptState, name, N, args);
1106 }
1107
1108 template <size_t N>
1109 v8::Local<v8::Value> v8CallExtraOrCrash(ScriptState* scriptState, const char* na me, v8::Local<v8::Value>(&args)[N])
1110 {
1111 return v8CallOrCrash(v8CallExtraHelper(scriptState, name, N, args));
1112 }
1113
1114 } // namespace blink 1090 } // namespace blink
1115 1091
1116 #endif // V8Binding_h 1092 #endif // V8Binding_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698