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

Unified Diff: mojo/system/proxy_message_pipe_endpoint.cc

Issue 587153003: Mojo: Move the paused message queue from ProxyMessagePipeEndpoint to ChannelEndpoint. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@del_pmpe_attach
Patch Set: rebased 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/system/proxy_message_pipe_endpoint.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/proxy_message_pipe_endpoint.cc
diff --git a/mojo/system/proxy_message_pipe_endpoint.cc b/mojo/system/proxy_message_pipe_endpoint.cc
index fda3f42c189b5744cebd4d855598bdbedf487ab9..75ce34dd7dbe8c705a3fc00be623a5a8be45d5bc 100644
--- a/mojo/system/proxy_message_pipe_endpoint.cc
+++ b/mojo/system/proxy_message_pipe_endpoint.cc
@@ -23,19 +23,15 @@ ProxyMessagePipeEndpoint::ProxyMessagePipeEndpoint(
ProxyMessagePipeEndpoint::ProxyMessagePipeEndpoint(
ChannelEndpoint* channel_endpoint,
- LocalMessagePipeEndpoint* local_message_pipe_endpoint,
bool is_peer_open)
: channel_endpoint_(channel_endpoint),
is_running_(false),
is_peer_open_(is_peer_open) {
- paused_message_queue_.Swap(local_message_pipe_endpoint->message_queue());
- local_message_pipe_endpoint->Close();
}
ProxyMessagePipeEndpoint::~ProxyMessagePipeEndpoint() {
DCHECK(!is_running());
DCHECK(!is_attached());
- DCHECK(paused_message_queue_.IsEmpty());
}
MessagePipeEndpoint::Type ProxyMessagePipeEndpoint::GetType() const {
@@ -47,10 +43,6 @@ bool ProxyMessagePipeEndpoint::OnPeerClose() {
is_peer_open_ = false;
- // If our outgoing message queue isn't empty, we shouldn't be destroyed yet.
- if (!paused_message_queue_.IsEmpty())
- return true;
-
if (is_attached()) {
if (!is_running()) {
// If we're not running yet, we can't be destroyed yet, because we're
@@ -69,13 +61,9 @@ bool ProxyMessagePipeEndpoint::OnPeerClose() {
// This case is handled in |Run()| (which will call us).
void ProxyMessagePipeEndpoint::EnqueueMessage(
scoped_ptr<MessageInTransit> message) {
- if (is_running()) {
- DCHECK(channel_endpoint_.get());
- LOG_IF(WARNING, !channel_endpoint_->EnqueueMessage(message.Pass()))
- << "Failed to write enqueue message to channel";
- } else {
- paused_message_queue_.AddMessage(message.Pass());
- }
+ DCHECK(channel_endpoint_.get());
+ LOG_IF(WARNING, !channel_endpoint_->EnqueueMessage(message.Pass()))
+ << "Failed to write enqueue message to channel";
}
bool ProxyMessagePipeEndpoint::Run() {
@@ -85,13 +73,6 @@ bool ProxyMessagePipeEndpoint::Run() {
is_running_ = true;
- while (!paused_message_queue_.IsEmpty()) {
- LOG_IF(
- WARNING,
- !channel_endpoint_->EnqueueMessage(paused_message_queue_.GetMessage()))
- << "Failed to write enqueue message to channel";
- }
-
if (is_peer_open_)
return true; // Stay alive.
@@ -110,7 +91,6 @@ void ProxyMessagePipeEndpoint::Detach() {
channel_endpoint_->DetachFromMessagePipe();
channel_endpoint_ = nullptr;
is_running_ = false;
- paused_message_queue_.Clear();
}
} // namespace system
« no previous file with comments | « mojo/system/proxy_message_pipe_endpoint.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698