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

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

Issue 585633004: Mojo: Add a MessageInTransit::Swap() method and remove the "PassContents" ctor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « mojo/system/message_in_transit_queue.cc ('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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/system/proxy_message_pipe_endpoint.h" 5 #include "mojo/system/proxy_message_pipe_endpoint.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "mojo/system/channel_endpoint.h" 10 #include "mojo/system/channel_endpoint.h"
11 #include "mojo/system/local_message_pipe_endpoint.h" 11 #include "mojo/system/local_message_pipe_endpoint.h"
12 #include "mojo/system/message_pipe_dispatcher.h" 12 #include "mojo/system/message_pipe_dispatcher.h"
13 13
14 namespace mojo { 14 namespace mojo {
15 namespace system { 15 namespace system {
16 16
17 ProxyMessagePipeEndpoint::ProxyMessagePipeEndpoint() 17 ProxyMessagePipeEndpoint::ProxyMessagePipeEndpoint()
18 : is_running_(false), is_peer_open_(true) { 18 : is_running_(false), is_peer_open_(true) {
19 } 19 }
20 20
21 ProxyMessagePipeEndpoint::ProxyMessagePipeEndpoint( 21 ProxyMessagePipeEndpoint::ProxyMessagePipeEndpoint(
22 LocalMessagePipeEndpoint* local_message_pipe_endpoint, 22 LocalMessagePipeEndpoint* local_message_pipe_endpoint,
23 bool is_peer_open) 23 bool is_peer_open)
24 : is_running_(false), 24 : is_running_(false), is_peer_open_(is_peer_open) {
25 is_peer_open_(is_peer_open), 25 paused_message_queue_.Swap(local_message_pipe_endpoint->message_queue());
26 paused_message_queue_(MessageInTransitQueue::PassContents(),
27 local_message_pipe_endpoint->message_queue()) {
28 local_message_pipe_endpoint->Close(); 26 local_message_pipe_endpoint->Close();
29 } 27 }
30 28
31 ProxyMessagePipeEndpoint::~ProxyMessagePipeEndpoint() { 29 ProxyMessagePipeEndpoint::~ProxyMessagePipeEndpoint() {
32 DCHECK(!is_running()); 30 DCHECK(!is_running());
33 DCHECK(!is_attached()); 31 DCHECK(!is_attached());
34 DCHECK(paused_message_queue_.IsEmpty()); 32 DCHECK(paused_message_queue_.IsEmpty());
35 } 33 }
36 34
37 MessagePipeEndpoint::Type ProxyMessagePipeEndpoint::GetType() const { 35 MessagePipeEndpoint::Type ProxyMessagePipeEndpoint::GetType() const {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 DCHECK(is_attached()); 108 DCHECK(is_attached());
111 109
112 channel_endpoint_->DetachFromMessagePipe(); 110 channel_endpoint_->DetachFromMessagePipe();
113 channel_endpoint_ = NULL; 111 channel_endpoint_ = NULL;
114 is_running_ = false; 112 is_running_ = false;
115 paused_message_queue_.Clear(); 113 paused_message_queue_.Clear();
116 } 114 }
117 115
118 } // namespace system 116 } // namespace system
119 } // namespace mojo 117 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/message_in_transit_queue.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698