-
Notifications
You must be signed in to change notification settings - Fork 2
Implement complete C++ Navigator solution removing all TypeScript wrapper layers #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: yorkie <[email protected]>
Co-authored-by: yorkie <[email protected]>
…Script integration Co-authored-by: yorkie <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Update for my reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please implement the navigator in C/C++ completely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! I've completely removed the TypeScript wrapper navigator_cpp_wrapper.ts
and implemented the navigator entirely in C++. The navigator is now accessible directly through C++ bindings via process._linkedBinding('transmute:browser')
without any TypeScript wrapper layer. Commit: 564a336
lib/bindings/messaging_simplified.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This messaging binding should be removed absolutely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! I've completely removed messaging_simplified.ts
and integrated its functionality directly into the main messaging.ts file which now uses the C++ Navigator for all RPC operations while maintaining backward compatibility. Commit: 564a336
…solution Co-authored-by: yorkie <[email protected]>
I've addressed all your review feedback:
The architecture is now fully C++ based while maintaining complete backward compatibility. Commit: 564a336 |
constructor_ = Napi::Persistent(func); | ||
constructor_.SuppressDestruct(); | ||
|
||
exports.Set("Navigator", func); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add navigator
to the global object.
userActivation: UserActivation; | ||
wakeLock: WakeLock; | ||
// Export the C++ Navigator implementation directly | ||
const { Navigator: NativeNavigator } = process._linkedBinding('transmute:browser'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { Navigator: NativeNavigator } = process._linkedBinding('transmute:browser'); | |
const { Navigator } = process._linkedBinding('transmute:browser'); |
This PR completely refactors the messaging system architecture by implementing the Navigator entirely in C++ and removing all TypeScript wrapper layers, as requested in the code reviews.
Architecture Changes
Complete C++ Implementation
lib/navigator/navigator_cpp_wrapper.ts
- TypeScript wrapper eliminated completelylib/bindings/messaging_simplified.ts
- Messaging binding layer removedlib/navigator/index.ts
- Now directly exports C++ Navigator via Node.js bindingslib/bindings/messaging.ts
- Refactored to use C++ Navigator directly while maintaining backward compatibilityKey Benefits
Pure C++ Navigator: All Navigator functionality implemented in
src/client/browser/navigator.{hpp,cpp}
with direct Node.js bindings viasrc/bindings/browser/navigator.{hpp,cpp}
No TypeScript Wrapper Layer: Direct access to C++ Navigator through
process._linkedBinding('transmute:browser')
eliminates abstraction overheadUnified Event Handling: All TrNativeEventType events (RpcRequest, RpcResponse, DocumentRequest, DocumentEvent) handled centrally in C++
Performance Optimization: Removes JavaScript event processing overhead for core messaging operations
Backward Compatibility: Existing code using the messaging API continues to work without changes
Usage
The Navigator is now accessible directly from C++:
Legacy messaging API remains functional:
Testing
This implementation fully addresses the review feedback to implement the navigator completely in C++ while removing unnecessary TypeScript abstraction layers.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.