Index: chrome/browser/extensions/process_map.cc |
diff --git a/chrome/browser/extensions/process_map.cc b/chrome/browser/extensions/process_map.cc |
index fa12f6c10e5876fc451938741a1c11d6049d8541..73bace9a28965bd360ba0a5577b408108086577d 100644 |
--- a/chrome/browser/extensions/process_map.cc |
+++ b/chrome/browser/extensions/process_map.cc |
@@ -7,31 +7,48 @@ |
namespace extensions { |
// Item |
-ProcessMap::Item::Item() { |
-} |
+struct ProcessMap::Item { |
+ Item() { |
+ } |
-ProcessMap::Item::Item(const ProcessMap::Item& other) |
- : extension_id(other.extension_id), process_id(other.process_id) { |
-} |
+ explicit Item(const ProcessMap::Item& other) |
+ : extension_id(other.extension_id), |
+ process_id(other.process_id), |
+ site_instance_id(other.site_instance_id) { |
+ } |
-ProcessMap::Item::Item(const std::string& extension_id, int process_id) |
- : extension_id(extension_id), process_id(process_id) { |
-} |
+ Item(const std::string& extension_id, int process_id, |
+ int site_instance_id) |
+ : extension_id(extension_id), |
+ process_id(process_id), |
+ site_instance_id(site_instance_id) { |
+ } |
-ProcessMap::Item::~Item() { |
-} |
+ ~Item() { |
+ } |
+ |
+ bool operator<(const ProcessMap::Item& other) const { |
+ if (extension_id < other.extension_id) |
+ return true; |
+ |
+ if (extension_id == other.extension_id && |
+ process_id < other.process_id) { |
+ return true; |
+ } |
-bool ProcessMap::Item::operator<(const ProcessMap::Item& other) const { |
- if (extension_id < other.extension_id) |
- return true; |
+ if (extension_id == other.extension_id && |
+ process_id == other.process_id && |
+ site_instance_id < other.site_instance_id) { |
+ return true; |
+ } |
- if (extension_id == other.extension_id && |
- process_id < other.process_id) { |
- return true; |
+ return false; |
} |
- return false; |
-} |
+ std::string extension_id; |
+ int process_id; |
+ int site_instance_id; |
+}; |
// ProcessMap |
@@ -41,15 +58,17 @@ ProcessMap::ProcessMap() { |
ProcessMap::~ProcessMap() { |
} |
-bool ProcessMap::Insert(const std::string& extension_id, int process_id) { |
- return items_.insert(Item(extension_id, process_id)).second; |
+bool ProcessMap::Insert(const std::string& extension_id, int process_id, |
+ int site_instance_id) { |
+ return items_.insert(Item(extension_id, process_id, site_instance_id)).second; |
} |
-bool ProcessMap::Remove(const std::string& extension_id, int process_id) { |
- return items_.erase(Item(extension_id, process_id)) > 0; |
+bool ProcessMap::Remove(const std::string& extension_id, int process_id, |
+ int site_instance_id) { |
+ return items_.erase(Item(extension_id, process_id, site_instance_id)) > 0; |
} |
-int ProcessMap::Remove(int process_id) { |
+int ProcessMap::RemoveAllFromProcess(int process_id) { |
int result = 0; |
for (ItemSet::const_iterator iter = items_.begin(); iter != items_.end(); ) { |
if (iter->process_id == process_id) { |
@@ -64,7 +83,12 @@ int ProcessMap::Remove(int process_id) { |
bool ProcessMap::Contains(const std::string& extension_id, |
int process_id) const { |
- return items_.find(Item(extension_id, process_id)) != items_.end(); |
+ for (ItemSet::const_iterator iter = items_.begin(); iter != items_.end(); |
+ ++iter) { |
+ if (iter->process_id == process_id && iter->extension_id == extension_id) |
+ return true; |
+ } |
+ return false; |
} |
bool ProcessMap::Contains(int process_id) const { |