Skip to content

Commit bc69a81

Browse files
joyeecheungtargos
authored andcommitted
src: move TickInfo out of Environment
PR-URL: #26824 Refs: #26776 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 495e5e9 commit bc69a81

File tree

3 files changed

+24
-28
lines changed

3 files changed

+24
-28
lines changed

src/api/callback.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void InternalCallbackScope::Close() {
9696
return;
9797
}
9898

99-
Environment::TickInfo* tick_info = env_->tick_info();
99+
TickInfo* tick_info = env_->tick_info();
100100

101101
if (!env_->can_call_into_js()) return;
102102
if (!tick_info->has_tick_scheduled()) {

src/env-inl.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -268,18 +268,18 @@ inline void ImmediateInfo::ref_count_dec(uint32_t decrement) {
268268
fields_[kRefCount] -= decrement;
269269
}
270270

271-
inline Environment::TickInfo::TickInfo(v8::Isolate* isolate)
271+
inline TickInfo::TickInfo(v8::Isolate* isolate)
272272
: fields_(isolate, kFieldsCount) {}
273273

274-
inline AliasedBuffer<uint8_t, v8::Uint8Array>& Environment::TickInfo::fields() {
274+
inline AliasedBuffer<uint8_t, v8::Uint8Array>& TickInfo::fields() {
275275
return fields_;
276276
}
277277

278-
inline bool Environment::TickInfo::has_tick_scheduled() const {
278+
inline bool TickInfo::has_tick_scheduled() const {
279279
return fields_[kHasTickScheduled] == 1;
280280
}
281281

282-
inline bool Environment::TickInfo::has_rejection_to_warn() const {
282+
inline bool TickInfo::has_rejection_to_warn() const {
283283
return fields_[kHasRejectionToWarn] == 1;
284284
}
285285

@@ -439,7 +439,7 @@ inline ImmediateInfo* Environment::immediate_info() {
439439
return &immediate_info_;
440440
}
441441

442-
inline Environment::TickInfo* Environment::tick_info() {
442+
inline TickInfo* Environment::tick_info() {
443443
return &tick_info_;
444444
}
445445

src/env.h

+18-22
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,24 @@ class ImmediateInfo {
642642
AliasedBuffer<uint32_t, v8::Uint32Array> fields_;
643643
};
644644

645+
class TickInfo {
646+
public:
647+
inline AliasedBuffer<uint8_t, v8::Uint8Array>& fields();
648+
inline bool has_tick_scheduled() const;
649+
inline bool has_rejection_to_warn() const;
650+
651+
TickInfo(const TickInfo&) = delete;
652+
TickInfo& operator=(const TickInfo&) = delete;
653+
654+
private:
655+
friend class Environment; // So we can call the constructor.
656+
inline explicit TickInfo(v8::Isolate* isolate);
657+
658+
enum Fields { kHasTickScheduled = 0, kHasRejectionToWarn, kFieldsCount };
659+
660+
AliasedBuffer<uint8_t, v8::Uint8Array> fields_;
661+
};
662+
645663
class Environment {
646664
public:
647665
Environment(const Environment&) = delete;
@@ -651,28 +669,6 @@ class Environment {
651669
inline void PushAsyncCallbackScope();
652670
inline void PopAsyncCallbackScope();
653671

654-
class TickInfo {
655-
public:
656-
inline AliasedBuffer<uint8_t, v8::Uint8Array>& fields();
657-
inline bool has_tick_scheduled() const;
658-
inline bool has_rejection_to_warn() const;
659-
660-
TickInfo(const TickInfo&) = delete;
661-
TickInfo& operator=(const TickInfo&) = delete;
662-
663-
private:
664-
friend class Environment; // So we can call the constructor.
665-
inline explicit TickInfo(v8::Isolate* isolate);
666-
667-
enum Fields {
668-
kHasTickScheduled = 0,
669-
kHasRejectionToWarn,
670-
kFieldsCount
671-
};
672-
673-
AliasedBuffer<uint8_t, v8::Uint8Array> fields_;
674-
};
675-
676672
enum Flags {
677673
kNoFlags = 0,
678674
kIsMainThread = 1 << 0,

0 commit comments

Comments
 (0)