From 65034fdf545d2f937dd05f1aa535c39ba21ccac5 Mon Sep 17 00:00:00 2001 From: Camillo Date: Wed, 10 Aug 2022 10:15:44 +0200 Subject: [PATCH] [api] Advance API deprecation Remove the following deprecated functions: include/v8-inspector.h:364 v10.3 Use version with client_is_trusted argument include/v8-locker.h:130 v10.3 This method will be removed. include/v8-message.h:90 v10.3 Use GetHostDefinedOptions include/v8-script.h:51 v10.0 Use HostDefinedOptions include/v8-script.h:671 v10.0 Use CompileFunction Output generated by tools/release/list_deprecated.py. Remove CompileFunctionInContext for chrome and only implement it if V8_SCRIPTORMODULE_LEGACY_LIFETIME is defined. Change-Id: I33dd3665220f484e277e66f340e17ed2c3b49916 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3702449 Reviewed-by: Victor Gomes Reviewed-by: Michael Lippautz Commit-Queue: Victor Gomes Auto-Submit: Camillo Bruni Cr-Commit-Position: refs/heads/main@{#82476} --- include/v8-inspector.h | 6 ------ include/v8-locker.h | 9 --------- include/v8-message.h | 2 -- include/v8-script.h | 3 +-- src/api/api.cc | 17 ++--------------- src/execution/v8threads.cc | 5 ----- 6 files changed, 3 insertions(+), 39 deletions(-) diff --git a/include/v8-inspector.h b/include/v8-inspector.h index 1fb1c2c61a..08105426d9 100644 --- a/include/v8-inspector.h +++ b/include/v8-inspector.h @@ -361,12 +361,6 @@ class V8_EXPORT V8Inspector { virtual void sendNotification(std::unique_ptr message) = 0; virtual void flushProtocolNotifications() = 0; }; - V8_DEPRECATED("Use version with client_is_trusted argument") - virtual std::unique_ptr connect(int contextGroupId, - Channel* channel, - StringView state) { - return connect(contextGroupId, channel, state, kFullyTrusted); - } enum ClientTrustLevel { kUntrusted, kFullyTrusted }; virtual std::unique_ptr connect( int contextGroupId, Channel*, StringView state, diff --git a/include/v8-locker.h b/include/v8-locker.h index 17ea88cb81..22b7a8767a 100644 --- a/include/v8-locker.h +++ b/include/v8-locker.h @@ -121,15 +121,6 @@ class V8_EXPORT Locker { */ static bool IsLocked(Isolate* isolate); - /** - * Returns whether any v8::Locker has ever been used in this process. - * TODO(cbruni, chromium:1240851): Fix locking checks on a per-thread basis. - * The current implementation is quite confusing and leads to unexpected - * results if anybody uses v8::Locker in the current process. - */ - V8_DEPRECATED("This method will be removed.") - static bool WasEverUsed(); - // Disallow copying and assigning. Locker(const Locker&) = delete; void operator=(const Locker&) = delete; diff --git a/include/v8-message.h b/include/v8-message.h index 15325e4234..09f9a0a97d 100644 --- a/include/v8-message.h +++ b/include/v8-message.h @@ -87,8 +87,6 @@ class V8_EXPORT ScriptOrigin { V8_INLINE int ColumnOffset() const; V8_INLINE int ScriptId() const; V8_INLINE Local SourceMapUrl() const; - V8_DEPRECATED("Use GetHostDefinedOptions") - Local HostDefinedOptions() const; V8_INLINE Local GetHostDefinedOptions() const; V8_INLINE ScriptOriginOptions Options() const { return options_; } diff --git a/include/v8-script.h b/include/v8-script.h index 12f785e4cd..dbd98ed55b 100644 --- a/include/v8-script.h +++ b/include/v8-script.h @@ -48,8 +48,6 @@ class V8_EXPORT ScriptOrModule { * The options that were passed by the embedder as HostDefinedOptions to * the ScriptOrigin. */ - V8_DEPRECATED("Use HostDefinedOptions") - Local GetHostDefinedOptions(); Local HostDefinedOptions(); }; @@ -706,6 +704,7 @@ class V8_EXPORT ScriptCompiler { CompileOptions options = kNoCompileOptions, NoCacheReason no_cache_reason = kNoCacheNoReason, Local* script_or_module_out = nullptr); + static V8_WARN_UNUSED_RESULT MaybeLocal CompileFunction( Local context, Source* source, size_t arguments_count = 0, Local arguments[] = nullptr, size_t context_extension_count = 0, diff --git a/src/api/api.cc b/src/api/api.cc index 0d3d7a1a81..353fa739d8 100644 --- a/src/api/api.cc +++ b/src/api/api.cc @@ -193,17 +193,6 @@ static ScriptOrigin GetScriptOriginForScript(i::Isolate* i_isolate, return origin; } -Local ScriptOrigin::HostDefinedOptions() const { - // TODO(cbruni, chromium:1244145): remove once migrated to the context. - Utils::ApiCheck(!host_defined_options_->IsFixedArray(), - "ScriptOrigin::HostDefinedOptions", - "HostDefinedOptions is not a PrimitiveArray, please use " - "ScriptOrigin::GetHostDefinedOptions()"); - i::Handle options = - Utils::OpenHandle(*host_defined_options_.As()); - return Utils::PrimitiveArrayToLocal(options); -} - // --- E x c e p t i o n B e h a v i o r --- // When V8 cannot allocate memory FatalProcessOutOfMemory is called. The default @@ -2170,10 +2159,6 @@ Local ScriptOrModule::GetResourceName() { return ToApiHandle(val); } -Local ScriptOrModule::GetHostDefinedOptions() { - return HostDefinedOptions().As(); -} - Local ScriptOrModule::HostDefinedOptions() { i::Handle obj = Utils::OpenHandle(this); i::Isolate* i_isolate = i::GetIsolateFromWritableObject(*obj); @@ -2632,6 +2617,7 @@ V8_WARN_UNUSED_RESULT MaybeLocal ScriptCompiler::CompileFunction( options, no_cache_reason, nullptr); } +#ifdef V8_SCRIPTORMODULE_LEGACY_LIFETIME // static MaybeLocal ScriptCompiler::CompileFunctionInContext( Local context, Source* source, size_t arguments_count, @@ -2643,6 +2629,7 @@ MaybeLocal ScriptCompiler::CompileFunctionInContext( context, source, arguments_count, arguments, context_extension_count, context_extensions, options, no_cache_reason, script_or_module_out); } +#endif // V8_SCRIPTORMODULE_LEGACY_LIFETIME MaybeLocal ScriptCompiler::CompileFunctionInternal( Local v8_context, Source* source, size_t arguments_count, diff --git a/src/execution/v8threads.cc b/src/execution/v8threads.cc index e0e90fddcc..be4f4a7f20 100644 --- a/src/execution/v8threads.cc +++ b/src/execution/v8threads.cc @@ -56,11 +56,6 @@ bool Locker::IsLocked(v8::Isolate* isolate) { return i_isolate->thread_manager()->IsLockedByCurrentThread(); } -// static -bool Locker::WasEverUsed() { - return base::Relaxed_Load(&g_locker_was_ever_used_) != 0; -} - Locker::~Locker() { DCHECK(isolate_->thread_manager()->IsLockedByCurrentThread()); if (has_lock_) {