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

Side by Side Diff: mojo/public/cpp/bindings/lib/associated_binding.cc

Issue 2680243003: Reduce size of mojo AssociatedBinding template expansions (Closed)
Patch Set: rebase Created 3 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
« no previous file with comments | « mojo/public/cpp/bindings/associated_binding.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "mojo/public/cpp/bindings/associated_binding.h"
6
7 namespace mojo {
8
9 AssociatedBindingBase::AssociatedBindingBase() {}
10
11 AssociatedBindingBase::~AssociatedBindingBase() {}
12
13 void AssociatedBindingBase::AddFilter(std::unique_ptr<MessageReceiver> filter) {
14 DCHECK(endpoint_client_);
15 endpoint_client_->AddFilter(std::move(filter));
16 }
17
18 void AssociatedBindingBase::Close() {
19 endpoint_client_.reset();
20 }
21
22 void AssociatedBindingBase::CloseWithReason(uint32_t custom_reason,
23 const std::string& description) {
24 if (endpoint_client_)
25 endpoint_client_->CloseWithReason(custom_reason, description);
26 Close();
27 }
28
29 void AssociatedBindingBase::set_connection_error_handler(
30 const base::Closure& error_handler) {
31 DCHECK(is_bound());
32 endpoint_client_->set_connection_error_handler(error_handler);
33 }
34
35 void AssociatedBindingBase::set_connection_error_with_reason_handler(
36 const ConnectionErrorWithReasonCallback& error_handler) {
37 DCHECK(is_bound());
38 endpoint_client_->set_connection_error_with_reason_handler(error_handler);
39 }
40
41 void AssociatedBindingBase::FlushForTesting() {
42 endpoint_client_->control_message_proxy()->FlushForTesting();
43 }
44
45 void AssociatedBindingBase::BindImpl(
46 ScopedInterfaceEndpointHandle handle,
47 MessageReceiverWithResponderStatus* receiver,
48 std::unique_ptr<MessageReceiver> payload_validator,
49 bool expect_sync_requests,
50 scoped_refptr<base::SingleThreadTaskRunner> runner,
51 uint32_t interface_version) {
52 DCHECK(handle.is_local())
53 << "The AssociatedInterfaceRequest is supposed to be used at the "
54 << "other side of the message pipe.";
55
56 if (!handle.is_valid() || !handle.is_local()) {
57 endpoint_client_.reset();
58 return;
59 }
60
61 endpoint_client_.reset(new InterfaceEndpointClient(
62 std::move(handle), receiver, std::move(payload_validator),
63 expect_sync_requests, std::move(runner), interface_version));
64 }
65
66 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/associated_binding.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698