OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "sky/tools/debugger/debugger.h" | 5 #include "sky/tools/debugger/debugger.h" |
6 | 6 |
7 namespace sky { | 7 namespace sky { |
8 namespace debugger { | 8 namespace debugger { |
9 | 9 |
10 SkyDebugger::SkyDebugger() | 10 SkyDebugger::SkyDebugger() |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 root_->AddChild(content_); | 59 root_->AddChild(content_); |
60 | 60 |
61 window_manager_app_->InitFocus( | 61 window_manager_app_->InitFocus( |
62 new FocusRules(window_manager_app_.get(), content_)); | 62 new FocusRules(window_manager_app_.get(), content_)); |
63 | 63 |
64 if (!pending_url_.empty()) | 64 if (!pending_url_.empty()) |
65 NavigateToURL(pending_url_); | 65 NavigateToURL(pending_url_); |
66 } | 66 } |
67 | 67 |
68 void SkyDebugger::OnViewManagerDisconnected(mojo::ViewManager* view_manager) { | 68 void SkyDebugger::OnViewManagerDisconnected(mojo::ViewManager* view_manager) { |
69 CHECK(false); // FIXME: This is dead code, why? | |
70 view_manager_ = nullptr; | 69 view_manager_ = nullptr; |
71 root_ = nullptr; | 70 root_ = nullptr; |
72 } | 71 } |
73 | 72 |
74 void SkyDebugger::OnViewDestroyed(mojo::View* view) { | 73 void SkyDebugger::OnViewDestroyed(mojo::View* view) { |
75 CHECK(false); // FIXME: This is dead code, why? | |
76 view->RemoveObserver(this); | 74 view->RemoveObserver(this); |
77 } | 75 } |
78 | 76 |
79 void SkyDebugger::OnViewBoundsChanged(mojo::View* view, | 77 void SkyDebugger::OnViewBoundsChanged(mojo::View* view, |
80 const mojo::Rect& old_bounds, | 78 const mojo::Rect& old_bounds, |
81 const mojo::Rect& new_bounds) { | 79 const mojo::Rect& new_bounds) { |
82 content_->SetBounds(new_bounds); | 80 content_->SetBounds(new_bounds); |
83 } | 81 } |
84 | 82 |
85 void SkyDebugger::Create(mojo::ApplicationConnection* connection, | 83 void SkyDebugger::Create(mojo::ApplicationConnection* connection, |
86 mojo::InterfaceRequest<Debugger> request) { | 84 mojo::InterfaceRequest<Debugger> request) { |
87 mojo::WeakBindToRequest(this, &request); | 85 mojo::WeakBindToRequest(this, &request); |
88 } | 86 } |
89 | 87 |
90 void SkyDebugger::NavigateToURL(const mojo::String& url) { | 88 void SkyDebugger::NavigateToURL(const mojo::String& url) { |
91 // We can get Navigate commands before we've actually been | 89 // We can get Navigate commands before we've actually been |
92 // embedded into the view and content_ created. | 90 // embedded into the view and content_ created. |
93 // Just save the last one. | 91 // Just save the last one. |
94 if (content_) { | 92 if (content_) { |
95 scoped_ptr<mojo::ServiceProviderImpl> exported_services( | 93 scoped_ptr<mojo::ServiceProviderImpl> exported_services( |
96 new mojo::ServiceProviderImpl()); | 94 new mojo::ServiceProviderImpl()); |
97 exported_services->AddService(&navigator_host_factory_); | 95 exported_services->AddService(&navigator_host_factory_); |
98 viewer_services_ = content_->Embed(url, exported_services.Pass()); | 96 viewer_services_ = content_->Embed(url, exported_services.Pass()); |
99 } else { | 97 } else { |
100 pending_url_ = url; | 98 pending_url_ = url; |
101 } | 99 } |
102 } | 100 } |
103 | 101 |
| 102 void SkyDebugger::Shutdown() { |
| 103 // Make sure we shut down mojo before quitting the message loop or things |
| 104 // like blink::shutdown() may try to talk to the message loop and crash. |
| 105 window_manager_app_.reset(); |
| 106 |
| 107 // TODO(eseidel): This still hits an X11 error which I don't understand |
| 108 // "X Error of failed request: GLXBadDrawable", crbug.com/430581 |
| 109 mojo::ApplicationImpl::Terminate(); |
| 110 } |
| 111 |
104 void SkyDebugger::InjectInspector() { | 112 void SkyDebugger::InjectInspector() { |
105 InspectorServicePtr inspector_service; | 113 InspectorServicePtr inspector_service; |
106 mojo::ConnectToService(viewer_services_.get(), &inspector_service); | 114 mojo::ConnectToService(viewer_services_.get(), &inspector_service); |
107 inspector_service->Inject(); | 115 inspector_service->Inject(); |
108 } | 116 } |
109 | 117 |
110 } // namespace debugger | 118 } // namespace debugger |
111 } // namespace sky | 119 } // namespace sky |
OLD | NEW |