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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/memory/weak_ptr.h" | 6 #include "base/memory/weak_ptr.h" |
7 #include "mojo/application/application_runner_chromium.h" | 7 #include "mojo/application/application_runner_chromium.h" |
8 #include "mojo/public/c/system/main.h" | 8 #include "mojo/public/c/system/main.h" |
9 #include "mojo/public/cpp/application/application_delegate.h" | 9 #include "mojo/public/cpp/application/application_delegate.h" |
10 #include "mojo/public/cpp/application/application_impl.h" | 10 #include "mojo/public/cpp/application/application_impl.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 void Inspect() { | 125 void Inspect() { |
126 debugger_->InjectInspector(); | 126 debugger_->InjectInspector(); |
127 std::cout | 127 std::cout |
128 << "Open the following URL in Chrome:" << std::endl | 128 << "Open the following URL in Chrome:" << std::endl |
129 << "chrome-devtools://devtools/bundled/devtools.html?ws=localhost:9898" | 129 << "chrome-devtools://devtools/bundled/devtools.html?ws=localhost:9898" |
130 << std::endl; | 130 << std::endl; |
131 } | 131 } |
132 | 132 |
133 void Quit() { | 133 void Quit() { |
134 std::cout << "quitting" << std::endl; | 134 std::cout << "quitting" << std::endl; |
135 exit(0); | 135 debugger_->Shutdown(); |
136 } | 136 } |
137 | 137 |
138 void ToggleTracing() { | 138 void ToggleTracing() { |
139 if (is_tracing_) { | 139 if (is_tracing_) { |
140 std::cout << "Stopping trace (writing to sky_viewer.trace)" << std::endl; | 140 std::cout << "Stopping trace (writing to sky_viewer.trace)" << std::endl; |
141 tracing_->Stop(); | 141 tracing_->Stop(); |
142 } else { | 142 } else { |
143 std::cout << "Starting trace (type 'trace' to stop tracing)" << std::endl; | 143 std::cout << "Starting trace (type 'trace' to stop tracing)" << std::endl; |
144 tracing_->Start(); | 144 tracing_->Start(); |
145 } | 145 } |
146 is_tracing_ = !is_tracing_; | 146 is_tracing_ = !is_tracing_; |
147 } | 147 } |
148 | 148 |
149 bool is_tracing_; | 149 bool is_tracing_; |
150 DebuggerPtr debugger_; | 150 DebuggerPtr debugger_; |
151 TracingPtr tracing_; | 151 TracingPtr tracing_; |
152 std::string url_; | 152 std::string url_; |
153 base::WeakPtrFactory<Prompt> weak_ptr_factory_; | 153 base::WeakPtrFactory<Prompt> weak_ptr_factory_; |
154 | 154 |
155 DISALLOW_COPY_AND_ASSIGN(Prompt); | 155 DISALLOW_COPY_AND_ASSIGN(Prompt); |
156 }; | 156 }; |
157 | 157 |
158 } // namespace debugger | 158 } // namespace debugger |
159 } // namespace sky | 159 } // namespace sky |
160 | 160 |
161 MojoResult MojoMain(MojoHandle shell_handle) { | 161 MojoResult MojoMain(MojoHandle shell_handle) { |
162 mojo::ApplicationRunnerChromium runner(new sky::debugger::Prompt); | 162 mojo::ApplicationRunnerChromium runner(new sky::debugger::Prompt); |
163 return runner.Run(shell_handle); | 163 return runner.Run(shell_handle); |
164 } | 164 } |
OLD | NEW |