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

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

Issue 621153003: Move mojo edk into mojo/edk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix checkdeps Created 6 years, 2 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/system/proxy_message_pipe_endpoint.h ('k') | mojo/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/system/proxy_message_pipe_endpoint.h"
6
7 #include <string.h>
8
9 #include "base/logging.h"
10 #include "mojo/system/channel_endpoint.h"
11 #include "mojo/system/local_message_pipe_endpoint.h"
12 #include "mojo/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_.get());
24 }
25
26 MessagePipeEndpoint::Type ProxyMessagePipeEndpoint::GetType() const {
27 return kTypeProxy;
28 }
29
30 bool ProxyMessagePipeEndpoint::OnPeerClose() {
31 DetachIfNecessary();
32 return false;
33 }
34
35 // Note: We may have to enqueue messages even when our (local) peer isn't open
36 // -- it may have been written to and closed immediately, before we were ready.
37 // This case is handled in |Run()| (which will call us).
38 void ProxyMessagePipeEndpoint::EnqueueMessage(
39 scoped_ptr<MessageInTransit> message) {
40 DCHECK(channel_endpoint_.get());
41 LOG_IF(WARNING, !channel_endpoint_->EnqueueMessage(message.Pass()))
42 << "Failed to write enqueue message to channel";
43 }
44
45 void ProxyMessagePipeEndpoint::Close() {
46 DetachIfNecessary();
47 }
48
49 void ProxyMessagePipeEndpoint::DetachIfNecessary() {
50 if (channel_endpoint_.get()) {
51 channel_endpoint_->DetachFromMessagePipe();
52 channel_endpoint_ = nullptr;
53 }
54 }
55
56 } // namespace system
57 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/proxy_message_pipe_endpoint.h ('k') | mojo/system/raw_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698