diff options
author | levin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-08 22:53:53 +0000 |
---|---|---|
committer | levin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-08 22:53:53 +0000 |
commit | f13881e0d070df4747641900172aafe0682a8f93 (patch) | |
tree | 71d80fd0a9d27f89570ee117575ae4fc4706ead2 /chrome/browser/worker_host | |
parent | b70ffd1f0c3716eb76cc281cb9f6f95792d46e66 (diff) | |
download | chromium_src-f13881e0d070df4747641900172aafe0682a8f93.zip chromium_src-f13881e0d070df4747641900172aafe0682a8f93.tar.gz chromium_src-f13881e0d070df4747641900172aafe0682a8f93.tar.bz2 |
Remove asserts in message_port_dispatcher that are too aggresive.
It seems like this data structure should have some checks to
validate the invariants that it is trying to maintain, but there
are more qualified folks than me to write them.
BUG=35221
TEST=None
Review URL: http://codereview.chromium.org/3325018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58889 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/worker_host')
-rw-r--r-- | chrome/browser/worker_host/message_port_dispatcher.cc | 43 | ||||
-rw-r--r-- | chrome/browser/worker_host/message_port_dispatcher.h | 6 |
2 files changed, 0 insertions, 49 deletions
diff --git a/chrome/browser/worker_host/message_port_dispatcher.cc b/chrome/browser/worker_host/message_port_dispatcher.cc index 070ea3d..52300f4 100644 --- a/chrome/browser/worker_host/message_port_dispatcher.cc +++ b/chrome/browser/worker_host/message_port_dispatcher.cc @@ -65,7 +65,6 @@ void MessagePortDispatcher::UpdateMessagePort( IPC::Message::Sender* sender, int routing_id, CallbackWithReturnValue<int>::Type* next_routing_id) { - DCHECK(CheckMessagePortMap(true)); if (!message_ports_.count(message_port_id)) { NOTREACHED(); return; @@ -75,17 +74,14 @@ void MessagePortDispatcher::UpdateMessagePort( port.sender = sender; port.route_id = routing_id; port.next_routing_id = next_routing_id; - DCHECK(CheckMessagePortMap(true)); } bool MessagePortDispatcher::Send(IPC::Message* message) { - DCHECK(CheckMessagePortMap(true)); return sender_->Send(message); } void MessagePortDispatcher::OnCreate(int *route_id, int* message_port_id) { - DCHECK(CheckMessagePortMap(true)); *message_port_id = ++next_message_port_id_; *route_id = next_routing_id_->Run(); @@ -97,11 +93,9 @@ void MessagePortDispatcher::OnCreate(int *route_id, port.entangled_message_port_id = MSG_ROUTING_NONE; port.queue_messages = false; message_ports_[*message_port_id] = port; - DCHECK(CheckMessagePortMap(true)); } void MessagePortDispatcher::OnDestroy(int message_port_id) { - DCHECK(CheckMessagePortMap(true)); if (!message_ports_.count(message_port_id)) { NOTREACHED(); return; @@ -109,12 +103,10 @@ void MessagePortDispatcher::OnDestroy(int message_port_id) { DCHECK(message_ports_[message_port_id].queued_messages.empty()); Erase(message_port_id); - DCHECK(CheckMessagePortMap(true)); } void MessagePortDispatcher::OnEntangle(int local_message_port_id, int remote_message_port_id) { - DCHECK(CheckMessagePortMap(false)); if (!message_ports_.count(local_message_port_id) || !message_ports_.count(remote_message_port_id)) { NOTREACHED(); @@ -125,14 +117,12 @@ void MessagePortDispatcher::OnEntangle(int local_message_port_id, MSG_ROUTING_NONE); message_ports_[remote_message_port_id].entangled_message_port_id = local_message_port_id; - DCHECK(CheckMessagePortMap(false)); } void MessagePortDispatcher::OnPostMessage( int sender_message_port_id, const string16& message, const std::vector<int>& sent_message_port_ids) { - DCHECK(CheckMessagePortMap(true)); if (!message_ports_.count(sender_message_port_id)) { NOTREACHED(); return; @@ -149,14 +139,12 @@ void MessagePortDispatcher::OnPostMessage( } PostMessageTo(entangled_message_port_id, message, sent_message_port_ids); - DCHECK(CheckMessagePortMap(true)); } void MessagePortDispatcher::PostMessageTo( int message_port_id, const string16& message, const std::vector<int>& sent_message_port_ids) { - DCHECK(CheckMessagePortMap(true)); if (!message_ports_.count(message_port_id)) { NOTREACHED(); return; @@ -198,11 +186,9 @@ void MessagePortDispatcher::PostMessageTo( new_routing_ids); entangled_port.sender->Send(ipc_msg); } - DCHECK(CheckMessagePortMap(true)); } void MessagePortDispatcher::OnQueueMessages(int message_port_id) { - DCHECK(CheckMessagePortMap(true)); if (!message_ports_.count(message_port_id)) { NOTREACHED(); return; @@ -212,13 +198,11 @@ void MessagePortDispatcher::OnQueueMessages(int message_port_id) { port.sender->Send(new WorkerProcessMsg_MessagesQueued(port.route_id)); port.queue_messages = true; port.sender = NULL; - DCHECK(CheckMessagePortMap(true)); } void MessagePortDispatcher::OnSendQueuedMessages( int message_port_id, const QueuedMessages& queued_messages) { - DCHECK(CheckMessagePortMap(true)); if (!message_ports_.count(message_port_id)) { NOTREACHED(); return; @@ -232,11 +216,9 @@ void MessagePortDispatcher::OnSendQueuedMessages( queued_messages.begin(), queued_messages.end()); SendQueuedMessagesIfPossible(message_port_id); - DCHECK(CheckMessagePortMap(true)); } void MessagePortDispatcher::SendQueuedMessagesIfPossible(int message_port_id) { - DCHECK(CheckMessagePortMap(true)); if (!message_ports_.count(message_port_id)) { NOTREACHED(); return; @@ -251,14 +233,11 @@ void MessagePortDispatcher::SendQueuedMessagesIfPossible(int message_port_id) { PostMessageTo(message_port_id, iter->first, iter->second); } port.queued_messages.clear(); - DCHECK(CheckMessagePortMap(true)); } void MessagePortDispatcher::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(CheckMessagePortMap(true)); - IPC::Message::Sender* sender = NULL; if (type.value == NotificationType::RESOURCE_MESSAGE_FILTER_SHUTDOWN) { sender = Source<ResourceMessageFilter>(source).ptr(); @@ -276,8 +255,6 @@ void MessagePortDispatcher::Observe(NotificationType type, Erase(cur_item->first); } } - - DCHECK(CheckMessagePortMap(true)); } void MessagePortDispatcher::Erase(int message_port_id) { @@ -294,23 +271,3 @@ void MessagePortDispatcher::Erase(int message_port_id) { } message_ports_.erase(erase_item); } - -#ifndef NDEBUG -bool MessagePortDispatcher::CheckMessagePortMap(bool check_entanglements) { - DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); - - for (MessagePorts::iterator iter = message_ports_.begin(); - iter != message_ports_.end(); iter++) { - DCHECK(iter->first <= next_message_port_id_); - DCHECK(iter->first == iter->second.message_port_id); - - int entangled_id = iter->second.entangled_message_port_id; - if (check_entanglements && entangled_id != MSG_ROUTING_NONE) { - MessagePorts::iterator entangled_item = message_ports_.find(entangled_id); - DCHECK(entangled_item != message_ports_.end()); - DCHECK(entangled_item->second.entangled_message_port_id == iter->first); - } - } - return true; -} -#endif // NDEBUG diff --git a/chrome/browser/worker_host/message_port_dispatcher.h b/chrome/browser/worker_host/message_port_dispatcher.h index 70747bd..b8f7021 100644 --- a/chrome/browser/worker_host/message_port_dispatcher.h +++ b/chrome/browser/worker_host/message_port_dispatcher.h @@ -74,12 +74,6 @@ class MessagePortDispatcher : public NotificationObserver { // verify that the message port id exists. void Erase(int message_port_id); -#ifdef NDEBUG - bool CheckMessagePortMap(bool check_entanglements) { return true; } -#else - bool CheckMessagePortMap(bool check_entanglements); -#endif - struct MessagePort { // sender and route_id are what we need to send messages to the port. IPC::Message::Sender* sender; |