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

Side by Side Diff: content/common/np_channel_base.cc

Issue 10544075: Remove NPChannelBase from cache on error. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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) 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/common/np_channel_base.h" 5 #include "content/common/np_channel_base.h"
6 6
7 #include <stack> 7 #include <stack>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 246 }
247 247
248 bool NPChannelBase::OnControlMessageReceived(const IPC::Message& msg) { 248 bool NPChannelBase::OnControlMessageReceived(const IPC::Message& msg) {
249 NOTREACHED() << 249 NOTREACHED() <<
250 "should override in subclass if you care about control messages"; 250 "should override in subclass if you care about control messages";
251 return false; 251 return false;
252 } 252 }
253 253
254 void NPChannelBase::OnChannelError() { 254 void NPChannelBase::OnChannelError() {
255 channel_valid_ = false; 255 channel_valid_ = false;
256
257 // TODO(shess): http://crbug.com/97285
258 // Once an error is seen on a channel, remap the channel to prevent
259 // it from being vended again. Keep the channel in the map so
260 // RemoveRoute() can clean things up correctly.
261 for (ChannelMap::iterator iter = g_channels.Get().begin();
262 iter != g_channels.Get().end(); ++iter) {
263 if (iter->second == this) {
264 // Insert new element before invalidating |iter|.
265 g_channels.Get()[iter->first + "-error"] = iter->second;
266 g_channels.Get().erase(iter);
267 break;
268 }
269 }
256 } 270 }
257 271
258 NPObject* NPChannelBase::GetExistingNPObjectProxy(int route_id) { 272 NPObject* NPChannelBase::GetExistingNPObjectProxy(int route_id) {
259 ProxyMap::iterator iter = proxy_map_.find(route_id); 273 ProxyMap::iterator iter = proxy_map_.find(route_id);
260 return iter != proxy_map_.end() ? iter->second : NULL; 274 return iter != proxy_map_.end() ? iter->second : NULL;
261 } 275 }
262 276
263 int NPChannelBase::GetExistingRouteForNPObjectStub(NPObject* npobject) { 277 int NPChannelBase::GetExistingRouteForNPObjectStub(NPObject* npobject) {
264 StubMap::iterator iter = stub_map_.find(npobject); 278 StubMap::iterator iter = stub_map_.find(npobject);
265 return iter != stub_map_.end() ? iter->second : MSG_ROUTING_NONE; 279 return iter != stub_map_.end() ? iter->second : MSG_ROUTING_NONE;
(...skipping 12 matching lines...) Expand all
278 292
279 void NPChannelBase::RemoveMappingForNPObjectStub(int route_id, 293 void NPChannelBase::RemoveMappingForNPObjectStub(int route_id,
280 NPObject* object) { 294 NPObject* object) {
281 DCHECK(object != NULL); 295 DCHECK(object != NULL);
282 stub_map_.erase(object); 296 stub_map_.erase(object);
283 } 297 }
284 298
285 void NPChannelBase::RemoveMappingForNPObjectProxy(int route_id) { 299 void NPChannelBase::RemoveMappingForNPObjectProxy(int route_id) {
286 proxy_map_.erase(route_id); 300 proxy_map_.erase(route_id);
287 } 301 }
OLDNEW
« 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