| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 template <size_t N> | 79 template <size_t N> |
| 80 static v8::MaybeLocal<v8::Value> callExtra(ScriptState* scriptState, const c
har* name, v8::Local<v8::Value>(&args)[N]) | 80 static v8::MaybeLocal<v8::Value> callExtra(ScriptState* scriptState, const c
har* name, v8::Local<v8::Value>(&args)[N]) |
| 81 { | 81 { |
| 82 return callExtraHelper(scriptState, name, N, args); | 82 return callExtraHelper(scriptState, name, N, args); |
| 83 } | 83 } |
| 84 | 84 |
| 85 template <size_t N> | 85 template <size_t N> |
| 86 static v8::Local<v8::Value> callExtraOrCrash(ScriptState* scriptState, const
char* name, v8::Local<v8::Value>(&args)[N]) | 86 static v8::Local<v8::Value> callExtraOrCrash(ScriptState* scriptState, const
char* name, v8::Local<v8::Value>(&args)[N]) |
| 87 { | 87 { |
| 88 return v8CallOrCrash(callExtraHelper(scriptState, name, N, args)); | 88 return callExtraHelper(scriptState, name, N, args).ToLocalChecked(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 private: | 91 private: |
| 92 static v8::MaybeLocal<v8::Value> callExtraHelper(ScriptState* scriptState, c
onst char* name, size_t numArgs, v8::Local<v8::Value>* args) | 92 static v8::MaybeLocal<v8::Value> callExtraHelper(ScriptState* scriptState, c
onst char* name, size_t numArgs, v8::Local<v8::Value>* args) |
| 93 { | 93 { |
| 94 v8::Isolate* isolate = scriptState->isolate(); | 94 v8::Isolate* isolate = scriptState->isolate(); |
| 95 v8::Local<v8::Value> undefined = v8::Undefined(isolate); | 95 v8::Local<v8::Value> undefined = v8::Undefined(isolate); |
| 96 v8::Local<v8::Value> functionValue = scriptState->getFromExtrasExports(n
ame).v8Value(); | 96 v8::Local<v8::Value> functionValue = scriptState->getFromExtrasExports(n
ame).v8Value(); |
| 97 if (functionValue.IsEmpty()) | 97 if (functionValue.IsEmpty()) |
| 98 return v8::MaybeLocal<v8::Value>(); | 98 return v8::MaybeLocal<v8::Value>(); |
| 99 v8::Local<v8::Function> function = functionValue.As<v8::Function>(); | 99 v8::Local<v8::Function> function = functionValue.As<v8::Function>(); |
| 100 return V8ScriptRunner::callInternalFunction(function, undefined, numArgs
, args, isolate); | 100 return V8ScriptRunner::callInternalFunction(function, undefined, numArgs
, args, isolate); |
| 101 } | 101 } |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 } // namespace blink | 104 } // namespace blink |
| 105 | 105 |
| 106 #endif // V8ScriptRunner_h | 106 #endif // V8ScriptRunner_h |
| OLD | NEW |