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

Side by Side Diff: mojo/edk/system/proxy_message_pipe_endpoint.cc

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 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/edk/system/proxy_message_pipe_endpoint.h ('k') | mojo/edk/system/raw_channel.h » ('j') | 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 2013 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/edk/system/proxy_message_pipe_endpoint.h"
6
7 #include <string.h>
8
9 #include "base/logging.h"
10 #include "mojo/edk/system/channel_endpoint.h"
11 #include "mojo/edk/system/local_message_pipe_endpoint.h"
12 #include "mojo/edk/system/message_pipe_dispatcher.h"
13
14 namespace mojo {
15 namespace system {
16
17 ProxyMessagePipeEndpoint::ProxyMessagePipeEndpoint(
18 ChannelEndpoint* channel_endpoint)
19 : channel_endpoint_(channel_endpoint) {
20 }
21
22 ProxyMessagePipeEndpoint::~ProxyMessagePipeEndpoint() {
23 DCHECK(!channel_endpoint_);
24 }
25
26 scoped_refptr<ChannelEndpoint>
27 ProxyMessagePipeEndpoint::ReleaseChannelEndpoint() {
28 DCHECK(channel_endpoint_);
29 scoped_refptr<ChannelEndpoint> rv;
30 rv.swap(channel_endpoint_);
31 return rv;
32 }
33
34 MessagePipeEndpoint::Type ProxyMessagePipeEndpoint::GetType() const {
35 return kTypeProxy;
36 }
37
38 bool ProxyMessagePipeEndpoint::OnPeerClose() {
39 DetachIfNecessary();
40 return false;
41 }
42
43 // Note: We may have to enqueue messages even when our (local) peer isn't open
44 // -- it may have been written to and closed immediately, before we were ready.
45 // This case is handled in |Run()| (which will call us).
46 void ProxyMessagePipeEndpoint::EnqueueMessage(
47 scoped_ptr<MessageInTransit> message) {
48 DCHECK(channel_endpoint_);
49 LOG_IF(WARNING, !channel_endpoint_->EnqueueMessage(message.Pass()))
50 << "Failed to write enqueue message to channel";
51 }
52
53 void ProxyMessagePipeEndpoint::Close() {
54 DetachIfNecessary();
55 }
56
57 void ProxyMessagePipeEndpoint::DetachIfNecessary() {
58 if (channel_endpoint_) {
59 channel_endpoint_->DetachFromClient();
60 channel_endpoint_ = nullptr;
61 }
62 }
63
64 } // namespace system
65 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/proxy_message_pipe_endpoint.h ('k') | mojo/edk/system/raw_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698