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

Unified Diff: mojo/public/cpp/bindings/lib/multiplex_router.cc

Issue 2035893003: Fix some MultiplexRouter behavior for sync messages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/multiplex_router.cc
diff --git a/mojo/public/cpp/bindings/lib/multiplex_router.cc b/mojo/public/cpp/bindings/lib/multiplex_router.cc
index d081b0155ba480edf20fd4357b00f4d49f7ecb62..8b461ea2e92eff43fa2c8c162c5ae0dd9b45891f 100644
--- a/mojo/public/cpp/bindings/lib/multiplex_router.cc
+++ b/mojo/public/cpp/bindings/lib/multiplex_router.cc
@@ -594,7 +594,7 @@ void MultiplexRouter::ProcessTasks(
bool sync_message = task->IsMessageTask() && task->message &&
task->message->has_flag(kMessageIsSync);
if (sync_message) {
- InterfaceId id = task->message->interface_id();
+ id = task->message->interface_id();
auto& sync_message_queue = sync_message_tasks_[id];
DCHECK_EQ(task.get(), sync_message_queue.front());
sync_message_queue.pop_front();
@@ -608,11 +608,11 @@ void MultiplexRouter::ProcessTasks(
current_task_runner);
if (!processed) {
- tasks_.push_front(std::move(task));
if (sync_message) {
auto& sync_message_queue = sync_message_tasks_[id];
sync_message_queue.push_front(task.get());
}
+ tasks_.push_front(std::move(task));
break;
} else {
if (sync_message) {
@@ -643,7 +643,15 @@ bool MultiplexRouter::ProcessFirstSyncMessageForEndpoint(InterfaceId id) {
DCHECK(processed);
iter = sync_message_tasks_.find(id);
- return iter != sync_message_tasks_.end() && !iter->second.empty();
+ if (iter == sync_message_tasks_.end())
+ return false;
+
+ if (iter->second.empty()) {
+ sync_message_tasks_.erase(iter);
+ return false;
+ }
+
+ return true;
}
bool MultiplexRouter::ProcessNotifyErrorTask(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698