Skip to content

Commit 2424661

Browse files
committed
src: move TickInfo out of Environment
PR-URL: #26824 Refs: #26776 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 4565698 commit 2424661

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
@@ -647,6 +647,24 @@ class ImmediateInfo {
647647
AliasedBuffer<uint32_t, v8::Uint32Array> fields_;
648648
};
649649

650+
class TickInfo {
651+
public:
652+
inline AliasedBuffer<uint8_t, v8::Uint8Array>& fields();
653+
inline bool has_tick_scheduled() const;
654+
inline bool has_rejection_to_warn() const;
655+
656+
TickInfo(const TickInfo&) = delete;
657+
TickInfo& operator=(const TickInfo&) = delete;
658+
659+
private:
660+
friend class Environment; // So we can call the constructor.
661+
inline explicit TickInfo(v8::Isolate* isolate);
662+
663+
enum Fields { kHasTickScheduled = 0, kHasRejectionToWarn, kFieldsCount };
664+
665+
AliasedBuffer<uint8_t, v8::Uint8Array> fields_;
666+
};
667+
650668
class Environment {
651669
public:
652670
Environment(const Environment&) = delete;
@@ -656,28 +674,6 @@ class Environment {
656674
inline void PushAsyncCallbackScope();
657675
inline void PopAsyncCallbackScope();
658676

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

0 commit comments

Comments
 (0)