Skip to content

Commit 60b7e73

Browse files
committed
style(runtime): format this branch's runtime changes with clang-format
The repo formats staged C/C++/ObjC sources through lint-staged, but the `clang-format` on PATH here resolved to depot_tools' wrapper, which needs a Chromium checkout and exits non-zero without one. The hook failed without aborting the commit, so everything this branch added went in unformatted while main's sources stayed formatted. Normalized with clang-format 20.1.8 (Homebrew LLVM), verified to reproduce byte-identical output on all 30 runtime files #412 touched, so this matches the style the V8 upgrade was written in. Scoped with `git clang-format origin/main` to the lines this branch actually changed: main's own pre-existing drift in files like ConcurrentQueue.cpp is left alone rather than swept into this branch's diff. Formatting only — no behavior change.
1 parent e24e505 commit 60b7e73

10 files changed

Lines changed: 851 additions & 646 deletions

File tree

NativeScript/runtime/ConcurrentQueue.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,18 @@ std::vector<std::shared_ptr<worker::Message>> ConcurrentQueue::PopAll() {
4141
}
4242

4343
bool ConcurrentQueue::IsEmpty() {
44-
std::unique_lock<std::mutex> mlock(this->mutex_);
45-
return this->messagesQueue_.empty();
44+
std::unique_lock<std::mutex> mlock(this->mutex_);
45+
return this->messagesQueue_.empty();
4646
}
4747

4848
void ConcurrentQueue::Signal() {
49-
// Mirrors Push()'s validity handling instead of SignalAndWakeUp()'s
50-
// assert: a retry racing Terminate() must be a silent no-op.
51-
if (this->runLoopTasksSource_ == nullptr || !CFRunLoopSourceIsValid(this->runLoopTasksSource_)) {
52-
return;
53-
}
54-
this->SignalAndWakeUp();
49+
// Mirrors Push()'s validity handling instead of SignalAndWakeUp()'s
50+
// assert: a retry racing Terminate() must be a silent no-op.
51+
if (this->runLoopTasksSource_ == nullptr ||
52+
!CFRunLoopSourceIsValid(this->runLoopTasksSource_)) {
53+
return;
54+
}
55+
this->SignalAndWakeUp();
5556
}
5657

5758
void ConcurrentQueue::SignalAndWakeUp() {

NativeScript/runtime/DevFlags.mm

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#import <Foundation/Foundation.h>
22

3+
#include <mutex>
4+
#include <vector>
35
#include "DevFlags.h"
46
#include "Helpers.h"
57
#include "Runtime.h"
68
#include "RuntimeConfig.h"
7-
#include <vector>
8-
#include <mutex>
99

1010
namespace tns {
1111

@@ -34,8 +34,7 @@ bool IsHttpFetchUrlLogEnabled() {
3434
}
3535
}
3636
if (IsScriptLoadingLogEnabled()) {
37-
Log(@"[http-loader] fetch-url-log=%s",
38-
s_enabled ? "enabled" : "disabled");
37+
Log(@"[http-loader] fetch-url-log=%s", s_enabled ? "enabled" : "disabled");
3938
}
4039
});
4140
return s_enabled;
@@ -57,8 +56,7 @@ bool IsHttpFetchUrlLogEnabled() {
5756
// "https://cdn.example.com.attacker.com/x.js" or
5857
// "https://cdn.example.com:9999/x.js". To allow a specific port, include it in
5958
// the allowlist entry (deny-by-default for anything not explicitly listed).
60-
static bool RemoteUrlMatchesAllowlistEntry(const std::string& url,
61-
const std::string& entry) {
59+
static bool RemoteUrlMatchesAllowlistEntry(const std::string& url, const std::string& entry) {
6260
if (entry.empty()) return false;
6361
if (url.size() < entry.size()) return false;
6462
if (url.compare(0, entry.size(), entry) != 0) return false;
@@ -126,14 +124,14 @@ bool IsRemoteUrlAllowed(const std::string& url) {
126124
if (s_remoteModuleAllowlist.empty()) {
127125
return true;
128126
}
129-
127+
130128
// Check if URL matches any allowlist entry on a URL-component boundary.
131129
for (const std::string& entry : s_remoteModuleAllowlist) {
132130
if (RemoteUrlMatchesAllowlistEntry(url, entry)) {
133131
return true;
134132
}
135133
}
136-
134+
137135
return false;
138136
}
139137

NativeScript/runtime/HMRSupport.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ namespace tns {
4444
// module under exactly one URL and never varies it for freshness.
4545
std::string CanonicalizeHttpUrlKey(const std::string& url);
4646

47-
// Minimal text fetch for HTTP ESM loader. Returns true on 2xx with non-empty body.
47+
// Minimal text fetch for HTTP ESM loader. Returns true on 2xx with non-empty
48+
// body.
4849
// - out: response body
4950
// - contentType: Content-Type header if present
5051
// - status: HTTP status code
@@ -109,8 +110,7 @@ void MarkUrlsForCacheBust(const std::vector<std::string>& urls);
109110
// `outFetchedCount` (optional) receives the number of distinct URLs
110111
// fetched. `outElapsedMs` (optional) receives wall-clock time.
111112
bool KickstartHmrPrefetchUrlsSync(const std::vector<std::string>& urls,
112-
int maxConcurrent,
113-
double timeoutSeconds,
113+
int maxConcurrent, double timeoutSeconds,
114114
size_t* outFetchedCount,
115115
uint64_t* outElapsedMs);
116116

@@ -131,8 +131,8 @@ void CleanupHMRGlobals();
131131
// Mirror a globally-installed value onto `globalThis.<name>` so
132132
// `globalThis.<name>` lookups resolve when the runtime installs the
133133
// canonical value on the realm's global object.
134-
void MirrorGlobalOnGlobalThis(v8::Isolate* isolate, v8::Local<v8::Context> context,
135-
const char* name);
134+
void MirrorGlobalOnGlobalThis(v8::Isolate* isolate,
135+
v8::Local<v8::Context> context, const char* name);
136136

137137
// ─────────────────────────────────────────────────────────────
138138
// Dev host namespace installer
@@ -147,12 +147,13 @@ void MirrorGlobalOnGlobalThis(v8::Isolate* isolate, v8::Local<v8::Context> conte
147147
// - configureRuntime(config) (import map + volatile patterns)
148148
// - invalidateModules(urls) (registry + cache eviction)
149149
// - kickstartPrefetch(urls, opts?) (parallel HTTP prewarm, list mode)
150-
// - seedModuleBodies(entries) (batch prewarm seeding from the boot archive)
150+
// - seedModuleBodies(entries) (batch prewarm seeding from the boot
151+
// archive)
151152
// - getLoadedModuleUrls() (registry introspection)
152153
// - setDevBootComplete(value?) (boot-complete signal)
153154
// - terminateAllWorkers() (main isolate only; see Worker.h)
154155
// - canonicalizeHttpUrlKey(url) (debug builds only; test diagnostic)
155-
void InitializeHmrDevGlobals(v8::Isolate* isolate, v8::Local<v8::Context> context,
156-
bool isWorker);
156+
void InitializeHmrDevGlobals(v8::Isolate* isolate,
157+
v8::Local<v8::Context> context, bool isWorker);
157158

158159
} // namespace tns

0 commit comments

Comments
 (0)