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

Side by Side Diff: content/browser/renderer_host/socket_stream_dispatcher_host.cc

Issue 10068037: RefCounted types should not have public destructors, content/browser part 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MSVC fixes Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/socket_stream_dispatcher_host.h" 5 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/renderer_host/socket_stream_host.h" 8 #include "content/browser/renderer_host/socket_stream_host.h"
9 #include "content/browser/ssl/ssl_manager.h" 9 #include "content/browser/ssl/ssl_manager.h"
10 #include "content/common/resource_messages.h" 10 #include "content/common/resource_messages.h"
(...skipping 10 matching lines...) Expand all
21 int render_process_id, 21 int render_process_id,
22 ResourceMessageFilter::URLRequestContextSelector* selector, 22 ResourceMessageFilter::URLRequestContextSelector* selector,
23 content::ResourceContext* resource_context) 23 content::ResourceContext* resource_context)
24 : render_process_id_(render_process_id), 24 : render_process_id_(render_process_id),
25 url_request_context_selector_(selector), 25 url_request_context_selector_(selector),
26 resource_context_(resource_context) { 26 resource_context_(resource_context) {
27 DCHECK(selector); 27 DCHECK(selector);
28 net::WebSocketJob::EnsureInit(); 28 net::WebSocketJob::EnsureInit();
29 } 29 }
30 30
31 SocketStreamDispatcherHost::~SocketStreamDispatcherHost() {
32 // TODO(ukai): Implement IDMap::RemoveAll().
33 for (IDMap<SocketStreamHost>::const_iterator iter(&hosts_);
34 !iter.IsAtEnd();
35 iter.Advance()) {
36 int socket_id = iter.GetCurrentKey();
37 const SocketStreamHost* socket_stream_host = iter.GetCurrentValue();
38 delete socket_stream_host;
39 hosts_.Remove(socket_id);
40 }
41 }
42
43 bool SocketStreamDispatcherHost::OnMessageReceived(const IPC::Message& message, 31 bool SocketStreamDispatcherHost::OnMessageReceived(const IPC::Message& message,
44 bool* message_was_ok) { 32 bool* message_was_ok) {
45 bool handled = true; 33 bool handled = true;
46 IPC_BEGIN_MESSAGE_MAP_EX(SocketStreamDispatcherHost, message, *message_was_ok) 34 IPC_BEGIN_MESSAGE_MAP_EX(SocketStreamDispatcherHost, message, *message_was_ok)
47 IPC_MESSAGE_HANDLER(SocketStreamHostMsg_Connect, OnConnect) 35 IPC_MESSAGE_HANDLER(SocketStreamHostMsg_Connect, OnConnect)
48 IPC_MESSAGE_HANDLER(SocketStreamHostMsg_SendData, OnSendData) 36 IPC_MESSAGE_HANDLER(SocketStreamHostMsg_SendData, OnSendData)
49 IPC_MESSAGE_HANDLER(SocketStreamHostMsg_Close, OnCloseReq) 37 IPC_MESSAGE_HANDLER(SocketStreamHostMsg_Close, OnCloseReq)
50 IPC_MESSAGE_UNHANDLED(handled = false) 38 IPC_MESSAGE_UNHANDLED(handled = false)
51 IPC_END_MESSAGE_MAP_EX() 39 IPC_END_MESSAGE_MAP_EX()
52 return handled; 40 return handled;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 const content::GlobalRequestID& id) { 149 const content::GlobalRequestID& id) {
162 int socket_id = id.request_id; 150 int socket_id = id.request_id;
163 DVLOG(1) << "SocketStreamDispatcherHost::ContinueSSLRequest socket_id=" 151 DVLOG(1) << "SocketStreamDispatcherHost::ContinueSSLRequest socket_id="
164 << socket_id; 152 << socket_id;
165 DCHECK_NE(content::kNoSocketId, socket_id); 153 DCHECK_NE(content::kNoSocketId, socket_id);
166 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); 154 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id);
167 DCHECK(socket_stream_host); 155 DCHECK(socket_stream_host);
168 socket_stream_host->ContinueDespiteError(); 156 socket_stream_host->ContinueDespiteError();
169 } 157 }
170 158
159 SocketStreamDispatcherHost::~SocketStreamDispatcherHost() {
160 // TODO(ukai): Implement IDMap::RemoveAll().
161 for (IDMap<SocketStreamHost>::const_iterator iter(&hosts_);
162 !iter.IsAtEnd();
163 iter.Advance()) {
164 int socket_id = iter.GetCurrentKey();
165 const SocketStreamHost* socket_stream_host = iter.GetCurrentValue();
166 delete socket_stream_host;
167 hosts_.Remove(socket_id);
168 }
169 }
170
171 // Message handlers called by OnMessageReceived. 171 // Message handlers called by OnMessageReceived.
172 void SocketStreamDispatcherHost::OnConnect(int render_view_id, 172 void SocketStreamDispatcherHost::OnConnect(int render_view_id,
173 const GURL& url, 173 const GURL& url,
174 int socket_id) { 174 int socket_id) {
175 DVLOG(1) << "SocketStreamDispatcherHost::OnConnect" 175 DVLOG(1) << "SocketStreamDispatcherHost::OnConnect"
176 << " render_view_id=" << render_view_id 176 << " render_view_id=" << render_view_id
177 << " url=" << url 177 << " url=" << url
178 << " socket_id=" << socket_id; 178 << " socket_id=" << socket_id;
179 DCHECK_NE(content::kNoSocketId, socket_id); 179 DCHECK_NE(content::kNoSocketId, socket_id);
180 if (hosts_.Lookup(socket_id)) { 180 if (hosts_.Lookup(socket_id)) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 hosts_.Remove(socket_id); 217 hosts_.Remove(socket_id);
218 if (!Send(new SocketStreamMsg_Closed(socket_id))) { 218 if (!Send(new SocketStreamMsg_Closed(socket_id))) {
219 LOG(ERROR) << "SocketStreamMsg_Closed failed."; 219 LOG(ERROR) << "SocketStreamMsg_Closed failed.";
220 } 220 }
221 } 221 }
222 222
223 net::URLRequestContext* SocketStreamDispatcherHost::GetURLRequestContext() { 223 net::URLRequestContext* SocketStreamDispatcherHost::GetURLRequestContext() {
224 return url_request_context_selector_->GetRequestContext( 224 return url_request_context_selector_->GetRequestContext(
225 ResourceType::SUB_RESOURCE); 225 ResourceType::SUB_RESOURCE);
226 } 226 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698