Skip to content

Commit

Permalink
Make mojo_system static and mojo_system_impl a component, never use both
Browse files Browse the repository at this point in the history
BUG=
R=viettrungluu@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263717 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
davemoore@chromium.org committed Apr 14, 2014
1 parent d2202e2 commit cf28cd1
Show file tree
Hide file tree
Showing 34 changed files with 695 additions and 524 deletions.
1 change: 0 additions & 1 deletion content/content_app.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
'dependencies': [
'../mojo/mojo.gyp:mojo_environment_chromium',
'../mojo/mojo.gyp:mojo_service_manager',
'../mojo/mojo.gyp:mojo_system',
'../mojo/mojo.gyp:mojo_system_impl',
],
}],
Expand Down
1 change: 0 additions & 1 deletion content/content_browser.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,6 @@
'content_common_mojo_bindings',
'../cc/cc.gyp:cc',
'../mojo/mojo.gyp:mojo_bindings',
'../mojo/mojo.gyp:mojo_system',
'../net/net.gyp:http_server',
'../third_party/leveldatabase/leveldatabase.gyp:leveldatabase',
'../ui/surface/surface.gyp:surface',
Expand Down
1 change: 0 additions & 1 deletion content/content_common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,6 @@
'../media/media.gyp:media',
'../media/media.gyp:shared_memory_support',
'../mojo/mojo.gyp:mojo_environment_chromium',
'../mojo/mojo.gyp:mojo_system',
'../mojo/mojo.gyp:mojo_system_impl',
'../third_party/WebKit/public/blink.gyp:blink',
'../ui/gl/gl.gyp:gl',
Expand Down
2 changes: 0 additions & 2 deletions content/content_common_mojo_bindings.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
'dependencies': [
'../mojo/mojo.gyp:mojo_bindings',
'../mojo/mojo.gyp:mojo_environment_chromium',
'../mojo/mojo.gyp:mojo_system',
],
'sources': [
'common/mojo/render_process.mojom',
Expand All @@ -24,7 +23,6 @@
'export_dependent_settings': [
'../mojo/mojo.gyp:mojo_bindings',
'../mojo/mojo.gyp:mojo_environment_chromium',
'../mojo/mojo.gyp:mojo_system',
],
},
],
Expand Down
3 changes: 0 additions & 3 deletions content/content_tests.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,6 @@
'type': 'static_library',
'dependencies': [
'../mojo/mojo.gyp:mojo_bindings',
'../mojo/mojo.gyp:mojo_system',
],
'sources': [
'test/data/web_ui_test_mojo_bindings.mojom',
Expand All @@ -967,7 +966,6 @@
'includes': [ '../mojo/public/tools/bindings/mojom_bindings_generator.gypi' ],
'export_dependent_settings': [
'../mojo/mojo.gyp:mojo_bindings',
'../mojo/mojo.gyp:mojo_system',
],
},
{
Expand All @@ -993,7 +991,6 @@
'../mojo/mojo.gyp:mojo_bindings',
'../mojo/mojo.gyp:mojo_environment_chromium',
'../mojo/mojo.gyp:mojo_service_manager',
'../mojo/mojo.gyp:mojo_system',
'../mojo/mojo.gyp:mojo_system_impl',
'../net/net.gyp:net_test_support',
'../ppapi/ppapi_internal.gyp:ppapi_host',
Expand Down
17 changes: 9 additions & 8 deletions mojo/embedder/embedder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "mojo/system/channel.h"
#include "mojo/system/core_impl.h"
#include "mojo/system/core.h"
#include "mojo/system/entrypoints.h"
#include "mojo/system/message_pipe.h"
#include "mojo/system/message_pipe_dispatcher.h"
#include "mojo/system/raw_channel.h"

namespace mojo {
namespace embedder {

void Init() {
system::entrypoints::SetCore(new system::Core());
}

struct ChannelInfo {
scoped_refptr<system::Channel> channel;
};
Expand Down Expand Up @@ -55,10 +60,6 @@ static void CreateChannelOnIOThread(
}
}

void Init() {
Core::Init(new system::CoreImpl());
}

ScopedMessagePipeHandle CreateChannel(
ScopedPlatformHandle platform_handle,
scoped_refptr<base::TaskRunner> io_thread_task_runner,
Expand All @@ -70,10 +71,10 @@ ScopedMessagePipeHandle CreateChannel(
scoped_refptr<system::MessagePipe> > remote_message_pipe =
system::MessagePipeDispatcher::CreateRemoteMessagePipe();

system::CoreImpl* core_impl = static_cast<system::CoreImpl*>(Core::Get());
DCHECK(core_impl);
system::Core* core = system::entrypoints::GetCore();
DCHECK(core);
ScopedMessagePipeHandle rv(
MessagePipeHandle(core_impl->AddDispatcher(remote_message_pipe.first)));
MessagePipeHandle(core->AddDispatcher(remote_message_pipe.first)));
// TODO(vtl): Do we properly handle the failure case here?
if (rv.is_valid()) {
io_thread_task_runner->PostTask(FROM_HERE,
Expand Down
15 changes: 8 additions & 7 deletions mojo/embedder/test_embedder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@

#include "base/logging.h"
#include "base/macros.h"
#include "mojo/system/core_impl.h"
#include "mojo/system/core.h"
#include "mojo/system/entrypoints.h"
#include "mojo/system/handle_table.h"

namespace mojo {

namespace system {
namespace internal {

bool ShutdownCheckNoLeaks(CoreImpl* core_impl) {
bool ShutdownCheckNoLeaks(Core* core_impl) {
// No point in taking the lock.
const HandleTable::HandleToEntryMap& handle_to_entry_map =
core_impl->handle_table_.handle_to_entry_map_;
Expand All @@ -38,12 +39,12 @@ namespace embedder {
namespace test {

bool Shutdown() {
system::CoreImpl* core_impl = static_cast<system::CoreImpl*>(Core::Get());
CHECK(core_impl);
Core::Reset();
system::Core* core = system::entrypoints::GetCore();
CHECK(core);
system::entrypoints::SetCore(NULL);

bool rv = system::internal::ShutdownCheckNoLeaks(core_impl);
delete core_impl;
bool rv = system::internal::ShutdownCheckNoLeaks(core);
delete core;
return rv;
}

Expand Down
31 changes: 14 additions & 17 deletions mojo/mojo.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
'mojo_js',
'mojo_js_unittests',
'mojo_message_generator',
'mojo_native_viewport_service',
'mojo_pepper_container_app',
'mojo_public_test_utils',
'mojo_public_bindings_unittests',
Expand Down Expand Up @@ -70,7 +71,6 @@
'../base/base.gyp:base',
'../base/base.gyp:test_support_base',
'../testing/gtest.gyp:gtest',
'mojo_system',
'mojo_system_impl',
'mojo_test_support',
'mojo_test_support_impl',
Expand All @@ -84,7 +84,6 @@
'type': 'static_library',
'dependencies': [
'../base/base.gyp:test_support_base',
'mojo_system',
'mojo_system_impl',
'mojo_test_support',
'mojo_test_support_impl',
Expand All @@ -97,12 +96,12 @@
'target_name': 'mojo_system_impl',
'type': '<(component)',
'dependencies': [
'mojo_system',
'../base/base.gyp:base',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
],
'defines': [
'MOJO_SYSTEM_IMPL_IMPLEMENTATION',
'MOJO_SYSTEM_IMPLEMENTATION',
],
'sources': [
'embedder/embedder.cc',
Expand All @@ -119,8 +118,8 @@
'system/channel.cc',
'system/channel.h',
'system/constants.h',
'system/core_impl.cc',
'system/core_impl.h',
'system/core.cc',
'system/core.h',
'system/data_pipe.cc',
'system/data_pipe.h',
'system/data_pipe_consumer_dispatcher.cc',
Expand All @@ -129,6 +128,7 @@
'system/data_pipe_producer_dispatcher.h',
'system/dispatcher.cc',
'system/dispatcher.h',
'system/entrypoints.cc',
'system/handle_table.cc',
'system/handle_table.h',
'system/local_data_pipe.cc',
Expand Down Expand Up @@ -179,16 +179,16 @@
'target_name': 'mojo_system_unittests',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
'../base/base.gyp:run_all_unittests',
'../testing/gtest.gyp:gtest',
'mojo_common_test_support',
'mojo_system',
'mojo_system_impl',
],
'sources': [
'embedder/embedder_unittest.cc',
'embedder/platform_channel_pair_posix_unittest.cc',
'system/core_impl_unittest.cc',
'system/core_unittest.cc',
'system/core_test_base.cc',
'system/core_test_base.h',
'system/data_pipe_unittest.cc',
Expand Down Expand Up @@ -223,6 +223,7 @@
'mojo_gles2',
'mojo_gles2_bindings',
'mojo_environment_chromium',
'mojo_system_impl',
],
'defines': [
'MOJO_GLES2_IMPL_IMPLEMENTATION',
Expand Down Expand Up @@ -257,7 +258,11 @@
'dependencies': [
'../base/base.gyp:base',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'mojo_system',
'mojo_system_impl',
],
'export_dependent_settings': [
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'mojo_system_impl',
],
'sources': [
'common/common_type_converters.cc',
Expand All @@ -280,7 +285,6 @@
'../base/base.gyp:base',
'../base/base.gyp:test_support_base',
'../testing/gtest.gyp:gtest',
'mojo_system',
'mojo_system_impl',
],
'sources': [
Expand All @@ -304,8 +308,6 @@
'mojo_common_test_support',
'mojo_public_test_utils',
'mojo_run_all_unittests',
'mojo_system',
'mojo_system_impl',
],
'sources': [
'common/common_type_converters_unittest.cc',
Expand Down Expand Up @@ -368,6 +370,7 @@
'mojo_common_lib',
'mojo_environment_chromium',
'mojo_shell_bindings',
'mojo_system_impl',
],
'sources': [
'service_manager/service_loader.h',
Expand Down Expand Up @@ -405,7 +408,6 @@
'mojo_gles2_impl',
'mojo_service_manager',
'mojo_shell_bindings',
'mojo_system',
'mojo_system_impl',
'mojo_native_viewport_service',
'mojo_spy',
Expand Down Expand Up @@ -466,7 +468,6 @@
'mojo_environment_chromium',
'mojo_service_manager',
'mojo_shell_lib',
'mojo_system',
'mojo_system_impl',
],
'sources': [
Expand All @@ -486,7 +487,6 @@
'mojo_run_all_unittests',
'mojo_service_manager',
'mojo_shell_client',
'mojo_system',
],
'variables': {
'mojom_base_output_dir': 'mojo',
Expand All @@ -505,13 +505,11 @@
'../gin/gin.gyp:gin',
'../v8/tools/gyp/v8.gyp:v8',
'mojo_common_lib',
'mojo_system',
],
'export_dependent_settings': [
'../base/base.gyp:base',
'../gin/gin.gyp:gin',
'mojo_common_lib',
'mojo_system',
],
'sources': [
'bindings/js/core.cc',
Expand Down Expand Up @@ -546,7 +544,6 @@
'mojo_bindings',
'mojo_common_lib',
'mojo_environment_chromium',
'mojo_system',
'mojo_system_impl',
],
'sources': [
Expand Down
3 changes: 1 addition & 2 deletions mojo/mojo_apps.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
'mojo_gles2_bindings',
'mojo_js_bindings_lib',
'mojo_native_viewport_bindings',
'mojo_system',
],
'export_dependent_settings': [
'../base/base.gyp:base',
Expand All @@ -23,7 +22,6 @@
'mojo_gles2',
'mojo_gles2_bindings',
'mojo_native_viewport_bindings',
'mojo_system',
],
'sources': [
'apps/js/mojo_runner_delegate.cc',
Expand Down Expand Up @@ -56,6 +54,7 @@
'type': 'shared_library',
'dependencies': [
'mojo_js_lib',
'mojo_system_impl',
],
'sources': [
'apps/js/main.cc',
Expand Down
Loading

0 comments on commit cf28cd1

Please sign in to comment.