Mojo: Add the beginnings of a proper embedder API.

Actually, just move mojo::system::CoreImpl::Init() to
mojo::embedder::Init(), in its own header file.

R=darin@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244284 0039d316-1c4b-4281-b951-d872f2087c98
parent fd14f812
......@@ -3,10 +3,10 @@
// found in the LICENSE file.
#include "base/test/perf_test_suite.h"
#include "mojo/system/core_impl.h"
#include "mojo/system/embedder.h"
int main(int argc, char** argv) {
mojo::system::CoreImpl::Init();
mojo::embedder::Init();
return base::PerfTestSuite(argc, argv).Run();
}
......@@ -5,12 +5,12 @@
#include "base/bind.h"
#include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h"
#include "mojo/system/core_impl.h"
#include "mojo/system/embedder.h"
int main(int argc, char** argv) {
base::TestSuite test_suite(argc, argv);
mojo::system::CoreImpl::Init();
mojo::embedder::Init();
return base::LaunchUnitTests(
argc, argv, base::Bind(&base::TestSuite::Run,
......
......@@ -94,6 +94,8 @@
'system/data_pipe_producer_dispatcher.h',
'system/dispatcher.cc',
'system/dispatcher.h',
'system/embedder.cc',
'system/embedder.h',
'system/local_data_pipe.cc',
'system/local_data_pipe.h',
'system/local_message_pipe_endpoint.cc',
......
......@@ -6,7 +6,7 @@
#include "mojo/shell/dynamic_service_loader.h"
#include "mojo/shell/network_delegate.h"
#include "mojo/system/core_impl.h"
#include "mojo/system/embedder.h"
namespace mojo {
namespace shell {
......@@ -19,7 +19,7 @@ Context::Context()
task_runners_.cache_runner(),
scoped_ptr<net::NetworkDelegate>(new NetworkDelegate()),
storage_.profile_path()) {
system::CoreImpl::Init();
embedder::Init();
BindingsSupport::Set(&bindings_support_impl_);
dynamic_service_loader_.reset(new DynamicServiceLoader(this));
service_manager_.set_default_loader(dynamic_service_loader_.get());
......
......@@ -14,6 +14,11 @@
#include "mojo/system/system_impl_export.h"
namespace mojo {
namespace embedder {
void Init(); // So it can be friended.
}
namespace system {
class CoreImpl;
......@@ -23,10 +28,8 @@ namespace test {
class CoreTestBase;
}
// |CoreImpl| is a singleton object that implements the Mojo system calls. With
// the (obvious) exception of |Init()|, which must be called first (and the call
// completed) before making any other calls, all the public methods are
// thread-safe.
// |CoreImpl| is a singleton object that implements the Mojo system calls. All
// public methods are thread-safe.
class MOJO_SYSTEM_IMPL_EXPORT CoreImpl : public Core {
public:
static void Init();
......@@ -82,6 +85,7 @@ class MOJO_SYSTEM_IMPL_EXPORT CoreImpl : public Core {
uint32_t num_bytes_read) OVERRIDE;
private:
friend void embedder::Init();
friend class test::CoreTestBase;
// The |busy| member is used only to deal with functions (in particular
......@@ -152,6 +156,7 @@ class MOJO_SYSTEM_IMPL_EXPORT CoreImpl : public Core {
};
} // namespace system
} // namespace mojo
#endif // MOJO_SYSTEM_CORE_IMPL_H_
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "mojo/system/embedder.h"
#include "mojo/system/core_impl.h"
namespace mojo {
namespace embedder {
void Init() {
Core::Init(new system::CoreImpl());
}
} // namespace embedder
} // namespace mojo
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MOJO_SYSTEM_EMBEDDER_H_
#define MOJO_SYSTEM_EMBEDDER_H_
#include "mojo/system/system_impl_export.h"
namespace mojo {
namespace embedder {
MOJO_SYSTEM_IMPL_EXPORT void Init();
} // namespace embedder
} // namespace mojo
#endif // MOJO_SYSTEM_EMBEDDER_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment