mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Bring skydebugger closer to clean-shutdown
This teaches the SkyDebugger prompt how to tell the sky debugger (server) to shut down instead of just calling exit(0). This also teaches the WindowManagerApp (server) how to tear down all of its connections itself instead of depending on the pipes to do so (which would crash when youd delete the WindowManagerApp as the pipes could outlive it with WindowManagerImpl objects containing raw pointers back to the WindowManagerApp). Shutdown is not yet clean. It errors out trying to talk to the X11 server, but it's closer to clean than it was prior to this change. I may add back and exit(0) to side-step shutdown until it can be made fully clean. R=jamesr@chromium.org, sky@chromium.org BUG=430291, 430242 Review URL: https://codereview.chromium.org/695183003
This commit is contained in:
parent
8b9bb313f1
commit
5c69487bf3
@ -66,13 +66,11 @@ void SkyDebugger::OnEmbed(
|
||||
}
|
||||
|
||||
void SkyDebugger::OnViewManagerDisconnected(mojo::ViewManager* view_manager) {
|
||||
CHECK(false); // FIXME: This is dead code, why?
|
||||
view_manager_ = nullptr;
|
||||
root_ = nullptr;
|
||||
}
|
||||
|
||||
void SkyDebugger::OnViewDestroyed(mojo::View* view) {
|
||||
CHECK(false); // FIXME: This is dead code, why?
|
||||
view->RemoveObserver(this);
|
||||
}
|
||||
|
||||
@ -101,6 +99,16 @@ void SkyDebugger::NavigateToURL(const mojo::String& url) {
|
||||
}
|
||||
}
|
||||
|
||||
void SkyDebugger::Shutdown() {
|
||||
// Make sure we shut down mojo before quitting the message loop or things
|
||||
// like blink::shutdown() may try to talk to the message loop and crash.
|
||||
window_manager_app_.reset();
|
||||
|
||||
// TODO(eseidel): This still hits an X11 error which I don't understand
|
||||
// "X Error of failed request: GLXBadDrawable", crbug.com/430581
|
||||
mojo::ApplicationImpl::Terminate();
|
||||
}
|
||||
|
||||
void SkyDebugger::InjectInspector() {
|
||||
InspectorServicePtr inspector_service;
|
||||
mojo::ConnectToService(viewer_services_.get(), &inspector_service);
|
||||
|
||||
@ -36,6 +36,7 @@ class SkyDebugger : public mojo::ApplicationDelegate,
|
||||
// Overridden from Debugger
|
||||
void NavigateToURL(const mojo::String& url) override;
|
||||
void InjectInspector() override;
|
||||
void Shutdown() override;
|
||||
|
||||
private:
|
||||
// Overridden from mojo::ApplicationDelegate:
|
||||
|
||||
@ -7,4 +7,5 @@ module sky;
|
||||
interface Debugger {
|
||||
NavigateToURL(string url);
|
||||
InjectInspector();
|
||||
Shutdown();
|
||||
};
|
||||
|
||||
@ -132,7 +132,7 @@ class Prompt : public mojo::ApplicationDelegate {
|
||||
|
||||
void Quit() {
|
||||
std::cout << "quitting" << std::endl;
|
||||
exit(0);
|
||||
debugger_->Shutdown();
|
||||
}
|
||||
|
||||
void ToggleTracing() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user