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

Side by Side Diff: ipc/ipc_channel_proxy.cc

Issue 4291001: Convert implicit scoped_refptr constructor calls to explicit ones, part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/build
Patch Set: comments Created 10 years, 1 month 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 | « chrome/test/automation/dom_element_proxy.cc ('k') | media/base/pipeline_impl.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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 ChannelProxy::Context::Context(Channel::Listener* listener, 63 ChannelProxy::Context::Context(Channel::Listener* listener,
64 MessageFilter* filter, 64 MessageFilter* filter,
65 MessageLoop* ipc_message_loop) 65 MessageLoop* ipc_message_loop)
66 : listener_message_loop_(MessageLoop::current()), 66 : listener_message_loop_(MessageLoop::current()),
67 listener_(listener), 67 listener_(listener),
68 ipc_message_loop_(ipc_message_loop), 68 ipc_message_loop_(ipc_message_loop),
69 channel_(NULL), 69 channel_(NULL),
70 peer_pid_(0), 70 peer_pid_(0),
71 channel_connected_called_(false) { 71 channel_connected_called_(false) {
72 if (filter) 72 if (filter)
73 filters_.push_back(filter); 73 filters_.push_back(make_scoped_refptr(filter));
74 } 74 }
75 75
76 void ChannelProxy::Context::CreateChannel(const std::string& id, 76 void ChannelProxy::Context::CreateChannel(const std::string& id,
77 const Channel::Mode& mode) { 77 const Channel::Mode& mode) {
78 DCHECK(channel_ == NULL); 78 DCHECK(channel_ == NULL);
79 channel_id_ = id; 79 channel_id_ = id;
80 channel_ = new Channel(id, mode, this); 80 channel_ = new Channel(id, mode, this);
81 } 81 }
82 82
83 bool ChannelProxy::Context::TryFilters(const Message& message) { 83 bool ChannelProxy::Context::TryFilters(const Message& message) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 delete message; 183 delete message;
184 OnChannelClosed(); 184 OnChannelClosed();
185 return; 185 return;
186 } 186 }
187 if (!channel_->Send(message)) 187 if (!channel_->Send(message))
188 OnChannelError(); 188 OnChannelError();
189 } 189 }
190 190
191 // Called on the IPC::Channel thread 191 // Called on the IPC::Channel thread
192 void ChannelProxy::Context::OnAddFilter(MessageFilter* filter) { 192 void ChannelProxy::Context::OnAddFilter(MessageFilter* filter) {
193 filters_.push_back(filter); 193 filters_.push_back(make_scoped_refptr(filter));
194 194
195 // If the channel has already been created, then we need to send this message 195 // If the channel has already been created, then we need to send this message
196 // so that the filter gets access to the Channel. 196 // so that the filter gets access to the Channel.
197 if (channel_) 197 if (channel_)
198 filter->OnFilterAdded(channel_); 198 filter->OnFilterAdded(channel_);
199 } 199 }
200 200
201 // Called on the IPC::Channel thread 201 // Called on the IPC::Channel thread
202 void ChannelProxy::Context::OnRemoveFilter(MessageFilter* filter) { 202 void ChannelProxy::Context::OnRemoveFilter(MessageFilter* filter) {
203 for (size_t i = 0; i < filters_.size(); ++i) { 203 for (size_t i = 0; i < filters_.size(); ++i) {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 int ChannelProxy::GetClientFileDescriptor() const { 341 int ChannelProxy::GetClientFileDescriptor() const {
342 Channel *channel = context_.get()->channel_; 342 Channel *channel = context_.get()->channel_;
343 DCHECK(channel); // Channel must have been created first. 343 DCHECK(channel); // Channel must have been created first.
344 return channel->GetClientFileDescriptor(); 344 return channel->GetClientFileDescriptor();
345 } 345 }
346 #endif 346 #endif
347 347
348 //----------------------------------------------------------------------------- 348 //-----------------------------------------------------------------------------
349 349
350 } // namespace IPC 350 } // namespace IPC
OLDNEW
« no previous file with comments | « chrome/test/automation/dom_element_proxy.cc ('k') | media/base/pipeline_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698