chore: bump chromium to 92.0.4499.0 (master) (#29046)
This commit is contained in:
parent
cbba602eae
commit
d5f2eb5a81
56 changed files with 162 additions and 148 deletions
|
@ -14,7 +14,7 @@
|
|||
#include "shell/common/gin_helper/function_template.h"
|
||||
#include "shell/common/gin_helper/locker.h"
|
||||
#include "shell/common/gin_helper/microtasks_scope.h"
|
||||
// Implements safe convertions between JS functions and base::Callback.
|
||||
// Implements safe convertions between JS functions and base::RepeatingCallback.
|
||||
|
||||
namespace gin_helper {
|
||||
|
||||
|
@ -111,7 +111,7 @@ struct V8FunctionInvoker<ReturnType(ArgTypes...)> {
|
|||
};
|
||||
|
||||
// Helper to pass a C++ funtion to JavaScript.
|
||||
using Translater = base::Callback<void(gin::Arguments* args)>;
|
||||
using Translater = base::RepeatingCallback<void(gin::Arguments* args)>;
|
||||
v8::Local<v8::Value> CreateFunctionFromTranslater(v8::Isolate* isolate,
|
||||
const Translater& translater,
|
||||
bool one_time);
|
||||
|
@ -127,7 +127,7 @@ struct NativeFunctionInvoker {};
|
|||
|
||||
template <typename ReturnType, typename... ArgTypes>
|
||||
struct NativeFunctionInvoker<ReturnType(ArgTypes...)> {
|
||||
static void Go(base::Callback<ReturnType(ArgTypes...)> val,
|
||||
static void Go(base::RepeatingCallback<ReturnType(ArgTypes...)> val,
|
||||
gin::Arguments* args) {
|
||||
using Indices = typename IndicesGenerator<sizeof...(ArgTypes)>::type;
|
||||
Invoker<Indices, ArgTypes...> invoker(args, 0);
|
||||
|
|
|
@ -12,19 +12,19 @@ namespace gin_helper {
|
|||
|
||||
namespace internal {
|
||||
|
||||
// This set of templates invokes a base::Callback by converting the Arguments
|
||||
// into native types. It relies on the function_template.h to provide helper
|
||||
// templates.
|
||||
// This set of templates invokes a base::RepeatingCallback by converting the
|
||||
// Arguments into native types. It relies on the function_template.h to provide
|
||||
// helper templates.
|
||||
inline WrappableBase* InvokeFactory(
|
||||
gin::Arguments* args,
|
||||
const base::Callback<WrappableBase*()>& callback) {
|
||||
const base::RepeatingCallback<WrappableBase*()>& callback) {
|
||||
return callback.Run();
|
||||
}
|
||||
|
||||
template <typename P1>
|
||||
inline WrappableBase* InvokeFactory(
|
||||
gin::Arguments* args,
|
||||
const base::Callback<WrappableBase*(P1)>& callback) {
|
||||
const base::RepeatingCallback<WrappableBase*(P1)>& callback) {
|
||||
typename CallbackParamTraits<P1>::LocalType a1;
|
||||
if (!gin_helper::GetNextArgument(args, 0, true, &a1))
|
||||
return nullptr;
|
||||
|
@ -34,7 +34,7 @@ inline WrappableBase* InvokeFactory(
|
|||
template <typename P1, typename P2>
|
||||
inline WrappableBase* InvokeFactory(
|
||||
gin::Arguments* args,
|
||||
const base::Callback<WrappableBase*(P1, P2)>& callback) {
|
||||
const base::RepeatingCallback<WrappableBase*(P1, P2)>& callback) {
|
||||
typename CallbackParamTraits<P1>::LocalType a1;
|
||||
typename CallbackParamTraits<P2>::LocalType a2;
|
||||
if (!gin_helper::GetNextArgument(args, 0, true, &a1) ||
|
||||
|
@ -46,7 +46,7 @@ inline WrappableBase* InvokeFactory(
|
|||
template <typename P1, typename P2, typename P3>
|
||||
inline WrappableBase* InvokeFactory(
|
||||
gin::Arguments* args,
|
||||
const base::Callback<WrappableBase*(P1, P2, P3)>& callback) {
|
||||
const base::RepeatingCallback<WrappableBase*(P1, P2, P3)>& callback) {
|
||||
typename CallbackParamTraits<P1>::LocalType a1;
|
||||
typename CallbackParamTraits<P2>::LocalType a2;
|
||||
typename CallbackParamTraits<P3>::LocalType a3;
|
||||
|
@ -60,7 +60,7 @@ inline WrappableBase* InvokeFactory(
|
|||
template <typename P1, typename P2, typename P3, typename P4>
|
||||
inline WrappableBase* InvokeFactory(
|
||||
gin::Arguments* args,
|
||||
const base::Callback<WrappableBase*(P1, P2, P3, P4)>& callback) {
|
||||
const base::RepeatingCallback<WrappableBase*(P1, P2, P3, P4)>& callback) {
|
||||
typename CallbackParamTraits<P1>::LocalType a1;
|
||||
typename CallbackParamTraits<P2>::LocalType a2;
|
||||
typename CallbackParamTraits<P3>::LocalType a3;
|
||||
|
@ -76,7 +76,8 @@ inline WrappableBase* InvokeFactory(
|
|||
template <typename P1, typename P2, typename P3, typename P4, typename P5>
|
||||
inline WrappableBase* InvokeFactory(
|
||||
gin::Arguments* args,
|
||||
const base::Callback<WrappableBase*(P1, P2, P3, P4, P5)>& callback) {
|
||||
const base::RepeatingCallback<WrappableBase*(P1, P2, P3, P4, P5)>&
|
||||
callback) {
|
||||
typename CallbackParamTraits<P1>::LocalType a1;
|
||||
typename CallbackParamTraits<P2>::LocalType a2;
|
||||
typename CallbackParamTraits<P3>::LocalType a3;
|
||||
|
@ -99,7 +100,8 @@ template <typename P1,
|
|||
typename P6>
|
||||
inline WrappableBase* InvokeFactory(
|
||||
gin::Arguments* args,
|
||||
const base::Callback<WrappableBase*(P1, P2, P3, P4, P5, P6)>& callback) {
|
||||
const base::RepeatingCallback<WrappableBase*(P1, P2, P3, P4, P5, P6)>&
|
||||
callback) {
|
||||
typename CallbackParamTraits<P1>::LocalType a1;
|
||||
typename CallbackParamTraits<P2>::LocalType a2;
|
||||
typename CallbackParamTraits<P3>::LocalType a3;
|
||||
|
@ -117,7 +119,7 @@ inline WrappableBase* InvokeFactory(
|
|||
}
|
||||
|
||||
template <typename Sig>
|
||||
void InvokeNew(const base::Callback<Sig>& factory,
|
||||
void InvokeNew(const base::RepeatingCallback<Sig>& factory,
|
||||
v8::Isolate* isolate,
|
||||
gin_helper::Arguments* args) {
|
||||
if (!args->IsConstructCall()) {
|
||||
|
|
|
@ -41,7 +41,8 @@ struct CallbackParamTraits<const T*> {
|
|||
typedef T* LocalType;
|
||||
};
|
||||
|
||||
// CallbackHolder and CallbackHolderBase are used to pass a base::Callback from
|
||||
// CallbackHolder and CallbackHolderBase are used to pass a
|
||||
// base::RepeatingCallback from
|
||||
// CreateFunctionTemplate through v8 (via v8::FunctionTemplate) to
|
||||
// DispatchToCallback, where it is invoked.
|
||||
|
||||
|
@ -70,10 +71,10 @@ template <typename Sig>
|
|||
class CallbackHolder : public CallbackHolderBase {
|
||||
public:
|
||||
CallbackHolder(v8::Isolate* isolate,
|
||||
const base::Callback<Sig>& callback,
|
||||
const base::RepeatingCallback<Sig>& callback,
|
||||
int flags)
|
||||
: CallbackHolderBase(isolate), callback(callback), flags(flags) {}
|
||||
base::Callback<Sig> callback;
|
||||
base::RepeatingCallback<Sig> callback;
|
||||
int flags = 0;
|
||||
|
||||
private:
|
||||
|
@ -214,7 +215,8 @@ class Invoker<IndicesHolder<indices...>, ArgTypes...>
|
|||
bool IsOK() { return And(ArgumentHolder<indices, ArgTypes>::ok...); }
|
||||
|
||||
template <typename ReturnType>
|
||||
void DispatchToCallback(base::Callback<ReturnType(ArgTypes...)> callback) {
|
||||
void DispatchToCallback(
|
||||
base::RepeatingCallback<ReturnType(ArgTypes...)> callback) {
|
||||
gin_helper::MicrotasksScope microtasks_scope(args_->isolate(), true);
|
||||
args_->Return(
|
||||
callback.Run(std::move(ArgumentHolder<indices, ArgTypes>::value)...));
|
||||
|
@ -223,7 +225,7 @@ class Invoker<IndicesHolder<indices...>, ArgTypes...>
|
|||
// In C++, you can declare the function foo(void), but you can't pass a void
|
||||
// expression to foo. As a result, we must specialize the case of Callbacks
|
||||
// that have the void return type.
|
||||
void DispatchToCallback(base::Callback<void(ArgTypes...)> callback) {
|
||||
void DispatchToCallback(base::RepeatingCallback<void(ArgTypes...)> callback) {
|
||||
gin_helper::MicrotasksScope microtasks_scope(args_->isolate(), true);
|
||||
callback.Run(std::move(ArgumentHolder<indices, ArgTypes>::value)...);
|
||||
}
|
||||
|
@ -239,7 +241,7 @@ class Invoker<IndicesHolder<indices...>, ArgTypes...>
|
|||
};
|
||||
|
||||
// DispatchToCallback converts all the JavaScript arguments to C++ types and
|
||||
// invokes the base::Callback.
|
||||
// invokes the base::RepeatingCallback.
|
||||
template <typename Sig>
|
||||
struct Dispatcher {};
|
||||
|
||||
|
@ -264,7 +266,8 @@ struct Dispatcher<ReturnType(ArgTypes...)> {
|
|||
};
|
||||
|
||||
// CreateFunctionTemplate creates a v8::FunctionTemplate that will create
|
||||
// JavaScript functions that execute a provided C++ function or base::Callback.
|
||||
// JavaScript functions that execute a provided C++ function or
|
||||
// base::RepeatingCallback.
|
||||
// JavaScript arguments are automatically converted via gin::Converter, as is
|
||||
// the return value of the C++ function, if any.
|
||||
//
|
||||
|
@ -275,7 +278,7 @@ struct Dispatcher<ReturnType(ArgTypes...)> {
|
|||
template <typename Sig>
|
||||
v8::Local<v8::FunctionTemplate> CreateFunctionTemplate(
|
||||
v8::Isolate* isolate,
|
||||
const base::Callback<Sig> callback,
|
||||
const base::RepeatingCallback<Sig> callback,
|
||||
int callback_flags = 0) {
|
||||
typedef CallbackHolder<Sig> HolderT;
|
||||
HolderT* holder = new HolderT(isolate, callback, callback_flags);
|
||||
|
@ -298,9 +301,9 @@ struct CallbackTraits {
|
|||
}
|
||||
};
|
||||
|
||||
// Specialization for base::Callback.
|
||||
// Specialization for base::RepeatingCallback.
|
||||
template <typename T>
|
||||
struct CallbackTraits<base::Callback<T>> {
|
||||
struct CallbackTraits<base::RepeatingCallback<T>> {
|
||||
static v8::Local<v8::FunctionTemplate> CreateTemplate(
|
||||
v8::Isolate* isolate,
|
||||
const base::RepeatingCallback<T>& callback) {
|
||||
|
|
|
@ -32,9 +32,9 @@ class ObjectTemplateBuilder {
|
|||
}
|
||||
|
||||
// In the following methods, T and U can be function pointer, member function
|
||||
// pointer, base::Callback, or v8::FunctionTemplate. Most clients will want to
|
||||
// use one of the first two options. Also see gin::CreateFunctionTemplate()
|
||||
// for creating raw function templates.
|
||||
// pointer, base::RepeatingCallback, or v8::FunctionTemplate. Most clients
|
||||
// will want to use one of the first two options. Also see
|
||||
// gin::CreateFunctionTemplate() for creating raw function templates.
|
||||
template <typename T>
|
||||
ObjectTemplateBuilder& SetMethod(const base::StringPiece& name,
|
||||
const T& callback) {
|
||||
|
|
|
@ -24,7 +24,7 @@ class Wrappable : public WrappableBase {
|
|||
|
||||
template <typename Sig>
|
||||
static void SetConstructor(v8::Isolate* isolate,
|
||||
const base::Callback<Sig>& constructor) {
|
||||
const base::RepeatingCallback<Sig>& constructor) {
|
||||
v8::Local<v8::FunctionTemplate> templ = gin_helper::CreateFunctionTemplate(
|
||||
isolate, base::BindRepeating(&internal::InvokeNew<Sig>, constructor));
|
||||
templ->InstanceTemplate()->SetInternalFieldCount(1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue