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

Side by Side Diff: mojo/edk/system/incoming_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/incoming_endpoint.h ('k') | mojo/edk/system/local_data_pipe.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 2014 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/incoming_endpoint.h"
6
7 #include "base/logging.h"
8 #include "mojo/edk/system/channel_endpoint.h"
9 #include "mojo/edk/system/message_in_transit.h"
10 #include "mojo/edk/system/message_pipe.h"
11
12 namespace mojo {
13 namespace system {
14
15 IncomingEndpoint::IncomingEndpoint() {
16 }
17
18 scoped_refptr<ChannelEndpoint> IncomingEndpoint::Init() {
19 endpoint_ = new ChannelEndpoint(this, 0);
20 return endpoint_;
21 }
22
23 scoped_refptr<MessagePipe> IncomingEndpoint::ConvertToMessagePipe() {
24 base::AutoLock locker(lock_);
25 scoped_refptr<MessagePipe> message_pipe(
26 MessagePipe::CreateLocalProxyFromExisting(&message_queue_,
27 endpoint_.get()));
28 DCHECK(message_queue_.IsEmpty());
29 endpoint_ = nullptr;
30 return message_pipe;
31 }
32
33 void IncomingEndpoint::Close() {
34 base::AutoLock locker(lock_);
35 if (endpoint_) {
36 endpoint_->DetachFromClient();
37 endpoint_ = nullptr;
38 }
39 }
40
41 bool IncomingEndpoint::OnReadMessage(unsigned /*port*/,
42 MessageInTransit* message) {
43 base::AutoLock locker(lock_);
44 if (!endpoint_)
45 return false;
46
47 message_queue_.AddMessage(make_scoped_ptr(message));
48 return true;
49 }
50
51 void IncomingEndpoint::OnDetachFromChannel(unsigned /*port*/) {
52 Close();
53 }
54
55 IncomingEndpoint::~IncomingEndpoint() {
56 }
57
58 } // namespace system
59 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/incoming_endpoint.h ('k') | mojo/edk/system/local_data_pipe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698