OLD | NEW |
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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "ipc/ipc_perftest_support.h" | 10 #include "ipc/ipc_perftest_support.h" |
11 #include "ipc/mojo/ipc_channel_mojo.h" | 11 #include "ipc/mojo/ipc_channel_mojo.h" |
12 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" | 12 #include "mojo/edk/embedder/embedder.h" |
13 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h" | 13 #include "mojo/edk/embedder/platform_channel_pair.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 // This is needed because we rely on //base/test:test_support_perf and | 17 // This is needed because we rely on //base/test:test_support_perf and |
18 // it provides main() which doesn't have Mojo initialization. We need | 18 // it provides main() which doesn't have Mojo initialization. We need |
19 // some way to call Init() only once before using Mojo. | 19 // some way to call Init() only once before using Mojo. |
20 struct MojoInitialier { | 20 struct MojoInitialier { |
21 MojoInitialier() { | 21 MojoInitialier() { mojo::edk::Init(); } |
22 mojo::embedder::Init(); | |
23 } | |
24 }; | 22 }; |
25 | 23 |
26 base::LazyInstance<MojoInitialier> g_mojo_initializer | 24 base::LazyInstance<MojoInitialier> g_mojo_initializer |
27 = LAZY_INSTANCE_INITIALIZER; | 25 = LAZY_INSTANCE_INITIALIZER; |
28 | 26 |
29 class MojoChannelPerfTest : public IPC::test::IPCChannelPerfTestBase { | 27 class MojoChannelPerfTest : public IPC::test::IPCChannelPerfTestBase { |
30 public: | 28 public: |
31 typedef IPC::test::IPCChannelPerfTestBase Super; | 29 typedef IPC::test::IPCChannelPerfTestBase Super; |
32 | 30 |
33 MojoChannelPerfTest(); | 31 MojoChannelPerfTest(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 run_loop.RunUntilIdle(); | 66 run_loop.RunUntilIdle(); |
69 } | 67 } |
70 | 68 |
71 // Test to see how many channels we can create. | 69 // Test to see how many channels we can create. |
72 TEST_F(MojoChannelPerfTest, DISABLED_MaxChannelCount) { | 70 TEST_F(MojoChannelPerfTest, DISABLED_MaxChannelCount) { |
73 #if defined(OS_POSIX) | 71 #if defined(OS_POSIX) |
74 LOG(INFO) << "base::GetMaxFds " << base::GetMaxFds(); | 72 LOG(INFO) << "base::GetMaxFds " << base::GetMaxFds(); |
75 base::SetFdLimit(20000); | 73 base::SetFdLimit(20000); |
76 #endif | 74 #endif |
77 | 75 |
78 std::vector<mojo::embedder::PlatformChannelPair*> channels; | 76 std::vector<mojo::edk::PlatformChannelPair*> channels; |
79 for (size_t i = 0; i < 10000; ++i) { | 77 for (size_t i = 0; i < 10000; ++i) { |
80 LOG(INFO) << "channels size: " << channels.size(); | 78 LOG(INFO) << "channels size: " << channels.size(); |
81 channels.push_back(new mojo::embedder::PlatformChannelPair()); | 79 channels.push_back(new mojo::edk::PlatformChannelPair()); |
82 } | 80 } |
83 } | 81 } |
84 | 82 |
85 class MojoTestClient : public IPC::test::PingPongTestClient { | 83 class MojoTestClient : public IPC::test::PingPongTestClient { |
86 public: | 84 public: |
87 typedef IPC::test::PingPongTestClient SuperType; | 85 typedef IPC::test::PingPongTestClient SuperType; |
88 | 86 |
89 MojoTestClient(); | 87 MojoTestClient(); |
90 | 88 |
91 scoped_ptr<IPC::Channel> CreateChannel(IPC::Listener* listener) override; | 89 scoped_ptr<IPC::Channel> CreateChannel(IPC::Listener* listener) override; |
(...skipping 14 matching lines...) Expand all Loading... |
106 MojoTestClient client; | 104 MojoTestClient client; |
107 int rv = client.RunMain(); | 105 int rv = client.RunMain(); |
108 | 106 |
109 base::RunLoop run_loop; | 107 base::RunLoop run_loop; |
110 run_loop.RunUntilIdle(); | 108 run_loop.RunUntilIdle(); |
111 | 109 |
112 return rv; | 110 return rv; |
113 } | 111 } |
114 | 112 |
115 } // namespace | 113 } // namespace |
OLD | NEW |