Commit 5214e811 authored by Nicolás Peña Moreno's avatar Nicolás Peña Moreno Committed by Commit Bot

Remove SubTaskAttribution

After the removal of the LongTaskV2 flag, SubTaskAtrribution is never
used. This CL removes the class and related code.

Bug: 738493
Change-Id: I2ecb5146bc6375daa6d131ed700fc0b257282186
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1869013
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Reviewed-by: default avatarSteve Kobes <skobes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707884}
parent 4ff734e0
...@@ -21,15 +21,6 @@ ...@@ -21,15 +21,6 @@
namespace blink { namespace blink {
namespace {
constexpr auto kLongTaskSubTaskThreshold =
base::TimeDelta::FromMilliseconds(12);
} // namespace
void PerformanceMonitor::BypassLongCompileThresholdOnceForTesting() {
bypass_long_compile_threshold_ = true;
}
// static // static
base::TimeDelta PerformanceMonitor::Threshold(ExecutionContext* context, base::TimeDelta PerformanceMonitor::Threshold(ExecutionContext* context,
Violation violation) { Violation violation) {
...@@ -203,16 +194,6 @@ void PerformanceMonitor::Will(const probe::ExecuteScript& probe) { ...@@ -203,16 +194,6 @@ void PerformanceMonitor::Will(const probe::ExecuteScript& probe) {
void PerformanceMonitor::Did(const probe::ExecuteScript& probe) { void PerformanceMonitor::Did(const probe::ExecuteScript& probe) {
DidExecuteScript(); DidExecuteScript();
if (!enabled_ || thresholds_[kLongTask].is_zero())
return;
if (probe.Duration() <= kLongTaskSubTaskThreshold)
return;
auto sub_task_attribution = std::make_unique<SubTaskAttribution>(
AtomicString("script-run"), probe.context->Url().GetString(),
probe.CaptureStartTime(), probe.Duration());
sub_task_attributions_.push_back(std::move(sub_task_attribution));
} }
void PerformanceMonitor::Will(const probe::CallFunction& probe) { void PerformanceMonitor::Will(const probe::CallFunction& probe) {
...@@ -252,26 +233,7 @@ void PerformanceMonitor::Will(const probe::V8Compile& probe) { ...@@ -252,26 +233,7 @@ void PerformanceMonitor::Will(const probe::V8Compile& probe) {
v8_compile_start_time_ = probe.CaptureStartTime(); v8_compile_start_time_ = probe.CaptureStartTime();
} }
void PerformanceMonitor::Did(const probe::V8Compile& probe) { void PerformanceMonitor::Did(const probe::V8Compile& probe) {}
if (!enabled_ || thresholds_[kLongTask].is_zero())
return;
base::TimeDelta v8_compile_duration = probe.Duration();
if (bypass_long_compile_threshold_) {
bypass_long_compile_threshold_ = false;
} else {
if (v8_compile_duration <= kLongTaskSubTaskThreshold)
return;
}
auto sub_task_attribution = std::make_unique<SubTaskAttribution>(
AtomicString("script-compile"),
String::Format("%s(%d, %d)", probe.file_name.Utf8().c_str(), probe.line,
probe.column),
v8_compile_start_time_, v8_compile_duration);
sub_task_attributions_.push_back(std::move(sub_task_attribution));
}
void PerformanceMonitor::Will(const probe::UserCallback& probe) { void PerformanceMonitor::Will(const probe::UserCallback& probe) {
++user_callback_depth_; ++user_callback_depth_;
...@@ -315,7 +277,6 @@ void PerformanceMonitor::WillProcessTask(base::TimeTicks start_time) { ...@@ -315,7 +277,6 @@ void PerformanceMonitor::WillProcessTask(base::TimeTicks start_time) {
per_task_style_and_layout_time_ = base::TimeDelta(); per_task_style_and_layout_time_ = base::TimeDelta();
user_callback_ = nullptr; user_callback_ = nullptr;
v8_compile_start_time_ = base::TimeTicks(); v8_compile_start_time_ = base::TimeTicks();
sub_task_attributions_.clear();
} }
void PerformanceMonitor::DidProcessTask(base::TimeTicks start_time, void PerformanceMonitor::DidProcessTask(base::TimeTicks start_time,
...@@ -341,7 +302,7 @@ void PerformanceMonitor::DidProcessTask(base::TimeTicks start_time, ...@@ -341,7 +302,7 @@ void PerformanceMonitor::DidProcessTask(base::TimeTicks start_time,
it.key->ReportLongTask( it.key->ReportLongTask(
start_time, end_time, start_time, end_time,
task_has_multiple_contexts_ ? nullptr : task_execution_context_, task_has_multiple_contexts_ ? nullptr : task_execution_context_,
task_has_multiple_contexts_, sub_task_attributions_); task_has_multiple_contexts_);
} }
} }
} }
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/timing/sub_task_attribution.h"
#include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource.h" #include "third_party/blink/renderer/platform/loader/fetch/resource.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h"
...@@ -55,12 +54,10 @@ class CORE_EXPORT PerformanceMonitor final ...@@ -55,12 +54,10 @@ class CORE_EXPORT PerformanceMonitor final
class CORE_EXPORT Client : public GarbageCollectedMixin { class CORE_EXPORT Client : public GarbageCollectedMixin {
public: public:
virtual void ReportLongTask( virtual void ReportLongTask(base::TimeTicks start_time,
base::TimeTicks start_time, base::TimeTicks end_time,
base::TimeTicks end_time, ExecutionContext* task_context,
ExecutionContext* task_context, bool has_multiple_contexts) {}
bool has_multiple_contexts,
const SubTaskAttribution::EntriesVector& sub_task_attributions) {}
virtual void ReportLongLayout(base::TimeDelta duration) {} virtual void ReportLongLayout(base::TimeDelta duration) {}
virtual void ReportGenericViolation(Violation, virtual void ReportGenericViolation(Violation,
const String& text, const String& text,
...@@ -76,8 +73,6 @@ class CORE_EXPORT PerformanceMonitor final ...@@ -76,8 +73,6 @@ class CORE_EXPORT PerformanceMonitor final
std::unique_ptr<SourceLocation>); std::unique_ptr<SourceLocation>);
static base::TimeDelta Threshold(ExecutionContext*, Violation); static base::TimeDelta Threshold(ExecutionContext*, Violation);
void BypassLongCompileThresholdOnceForTesting();
// Instrumenting methods. // Instrumenting methods.
void Will(const probe::RecalculateStyle&); void Will(const probe::RecalculateStyle&);
void Did(const probe::RecalculateStyle&); void Did(const probe::RecalculateStyle&);
...@@ -149,8 +144,6 @@ class CORE_EXPORT PerformanceMonitor final ...@@ -149,8 +144,6 @@ class CORE_EXPORT PerformanceMonitor final
const void* user_callback_; const void* user_callback_;
base::TimeTicks v8_compile_start_time_; base::TimeTicks v8_compile_start_time_;
SubTaskAttribution::EntriesVector sub_task_attributions_;
base::TimeDelta thresholds_[kAfterLast]; base::TimeDelta thresholds_[kAfterLast];
Member<LocalFrame> local_root_; Member<LocalFrame> local_root_;
...@@ -163,7 +156,6 @@ class CORE_EXPORT PerformanceMonitor final ...@@ -163,7 +156,6 @@ class CORE_EXPORT PerformanceMonitor final
typename DefaultHash<size_t>::Hash, typename DefaultHash<size_t>::Hash,
WTF::UnsignedWithZeroKeyHashTraits<size_t>> WTF::UnsignedWithZeroKeyHashTraits<size_t>>
subscriptions_; subscriptions_;
bool bypass_long_compile_threshold_ = false;
DISALLOW_COPY_AND_ASSIGN(PerformanceMonitor); DISALLOW_COPY_AND_ASSIGN(PerformanceMonitor);
}; };
......
...@@ -3392,21 +3392,6 @@ void Internals::simulateRasterUnderInvalidations(bool enable) { ...@@ -3392,21 +3392,6 @@ void Internals::simulateRasterUnderInvalidations(bool enable) {
RasterInvalidationTracking::SimulateRasterUnderInvalidations(enable); RasterInvalidationTracking::SimulateRasterUnderInvalidations(enable);
} }
void Internals::BypassLongCompileThresholdOnce(
ExceptionState& exception_state) {
LocalFrame* frame = GetFrame();
DCHECK(frame);
PerformanceMonitor* performance_monitor = frame->GetPerformanceMonitor();
if (!performance_monitor) {
exception_state.ThrowDOMException(
DOMExceptionCode::kInvalidAccessError,
"PerformanceObserver should be observing 'longtask' while "
"calling BypassLongCompileThresholdOnce.");
return;
}
return performance_monitor->BypassLongCompileThresholdOnceForTesting();
}
unsigned Internals::LifecycleUpdateCount() const { unsigned Internals::LifecycleUpdateCount() const {
return document_->View()->LifecycleUpdateCountForTesting(); return document_->View()->LifecycleUpdateCountForTesting();
} }
......
...@@ -585,8 +585,6 @@ class Internals final : public ScriptWrappable { ...@@ -585,8 +585,6 @@ class Internals final : public ScriptWrappable {
void simulateRasterUnderInvalidations(bool enable); void simulateRasterUnderInvalidations(bool enable);
void BypassLongCompileThresholdOnce(ExceptionState&);
// The number of calls to update the blink lifecycle (see: // The number of calls to update the blink lifecycle (see:
// LocalFrameView::UpdateLifecyclePhasesInternal). // LocalFrameView::UpdateLifecyclePhasesInternal).
unsigned LifecycleUpdateCount() const; unsigned LifecycleUpdateCount() const;
......
...@@ -399,11 +399,6 @@ ...@@ -399,11 +399,6 @@
// be reported as raster under-invalidations. // be reported as raster under-invalidations.
void simulateRasterUnderInvalidations(boolean enable); void simulateRasterUnderInvalidations(boolean enable);
// Bypass the threshold of 'script-compile' of long-task attribution in
// PerformanceMonitor for testing. "PerformanceObserver should be observing
// 'longtask' while calling BypassLongCompileThresholdOnce.
[RaisesException] void BypassLongCompileThresholdOnce();
// The number of calls to update the blink lifecycle (see: // The number of calls to update the blink lifecycle (see:
// LocalFrameView::UpdateLifecyclePhasesInternal). // LocalFrameView::UpdateLifecyclePhasesInternal).
unsigned long LifecycleUpdateCount(); unsigned long LifecycleUpdateCount();
......
...@@ -52,8 +52,6 @@ blink_core_sources("timing") { ...@@ -52,8 +52,6 @@ blink_core_sources("timing") {
"profiler.h", "profiler.h",
"profiler_group.cc", "profiler_group.cc",
"profiler_group.h", "profiler_group.h",
"sub_task_attribution.cc",
"sub_task_attribution.h",
"task_attribution_timing.cc", "task_attribution_timing.cc",
"task_attribution_timing.h", "task_attribution_timing.h",
"time_clamper.cc", "time_clamper.cc",
......
...@@ -612,27 +612,19 @@ bool Performance::CanAddResourceTimingEntry() { ...@@ -612,27 +612,19 @@ bool Performance::CanAddResourceTimingEntry() {
return resource_timing_buffer_.size() < resource_timing_buffer_size_limit_; return resource_timing_buffer_.size() < resource_timing_buffer_size_limit_;
} }
void Performance::AddLongTaskTiming( void Performance::AddLongTaskTiming(base::TimeTicks start_time,
base::TimeTicks start_time, base::TimeTicks end_time,
base::TimeTicks end_time, const AtomicString& name,
const AtomicString& name, const String& frame_src,
const String& frame_src, const String& frame_id,
const String& frame_id, const String& frame_name) {
const String& frame_name,
const SubTaskAttribution::EntriesVector& sub_task_attributions) {
if (!HasObserverFor(PerformanceEntry::kLongTask)) if (!HasObserverFor(PerformanceEntry::kLongTask))
return; return;
for (auto&& it : sub_task_attributions) {
it->setHighResStartTime(
MonotonicTimeToDOMHighResTimeStamp(it->startTime()));
it->setHighResDuration(
ConvertTimeDeltaToDOMHighResTimeStamp(it->duration()));
}
auto* entry = MakeGarbageCollected<PerformanceLongTaskTiming>( auto* entry = MakeGarbageCollected<PerformanceLongTaskTiming>(
MonotonicTimeToDOMHighResTimeStamp(start_time), MonotonicTimeToDOMHighResTimeStamp(start_time),
MonotonicTimeToDOMHighResTimeStamp(end_time), name, frame_src, frame_id, MonotonicTimeToDOMHighResTimeStamp(end_time), name, frame_src, frame_id,
frame_name, sub_task_attributions); frame_name);
NotifyObserversOfEntry(*entry); NotifyObserversOfEntry(*entry);
} }
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "third_party/blink/renderer/core/timing/performance_entry.h" #include "third_party/blink/renderer/core/timing/performance_entry.h"
#include "third_party/blink/renderer/core/timing/performance_navigation_timing.h" #include "third_party/blink/renderer/core/timing/performance_navigation_timing.h"
#include "third_party/blink/renderer/core/timing/performance_paint_timing.h" #include "third_party/blink/renderer/core/timing/performance_paint_timing.h"
#include "third_party/blink/renderer/core/timing/sub_task_attribution.h"
#include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/timer.h" #include "third_party/blink/renderer/platform/timer.h"
#include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/forward.h"
...@@ -79,7 +78,6 @@ class ScriptState; ...@@ -79,7 +78,6 @@ class ScriptState;
class ScriptValue; class ScriptValue;
class SecurityOrigin; class SecurityOrigin;
class StringOrPerformanceMeasureOptions; class StringOrPerformanceMeasureOptions;
class SubTaskAttribution;
class UserTiming; class UserTiming;
class V8ObjectBuilder; class V8ObjectBuilder;
...@@ -145,14 +143,12 @@ class CORE_EXPORT Performance : public EventTargetWithInlineData { ...@@ -145,14 +143,12 @@ class CORE_EXPORT Performance : public EventTargetWithInlineData {
DEFINE_ATTRIBUTE_EVENT_LISTENER(resourcetimingbufferfull, DEFINE_ATTRIBUTE_EVENT_LISTENER(resourcetimingbufferfull,
kResourcetimingbufferfull) kResourcetimingbufferfull)
void AddLongTaskTiming( void AddLongTaskTiming(base::TimeTicks start_time,
base::TimeTicks start_time, base::TimeTicks end_time,
base::TimeTicks end_time, const AtomicString& name,
const AtomicString& name, const String& culprit_frame_src,
const String& culprit_frame_src, const String& culprit_frame_id,
const String& culprit_frame_id, const String& culprit_frame_name);
const String& culprit_frame_name,
const SubTaskAttribution::EntriesVector& sub_task_attributions);
// Generates and add a performance entry for the given ResourceTimingInfo. // Generates and add a performance entry for the given ResourceTimingInfo.
// |overridden_initiator_type| allows the initiator type to be overridden to // |overridden_initiator_type| allows the initiator type to be overridden to
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "third_party/blink/renderer/bindings/core/v8/v8_object_builder.h" #include "third_party/blink/renderer/bindings/core/v8/v8_object_builder.h"
#include "third_party/blink/renderer/core/frame/dom_window.h" #include "third_party/blink/renderer/core/frame/dom_window.h"
#include "third_party/blink/renderer/core/performance_entry_names.h" #include "third_party/blink/renderer/core/performance_entry_names.h"
#include "third_party/blink/renderer/core/timing/sub_task_attribution.h"
#include "third_party/blink/renderer/core/timing/task_attribution_timing.h" #include "third_party/blink/renderer/core/timing/task_attribution_timing.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
...@@ -19,8 +18,7 @@ PerformanceLongTaskTiming::PerformanceLongTaskTiming( ...@@ -19,8 +18,7 @@ PerformanceLongTaskTiming::PerformanceLongTaskTiming(
const AtomicString& name, const AtomicString& name,
const String& culprit_frame_src, const String& culprit_frame_src,
const String& culprit_frame_id, const String& culprit_frame_id,
const String& culprit_frame_name, const String& culprit_frame_name)
const SubTaskAttribution::EntriesVector& sub_task_attributions)
: PerformanceEntry(name, start_time, end_time) { : PerformanceEntry(name, start_time, end_time) {
// Only one possible container type exists currently: "iframe". // Only one possible container type exists currently: "iframe".
TaskAttributionTiming* attribution_entry = TaskAttributionTiming* attribution_entry =
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#define THIRD_PARTY_BLINK_RENDERER_CORE_TIMING_PERFORMANCE_LONG_TASK_TIMING_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_TIMING_PERFORMANCE_LONG_TASK_TIMING_H_
#include "third_party/blink/renderer/core/timing/performance_entry.h" #include "third_party/blink/renderer/core/timing/performance_entry.h"
#include "third_party/blink/renderer/core/timing/sub_task_attribution.h"
#include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/forward.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
...@@ -20,14 +19,12 @@ class PerformanceLongTaskTiming final : public PerformanceEntry { ...@@ -20,14 +19,12 @@ class PerformanceLongTaskTiming final : public PerformanceEntry {
DEFINE_WRAPPERTYPEINFO(); DEFINE_WRAPPERTYPEINFO();
public: public:
PerformanceLongTaskTiming( PerformanceLongTaskTiming(double start_time,
double start_time, double end_time,
double end_time, const AtomicString& name,
const AtomicString& name, const String& frame_src,
const String& frame_src, const String& frame_id,
const String& frame_id, const String& frame_name);
const String& frame_name,
const SubTaskAttribution::EntriesVector& sub_task_attributions);
AtomicString entryType() const override; AtomicString entryType() const override;
PerformanceEntryType EntryTypeEnum() const override; PerformanceEntryType EntryTypeEnum() const override;
......
...@@ -119,13 +119,12 @@ TEST_F(PerformanceTest, Activate) { ...@@ -119,13 +119,12 @@ TEST_F(PerformanceTest, Activate) {
TEST_F(PerformanceTest, AddLongTaskTiming) { TEST_F(PerformanceTest, AddLongTaskTiming) {
V8TestingScope scope; V8TestingScope scope;
Initialize(scope.GetScriptState()); Initialize(scope.GetScriptState());
SubTaskAttribution::EntriesVector sub_task_attributions;
// Add a long task entry, but no observer registered. // Add a long task entry, but no observer registered.
base_->AddLongTaskTiming( base_->AddLongTaskTiming(
base::TimeTicks() + base::TimeDelta::FromSecondsD(1234), base::TimeTicks() + base::TimeDelta::FromSecondsD(1234),
base::TimeTicks() + base::TimeDelta::FromSecondsD(5678), "same-origin", base::TimeTicks() + base::TimeDelta::FromSecondsD(5678), "same-origin",
"www.foo.com/bar", "", "", sub_task_attributions); "www.foo.com/bar", "", "");
EXPECT_FALSE(base_->HasPerformanceObserverFor(PerformanceEntry::kLongTask)); EXPECT_FALSE(base_->HasPerformanceObserverFor(PerformanceEntry::kLongTask));
EXPECT_EQ(0, NumPerformanceEntriesInObserver()); // has no effect EXPECT_EQ(0, NumPerformanceEntriesInObserver()); // has no effect
...@@ -142,7 +141,7 @@ TEST_F(PerformanceTest, AddLongTaskTiming) { ...@@ -142,7 +141,7 @@ TEST_F(PerformanceTest, AddLongTaskTiming) {
base_->AddLongTaskTiming( base_->AddLongTaskTiming(
base::TimeTicks() + base::TimeDelta::FromSecondsD(1234), base::TimeTicks() + base::TimeDelta::FromSecondsD(1234),
base::TimeTicks() + base::TimeDelta::FromSecondsD(5678), "same-origin", base::TimeTicks() + base::TimeDelta::FromSecondsD(5678), "same-origin",
"www.foo.com/bar", "", "", sub_task_attributions); "www.foo.com/bar", "", "");
EXPECT_EQ(1, NumPerformanceEntriesInObserver()); // added an entry EXPECT_EQ(1, NumPerformanceEntriesInObserver()); // added an entry
} }
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/core/timing/sub_task_attribution.h"
namespace blink {
SubTaskAttribution::SubTaskAttribution(const AtomicString& sub_task_name,
const String& script_url,
base::TimeTicks start_time,
base::TimeDelta duration)
: sub_task_name_(sub_task_name),
script_url_(script_url),
start_time_(start_time),
duration_(duration) {}
} // namespace blink
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_TIMING_SUB_TASK_ATTRIBUTION_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_TIMING_SUB_TASK_ATTRIBUTION_H_
#include <memory>
#include "third_party/blink/renderer/core/dom/dom_high_res_time_stamp.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
class SubTaskAttribution {
USING_FAST_MALLOC(SubTaskAttribution);
public:
using EntriesVector = Vector<std::unique_ptr<SubTaskAttribution>>;
SubTaskAttribution(const AtomicString& sub_task_name,
const String& script_url,
base::TimeTicks start_time,
base::TimeDelta duration);
inline AtomicString subTaskName() const { return sub_task_name_; }
inline String scriptURL() const { return script_url_; }
inline base::TimeTicks startTime() const { return start_time_; }
inline base::TimeDelta duration() const { return duration_; }
inline DOMHighResTimeStamp highResStartTime() const {
return high_res_start_time_;
}
inline DOMHighResTimeStamp highResDuration() const {
return high_res_duration_;
}
void setHighResStartTime(DOMHighResTimeStamp high_res_start_time) {
high_res_start_time_ = high_res_start_time;
}
void setHighResDuration(DOMHighResTimeStamp high_res_duration) {
high_res_duration_ = high_res_duration;
}
private:
AtomicString sub_task_name_;
String script_url_;
base::TimeTicks start_time_;
base::TimeDelta duration_;
DOMHighResTimeStamp high_res_start_time_;
DOMHighResTimeStamp high_res_duration_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_TIMING_SUB_TASK_ATTRIBUTION_H_
...@@ -112,12 +112,6 @@ AtomicString SameOriginAttribution(Frame* observer_frame, ...@@ -112,12 +112,6 @@ AtomicString SameOriginAttribution(Frame* observer_frame,
return SameOriginKeyword(); return SameOriginKeyword();
} }
bool IsSameOrigin(const AtomicString& key) {
DCHECK(IsMainThread());
return key == SameOriginKeyword() || key == SameOriginDescendantKeyword() ||
key == SameOriginAncestorKeyword() || key == SelfKeyword();
}
} // namespace } // namespace
static base::TimeTicks ToTimeOrigin(LocalDOMWindow* window) { static base::TimeTicks ToTimeOrigin(LocalDOMWindow* window) {
...@@ -291,25 +285,20 @@ std::pair<AtomicString, DOMWindow*> WindowPerformance::SanitizedAttribution( ...@@ -291,25 +285,20 @@ std::pair<AtomicString, DOMWindow*> WindowPerformance::SanitizedAttribution(
return std::make_pair(kCrossOriginAttribution, nullptr); return std::make_pair(kCrossOriginAttribution, nullptr);
} }
void WindowPerformance::ReportLongTask( void WindowPerformance::ReportLongTask(base::TimeTicks start_time,
base::TimeTicks start_time, base::TimeTicks end_time,
base::TimeTicks end_time, ExecutionContext* task_context,
ExecutionContext* task_context, bool has_multiple_contexts) {
bool has_multiple_contexts,
const SubTaskAttribution::EntriesVector& sub_task_attributions) {
if (!GetFrame()) if (!GetFrame())
return; return;
std::pair<AtomicString, DOMWindow*> attribution = std::pair<AtomicString, DOMWindow*> attribution =
WindowPerformance::SanitizedAttribution( WindowPerformance::SanitizedAttribution(
task_context, has_multiple_contexts, GetFrame()); task_context, has_multiple_contexts, GetFrame());
DOMWindow* culprit_dom_window = attribution.second; DOMWindow* culprit_dom_window = attribution.second;
SubTaskAttribution::EntriesVector empty_vector;
if (!culprit_dom_window || !culprit_dom_window->GetFrame() || if (!culprit_dom_window || !culprit_dom_window->GetFrame() ||
!culprit_dom_window->GetFrame()->DeprecatedLocalOwner()) { !culprit_dom_window->GetFrame()->DeprecatedLocalOwner()) {
AddLongTaskTiming( AddLongTaskTiming(start_time, end_time, attribution.first, g_empty_string,
start_time, end_time, attribution.first, g_empty_string, g_empty_string, g_empty_string, g_empty_string);
g_empty_string,
IsSameOrigin(attribution.first) ? sub_task_attributions : empty_vector);
} else { } else {
HTMLFrameOwnerElement* frame_owner = HTMLFrameOwnerElement* frame_owner =
culprit_dom_window->GetFrame()->DeprecatedLocalOwner(); culprit_dom_window->GetFrame()->DeprecatedLocalOwner();
...@@ -317,8 +306,7 @@ void WindowPerformance::ReportLongTask( ...@@ -317,8 +306,7 @@ void WindowPerformance::ReportLongTask(
start_time, end_time, attribution.first, start_time, end_time, attribution.first,
GetFrameAttribute(frame_owner, html_names::kSrcAttr, false), GetFrameAttribute(frame_owner, html_names::kSrcAttr, false),
GetFrameAttribute(frame_owner, html_names::kIdAttr, false), GetFrameAttribute(frame_owner, html_names::kIdAttr, false),
GetFrameAttribute(frame_owner, html_names::kNameAttr, true), GetFrameAttribute(frame_owner, html_names::kNameAttr, true));
IsSameOrigin(attribution.first) ? sub_task_attributions : empty_vector);
} }
} }
......
...@@ -106,12 +106,10 @@ class CORE_EXPORT WindowPerformance final : public Performance, ...@@ -106,12 +106,10 @@ class CORE_EXPORT WindowPerformance final : public Performance,
LocalFrame* observer_frame); LocalFrame* observer_frame);
// PerformanceMonitor::Client implementation. // PerformanceMonitor::Client implementation.
void ReportLongTask( void ReportLongTask(base::TimeTicks start_time,
base::TimeTicks start_time, base::TimeTicks end_time,
base::TimeTicks end_time, ExecutionContext* task_context,
ExecutionContext* task_context, bool has_multiple_contexts) override;
bool has_multiple_contexts,
const SubTaskAttribution::EntriesVector& sub_task_attributions) override;
void BuildJSONValue(V8ObjectBuilder&) const override; void BuildJSONValue(V8ObjectBuilder&) const override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment