Send richer service protocol respones from the Shell (flutter/engine#2929)
This commit is contained in:
@@ -47,6 +47,11 @@ UIDartState* UIDartState::CreateForChildIsolate() {
|
||||
|
||||
void UIDartState::DidSetIsolate() {
|
||||
main_port_ = Dart_GetMainPortId();
|
||||
DartApiScope api_scope;
|
||||
Dart_Handle debug_name = Dart_DebugName();
|
||||
if (Dart_IsString(debug_name)) {
|
||||
debug_name_ = tonic::StdStringFromDart(debug_name);
|
||||
}
|
||||
}
|
||||
|
||||
UIDartState* UIDartState::Current() {
|
||||
|
||||
@@ -39,7 +39,7 @@ class UIDartState : public tonic::DartState {
|
||||
|
||||
IsolateClient* isolate_client() { return isolate_client_; }
|
||||
Dart_Port main_port() const { return main_port_; }
|
||||
|
||||
const std::string& debug_name() const { return debug_name_; }
|
||||
Window* window() const { return window_.get(); }
|
||||
|
||||
void set_mojo_services(std::unique_ptr<MojoServices> mojo_services);
|
||||
@@ -59,6 +59,7 @@ class UIDartState : public tonic::DartState {
|
||||
|
||||
IsolateClient* isolate_client_;
|
||||
Dart_Port main_port_;
|
||||
std::string debug_name_;
|
||||
std::unique_ptr<MojoServices> mojo_services_;
|
||||
std::unique_ptr<Window> window_;
|
||||
|
||||
|
||||
@@ -113,4 +113,15 @@ Dart_Port RuntimeController::GetMainPort() {
|
||||
return dart_controller_->dart_state()->main_port();
|
||||
}
|
||||
|
||||
std::string RuntimeController::GetIsolateName() {
|
||||
if (!dart_controller_) {
|
||||
return "";
|
||||
}
|
||||
if (!dart_controller_->dart_state()) {
|
||||
return "";
|
||||
}
|
||||
return dart_controller_->dart_state()->debug_name();
|
||||
}
|
||||
|
||||
|
||||
} // namespace blink
|
||||
|
||||
@@ -44,6 +44,8 @@ class RuntimeController : public WindowClient, public IsolateClient {
|
||||
|
||||
Dart_Port GetMainPort();
|
||||
|
||||
std::string GetIsolateName();
|
||||
|
||||
private:
|
||||
explicit RuntimeController(RuntimeDelegate* client);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user