Skip to content

Commit

Permalink
Minor cleanup of network_service
Browse files Browse the repository at this point in the history
TBR=ben@chromium.org
BUG=

Review URL: https://codereview.chromium.org/714643003

Cr-Commit-Position: refs/heads/master@{#303531}
  • Loading branch information
dmmoore authored and Commit bot committed Nov 10, 2014
1 parent 42287bc commit 702233b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
3 changes: 1 addition & 2 deletions mojo/services/network/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ shared_library("network") {
"//mojo/application",
"//mojo/public/c/system:for_shared_library",
"//mojo/public/cpp/bindings:bindings",
"//mojo/services/public/cpp/network",
"//mojo/services/public/interfaces/network",
]

sources = [ "main.cc" ]
sources = [ "network_service.cc" ]
}

# GYP version: mojo/mojo_services.gypi:mojo_network_service_lib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/at_exit.h"
#include "base/base_paths.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
Expand All @@ -13,15 +11,13 @@
#include "mojo/public/cpp/application/application_connection.h"
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/application/interface_factory.h"
#include "mojo/public/cpp/bindings/interface_ptr.h"
#include "mojo/services/network/network_context.h"
#include "mojo/services/network/network_service_impl.h"

class Delegate : public mojo::ApplicationDelegate,
public mojo::InterfaceFactory<mojo::NetworkService> {
public:
Delegate() {}

class NetworkServiceDelegate
: public mojo::ApplicationDelegate,
public mojo::InterfaceFactory<mojo::NetworkService> {
private:
void Initialize(mojo::ApplicationImpl* app) override {
base::FilePath base_path;
CHECK(PathService::Get(base::DIR_TEMP, &base_path));
Expand All @@ -44,12 +40,11 @@ class Delegate : public mojo::ApplicationDelegate,
new mojo::NetworkServiceImpl(connection, context_.get()), &request);
}

private:
scoped_ptr<mojo::NetworkContext> context_;
};

MojoResult MojoMain(MojoHandle shell_handle) {
mojo::ApplicationRunnerChromium runner(new Delegate);
mojo::ApplicationRunnerChromium runner(new NetworkServiceDelegate);
runner.set_message_loop_type(base::MessageLoop::TYPE_IO);
return runner.Run(shell_handle);
}

0 comments on commit 702233b

Please sign in to comment.