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

Side by Side Diff: ipc/ipc_channel_proxy.cc

Issue 5978003: Make IPC::Channel::Listener:OnMessageReceived have a return value indicating ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
« no previous file with comments | « ipc/ipc_channel_proxy.h ('k') | ipc/ipc_fuzzing_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/message_loop.h" 5 #include "base/message_loop.h"
6 #include "base/ref_counted.h" 6 #include "base/ref_counted.h"
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "base/thread.h" 8 #include "base/thread.h"
9 #include "ipc/ipc_channel_proxy.h" 9 #include "ipc/ipc_channel_proxy.h"
10 #include "ipc/ipc_logging.h" 10 #include "ipc/ipc_logging.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 if (logger->Enabled()) 89 if (logger->Enabled())
90 logger->OnPostDispatchMessage(message, channel_id_); 90 logger->OnPostDispatchMessage(message, channel_id_);
91 #endif 91 #endif
92 return true; 92 return true;
93 } 93 }
94 } 94 }
95 return false; 95 return false;
96 } 96 }
97 97
98 // Called on the IPC::Channel thread 98 // Called on the IPC::Channel thread
99 void ChannelProxy::Context::OnMessageReceived(const Message& message) { 99 bool ChannelProxy::Context::OnMessageReceived(const Message& message) {
100 // First give a chance to the filters to process this message. 100 // First give a chance to the filters to process this message.
101 if (!TryFilters(message)) 101 if (!TryFilters(message))
102 OnMessageReceivedNoFilter(message); 102 OnMessageReceivedNoFilter(message);
103 return true;
103 } 104 }
104 105
105 // Called on the IPC::Channel thread 106 // Called on the IPC::Channel thread
106 void ChannelProxy::Context::OnMessageReceivedNoFilter(const Message& message) { 107 bool ChannelProxy::Context::OnMessageReceivedNoFilter(const Message& message) {
107 // NOTE: This code relies on the listener's message loop not going away while 108 // NOTE: This code relies on the listener's message loop not going away while
108 // this thread is active. That should be a reasonable assumption, but it 109 // this thread is active. That should be a reasonable assumption, but it
109 // feels risky. We may want to invent some more indirect way of referring to 110 // feels risky. We may want to invent some more indirect way of referring to
110 // a MessageLoop if this becomes a problem. 111 // a MessageLoop if this becomes a problem.
111 listener_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( 112 listener_message_loop_->PostTask(FROM_HERE, NewRunnableMethod(
112 this, &Context::OnDispatchMessage, message)); 113 this, &Context::OnDispatchMessage, message));
114 return true;
113 } 115 }
114 116
115 // Called on the IPC::Channel thread 117 // Called on the IPC::Channel thread
116 void ChannelProxy::Context::OnChannelConnected(int32 peer_pid) { 118 void ChannelProxy::Context::OnChannelConnected(int32 peer_pid) {
117 // Add any pending filters. This avoids a race condition where someone 119 // Add any pending filters. This avoids a race condition where someone
118 // creates a ChannelProxy, calls AddFilter, and then right after starts the 120 // creates a ChannelProxy, calls AddFilter, and then right after starts the
119 // peer process. The IO thread could receive a message before the task to add 121 // peer process. The IO thread could receive a message before the task to add
120 // the filter is run on the IO thread. 122 // the filter is run on the IO thread.
121 OnAddFilter(); 123 OnAddFilter();
122 124
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 Channel *channel = context_.get()->channel_.get(); 374 Channel *channel = context_.get()->channel_.get();
373 // Channel must have been created first. 375 // Channel must have been created first.
374 DCHECK(channel) << context_.get()->channel_id_; 376 DCHECK(channel) << context_.get()->channel_id_;
375 return channel->GetClientFileDescriptor(); 377 return channel->GetClientFileDescriptor();
376 } 378 }
377 #endif 379 #endif
378 380
379 //----------------------------------------------------------------------------- 381 //-----------------------------------------------------------------------------
380 382
381 } // namespace IPC 383 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_proxy.h ('k') | ipc/ipc_fuzzing_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698