[go: nahoru, domu]

blob: 9d1a5e68ffcacbd02730158938c8effc3dbd27e0 [file] [log] [blame]
commit-queue@webkit.org9a7877a2012-10-18 01:56:101/*
2 * Copyright (C) 2012 Intel Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
Blink Reformata30d4232018-04-07 15:31:0626#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_TIMING_PERFORMANCE_MARK_H_
27#define THIRD_PARTY_BLINK_RENDERER_CORE_TIMING_PERFORMANCE_MARK_H_
commit-queue@webkit.org9a7877a2012-10-18 01:56:1028
Gabriel Charetted87f10f2022-03-31 00:44:2229#include "base/time/time.h"
Yuta Kasaie1f610302019-11-14 03:31:1630#include "third_party/blink/public/mojom/timing/performance_mark_or_measure.mojom-blink-forward.h"
Liquan(Max) Gu5c5b8b192019-07-09 01:25:5731#include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h"
Blink Reformata30d4232018-04-07 15:31:0632#include "third_party/blink/renderer/core/timing/performance_entry.h"
Blink Reformata30d4232018-04-07 15:31:0633#include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h"
Lei Zhangb20a0672022-02-28 18:53:5034#include "third_party/blink/renderer/platform/heap/collection_support/heap_hash_map.h"
Michael Lippautzaaddb9d2021-11-22 13:22:0735#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h"
Liquan(Max) Gu5c5b8b192019-07-09 01:25:5736#include "third_party/blink/renderer/platform/heap/member.h"
Blink Reformata30d4232018-04-07 15:31:0637#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
commit-queue@webkit.org9a7877a2012-10-18 01:56:1038
abarth@chromium.org99698542014-07-18 22:10:4339namespace blink {
commit-queue@webkit.org9a7877a2012-10-18 01:56:1040
Liquan(Max) Gu086ccf02019-04-29 19:45:3841class ExceptionState;
42class PerformanceMarkOptions;
43
panicker4a55e3592016-05-20 05:57:5144class CORE_EXPORT PerformanceMark final : public PerformanceEntry {
Blink Reformat1c8e1a72016-10-01 00:25:3245 DEFINE_WRAPPERTYPEINFO();
commit-queue@webkit.org9a7877a2012-10-18 01:56:1046
Blink Reformat1c8e1a72016-10-01 00:25:3247 public:
Tom McKeed0f43c612020-02-24 23:34:4348 // This method corresponds to the PerformanceMark constructor defined in the
49 // User Timing L3 spec
50 // (https://w3c.github.io/user-timing/#the-performancemark-constructor). It
51 // gets called as a subroutine of the `performance.mark` method as well as
52 // whenever script runs `new PerformanceMark(..)`.
Liquan(Max) Gu086ccf02019-04-29 19:45:3853 static PerformanceMark* Create(ScriptState*,
54 const AtomicString& mark_name,
Liquan(Max) Gu086ccf02019-04-29 19:45:3855 PerformanceMarkOptions*,
56 ExceptionState&);
57
Tom McKeed0f43c612020-02-24 23:34:4358 // This constructor is only public so that MakeGarbageCollected can call it.
haoliuka9978712022-02-17 17:43:1159 PerformanceMark(
60 const AtomicString& name,
61 double start_time,
62 base::TimeTicks unsafe_time_for_traces,
63 scoped_refptr<SerializedScriptValue>,
64 ExceptionState& exception_state,
65 uint32_t navigation_count = 0); /* TODO(1273925): Remove the default value
66 when all callers have been updated. */
67
Michael Lippautzf759c842021-01-28 18:13:3368 ~PerformanceMark() override = default;
Keishi Hattori2fad33f2018-11-29 08:36:1769
Nicolas Penac1856012018-07-09 21:00:1370 AtomicString entryType() const override;
71 PerformanceEntryType EntryTypeEnum() const override;
Yuta Kasaie1f610302019-11-14 03:31:1672 mojom::blink::PerformanceMarkOrMeasurePtr ToMojoPerformanceMarkOrMeasure()
73 override;
Nicolas Penac1856012018-07-09 21:00:1374
Liquan(Max) Gu5c5b8b192019-07-09 01:25:5775 ScriptValue detail(ScriptState*);
Liquan (Max) Gu669cfa82018-01-17 18:44:5276
Omer Katz052831f2020-05-17 03:54:0677 void Trace(Visitor*) const override;
Liquan (Max) Gu669cfa82018-01-17 18:44:5278
Yoav Weiss1ee40bf92021-03-23 11:47:5779 base::TimeTicks UnsafeTimeForTraces() const {
80 return unsafe_time_for_traces_;
81 }
82
Blink Reformat1c8e1a72016-10-01 00:25:3283 private:
Liquan(Max) Gu5c5b8b192019-07-09 01:25:5784 scoped_refptr<SerializedScriptValue> serialized_detail_;
85 // In order to prevent cross-world reference leak, we create a copy of the
86 // detail for each world.
87 HeapHashMap<WeakMember<ScriptState>, TraceWrapperV8Reference<v8::Value>>
88 deserialized_detail_map_;
Yoav Weiss1ee40bf92021-03-23 11:47:5789 base::TimeTicks unsafe_time_for_traces_;
commit-queue@webkit.org9a7877a2012-10-18 01:56:1090};
91
Blink Reformat1c8e1a72016-10-01 00:25:3292} // namespace blink
commit-queue@webkit.org9a7877a2012-10-18 01:56:1093
Blink Reformata30d4232018-04-07 15:31:0694#endif // THIRD_PARTY_BLINK_RENDERER_CORE_TIMING_PERFORMANCE_MARK_H_