| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/extensions/extension_message_service.h" | 5 #include "chrome/browser/extensions/extension_message_service.h" |
| 6 | 6 |
| 7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 NotificationService::AllSources()); | 146 NotificationService::AllSources()); |
| 147 | 147 |
| 148 extension_devtools_manager_ = profile_->GetExtensionDevToolsManager(); | 148 extension_devtools_manager_ = profile_->GetExtensionDevToolsManager(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 ExtensionMessageService::~ExtensionMessageService() { | 151 ExtensionMessageService::~ExtensionMessageService() { |
| 152 STLDeleteContainerPairSecondPointers(channels_.begin(), channels_.end()); | 152 STLDeleteContainerPairSecondPointers(channels_.begin(), channels_.end()); |
| 153 channels_.clear(); | 153 channels_.clear(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void ExtensionMessageService::ProfileDestroyed() { | 156 void ExtensionMessageService::DestroyingProfile() { |
| 157 profile_ = NULL; | 157 profile_ = NULL; |
| 158 if (!registrar_.IsEmpty()) | 158 if (!registrar_.IsEmpty()) |
| 159 registrar_.RemoveAll(); | 159 registrar_.RemoveAll(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void ExtensionMessageService::AddEventListener(const std::string& event_name, | 162 void ExtensionMessageService::AddEventListener(const std::string& event_name, |
| 163 int render_process_id) { | 163 int render_process_id) { |
| 164 // It is possible that this RenderProcessHost is being destroyed. If that is | 164 // It is possible that this RenderProcessHost is being destroyed. If that is |
| 165 // the case, we'll have already removed his listeners, so do nothing here. | 165 // the case, we'll have already removed his listeners, so do nothing here. |
| 166 RenderProcessHost* rph = RenderProcessHost::FromID(render_process_id); | 166 RenderProcessHost* rph = RenderProcessHost::FromID(render_process_id); |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 | 464 |
| 465 if (current->second->opener.sender == sender) { | 465 if (current->second->opener.sender == sender) { |
| 466 CloseChannelImpl(current, GET_CHANNEL_OPENER_ID(current->first), | 466 CloseChannelImpl(current, GET_CHANNEL_OPENER_ID(current->first), |
| 467 notify_other_port); | 467 notify_other_port); |
| 468 } else if (current->second->receiver.sender == sender) { | 468 } else if (current->second->receiver.sender == sender) { |
| 469 CloseChannelImpl(current, GET_CHANNEL_RECEIVERS_ID(current->first), | 469 CloseChannelImpl(current, GET_CHANNEL_RECEIVERS_ID(current->first), |
| 470 notify_other_port); | 470 notify_other_port); |
| 471 } | 471 } |
| 472 } | 472 } |
| 473 } | 473 } |
| OLD | NEW |