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

Side by Side Diff: ipc/mojo/ipc_mojo_perftest.cc

Issue 1350023003: Add a Mojo EDK for Chrome that uses one OS pipe per message pipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more cleanup Created 5 years, 2 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 unified diff | Download patch
OLDNEW
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 "base/lazy_instance.h" 5 #include "base/lazy_instance.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "ipc/ipc_perftest_support.h" 7 #include "ipc/ipc_perftest_support.h"
8 #include "ipc/mojo/ipc_channel_mojo.h" 8 #include "ipc/mojo/ipc_channel_mojo.h"
9 #include "third_party/mojo/src/mojo/edk/embedder/test_embedder.h" 9 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
10 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
10 11
11 namespace { 12 namespace {
12 13
13 // This is needed because we rely on //base/test:test_support_perf and 14 // This is needed because we rely on //base/test:test_support_perf and
14 // it provides main() which doesn't have Mojo initialization. We need 15 // it provides main() which doesn't have Mojo initialization. We need
15 // some way to call InitWithSimplePlatformSupport() only once before 16 // some way to call Init() only once before using Mojo.
16 // using Mojo.
17 struct MojoInitialier { 17 struct MojoInitialier {
18 MojoInitialier() { 18 MojoInitialier() {
19 mojo::embedder::test::InitWithSimplePlatformSupport(); 19 mojo::embedder::Init();
20 } 20 }
21 }; 21 };
22 22
23 base::LazyInstance<MojoInitialier> g_mojo_initializer 23 base::LazyInstance<MojoInitialier> g_mojo_initializer
24 = LAZY_INSTANCE_INITIALIZER; 24 = LAZY_INSTANCE_INITIALIZER;
25 25
26 class MojoChannelPerfTest : public IPC::test::IPCChannelPerfTestBase { 26 class MojoChannelPerfTest : public IPC::test::IPCChannelPerfTestBase {
27 public: 27 public:
28 typedef IPC::test::IPCChannelPerfTestBase Super; 28 typedef IPC::test::IPCChannelPerfTestBase Super;
29 29
(...skipping 28 matching lines...) Expand all
58 run_loop.RunUntilIdle(); 58 run_loop.RunUntilIdle();
59 } 59 }
60 60
61 TEST_F(MojoChannelPerfTest, ChannelProxyPingPong) { 61 TEST_F(MojoChannelPerfTest, ChannelProxyPingPong) {
62 RunTestChannelProxyPingPong(GetDefaultTestParams()); 62 RunTestChannelProxyPingPong(GetDefaultTestParams());
63 63
64 base::RunLoop run_loop; 64 base::RunLoop run_loop;
65 run_loop.RunUntilIdle(); 65 run_loop.RunUntilIdle();
66 } 66 }
67 67
68 // Test to see how many channels we can create.
69 TEST_F(MojoChannelPerfTest, DISABLED_MaxChannelCount) {
70 #if defined(OS_POSIX)
71 LOG(INFO) << "base::GetMaxFds " << base::GetMaxFds();
72 base::SetFdLimit(20000);
73 #endif
74
75 std::vector<mojo::embedder::PlatformChannelPair*> channels;
76 for (size_t i = 0; i < 10000; ++i) {
77 LOG(INFO) << "channels size: " << channels.size();
78 channels.push_back(new mojo::embedder::PlatformChannelPair());
79 }
80 }
81
68 class MojoTestClient : public IPC::test::PingPongTestClient { 82 class MojoTestClient : public IPC::test::PingPongTestClient {
69 public: 83 public:
70 typedef IPC::test::PingPongTestClient SuperType; 84 typedef IPC::test::PingPongTestClient SuperType;
71 85
72 MojoTestClient(); 86 MojoTestClient();
73 87
74 scoped_ptr<IPC::Channel> CreateChannel(IPC::Listener* listener) override; 88 scoped_ptr<IPC::Channel> CreateChannel(IPC::Listener* listener) override;
75 }; 89 };
76 90
77 MojoTestClient::MojoTestClient() { 91 MojoTestClient::MojoTestClient() {
(...skipping 11 matching lines...) Expand all
89 MojoTestClient client; 103 MojoTestClient client;
90 int rv = client.RunMain(); 104 int rv = client.RunMain();
91 105
92 base::RunLoop run_loop; 106 base::RunLoop run_loop;
93 run_loop.RunUntilIdle(); 107 run_loop.RunUntilIdle();
94 108
95 return rv; 109 return rv;
96 } 110 }
97 111
98 } // namespace 112 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698