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

Side by Side Diff: mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc

Issue 1682113003: Mojo C++ bindings: Generate InterfaceHandle<> instead of InterfacePtr<>. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebase ontop of master, address trung's comments Created 4 years, 10 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 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
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
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
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/handle_passing_unittest.cc ('k') | mojo/public/cpp/bindings/tests/sample_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698