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

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

Issue 1526563004: Fix shutdown assert with the new Mojo EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment Created 5 years 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/message_pipe_dispatcher.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/edk/system/routed_raw_channel.h" 5 #include "mojo/edk/system/routed_raw_channel.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "mojo/edk/embedder/embedder_internal.h" 9 #include "mojo/edk/embedder/embedder_internal.h"
10 10
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 memcpy(&msg->message[0], message_view.main_buffer(), 125 memcpy(&msg->message[0], message_view.main_buffer(),
126 message_view.total_size()); 126 message_view.total_size());
127 msg->handles = platform_handles.Pass(); 127 msg->handles = platform_handles.Pass();
128 pending_messages_.push_back(msg.Pass()); 128 pending_messages_.push_back(msg.Pass());
129 } 129 }
130 } 130 }
131 131
132 void RoutedRawChannel::OnError(Error error) { 132 void RoutedRawChannel::OnError(Error error) {
133 DCHECK(internal::g_io_thread_task_runner->RunsTasksOnCurrentThread()); 133 DCHECK(internal::g_io_thread_task_runner->RunsTasksOnCurrentThread());
134 134
135 channel_->Shutdown(); 135 // This needs to match non-multiplexed MessagePipeDispatcher's destruction of
136 channel_ = nullptr; 136 // the channel only when read errors occur.
137 if (error != ERROR_WRITE) {
138 channel_->Shutdown();
139 channel_ = nullptr;
140 }
141
137 if (routes_.empty()) { 142 if (routes_.empty()) {
138 delete this; 143 delete this;
139 return; 144 return;
140 } 145 }
141 146
142 for (auto it = routes_.begin(); it != routes_.end();) { 147 for (auto it = routes_.begin(); it != routes_.end();) {
143 // Handle the delegate calling RemoveRoute in this call. 148 // Handle the delegate calling RemoveRoute in this call.
144 auto cur_it = it++; 149 auto cur_it = it++;
145 cur_it->second->OnError(error); 150 cur_it->second->OnError(error);
146 } 151 }
147 } 152 }
148 153
149 } // namespace edk 154 } // namespace edk
150 } // namespace mojo 155 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/message_pipe_dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698