Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: sky/tools/debugger/debugger.cc

Issue 947253003: Add ApplicationDelegate::Quit() (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/profiler.h" 8 #include "base/debug/profiler.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 60 }
61 61
62 // http_server::HttpHandler: 62 // http_server::HttpHandler:
63 void HandleRequest(http_server::HttpRequestPtr request, 63 void HandleRequest(http_server::HttpRequestPtr request,
64 const HandleRequestCallback& callback) override { 64 const HandleRequestCallback& callback) override {
65 // FIXME: We should use use a fancier lookup system more like what 65 // FIXME: We should use use a fancier lookup system more like what
66 // services/http_server/http_server.cc does with AddHandler. 66 // services/http_server/http_server.cc does with AddHandler.
67 if (request->relative_url == "/reload") { 67 if (request->relative_url == "/reload") {
68 Load(callback, url_); 68 Load(callback, url_);
69 } else if (request->relative_url == "/quit") { 69 } else if (request->relative_url == "/quit") {
70 Quit(); 70 Exit();
71 } else if (request->relative_url == "/load") { 71 } else if (request->relative_url == "/load") {
72 std::string url; 72 std::string url;
73 mojo::common::BlockingCopyToString(request->body.Pass(), &url); 73 mojo::common::BlockingCopyToString(request->body.Pass(), &url);
74 Load(callback, url); 74 Load(callback, url);
75 } else if (request->relative_url == "/start_profiling") { 75 } else if (request->relative_url == "/start_profiling") {
76 StartProfiling(callback); 76 StartProfiling(callback);
77 } else if (request->relative_url == "/stop_profiling") { 77 } else if (request->relative_url == "/stop_profiling") {
78 StopProfiling(callback); 78 StopProfiling(callback);
79 } else if (request->relative_url == "/start_tracing") { 79 } else if (request->relative_url == "/start_tracing") {
80 StartTracing(callback); 80 StartTracing(callback);
(...skipping 30 matching lines...) Expand all
111 Reload(); 111 Reload();
112 std::string response = std::string("Loaded ") + url + "\n"; 112 std::string response = std::string("Loaded ") + url + "\n";
113 Respond(callback, response); 113 Respond(callback, response);
114 } 114 }
115 115
116 void Reload() { 116 void Reload() {
117 // SimpleWindowManager will wire up necessary services on our behalf. 117 // SimpleWindowManager will wire up necessary services on our behalf.
118 window_manager_->Embed(url_, nullptr, nullptr); 118 window_manager_->Embed(url_, nullptr, nullptr);
119 } 119 }
120 120
121 void Quit() { 121 void Exit() {
122 // TODO(eseidel): We should orderly shutdown once mojo can. 122 // TODO(eseidel): We should orderly shutdown once mojo can.
123 exit(0); 123 exit(0);
124 } 124 }
125 125
126 void StartTracing(const HandleRequestCallback& callback) { 126 void StartTracing(const HandleRequestCallback& callback) {
127 if (is_tracing_) { 127 if (is_tracing_) {
128 Error(callback, "Already tracing. Use stop_tracing to stop.\n"); 128 Error(callback, "Already tracing. Use stop_tracing to stop.\n");
129 return; 129 return;
130 } 130 }
131 131
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 }; 188 };
189 189
190 } // namespace debugger 190 } // namespace debugger
191 } // namespace sky 191 } // namespace sky
192 192
193 MojoResult MojoMain(MojoHandle shell_handle) { 193 MojoResult MojoMain(MojoHandle shell_handle) {
194 mojo::ApplicationRunnerChromium runner(new sky::debugger::SkyDebugger); 194 mojo::ApplicationRunnerChromium runner(new sky::debugger::SkyDebugger);
195 runner.set_message_loop_type(base::MessageLoop::TYPE_IO); 195 runner.set_message_loop_type(base::MessageLoop::TYPE_IO);
196 return runner.Run(shell_handle); 196 return runner.Run(shell_handle);
197 } 197 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698