diff --git a/include/v8.h b/include/v8.h index 86a55459df..5b9fcd4a0c 100644 --- a/include/v8.h +++ b/include/v8.h @@ -8236,19 +8236,7 @@ class V8_EXPORT Isolate { kRegExpExecCalledOnSlowRegExp = 79, kRegExpReplaceCalledOnSlowRegExp = 80, kDisplayNames = 81, - // Temporary kCallInDetachedWindowBy* counters are for reporting function - // calls within contexts marked using |SetDetachedWindowReason|. - // TODO(bartekn,chromium:1018156): Remove once not needed. - kCallInDetachedWindowByNavigation = 82, - kCallInDetachedWindowByNavigationAfter10s = 83, - kCallInDetachedWindowByNavigationAfter1min = 84, - kCallInDetachedWindowByClosing = 85, - kCallInDetachedWindowByClosingAfter10s = 86, - kCallInDetachedWindowByClosingAfter1min = 87, - kCallInDetachedWindowByOtherReason = 88, - kCallInDetachedWindowByOtherReasonAfter10s = 89, - kCallInDetachedWindowByOtherReasonAfter1min = 90, - kSharedArrayBufferConstructed = 91, + kSharedArrayBufferConstructed = 82, // If you add new values here, you'll also need to update Chromium's: // web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to diff --git a/src/objects/contexts.cc b/src/objects/contexts.cc index 71da3f0056..fff68b49df 100644 --- a/src/objects/contexts.cc +++ b/src/objects/contexts.cc @@ -503,10 +503,6 @@ STATIC_ASSERT(NativeContext::kSize == void NativeContext::SetDetachedWindowReason( v8::Context::DetachedWindowReason reason) { set_detached_window_reason(Smi::FromEnum(reason)); - - Isolate* isolate = GetIsolate(); - set_detached_window_time_in_seconds( - Smi::FromInt(static_cast(isolate->time_millis_since_init() / 1000))); } v8::Context::DetachedWindowReason NativeContext::GetDetachedWindowReason() @@ -515,11 +511,5 @@ v8::Context::DetachedWindowReason NativeContext::GetDetachedWindowReason() detached_window_reason().value()); } -int NativeContext::SecondsSinceDetachedWindow() const { - Isolate* isolate = GetIsolate(); - return static_cast(isolate->time_millis_since_init() / 1000 - - detached_window_time_in_seconds().value()); -} - } // namespace internal } // namespace v8 diff --git a/src/objects/contexts.h b/src/objects/contexts.h index bef5d648d0..c6609e2142 100644 --- a/src/objects/contexts.h +++ b/src/objects/contexts.h @@ -369,7 +369,6 @@ enum ContextLookupFlags { V(WEAKSET_ADD_INDEX, JSFunction, weakset_add) \ V(OSR_CODE_CACHE_INDEX, WeakFixedArray, osr_code_cache) \ V(DETACHED_WINDOW_REASON_INDEX, Smi, detached_window_reason) \ - V(DETACHED_WINDOW_TIME_INDEX, Smi, detached_window_time_in_seconds) \ NATIVE_CONTEXT_INTRINSIC_FUNCTIONS(V) // A table of all script contexts. Every loaded top-level script with top-level @@ -735,8 +734,6 @@ class NativeContext : public Context { void SetDetachedWindowReason(v8::Context::DetachedWindowReason reason); v8::Context::DetachedWindowReason GetDetachedWindowReason() const; - // This can be off up to 1s in each direction. - int SecondsSinceDetachedWindow() const; private: STATIC_ASSERT(OffsetOfElementAt(EMBEDDER_DATA_INDEX) == diff --git a/src/runtime/runtime-internal.cc b/src/runtime/runtime-internal.cc index 206f6ce041..e253a19d63 100644 --- a/src/runtime/runtime-internal.cc +++ b/src/runtime/runtime-internal.cc @@ -87,38 +87,9 @@ RUNTIME_FUNCTION(Runtime_ReportDetachedWindowAccess) { DCHECK_EQ(0, args.length()); Handle native_context(isolate->context().native_context(), isolate); - v8::Isolate::UseCounterFeature counter_main; - v8::Isolate::UseCounterFeature counter_10s; - v8::Isolate::UseCounterFeature counter_1min; - switch (native_context->GetDetachedWindowReason()) { - case v8::Context::kWindowNotDetached: - // We should never get here. Just exit early in case we do. - return ReadOnlyRoots(isolate).undefined_value(); - case v8::Context::kDetachedWindowByNavigation: - counter_main = v8::Isolate::kCallInDetachedWindowByNavigation; - counter_10s = v8::Isolate::kCallInDetachedWindowByNavigationAfter10s; - counter_1min = v8::Isolate::kCallInDetachedWindowByNavigationAfter1min; - break; - case v8::Context::kDetachedWindowByClosing: - counter_main = v8::Isolate::kCallInDetachedWindowByClosing; - counter_10s = v8::Isolate::kCallInDetachedWindowByClosingAfter10s; - counter_1min = v8::Isolate::kCallInDetachedWindowByClosingAfter1min; - break; - case v8::Context::kDetachedWindowByOtherReason: - counter_main = v8::Isolate::kCallInDetachedWindowByOtherReason; - counter_10s = v8::Isolate::kCallInDetachedWindowByOtherReasonAfter10s; - counter_1min = v8::Isolate::kCallInDetachedWindowByOtherReasonAfter1min; - break; - } - isolate->CountUsage(counter_main); - // This can be off by up to 1s in each direction, but that's ok. - int secs_passed = native_context->SecondsSinceDetachedWindow(); - if (secs_passed >= 10) { - isolate->CountUsage(counter_10s); - } - if (secs_passed >= 60) { - isolate->CountUsage(counter_1min); - } + // TODO(bartekn,chromium:1018156): Report this to Blink, for it to emit it + // via UKM. Use native_context->detached_window_reason().value() + // This will be addressed as the first step after this CL lands. // The return value isn't needed, but RUNTIME_FUNCTION sets it up. return ReadOnlyRoots(isolate).undefined_value();