OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "mojo/public/cpp/bindings/binding.h" | 7 #include "mojo/public/cpp/bindings/binding.h" |
8 #include "mojo/public/cpp/bindings/strong_binding.h" | 8 #include "mojo/public/cpp/bindings/strong_binding.h" |
9 #include "mojo/public/cpp/environment/environment.h" | 9 #include "mojo/public/cpp/environment/environment.h" |
10 #include "mojo/public/cpp/utility/run_loop.h" | 10 #include "mojo/public/cpp/utility/run_loop.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 public: | 146 public: |
147 ~ReentrantServiceImpl() override {} | 147 ~ReentrantServiceImpl() override {} |
148 | 148 |
149 explicit ReentrantServiceImpl(InterfaceRequest<sample::Service> request) | 149 explicit ReentrantServiceImpl(InterfaceRequest<sample::Service> request) |
150 : call_depth_(0), max_call_depth_(0), binding_(this, request.Pass()) {} | 150 : call_depth_(0), max_call_depth_(0), binding_(this, request.Pass()) {} |
151 | 151 |
152 int max_call_depth() { return max_call_depth_; } | 152 int max_call_depth() { return max_call_depth_; } |
153 | 153 |
154 void Frobinate(sample::FooPtr foo, | 154 void Frobinate(sample::FooPtr foo, |
155 sample::Service::BazOptions baz, | 155 sample::Service::BazOptions baz, |
156 sample::PortPtr port, | 156 mojo::InterfaceHandle<sample::Port> port, |
157 const sample::Service::FrobinateCallback& callback) override { | 157 const sample::Service::FrobinateCallback& callback) override { |
158 max_call_depth_ = std::max(++call_depth_, max_call_depth_); | 158 max_call_depth_ = std::max(++call_depth_, max_call_depth_); |
159 if (call_depth_ == 1) { | 159 if (call_depth_ == 1) { |
160 EXPECT_TRUE(binding_.WaitForIncomingMethodCall()); | 160 EXPECT_TRUE(binding_.WaitForIncomingMethodCall()); |
161 } | 161 } |
162 call_depth_--; | 162 call_depth_--; |
163 callback.Run(5); | 163 callback.Run(5); |
164 } | 164 } |
165 | 165 |
166 void GetPort(mojo::InterfaceRequest<sample::Port> port) override {} | 166 void GetPort(mojo::InterfaceRequest<sample::Port> port) override {} |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 // While B & C have fallen out of scope, the pipes will remain until they are | 656 // While B & C have fallen out of scope, the pipes will remain until they are |
657 // flushed. | 657 // flushed. |
658 EXPECT_FALSE(a_impl.d_called()); | 658 EXPECT_FALSE(a_impl.d_called()); |
659 PumpMessages(); | 659 PumpMessages(); |
660 EXPECT_TRUE(a_impl.d_called()); | 660 EXPECT_TRUE(a_impl.d_called()); |
661 } | 661 } |
662 | 662 |
663 } // namespace | 663 } // namespace |
664 } // namespace test | 664 } // namespace test |
665 } // namespace mojo | 665 } // namespace mojo |
OLD | NEW |