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

Unified Diff: services/debugger/debugger.cc

Issue 2015363003: Yet more ApplicationDelegate -> ApplicationImplBase conversion. (Closed) Base URL: https://github.com/domokit/mojo.git@work797-x-work796_no_run_main_app
Patch Set: rebased again Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/application/run_application.cc ('k') | services/gfx/compositor/compositor_app.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/debugger/debugger.cc
diff --git a/services/debugger/debugger.cc b/services/debugger/debugger.cc
index e642f1aec519d34b6980ebfa175c3415b88f1dce..689e0c2d773e9a80923bc2dc5b6c299c46816a5d 100644
--- a/services/debugger/debugger.cc
+++ b/services/debugger/debugger.cc
@@ -8,12 +8,12 @@
#include "base/debug/profiler.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
-#include "mojo/application/application_runner_chromium.h"
#include "mojo/data_pipe_utils/data_pipe_utils.h"
+#include "mojo/environment/scoped_chromium_init.h"
#include "mojo/public/c/system/main.h"
-#include "mojo/public/cpp/application/application_delegate.h"
-#include "mojo/public/cpp/application/application_impl.h"
+#include "mojo/public/cpp/application/application_impl_base.h"
#include "mojo/public/cpp/application/connect.h"
+#include "mojo/public/cpp/application/run_application.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/services/http_server/cpp/http_server_util.h"
#include "mojo/services/http_server/interfaces/http_server.mojom.h"
@@ -29,26 +29,24 @@
namespace debugger {
-class Debugger : public mojo::ApplicationDelegate,
+class Debugger : public mojo::ApplicationImplBase,
public http_server::HttpHandler {
public:
- Debugger() : is_tracing_(false), app_(nullptr), handler_binding_(this) {}
+ Debugger() : is_tracing_(false), handler_binding_(this) {}
~Debugger() override {}
private:
- // mojo::ApplicationDelegate:
- void Initialize(mojo::ApplicationImpl* app) override {
- app_ = app;
-
+ // mojo::ApplicationImplBase:
+ void OnInitialize() override {
// Format: --args-for="app_url command_port"
- if (app->args().size() < 2) {
+ if (args().size() < 2) {
LOG(ERROR) << "--args-for required to specify command_port";
- mojo::ApplicationImpl::Terminate();
+ mojo::TerminateApplication(MOJO_RESULT_INVALID_ARGUMENT);
return;
}
- base::StringToUint(app->args()[1], &command_port_);
+ base::StringToUint(args()[1], &command_port_);
http_server::HttpServerFactoryPtr http_server_factory;
- mojo::ConnectToService(app->shell(), "mojo:http_server",
+ mojo::ConnectToService(shell(), "mojo:http_server",
GetProxy(&http_server_factory));
mojo::NetAddressPtr local_address(mojo::NetAddress::New());
@@ -118,8 +116,7 @@ class Debugger : public mojo::ApplicationDelegate,
}
if (!tracing_) {
- mojo::ConnectToService(app_->shell(), "mojo:tracing",
- GetProxy(&tracing_));
+ mojo::ConnectToService(shell(), "mojo:tracing", GetProxy(&tracing_));
}
is_tracing_ = true;
mojo::DataPipe pipe;
@@ -146,7 +143,6 @@ class Debugger : public mojo::ApplicationDelegate,
}
bool is_tracing_;
- mojo::ApplicationImpl* app_;
tracing::TraceCollectorPtr tracing_;
uint32_t command_port_;
@@ -161,7 +157,7 @@ class Debugger : public mojo::ApplicationDelegate,
} // namespace debugger
MojoResult MojoMain(MojoHandle application_request) {
- mojo::ApplicationRunnerChromium runner(new debugger::Debugger);
- runner.set_message_loop_type(base::MessageLoop::TYPE_IO);
- return runner.Run(application_request);
+ mojo::ScopedChromiumInit init;
+ debugger::Debugger debugger_app;
+ return mojo::RunApplication(application_request, &debugger_app);
}
« no previous file with comments | « mojo/application/run_application.cc ('k') | services/gfx/compositor/compositor_app.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698