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

Unified Diff: ipc/ipc_channel_win.cc

Issue 1309003003: ipc: Add the inner class OutputElement to Channel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ipc_add_header3
Patch Set: Rebase to fix compile errors. Created 5 years, 4 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
« ipc/ipc_channel.cc ('K') | « ipc/ipc_channel_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_channel_win.cc
diff --git a/ipc/ipc_channel_win.cc b/ipc/ipc_channel_win.cc
index ad7ffb5f62be6cdbd39432819a37ea442d5dfc4e..8d76d1af25559b8974052ff552dbe63054777942 100644
--- a/ipc/ipc_channel_win.cc
+++ b/ipc/ipc_channel_win.cc
@@ -74,9 +74,9 @@ void ChannelWin::Close() {
}
while (!output_queue_.empty()) {
- Message* m = output_queue_.front();
+ OutputElement* element = output_queue_.front();
output_queue_.pop();
- delete m;
+ delete element;
}
}
@@ -126,7 +126,12 @@ bool ChannelWin::ProcessMessageForDelivery(Message* message) {
TRACE_EVENT_FLAG_FLOW_OUT);
// |output_queue_| takes ownership of |message|.
- output_queue_.push(message);
+ OutputElement* element = new OutputElement(message);
+ output_queue_.push(element);
+
+ // TODO(erikchen): Serialize the brokerable attachments and add them to the
+ // output_queue_. http://crbug.com/493414.
+
// ensure waiting to write
if (!waiting_connect_) {
if (!output_state_.is_pending) {
@@ -363,7 +368,8 @@ bool ChannelWin::CreatePipe(const IPC::ChannelHandle &channel_handle,
return false;
}
- output_queue_.push(m.release());
+ OutputElement* element = new OutputElement(m.release());
+ output_queue_.push(element);
return true;
}
@@ -453,9 +459,9 @@ bool ChannelWin::ProcessOutgoingMessages(
}
// Message was sent.
CHECK(!output_queue_.empty());
- Message* m = output_queue_.front();
+ OutputElement* element = output_queue_.front();
output_queue_.pop();
- delete m;
+ delete element;
}
if (output_queue_.empty())
@@ -465,11 +471,11 @@ bool ChannelWin::ProcessOutgoingMessages(
return false;
// Write to pipe...
- Message* m = output_queue_.front();
- DCHECK(m->size() <= INT_MAX);
+ OutputElement* element = output_queue_.front();
+ DCHECK(element->size() <= INT_MAX);
BOOL ok = WriteFile(pipe_.Get(),
- m->data(),
- static_cast<uint32>(m->size()),
+ element->data(),
+ static_cast<uint32>(element->size()),
NULL,
&output_state_.context.overlapped);
if (!ok) {
@@ -477,8 +483,11 @@ bool ChannelWin::ProcessOutgoingMessages(
if (write_error == ERROR_IO_PENDING) {
output_state_.is_pending = true;
- DVLOG(2) << "sent pending message @" << m << " on channel @" << this
- << " with type " << m->type();
+ const Message* m = element->get_message();
+ if (m) {
+ DVLOG(2) << "sent pending message @" << m << " on channel @" << this
+ << " with type " << m->type();
+ }
return true;
}
@@ -486,8 +495,11 @@ bool ChannelWin::ProcessOutgoingMessages(
return false;
}
- DVLOG(2) << "sent message @" << m << " on channel @" << this
- << " with type " << m->type();
+ const Message* m = element->get_message();
+ if (m) {
+ DVLOG(2) << "sent message @" << m << " on channel @" << this
+ << " with type " << m->type();
+ }
output_state_.is_pending = true;
return true;
« ipc/ipc_channel.cc ('K') | « ipc/ipc_channel_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698