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

Unified Diff: mojo/public/cpp/bindings/tests/e2e_perftest.cc

Issue 2326913003: Privatize StrongBinding lifetime management (Closed)
Patch Set: rebase Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/bindings/tests/e2e_perftest.cc
diff --git a/mojo/public/cpp/bindings/tests/e2e_perftest.cc b/mojo/public/cpp/bindings/tests/e2e_perftest.cc
index 66ac6dc76db6bc4155a25a247549d70b573f4500..3e3fad1b0cfa6eaddb6245b116d0d7cefee3a574 100644
--- a/mojo/public/cpp/bindings/tests/e2e_perftest.cc
+++ b/mojo/public/cpp/bindings/tests/e2e_perftest.cc
@@ -23,8 +23,7 @@ namespace {
class EchoServiceImpl : public test::EchoService {
public:
- EchoServiceImpl(InterfaceRequest<EchoService> request,
- const base::Closure& quit_closure);
+ explicit EchoServiceImpl(const base::Closure& quit_closure);
~EchoServiceImpl() override;
// |EchoService| methods:
@@ -32,13 +31,11 @@ class EchoServiceImpl : public test::EchoService {
const EchoCallback& callback) override;
private:
- const StrongBinding<EchoService> binding_;
const base::Closure quit_closure_;
};
-EchoServiceImpl::EchoServiceImpl(InterfaceRequest<EchoService> request,
- const base::Closure& quit_closure)
- : binding_(this, std::move(request)), quit_closure_(quit_closure) {}
+EchoServiceImpl::EchoServiceImpl(const base::Closure& quit_closure)
+ : quit_closure_(quit_closure) {}
EchoServiceImpl::~EchoServiceImpl() {
quit_closure_.Run();
@@ -163,7 +160,7 @@ class MojoE2EPerftest : public edk::test::MojoTestBase {
void CreateAndRunService(InterfaceRequest<test::EchoService> request,
const base::Closure& cb) {
- new EchoServiceImpl(std::move(request), cb);
+ MakeStrongBinding(base::MakeUnique<EchoServiceImpl>(cb), std::move(request));
}
DEFINE_TEST_CLIENT_TEST_WITH_PIPE(PingService, MojoE2EPerftest, mp) {
« no previous file with comments | « mojo/public/cpp/bindings/tests/binding_unittest.cc ('k') | mojo/public/cpp/bindings/tests/handle_passing_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698